diff --git a/.gitignore b/.gitignore index 6ed87a3f8..789f2728f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,7 @@ selfdrive/sensord/_gpsd selfdrive/sensord/_sensord selfdrive/camerad/camerad selfdrive/modeld/_modeld -selfdrive/modeld/_monitoringd +selfdrive/modeld/_dmonitoringmodeld /src/ one diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 738679aca..b4cccc2da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,3 +29,12 @@ Code is automatically check for style by travis as part of the automated tests. We've released a [Model Port guide](https://medium.com/@comma_ai/openpilot-port-guide-for-toyota-models-e5467f4b5fe6) for porting to Toyota/Lexus models. If you port openpilot to a substantially new car brand, see this more generic [Brand Port guide](https://medium.com/@comma_ai/how-to-write-a-car-port-for-openpilot-7ce0785eda84). You might also be eligible for a bounty. See our bounties at [comma.ai/bounties.html](https://comma.ai/bounties.html) + +## Pull Requests + +Pull requests should be against the master branch. Before running master on in-car hardware, you'll need to run +``` +git submodule init +git submodule update +``` +in order to pull down the submodules, such as `panda` and `opendbc`. diff --git a/Dockerfile.openpilot b/Dockerfile.openpilot deleted file mode 100644 index 9faa5c282..000000000 --- a/Dockerfile.openpilot +++ /dev/null @@ -1,84 +0,0 @@ -FROM ubuntu:16.04 -ENV PYTHONUNBUFFERED 1 - -RUN apt-get update && apt-get install -y \ - autoconf \ - build-essential \ - bzip2 \ - clang \ - cmake \ - curl \ - ffmpeg \ - git \ - libarchive-dev \ - libbz2-dev \ - libcurl4-openssl-dev \ - libeigen3-dev \ - libffi-dev \ - libglew-dev \ - libgles2-mesa-dev \ - libglfw3-dev \ - libglib2.0-0 \ - liblzma-dev \ - libmysqlclient-dev \ - libomp-dev \ - libopencv-dev \ - libssl-dev \ - libsqlite3-dev \ - libtool \ - libusb-1.0-0-dev \ - libzmq5-dev \ - locales \ - ocl-icd-libopencl1 \ - ocl-icd-opencl-dev \ - opencl-headers \ - python-dev \ - python-pip \ - screen \ - sudo \ - vim \ - wget - - -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash - -ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" -RUN pyenv install 3.7.3 -RUN pyenv global 3.7.3 -RUN pyenv rehash - -RUN pip install pipenv==2018.11.26 - -COPY Pipfile /tmp/ -COPY Pipfile.lock /tmp/ - -RUN python --version -RUN cd /tmp && pipenv install --system --deploy - -# Install subset of dev dependencies needed for CI -RUN pip install matplotlib==3.1.1 dictdiffer==0.8.0 fastcluster==1.1.25 aenum==2.2.1 scipy==1.3.1 lru-dict==1.1.6 tenacity==5.1.1 azure-common==1.1.23 azure-nspkg==3.0.2 azure-storage-blob==2.1.0 azure-storage-common==2.1.0 azure-storage-nspkg==3.1.0 pycurl==7.43.0.3 - -COPY phonelibs/install_capnp.sh /tmp/install_capnp.sh -RUN /tmp/install_capnp.sh - -RUN git clone --branch v0.7 https://github.com/commaai/openpilot-tools.git /tmp/openpilot/tools - -ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH} -COPY ./.pylintrc /tmp/openpilot/.pylintrc -COPY ./common /tmp/openpilot/common -COPY ./cereal /tmp/openpilot/cereal -COPY ./opendbc /tmp/openpilot/opendbc -COPY ./selfdrive /tmp/openpilot/selfdrive -COPY ./phonelibs /tmp/openpilot/phonelibs -COPY ./pyextra /tmp/openpilot/pyextra -COPY ./panda /tmp/openpilot/panda - -COPY SConstruct /tmp/openpilot/SConstruct - -RUN mkdir -p /tmp/openpilot/selfdrive/test/out -RUN cd /tmp/openpilot && scons -j$(nproc) diff --git a/Makefile b/Makefile deleted file mode 100644 index 4f690b2e7..000000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ - -code_dir := $(shell pwd) - -# TODO: Add a global build system - -.PHONY: all -all: - cd selfdrive && PYTHONPATH=$(code_dir) PREPAREONLY=1 ./manager.py - diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 4d3e046de..000000000 --- a/Pipfile +++ /dev/null @@ -1,128 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -opencv-python= "==3.4.2.17" -PyQt5 = "*" -ipython = "*" -networkx = "==2.3" -azure-core = "==1.1.1" -azure-common = "==1.1.24" -azure-nspkg = "==3.0.2" -azure-storage-blob = "==2.1.0" -azure-storage-common = "==2.1.0" -azure-storage-nspkg = "==3.1.0" -boto = "*" -"boto3" = "*" -control = "*" -datadog = "*" -dlib = "*" -elasticsearch = "*" -future = "*" -futures = "*" -pycocotools = {git = "https://github.com/cocodataset/cocoapi.git",subdirectory = "PythonAPI"} -gunicorn = "*" -"h5py" = "*" -hexdump = "*" -"html5lib" = "*" -imageio = "*" -ipykernel = "*" -joblib = "*" -json-logging-py = "*" -jupyter = "*" -libarchive = "*" -lru-dict = "*" -"mpld3" = "*" -msgpack-python = "*" -nbstripout = "*" -numpy = "*" -osmium = "*" -pbr = "*" -percache = "*" -pprofile = "*" -pycurl = "*" -git-pylint-commit-hook = "*" -pymongo = "*" -"pynmea2" = "*" -pypolyline = "*" -python-logstash = "*" -redis = "*" -"s2sphere" = "*" -scikit-image = "*" -"subprocess32" = "*" -tenacity = "*" -tensorflow-gpu = "" -PyJWT = "==1.4.1" -PyMySQL = "==0.9.2" -Werkzeug = "*" -"backports.lzma" = "*" -Flask-Cors = "*" -Flask-SocketIO = "*" -"GeoAlchemy2" = "*" -Pygments = "*" -PyNaCl = "*" -"PySDL2" = "*" -reverse_geocoder = "*" -Shapely = "*" -SQLAlchemy = "*" -scipy = "*" -fastcluster = "*" -backports-abc = "*" -pygame = "*" -simplejson = "*" -python-logstash-async = "*" -seaborn = "*" -pyproj = "*" -mock = "*" -matplotlib = "*" -dictdiffer = "*" -aenum = "*" -coverage = "*" -azure-cli-core = "*" - -[packages] -overpy = {git = "https://github.com/commaai/python-overpy.git",ref = "f86529af402d4642e1faeb146671c40284007323"} -atomicwrites = "*" -cffi = "*" -crcmod = "*" -hexdump = "*" -libusb1 = "*" -numpy = "*" -psutil = "*" -pycapnp = "*" -cryptography = "*" -pyserial = "*" -python-dateutil = "*" -pyzmq = "*" -raven = "*" -requests = "*" -setproctitle = "*" -six = "*" -smbus2 = "*" -sympy = "*" -tqdm = "*" -Cython = "*" -PyYAML = "*" -websocket_client = "*" -Logentries = {git = "https://github.com/commaai/le_python.git",ref = "feaeacb48f7f4bdb02c0a8fc092326d4e101b7f2"} -urllib3 = "*" -chardet = "*" -idna = "*" -gunicorn = "*" -utm = "*" -json-rpc = "*" -Flask = "*" -PyJWT = "*" -"Jinja2" = "*" -nose = "*" -flake8 = "*" -pylint = "*" -pycryptodome = "*" -pillow = "*" -scons = "*" -cysignals = "*" - -[requires] -python_version = "3.7.3" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 045857cd1..000000000 --- a/Pipfile.lock +++ /dev/null @@ -1,2895 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "bc5d2f0b8b59443cbdf4373de05f7522ff24afa7f6e55d1aae08c3961e970beb" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.7.3" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "astroid": { - "hashes": [ - "sha256:71ea07f44df9568a75d0f354c49143a4575d90645e9fead6dfb52c26a85ed13a", - "sha256:840947ebfa8b58f318d42301cf8c0a20fd794a33b61cc4638e28e9e61ba32f42" - ], - "markers": "python_version >= '3.5'", - "version": "==2.3.3" - }, - "atomicwrites": { - "hashes": [ - "sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4", - "sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6" - ], - "index": "pypi", - "version": "==1.3.0" - }, - "certifi": { - "hashes": [ - "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", - "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" - ], - "version": "==2019.11.28" - }, - "cffi": { - "hashes": [ - "sha256:0b49274afc941c626b605fb59b59c3485c17dc776dc3cc7cc14aca74cc19cc42", - "sha256:0e3ea92942cb1168e38c05c1d56b0527ce31f1a370f6117f1d490b8dcd6b3a04", - "sha256:135f69aecbf4517d5b3d6429207b2dff49c876be724ac0c8bf8e1ea99df3d7e5", - "sha256:19db0cdd6e516f13329cba4903368bff9bb5a9331d3410b1b448daaadc495e54", - "sha256:2781e9ad0e9d47173c0093321bb5435a9dfae0ed6a762aabafa13108f5f7b2ba", - "sha256:291f7c42e21d72144bb1c1b2e825ec60f46d0a7468f5346841860454c7aa8f57", - "sha256:2c5e309ec482556397cb21ede0350c5e82f0eb2621de04b2633588d118da4396", - "sha256:2e9c80a8c3344a92cb04661115898a9129c074f7ab82011ef4b612f645939f12", - "sha256:32a262e2b90ffcfdd97c7a5e24a6012a43c61f1f5a57789ad80af1d26c6acd97", - "sha256:3c9fff570f13480b201e9ab69453108f6d98244a7f495e91b6c654a47486ba43", - "sha256:415bdc7ca8c1c634a6d7163d43fb0ea885a07e9618a64bda407e04b04333b7db", - "sha256:42194f54c11abc8583417a7cf4eaff544ce0de8187abaf5d29029c91b1725ad3", - "sha256:4424e42199e86b21fc4db83bd76909a6fc2a2aefb352cb5414833c030f6ed71b", - "sha256:4a43c91840bda5f55249413037b7a9b79c90b1184ed504883b72c4df70778579", - "sha256:599a1e8ff057ac530c9ad1778293c665cb81a791421f46922d80a86473c13346", - "sha256:5c4fae4e9cdd18c82ba3a134be256e98dc0596af1e7285a3d2602c97dcfa5159", - "sha256:5ecfa867dea6fabe2a58f03ac9186ea64da1386af2159196da51c4904e11d652", - "sha256:62f2578358d3a92e4ab2d830cd1c2049c9c0d0e6d3c58322993cc341bdeac22e", - "sha256:6471a82d5abea994e38d2c2abc77164b4f7fbaaf80261cb98394d5793f11b12a", - "sha256:6d4f18483d040e18546108eb13b1dfa1000a089bcf8529e30346116ea6240506", - "sha256:71a608532ab3bd26223c8d841dde43f3516aa5d2bf37b50ac410bb5e99053e8f", - "sha256:74a1d8c85fb6ff0b30fbfa8ad0ac23cd601a138f7509dc617ebc65ef305bb98d", - "sha256:7b93a885bb13073afb0aa73ad82059a4c41f4b7d8eb8368980448b52d4c7dc2c", - "sha256:7d4751da932caaec419d514eaa4215eaf14b612cff66398dd51129ac22680b20", - "sha256:7f627141a26b551bdebbc4855c1157feeef18241b4b8366ed22a5c7d672ef858", - "sha256:8169cf44dd8f9071b2b9248c35fc35e8677451c52f795daa2bb4643f32a540bc", - "sha256:aa00d66c0fab27373ae44ae26a66a9e43ff2a678bf63a9c7c1a9a4d61172827a", - "sha256:ccb032fda0873254380aa2bfad2582aedc2959186cce61e3a17abc1a55ff89c3", - "sha256:d754f39e0d1603b5b24a7f8484b22d2904fa551fe865fd0d4c3332f078d20d4e", - "sha256:d75c461e20e29afc0aee7172a0950157c704ff0dd51613506bd7d82b718e7410", - "sha256:dcd65317dd15bc0451f3e01c80da2216a31916bdcffd6221ca1202d96584aa25", - "sha256:e570d3ab32e2c2861c4ebe6ffcad6a8abf9347432a37608fe1fbd157b3f0036b", - "sha256:fd43a88e045cf992ed09fa724b5315b790525f2676883a6ea64e3263bae6549d" - ], - "index": "pypi", - "version": "==1.13.2" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "index": "pypi", - "version": "==3.0.4" - }, - "click": { - "hashes": [ - "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", - "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==7.0" - }, - "crcmod": { - "hashes": [ - "sha256:50586ab48981f11e5b117523d97bb70864a2a1af246cf6e4f5c4a21ef4611cd1", - "sha256:69a2e5c6c36d0f096a7beb4cd34e5f882ec5fd232efb710cdb85d4ff196bd52e", - "sha256:737fb308fa2ce9aed2e29075f0d5980d4a89bfbec48a368c607c5c63b3efb90e", - "sha256:dc7051a0db5f2bd48665a990d3ec1cc305a466a77358ca4492826f41f283601e" - ], - "index": "pypi", - "version": "==1.7" - }, - "cryptography": { - "hashes": [ - "sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c", - "sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595", - "sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad", - "sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651", - "sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2", - "sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff", - "sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d", - "sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42", - "sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d", - "sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e", - "sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912", - "sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793", - "sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13", - "sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7", - "sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0", - "sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879", - "sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f", - "sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9", - "sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2", - "sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf", - "sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8" - ], - "index": "pypi", - "version": "==2.8" - }, - "cysignals": { - "hashes": [ - "sha256:8107b67a0c5991f74b0e000c6fa9fe8efcb2a22c7ede5b017aac4c3e20fb7db2" - ], - "index": "pypi", - "version": "==1.10.2" - }, - "cython": { - "hashes": [ - "sha256:03f6bbb380ad0acb744fb06e42996ea217e9d00016ca0ff6f2e7d60f580d0360", - "sha256:05e8cfd3a3a6087aec49a1ae08a89171db991956209406d1e5576f9db70ece52", - "sha256:05eb79efc8029d487251c8a2702a909a8ba33c332e06d2f3980866541bd81253", - "sha256:094d28a34c3fa992ae02aea1edbe6ff89b3cc5870b6ee38b5baeb805dc57b013", - "sha256:0c70e842e52e2f50cc43bad43b5e5bc515f30821a374e544abb0e0746f2350ff", - "sha256:1dcdaa319558eb924294a554dcf6c12383ec947acc7e779e8d3622409a7f7d28", - "sha256:1fc5bdda28f25fec44e4721677458aa509d743cd350862270309d61aa148d6ff", - "sha256:280573a01d9348d44a42d6a9c651d9f7eb1fe9217df72555b2a118f902996a10", - "sha256:298ceca7b0f0da4205fcb0b7c9ac9e120e2dafffd5019ba1618e84ef89434b5a", - "sha256:4074a8bff0040035673cc6dd365a762476d6bff4d03d8ce6904e3e53f9a25dc8", - "sha256:41e7068e95fbf9ec94b41437f989caf9674135e770a39cdb9c00de459bafd1bc", - "sha256:47e5e1502d52ef03387cf9d3b3241007961a84a466e58a3b74028e1dd4957f8c", - "sha256:521340844cf388d109ceb61397f3fd5250ccb622a1a8e93559e8de76c80940a9", - "sha256:6c53338c1811f8c6d7f8cb7abd874810b15045e719e8207f957035c9177b4213", - "sha256:75c2dda47dcc3c77449712b1417bb6b89ec3b7b02e18c64262494dceffdf455e", - "sha256:773c5a98e463b52f7e8197254b39b703a5ea1972aef3a94b3b921515d77dd041", - "sha256:78c3068dcba300d473fef57cdf523e34b37de522f5a494ef9ee1ac9b4b8bbe3f", - "sha256:7bc18fc5a170f2c1cef5387a3d997c28942918bbee0f700e73fd2178ee8d474d", - "sha256:7f89eff20e4a7a64b55210dac17aea711ed8a3f2e78f2ff784c0e984302583dd", - "sha256:89458b49976b1dee5d89ab4ac943da3717b4292bf624367e862e4ee172fcce99", - "sha256:986f871c0fa649b293061236b93782d25c293a8dd8117c7ba05f8a61bdc261ae", - "sha256:a0f495a4fe5278aab278feee35e6102efecde5176a8a74dd28c28e3fc5c8d7c7", - "sha256:a14aa436586c41633339415de82a41164691d02d3e661038da533be5d40794a5", - "sha256:b8ab3ab38afc47d8f4fe629b836243544351cef681b6bdb1dc869028d6fdcbfb", - "sha256:bb487881608ebd293592553c618f0c83316f4f13a64cb18605b1d2fb9fd3da3e", - "sha256:c0b24bfe3431b3cb7ced323bca813dbd13aca973a1475b512d3331fd0de8ec60", - "sha256:c7894c06205166d360ab2915ae306d1f7403e9ce3d3aaeff4095eaf98e42ce66", - "sha256:d4039bb7f234ad32267c55e72fd49fb56078ea102f9d9d8559f6ec34d4887630", - "sha256:e4d6bb8703d0319eb04b7319b12ea41580df44fd84d83ccda13ea463c6801414", - "sha256:e8fab9911fd2fa8e5af407057cb8bdf87762f983cba483fa3234be20a9a0af77", - "sha256:f3818e578e687cdb21dc4aa4a3bc6278c656c9c393e9eda14dd04943f478863d", - "sha256:fe666645493d72712c46e4fbe8bec094b06aec3c337400479e9704439c9d9586" - ], - "index": "pypi", - "version": "==0.29.14" - }, - "entrypoints": { - "hashes": [ - "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", - "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451" - ], - "markers": "python_version >= '2.7'", - "version": "==0.3" - }, - "flake8": { - "hashes": [ - "sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb", - "sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca" - ], - "index": "pypi", - "version": "==3.7.9" - }, - "flask": { - "hashes": [ - "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52", - "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6" - ], - "index": "pypi", - "version": "==1.1.1" - }, - "gunicorn": { - "hashes": [ - "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", - "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" - ], - "index": "pypi", - "version": "==20.0.4" - }, - "hexdump": { - "hashes": [ - "sha256:d781a43b0c16ace3f9366aade73e8ad3a7bd5137d58f0b45ab2d3f54876f20db" - ], - "index": "pypi", - "version": "==3.3" - }, - "idna": { - "hashes": [ - "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", - "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" - ], - "index": "pypi", - "version": "==2.8" - }, - "isort": { - "hashes": [ - "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", - "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.3.21" - }, - "itsdangerous": { - "hashes": [ - "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19", - "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.0" - }, - "jinja2": { - "hashes": [ - "sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f", - "sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de" - ], - "index": "pypi", - "version": "==2.10.3" - }, - "json-rpc": { - "hashes": [ - "sha256:84b45058e5ba95f49c7b6afcf7e03ab86bee89bf2c01f3ad8dd41fe114fc1f84", - "sha256:def0dbcf5b7084fc31d677f2f5990d988d06497f2f47f13024274cfb2d5d7589" - ], - "index": "pypi", - "version": "==1.13.0" - }, - "lazy-object-proxy": { - "hashes": [ - "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", - "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", - "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", - "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", - "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", - "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", - "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", - "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", - "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", - "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", - "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", - "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", - "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", - "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", - "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", - "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", - "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", - "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", - "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", - "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", - "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.4.3" - }, - "libusb1": { - "hashes": [ - "sha256:adf64a4f3f5c94643a1286f8153bcf4bc787c348b38934aacd7fe17fbeebc571" - ], - "index": "pypi", - "version": "==1.7.1" - }, - "logentries": { - "git": "https://github.com/commaai/le_python.git", - "ref": "feaeacb48f7f4bdb02c0a8fc092326d4e101b7f2", - "version": "==0.8" - }, - "markupsafe": { - "hashes": [ - "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", - "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", - "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", - "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", - "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", - "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", - "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", - "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", - "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", - "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", - "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", - "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", - "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", - "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", - "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", - "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", - "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", - "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", - "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", - "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", - "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", - "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", - "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", - "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", - "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", - "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", - "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", - "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.1" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "mpmath": { - "hashes": [ - "sha256:fc17abe05fbab3382b61a123c398508183406fa132e0223874578e20946499f6" - ], - "version": "==1.1.0" - }, - "nose": { - "hashes": [ - "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", - "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", - "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" - ], - "index": "pypi", - "version": "==1.3.7" - }, - "numpy": { - "hashes": [ - "sha256:1786a08236f2c92ae0e70423c45e1e62788ed33028f94ca99c4df03f5be6b3c6", - "sha256:17aa7a81fe7599a10f2b7d95856dc5cf84a4eefa45bc96123cbbc3ebc568994e", - "sha256:20b26aaa5b3da029942cdcce719b363dbe58696ad182aff0e5dcb1687ec946dc", - "sha256:2d75908ab3ced4223ccba595b48e538afa5ecc37405923d1fea6906d7c3a50bc", - "sha256:39d2c685af15d3ce682c99ce5925cc66efc824652e10990d2462dfe9b8918c6a", - "sha256:56bc8ded6fcd9adea90f65377438f9fea8c05fcf7c5ba766bef258d0da1554aa", - "sha256:590355aeade1a2eaba17617c19edccb7db8d78760175256e3cf94590a1a964f3", - "sha256:70a840a26f4e61defa7bdf811d7498a284ced303dfbc35acb7be12a39b2aa121", - "sha256:77c3bfe65d8560487052ad55c6998a04b654c2fbc36d546aef2b2e511e760971", - "sha256:9537eecf179f566fd1c160a2e912ca0b8e02d773af0a7a1120ad4f7507cd0d26", - "sha256:9acdf933c1fd263c513a2df3dceecea6f3ff4419d80bf238510976bf9bcb26cd", - "sha256:ae0975f42ab1f28364dcda3dde3cf6c1ddab3e1d4b2909da0cb0191fa9ca0480", - "sha256:b3af02ecc999c8003e538e60c89a2b37646b39b688d4e44d7373e11c2debabec", - "sha256:b6ff59cee96b454516e47e7721098e6ceebef435e3e21ac2d6c3b8b02628eb77", - "sha256:b765ed3930b92812aa698a455847141869ef755a87e099fddd4ccf9d81fffb57", - "sha256:c98c5ffd7d41611407a1103ae11c8b634ad6a43606eca3e2a5a269e5d6e8eb07", - "sha256:cf7eb6b1025d3e169989416b1adcd676624c2dbed9e3bcb7137f51bfc8cc2572", - "sha256:d92350c22b150c1cae7ebb0ee8b5670cc84848f6359cf6b5d8f86617098a9b73", - "sha256:e422c3152921cece8b6a2fb6b0b4d73b6579bd20ae075e7d15143e711f3ca2ca", - "sha256:e840f552a509e3380b0f0ec977e8124d0dc34dc0e68289ca28f4d7c1d0d79474", - "sha256:f3d0a94ad151870978fb93538e95411c83899c9dc63e6fb65542f769568ecfa5" - ], - "index": "pypi", - "version": "==1.18.1" - }, - "overpy": { - "git": "https://github.com/commaai/python-overpy.git", - "ref": "f86529af402d4642e1faeb146671c40284007323", - "version": "==0.4" - }, - "pillow": { - "hashes": [ - "sha256:0a628977ac2e01ca96aaae247ec2bd38e729631ddf2221b4b715446fd45505be", - "sha256:4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946", - "sha256:54ebae163e8412aff0b9df1e88adab65788f5f5b58e625dc5c7f51eaf14a6837", - "sha256:5bfef0b1cdde9f33881c913af14e43db69815c7e8df429ceda4c70a5e529210f", - "sha256:5f3546ceb08089cedb9e8ff7e3f6a7042bb5b37c2a95d392fb027c3e53a2da00", - "sha256:5f7ae9126d16194f114435ebb79cc536b5682002a4fa57fa7bb2cbcde65f2f4d", - "sha256:62a889aeb0a79e50ecf5af272e9e3c164148f4bd9636cc6bcfa182a52c8b0533", - "sha256:7406f5a9b2fd966e79e6abdaf700585a4522e98d6559ce37fc52e5c955fade0a", - "sha256:8453f914f4e5a3d828281a6628cf517832abfa13ff50679a4848926dac7c0358", - "sha256:87269cc6ce1e3dee11f23fa515e4249ae678dbbe2704598a51cee76c52e19cda", - "sha256:875358310ed7abd5320f21dd97351d62de4929b0426cdb1eaa904b64ac36b435", - "sha256:8ac6ce7ff3892e5deaab7abaec763538ffd011f74dc1801d93d3c5fc541feee2", - "sha256:91b710e3353aea6fc758cdb7136d9bbdcb26b53cefe43e2cba953ac3ee1d3313", - "sha256:9d2ba4ed13af381233e2d810ff3bab84ef9f18430a9b336ab69eaf3cd24299ff", - "sha256:a62ec5e13e227399be73303ff301f2865bf68657d15ea50b038d25fc41097317", - "sha256:ab76e5580b0ed647a8d8d2d2daee170e8e9f8aad225ede314f684e297e3643c2", - "sha256:bf4003aa538af3f4205c5fac56eacaa67a6dd81e454ffd9e9f055fff9f1bc614", - "sha256:bf598d2e37cf8edb1a2f26ed3fb255191f5232badea4003c16301cb94ac5bdd0", - "sha256:c18f70dc27cc5d236f10e7834236aff60aadc71346a5bc1f4f83a4b3abee6386", - "sha256:c5ed816632204a2fc9486d784d8e0d0ae754347aba99c811458d69fcdfd2a2f9", - "sha256:dc058b7833184970d1248135b8b0ab702e6daa833be14035179f2acb78ff5636", - "sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865" - ], - "index": "pypi", - "version": "==7.0.0" - }, - "psutil": { - "hashes": [ - "sha256:094f899ac3ef72422b7e00411b4ed174e3c5a2e04c267db6643937ddba67a05b", - "sha256:10b7f75cc8bd676cfc6fa40cd7d5c25b3f45a0e06d43becd7c2d2871cbb5e806", - "sha256:1b1575240ca9a90b437e5a40db662acd87bbf181f6aa02f0204978737b913c6b", - "sha256:21231ef1c1a89728e29b98a885b8e0a8e00d09018f6da5cdc1f43f988471a995", - "sha256:28f771129bfee9fc6b63d83a15d857663bbdcae3828e1cb926e91320a9b5b5cd", - "sha256:70387772f84fa5c3bb6a106915a2445e20ac8f9821c5914d7cbde148f4d7ff73", - "sha256:b560f5cd86cf8df7bcd258a851ca1ad98f0d5b8b98748e877a0aec4e9032b465", - "sha256:b74b43fecce384a57094a83d2778cdfc2e2d9a6afaadd1ebecb2e75e0d34e10d", - "sha256:e85f727ffb21539849e6012f47b12f6dd4c44965e56591d8dec6e8bc9ab96f4a", - "sha256:fd2e09bb593ad9bdd7429e779699d2d47c1268cbde4dda95fcd1bd17544a0217", - "sha256:ffad8eb2ac614518bbe3c0b8eb9dffdb3a8d2e3a7d5da51c5b974fb723a5c5aa" - ], - "index": "pypi", - "version": "==5.6.7" - }, - "pycapnp": { - "hashes": [ - "sha256:44e14a5ace399cf1753acb8bbce558b8c895c48fd2102d266c34eaff286824cf" - ], - "index": "pypi", - "version": "==0.6.4" - }, - "pycodestyle": { - "hashes": [ - "sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", - "sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.5.0" - }, - "pycparser": { - "hashes": [ - "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" - ], - "version": "==2.19" - }, - "pycryptodome": { - "hashes": [ - "sha256:042ae873baadd0c33b4d699a5c5b976ade3233a979d972f98ca82314632d868c", - "sha256:0502876279772b1384b660ccc91563d04490d562799d8e2e06b411e2d81128a9", - "sha256:2de33ed0a95855735d5a0fc0c39603314df9e78ee8bbf0baa9692fb46b3b8bbb", - "sha256:319e568baf86620b419d53063b18c216abf924875966efdfe06891b987196a45", - "sha256:4372ec7518727172e1605c0843cdc5375d4771e447b8148c787b860260aae151", - "sha256:48821950ffb9c836858d8fa09d7840b6df52eadd387a3c5acece55cb387743f9", - "sha256:4b9533d4166ca07abdd49ce9d516666b1df944997fe135d4b21ac376aa624aff", - "sha256:54456cf85130e01674d21fb1ab89ffccacb138a8ade88d72fa2b0ac898d2798b", - "sha256:56fdd0e425f1b8fd3a00b6d96351f86226674974814c50534864d0124d48871f", - "sha256:57b1b707363490c495ad0eeb38bd1b0e1697c497af25fad78d3a1ebf0477fd5b", - "sha256:5c485ed6e9718ebcaa81138fa70ace9c563d202b56a8cee119b4085b023931f5", - "sha256:63c103a22cbe9752f6ea9f1a0de129995bad91c4d03a66c67cffcf6ee0c9f1e1", - "sha256:68fab8455efcbfe87c5d75015476f9b606227ffe244d57bfd66269451706e899", - "sha256:6c2720696b10ae356040e888bde1239b8957fe18885ccf5e7b4e8dec882f0856", - "sha256:72166c2ac520a5dbd2d90208b9c279161ec0861662a621892bd52fb6ca13ab91", - "sha256:7c52308ac5b834331b2f107a490b2c27de024a229b61df4cdc5c131d563dfe98", - "sha256:87d8d85b4792ca5e730fb7a519fbc3ed976c59dcf79c5204589c59afd56b9926", - "sha256:896e9b6fd0762aa07b203c993fbbee7a1f1a4674c6886afd7bfa86f3d1be98a8", - "sha256:8a799bea3c6617736e914a2e77c409f52893d382f619f088f8a80e2e21f573c1", - "sha256:9d9945ac8375d5d8e60bd2a2e1df5882eaa315522eedf3ca868b1546dfa34eba", - "sha256:9ef966c727de942de3e41aa8462c4b7b4bca70f19af5a3f99e31376589c11aac", - "sha256:a168e73879619b467072509a223282a02c8047d932a48b74fbd498f27224aa04", - "sha256:a30f501bbb32e01a49ef9e09ca1260e5ab49bf33a257080ec553e08997acc487", - "sha256:a8ca2450394d3699c9f15ef25e8de9a24b401933716a1e39d37fa01f5fe3c58b", - "sha256:aec4d42deb836b8fb3ba32f2ba1ef0d33dd3dc9d430b1479ee7a914490d15b5e", - "sha256:b4af098f2a50f8d048ab12cabb59456585c0acf43d90ee79782d2d6d0ed59dba", - "sha256:b55c60c321ac91945c60a40ac9896ac7a3d432bb3e8c14006dfd82ad5871c331", - "sha256:c53348358408d94869059e16fba5ff3bef8c52c25b18421472aba272b9bb450f", - "sha256:cbfd97f9e060f0d30245cd29fa267a9a84de9da97559366fca0a3f7655acc63f", - "sha256:d3fe3f33ad52bf0c19ee6344b695ba44ffbfa16f3c29ca61116b48d97bd970fb", - "sha256:e3a79a30d15d9c7c284a7734036ee8abdb5ca3a6f5774d293cdc9e1358c1dc10", - "sha256:eec0689509389f19875f66ae8dedd59f982240cdab31b9f78a8dc266011df93a" - ], - "index": "pypi", - "version": "==3.9.4" - }, - "pyflakes": { - "hashes": [ - "sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", - "sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.1.1" - }, - "pyjwt": { - "hashes": [ - "sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e", - "sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96" - ], - "index": "pypi", - "version": "==1.7.1" - }, - "pylint": { - "hashes": [ - "sha256:3db5468ad013380e987410a8d6956226963aed94ecb5f9d3a28acca6d9ac36cd", - "sha256:886e6afc935ea2590b462664b161ca9a5e40168ea99e5300935f6591ad467df4" - ], - "index": "pypi", - "version": "==2.4.4" - }, - "pyserial": { - "hashes": [ - "sha256:6e2d401fdee0eab996cf734e67773a0143b932772ca8b42451440cfed942c627", - "sha256:e0770fadba80c31013896c7e6ef703f72e7834965954a78e71a3049488d4d7d8" - ], - "index": "pypi", - "version": "==3.4" - }, - "python-dateutil": { - "hashes": [ - "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c", - "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a" - ], - "index": "pypi", - "version": "==2.8.1" - }, - "pyyaml": { - "hashes": [ - "sha256:059b2ee3194d718896c0ad077dd8c043e5e909d9180f387ce42012662a4946d6", - "sha256:1cf708e2ac57f3aabc87405f04b86354f66799c8e62c28c5fc5f88b5521b2dbf", - "sha256:24521fa2890642614558b492b473bee0ac1f8057a7263156b02e8b14c88ce6f5", - "sha256:4fee71aa5bc6ed9d5f116327c04273e25ae31a3020386916905767ec4fc5317e", - "sha256:70024e02197337533eef7b85b068212420f950319cc8c580261963aefc75f811", - "sha256:74782fbd4d4f87ff04159e986886931456a1894c61229be9eaf4de6f6e44b99e", - "sha256:940532b111b1952befd7db542c370887a8611660d2b9becff75d39355303d82d", - "sha256:cb1f2f5e426dc9f07a7681419fe39cee823bb74f723f36f70399123f439e9b20", - "sha256:dbbb2379c19ed6042e8f11f2a2c66d39cceb8aeace421bfc29d085d93eda3689", - "sha256:e3a057b7a64f1222b56e47bcff5e4b94c4f61faac04c7c4ecb1985e18caa3994", - "sha256:e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" - ], - "index": "pypi", - "version": "==5.3" - }, - "pyzmq": { - "hashes": [ - "sha256:01b588911714a6696283de3904f564c550c9e12e8b4995e173f1011755e01086", - "sha256:0573b9790aa26faff33fba40f25763657271d26f64bffb55a957a3d4165d6098", - "sha256:0fa82b9fc3334478be95a5566f35f23109f763d1669bb762e3871a8fa2a4a037", - "sha256:1e59b7b19396f26e360f41411a5d4603356d18871049cd7790f1a7d18f65fb2c", - "sha256:2a294b4f44201bb21acc2c1a17ff87fbe57b82060b10ddb00ac03e57f3d7fcfa", - "sha256:355b38d7dd6f884b8ee9771f59036bcd178d98539680c4f87e7ceb2c6fd057b6", - "sha256:4b73d20aec63933bbda7957e30add233289d86d92a0bb9feb3f4746376f33527", - "sha256:4ec47f2b50bdb97df58f1697470e5c58c3c5109289a623e30baf293481ff0166", - "sha256:5541dc8cad3a8486d58bbed076cb113b65b5dd6b91eb94fb3e38a3d1d3022f20", - "sha256:6fca7d11310430e751f9832257866a122edf9d7b635305c5d8c51f74a5174d3d", - "sha256:7369656f89878455a5bcd5d56ca961884f5d096268f71c0750fc33d6732a25e5", - "sha256:75d73ee7ca4b289a2a2dfe0e6bd8f854979fc13b3fe4ebc19381be3b04e37a4a", - "sha256:80c928d5adcfa12346b08d31360988d843b54b94154575cccd628f1fe91446bc", - "sha256:83ce18b133dc7e6789f64cb994e7376c5aa6b4aeced993048bf1d7f9a0fe6d3a", - "sha256:8b8498ceee33a7023deb2f3db907ca41d6940321e282297327a9be41e3983792", - "sha256:8c69a6cbfa94da29a34f6b16193e7c15f5d3220cb772d6d17425ff3faa063a6d", - "sha256:8ff946b20d13a99dc5c21cb76f4b8b253eeddf3eceab4218df8825b0c65ab23d", - "sha256:972d723a36ab6a60b7806faa5c18aa3c080b7d046c407e816a1d8673989e2485", - "sha256:a6c9c42bbdba3f9c73aedbb7671815af1943ae8073e532c2b66efb72f39f4165", - "sha256:aa3872f2ebfc5f9692ef8957fe69abe92d905a029c0608e45ebfcd451ad30ab5", - "sha256:cf08435b14684f7f2ca2df32c9df38a79cdc17c20dc461927789216cb43d8363", - "sha256:d30db4566177a6205ed1badb8dbbac3c043e91b12a2db5ef9171b318c5641b75", - "sha256:d5ac84f38575a601ab20c1878818ffe0d09eb51d6cb8511b636da46d0fd8949a", - "sha256:e37f22eb4bfbf69cd462c7000616e03b0cdc1b65f2d99334acad36ea0e4ddf6b", - "sha256:e6549dd80de7b23b637f586217a4280facd14ac01e9410a037a13854a6977299", - "sha256:ed6205ca0de035f252baa0fd26fdd2bc8a8f633f92f89ca866fd423ff26c6f25", - "sha256:efdde21febb9b5d7a8e0b87ea2549d7e00fda1936459cfb27fb6fca0c36af6c1", - "sha256:f4e72646bfe79ff3adbf1314906bbd2d67ef9ccc71a3a98b8b2ccbcca0ab7bec" - ], - "index": "pypi", - "version": "==18.1.1" - }, - "raven": { - "hashes": [ - "sha256:3fa6de6efa2493a7c827472e984ce9b020797d0da16f1db67197bcc23c8fae54", - "sha256:44a13f87670836e153951af9a3c80405d36b43097db869a36e92809673692ce4" - ], - "index": "pypi", - "version": "==6.10.0" - }, - "requests": { - "hashes": [ - "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", - "sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31" - ], - "index": "pypi", - "version": "==2.22.0" - }, - "scons": { - "hashes": [ - "sha256:0f860678cd96fc943ff2294389b0f33cbe51080801591497bc652e72237f0176", - "sha256:8aaa483c303efeb678e6f7c776c8444a482f8ddc3ad891f8b6cdd35264da9a1f" - ], - "index": "pypi", - "version": "==3.1.2" - }, - "setproctitle": { - "hashes": [ - "sha256:6283b7a58477dd8478fbb9e76defb37968ee4ba47b05ec1c053cb39638bd7398", - "sha256:6a035eddac62898786aed2c2eee7334c28cfc8106e8eb29fdd117cac56c6cdf0" - ], - "index": "pypi", - "version": "==1.1.10" - }, - "six": { - "hashes": [ - "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd", - "sha256:30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66" - ], - "index": "pypi", - "version": "==1.13.0" - }, - "smbus2": { - "hashes": [ - "sha256:210e66eebe4d0b1fe836b3ec2751841942e1c4918c0b429b20a0e20a222228b4" - ], - "index": "pypi", - "version": "==0.3.0" - }, - "sympy": { - "hashes": [ - "sha256:4880d3a351558063bd89febda302f220dc4b88de393bba81fa6539a3966f03fa", - "sha256:d77901d748287d15281f5ffe5b0fef62dd38f357c2b827c44ff07f35695f4e7e" - ], - "index": "pypi", - "version": "==1.5.1" - }, - "tqdm": { - "hashes": [ - "sha256:4789ccbb6fc122b5a6a85d512e4e41fc5acad77216533a6f2b8ce51e0f265c23", - "sha256:efab950cf7cc1e4d8ee50b2bb9c8e4a89f8307b49e0b2c9cfef3ec4ca26655eb" - ], - "index": "pypi", - "version": "==4.41.1" - }, - "typed-ast": { - "hashes": [ - "sha256:1170afa46a3799e18b4c977777ce137bb53c7485379d9706af8a59f2ea1aa161", - "sha256:18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e", - "sha256:262c247a82d005e43b5b7f69aff746370538e176131c32dda9cb0f324d27141e", - "sha256:2b907eb046d049bcd9892e3076c7a6456c93a25bebfe554e931620c90e6a25b0", - "sha256:354c16e5babd09f5cb0ee000d54cfa38401d8b8891eefa878ac772f827181a3c", - "sha256:48e5b1e71f25cfdef98b013263a88d7145879fbb2d5185f2a0c79fa7ebbeae47", - "sha256:4e0b70c6fc4d010f8107726af5fd37921b666f5b31d9331f0bd24ad9a088e631", - "sha256:630968c5cdee51a11c05a30453f8cd65e0cc1d2ad0d9192819df9978984529f4", - "sha256:66480f95b8167c9c5c5c87f32cf437d585937970f3fc24386f313a4c97b44e34", - "sha256:71211d26ffd12d63a83e079ff258ac9d56a1376a25bc80b1cdcdf601b855b90b", - "sha256:7954560051331d003b4e2b3eb822d9dd2e376fa4f6d98fee32f452f52dd6ebb2", - "sha256:838997f4310012cf2e1ad3803bce2f3402e9ffb71ded61b5ee22617b3a7f6b6e", - "sha256:95bd11af7eafc16e829af2d3df510cecfd4387f6453355188342c3e79a2ec87a", - "sha256:bc6c7d3fa1325a0c6613512a093bc2a2a15aeec350451cbdf9e1d4bffe3e3233", - "sha256:cc34a6f5b426748a507dd5d1de4c1978f2eb5626d51326e43280941206c209e1", - "sha256:d755f03c1e4a51e9b24d899561fec4ccaf51f210d52abdf8c07ee2849b212a36", - "sha256:d7c45933b1bdfaf9f36c579671fec15d25b06c8398f113dab64c18ed1adda01d", - "sha256:d896919306dd0aa22d0132f62a1b78d11aaf4c9fc5b3410d3c666b818191630a", - "sha256:fdc1c9bbf79510b76408840e009ed65958feba92a88833cdceecff93ae8fff66", - "sha256:ffde2fbfad571af120fcbfbbc61c72469e72f550d676c3342492a9dfdefb8f12" - ], - "markers": "python_version < '3.8' and implementation_name == 'cpython'", - "version": "==1.4.0" - }, - "urllib3": { - "hashes": [ - "sha256:a8a318824cc77d1fd4b2bec2ded92646630d7fe8619497b142c84a9e6f5a7293", - "sha256:f3c5fd51747d450d4dcf6f923c81f78f811aab8205fda64b0aba34a4e48b0745" - ], - "index": "pypi", - "version": "==1.25.7" - }, - "utm": { - "hashes": [ - "sha256:07e55707ed660eec1ae983bd54a406c437962618a6261b38d70592fe30f5f508" - ], - "index": "pypi", - "version": "==0.5.0" - }, - "websocket-client": { - "hashes": [ - "sha256:0fc45c961324d79c781bab301359d5a1b00b13ad1b10415a4780229ef71a5549", - "sha256:d735b91d6d1692a6a181f2a8c9e0238e5f6373356f561bb9dc4c7af36f452010" - ], - "index": "pypi", - "version": "==0.57.0" - }, - "werkzeug": { - "hashes": [ - "sha256:7280924747b5733b246fe23972186c6b348f9ae29724135a6dfc1e53cea433e7", - "sha256:e5f4a1f98b52b18a93da705a7458e55afb26f32bff83ff5d19189f92462d65c4" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.16.0" - }, - "wrapt": { - "hashes": [ - "sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1" - ], - "version": "==1.11.2" - } - }, - "develop": { - "absl-py": { - "hashes": [ - "sha256:75e737d6ce7723d9ff9b7aa1ba3233c34be62ef18d5859e706b8fdc828989830" - ], - "version": "==0.9.0" - }, - "adal": { - "hashes": [ - "sha256:5a7f1e037c6290c6d7609cab33a9e5e988c2fbec5c51d1c4c649ee3faff37eaf", - "sha256:fd17e5661f60634ddf96a569b95d34ccb8a98de60593d729c28bdcfe360eaad1" - ], - "version": "==1.2.2" - }, - "aenum": { - "hashes": [ - "sha256:284ddb976413d97239a932d7e5202ba58d66e5dbd81531bf3033ebb36ec30b23", - "sha256:a4334cabf47c167d44ab5a6198837b80deec5d5bad1b5cf70c966c3a330260e8", - "sha256:d2bb6ea7586aaae889d3a5c332eafa851eeffe6e7068807c79b6c86c4326b938" - ], - "index": "pypi", - "version": "==2.2.3" - }, - "antlr4-python3-runtime": { - "hashes": [ - "sha256:168cdcec8fb9152e84a87ca6fd261b3d54c8f6358f42ab3b813b14a7193bb50b" - ], - "markers": "python_version >= '3.0'", - "version": "==4.7.2" - }, - "applicationinsights": { - "hashes": [ - "sha256:30a11aafacea34f8b160fbdc35254c9029c7e325267874e3c68f6bdbcd6ed2c3", - "sha256:b88bc5a41385d8e516489128d5e63f8c52efe597a3579b1718d1ab2f7cf150a2" - ], - "version": "==0.11.9" - }, - "argcomplete": { - "hashes": [ - "sha256:52a08b426bd0b03b6881182dd84149b2493540d1c3109ccf9f09f78e4459e387", - "sha256:783d6a12c6c84a33653dc5bac4d6c0640ba64d1037c2662acd9dbe410c26056f" - ], - "version": "==1.11.0" - }, - "astor": { - "hashes": [ - "sha256:070a54e890cefb5b3739d19f30f5a5ec840ffc9c50ffa7d23cc9fc1a38ebbfc5", - "sha256:6a6effda93f4e1ce9f618779b2dd1d9d84f1e32812c23a29b3fff6fd7f63fa5e" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.8.1" - }, - "astroid": { - "hashes": [ - "sha256:71ea07f44df9568a75d0f354c49143a4575d90645e9fead6dfb52c26a85ed13a", - "sha256:840947ebfa8b58f318d42301cf8c0a20fd794a33b61cc4638e28e9e61ba32f42" - ], - "markers": "python_version >= '3.5'", - "version": "==2.3.3" - }, - "attrs": { - "hashes": [ - "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", - "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==19.3.0" - }, - "azure-cli-core": { - "hashes": [ - "sha256:979954688c56cb76be7043e4c4ecc8433ce20dfc4d95ea42d6584b061cbafdb3", - "sha256:bcd371210ccc83a29884a9add0fa84702538092926eefa4dfdb5075d71ccb6c2" - ], - "index": "pypi", - "version": "==2.0.79" - }, - "azure-cli-nspkg": { - "hashes": [ - "sha256:1bde56090f548c6435bd3093995cf88e4c445fb040604df8b5b5f70780d79181", - "sha256:9a1e4f3197183470e4afecfdd45c92320f6753555b06a70651f89972332ffaf6" - ], - "version": "==3.0.4" - }, - "azure-cli-telemetry": { - "hashes": [ - "sha256:1f239d544d309c29e827982cc20113eb57037dba16db6cdd2e0283e437e0e577", - "sha256:7b18d7520e35e134136a0f7de38403a7dbce7b1e835065bd9e965579815ddf2f" - ], - "version": "==1.0.4" - }, - "azure-common": { - "hashes": [ - "sha256:184ad6a05a3089dfdc1ce07c1cbfa489bbc45b5f6f56e848cac0851e6443da21", - "sha256:3d64e9ab995300f42abd5bc0ef02f02bab661321e394d4dbacb4382ea1fb2f72" - ], - "index": "pypi", - "version": "==1.1.24" - }, - "azure-core": { - "hashes": [ - "sha256:4d047fd4e46a958c9b63f9d5cb52e6bf7dfc5c2a1c2a81b968499335a94bb5cb", - "sha256:b44fe5b46d2bb0260cafb737ab5ee89a16d478fc1885dabe21c426c4df205502" - ], - "index": "pypi", - "version": "==1.1.1" - }, - "azure-mgmt-resource": { - "hashes": [ - "sha256:a557a87fad2a2a5190d03e12cd7cf6307a194604e808773972c34847503b482b", - "sha256:e04e867af9289a237cfe285995025555fcceb90de5deb420c540dca3a4c9c622" - ], - "version": "==6.0.0" - }, - "azure-nspkg": { - "hashes": [ - "sha256:1d0bbb2157cf57b1bef6c8c8e5b41133957364456c43b0a43599890023cca0a8", - "sha256:31a060caca00ed1ebd369fc7fe01a56768c927e404ebc92268f4d9d636435e28", - "sha256:e7d3cea6af63e667d87ba1ca4f8cd7cb4dfca678e4c55fc1cedb320760e39dd0" - ], - "index": "pypi", - "version": "==3.0.2" - }, - "azure-storage-blob": { - "hashes": [ - "sha256:a8e91a51d4f62d11127c7fd8ba0077385c5b11022f0269f8a2a71b9fc36bef31", - "sha256:b90323aad60f207f9f90a0c4cf94c10acc313c20b39403398dfba51f25f7b454" - ], - "index": "pypi", - "version": "==2.1.0" - }, - "azure-storage-common": { - "hashes": [ - "sha256:b01a491a18839b9d05a4fe3421458a0ddb5ab9443c14e487f40d16f9a1dc2fbe", - "sha256:ccedef5c67227bc4d6670ffd37cec18fb529a1b7c3a5e53e4096eb0cf23dc73f" - ], - "index": "pypi", - "version": "==2.1.0" - }, - "azure-storage-nspkg": { - "hashes": [ - "sha256:6f3bbe8652d5f542767d8433e7f96b8df7f518774055ac7c92ed7ca85f653811", - "sha256:7da3bd6c73b8c464a57f53ae9af8328490d2267c66430d8a7621997e52a9703e" - ], - "index": "pypi", - "version": "==3.1.0" - }, - "backcall": { - "hashes": [ - "sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4", - "sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2" - ], - "version": "==0.1.0" - }, - "backports-abc": { - "hashes": [ - "sha256:033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde", - "sha256:52089f97fe7a9aa0d3277b220c1d730a85aefd64e1b2664696fe35317c5470a7" - ], - "index": "pypi", - "version": "==0.5" - }, - "backports.lzma": { - "hashes": [ - "sha256:16d8b68e4d3cd4e6c9ddb059850452946da3914c8a8e197a7f2b0954559f2df4" - ], - "index": "pypi", - "version": "==0.0.14" - }, - "bcrypt": { - "hashes": [ - "sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89", - "sha256:0b0069c752ec14172c5f78208f1863d7ad6755a6fae6fe76ec2c80d13be41e42", - "sha256:19a4b72a6ae5bb467fea018b825f0a7d917789bcfe893e53f15c92805d187294", - "sha256:5432dd7b34107ae8ed6c10a71b4397f1c853bd39a4d6ffa7e35f40584cffd161", - "sha256:6305557019906466fc42dbc53b46da004e72fd7a551c044a827e572c82191752", - "sha256:69361315039878c0680be456640f8705d76cb4a3a3fe1e057e0f261b74be4b31", - "sha256:6fe49a60b25b584e2f4ef175b29d3a83ba63b3a4df1b4c0605b826668d1b6be5", - "sha256:74a015102e877d0ccd02cdeaa18b32aa7273746914a6c5d0456dd442cb65b99c", - "sha256:763669a367869786bb4c8fcf731f4175775a5b43f070f50f46f0b59da45375d0", - "sha256:8b10acde4e1919d6015e1df86d4c217d3b5b01bb7744c36113ea43d529e1c3de", - "sha256:9fe92406c857409b70a38729dbdf6578caf9228de0aef5bc44f859ffe971a39e", - "sha256:a190f2a5dbbdbff4b74e3103cef44344bc30e61255beb27310e2aec407766052", - "sha256:a595c12c618119255c90deb4b046e1ca3bcfad64667c43d1166f2b04bc72db09", - "sha256:c9457fa5c121e94a58d6505cadca8bed1c64444b83b3204928a866ca2e599105", - "sha256:cb93f6b2ab0f6853550b74e051d297c27a638719753eb9ff66d1e4072be67133", - "sha256:ce4e4f0deb51d38b1611a27f330426154f2980e66582dc5f438aad38b5f24fc1", - "sha256:d7bdc26475679dd073ba0ed2766445bb5b20ca4793ca0db32b399dccc6bc84b7", - "sha256:ff032765bb8716d9387fd5376d987a937254b0619eff0972779515b5c98820bc" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==3.1.7" - }, - "bleach": { - "hashes": [ - "sha256:213336e49e102af26d9cde77dd2d0397afabc5a6bf2fed985dc35b5d1e285a16", - "sha256:3fdf7f77adcf649c9911387df51254b813185e32b2c6619f690b593a617e19fa" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==3.1.0" - }, - "boto": { - "hashes": [ - "sha256:147758d41ae7240dc989f0039f27da8ca0d53734be0eb869ef16e3adcfa462e8", - "sha256:ea0d3b40a2d852767be77ca343b58a9e3a4b00d9db440efb8da74b4e58025e5a" - ], - "index": "pypi", - "version": "==2.49.0" - }, - "boto3": { - "hashes": [ - "sha256:b3b134d8df25ba2465eb4c39b642aaa7b5342917c7810dc24c0aeb866bc6d816", - "sha256:ff3539243b9d8fde9a1e86f8e79a5ae385ccb583ec2a1083f3a63aed078aa42d" - ], - "index": "pypi", - "version": "==1.10.47" - }, - "botocore": { - "hashes": [ - "sha256:a5187cc5ec9558890ce5522a3c7e73c812cbae31c6d905d13a868e861a771272", - "sha256:b7d1001208a0c514ced7b126606dae360ca5e0141cc9496d37f83a2c89ebd915" - ], - "version": "==1.13.47" - }, - "cachetools": { - "hashes": [ - "sha256:9a52dd97a85f257f4e4127f15818e71a0c7899f121b34591fcc1173ea79a0198", - "sha256:b304586d357c43221856be51d73387f93e2a961598a9b6b6670664746f3b6c6c" - ], - "markers": "python_version ~= '3.5'", - "version": "==4.0.0" - }, - "certifi": { - "hashes": [ - "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", - "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" - ], - "version": "==2019.11.28" - }, - "cffi": { - "hashes": [ - "sha256:0b49274afc941c626b605fb59b59c3485c17dc776dc3cc7cc14aca74cc19cc42", - "sha256:0e3ea92942cb1168e38c05c1d56b0527ce31f1a370f6117f1d490b8dcd6b3a04", - "sha256:135f69aecbf4517d5b3d6429207b2dff49c876be724ac0c8bf8e1ea99df3d7e5", - "sha256:19db0cdd6e516f13329cba4903368bff9bb5a9331d3410b1b448daaadc495e54", - "sha256:2781e9ad0e9d47173c0093321bb5435a9dfae0ed6a762aabafa13108f5f7b2ba", - "sha256:291f7c42e21d72144bb1c1b2e825ec60f46d0a7468f5346841860454c7aa8f57", - "sha256:2c5e309ec482556397cb21ede0350c5e82f0eb2621de04b2633588d118da4396", - "sha256:2e9c80a8c3344a92cb04661115898a9129c074f7ab82011ef4b612f645939f12", - "sha256:32a262e2b90ffcfdd97c7a5e24a6012a43c61f1f5a57789ad80af1d26c6acd97", - "sha256:3c9fff570f13480b201e9ab69453108f6d98244a7f495e91b6c654a47486ba43", - "sha256:415bdc7ca8c1c634a6d7163d43fb0ea885a07e9618a64bda407e04b04333b7db", - "sha256:42194f54c11abc8583417a7cf4eaff544ce0de8187abaf5d29029c91b1725ad3", - "sha256:4424e42199e86b21fc4db83bd76909a6fc2a2aefb352cb5414833c030f6ed71b", - "sha256:4a43c91840bda5f55249413037b7a9b79c90b1184ed504883b72c4df70778579", - "sha256:599a1e8ff057ac530c9ad1778293c665cb81a791421f46922d80a86473c13346", - "sha256:5c4fae4e9cdd18c82ba3a134be256e98dc0596af1e7285a3d2602c97dcfa5159", - "sha256:5ecfa867dea6fabe2a58f03ac9186ea64da1386af2159196da51c4904e11d652", - "sha256:62f2578358d3a92e4ab2d830cd1c2049c9c0d0e6d3c58322993cc341bdeac22e", - "sha256:6471a82d5abea994e38d2c2abc77164b4f7fbaaf80261cb98394d5793f11b12a", - "sha256:6d4f18483d040e18546108eb13b1dfa1000a089bcf8529e30346116ea6240506", - "sha256:71a608532ab3bd26223c8d841dde43f3516aa5d2bf37b50ac410bb5e99053e8f", - "sha256:74a1d8c85fb6ff0b30fbfa8ad0ac23cd601a138f7509dc617ebc65ef305bb98d", - "sha256:7b93a885bb13073afb0aa73ad82059a4c41f4b7d8eb8368980448b52d4c7dc2c", - "sha256:7d4751da932caaec419d514eaa4215eaf14b612cff66398dd51129ac22680b20", - "sha256:7f627141a26b551bdebbc4855c1157feeef18241b4b8366ed22a5c7d672ef858", - "sha256:8169cf44dd8f9071b2b9248c35fc35e8677451c52f795daa2bb4643f32a540bc", - "sha256:aa00d66c0fab27373ae44ae26a66a9e43ff2a678bf63a9c7c1a9a4d61172827a", - "sha256:ccb032fda0873254380aa2bfad2582aedc2959186cce61e3a17abc1a55ff89c3", - "sha256:d754f39e0d1603b5b24a7f8484b22d2904fa551fe865fd0d4c3332f078d20d4e", - "sha256:d75c461e20e29afc0aee7172a0950157c704ff0dd51613506bd7d82b718e7410", - "sha256:dcd65317dd15bc0451f3e01c80da2216a31916bdcffd6221ca1202d96584aa25", - "sha256:e570d3ab32e2c2861c4ebe6ffcad6a8abf9347432a37608fe1fbd157b3f0036b", - "sha256:fd43a88e045cf992ed09fa724b5315b790525f2676883a6ea64e3263bae6549d" - ], - "index": "pypi", - "version": "==1.13.2" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "index": "pypi", - "version": "==3.0.4" - }, - "click": { - "hashes": [ - "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", - "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==7.0" - }, - "colorama": { - "hashes": [ - "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff", - "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.4.3" - }, - "control": { - "hashes": [ - "sha256:1fcfdcf39f96523cb1f2cf7bf7b8ae68ec3ef8350e5c55e17e02afdb0872edbb" - ], - "index": "pypi", - "version": "==0.8.3" - }, - "coverage": { - "hashes": [ - "sha256:189aac76d6e0d7af15572c51892e7326ee451c076c5a50a9d266406cd6c49708", - "sha256:1bf7ba2af1d373a1750888724f84cffdfc697738f29a353c98195f98fc011509", - "sha256:1f4ee8e2e4243971618bc16fcc4478317405205f135e95226c2496e2a3b8dbbf", - "sha256:225e79a5d485bc1642cb7ba02281419c633c216cdc6b26c26494ba959f09e69f", - "sha256:23688ff75adfa8bfa2a67254d889f9bdf9302c27241d746e17547c42c732d3f4", - "sha256:28f7f73b34a05e23758e860a89a7f649b85c6749e252eff60ebb05532d180e86", - "sha256:2d0cb9b1fe6ad0d915d45ad3d87f03a38e979093a98597e755930db1f897afae", - "sha256:47874b4711c5aeb295c31b228a758ce3d096be83dc37bd56da48ed99efb8813b", - "sha256:511ec0c00840e12fb4e852e4db58fa6a01ca4da72f36a9766fae344c3d502033", - "sha256:53e7438fef0c97bc248f88ba1edd10268cd94d5609970aaf87abbe493691af87", - "sha256:569f9ee3025682afda6e9b0f5bb14897c0db03f1a1dc088b083dd36e743f92bb", - "sha256:593853aa1ac6dcc6405324d877544c596c9d948ef20d2e9512a0f5d2d3202356", - "sha256:5b0a07158360d22492f9abd02a0f2ee7981b33f0646bf796598b7673f6bbab14", - "sha256:7ca3db38a61f3655a2613ee2c190d63639215a7a736d3c64cc7bbdb002ce6310", - "sha256:7d1cc7acc9ce55179616cf72154f9e648136ea55987edf84addbcd9886ffeba2", - "sha256:88b51153657612aea68fa684a5b88037597925260392b7bb4509d4f9b0bdd889", - "sha256:955ec084f549128fa2702f0b2dc696392001d986b71acd8fd47424f28289a9c3", - "sha256:b251c7092cbb6d789d62dc9c9e7c4fb448c9138b51285c36aeb72462cad3600e", - "sha256:bd82b684bb498c60ef47bb1541a50e6d006dde8579934dcbdbc61d67d1ea70d9", - "sha256:bfe102659e2ec13b86c7f3b1db6c9a4e7beea4255058d006351339e6b342d5d2", - "sha256:c1e4e39e43057396a5e9d069bfbb6ffeee892e40c5d2effbd8cd71f34ee66c4d", - "sha256:cb2b74c123f65e8166f7e1265829a6c8ed755c3cd16d7f50e75a83456a5f3fd7", - "sha256:cca38ded59105f7705ef6ffe1e960b8db6c7d8279c1e71654a4775ab4454ca15", - "sha256:cf908840896f7aa62d0ec693beb53264b154f972eb8226fb864ac38975590c4f", - "sha256:d095a7b473f8a95f7efe821f92058c8a2ecfb18f8db6677ae3819e15dc11aaae", - "sha256:d22b4297e7e4225ccf01f1aa55e7a96412ea0796b532dd614c3fcbafa341128e", - "sha256:d4a2b578a7a70e0c71f662705262f87a456f1e6c1e40ada7ea699abaf070a76d", - "sha256:ddeb42a3d5419434742bf4cc71c9eaa22df3b76808e23a82bd0b0bd360f1a9f1", - "sha256:e65a5aa1670db6263f19fdc03daee1d7dbbadb5cb67fd0a1f16033659db13c1d", - "sha256:eaad65bd20955131bcdb3967a4dea66b4e4d4ca488efed7c00d91ee0173387e8", - "sha256:f45fba420b94165c17896861bb0e8b27fb7abdcedfeb154895d8553df90b7b00" - ], - "index": "pypi", - "version": "==5.0.2" - }, - "cryptography": { - "hashes": [ - "sha256:02079a6addc7b5140ba0825f542c0869ff4df9a69c360e339ecead5baefa843c", - "sha256:1df22371fbf2004c6f64e927668734070a8953362cd8370ddd336774d6743595", - "sha256:369d2346db5934345787451504853ad9d342d7f721ae82d098083e1f49a582ad", - "sha256:3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651", - "sha256:44ff04138935882fef7c686878e1c8fd80a723161ad6a98da31e14b7553170c2", - "sha256:4b1030728872c59687badcca1e225a9103440e467c17d6d1730ab3d2d64bfeff", - "sha256:58363dbd966afb4f89b3b11dfb8ff200058fbc3b947507675c19ceb46104b48d", - "sha256:6ec280fb24d27e3d97aa731e16207d58bd8ae94ef6eab97249a2afe4ba643d42", - "sha256:7270a6c29199adc1297776937a05b59720e8a782531f1f122f2eb8467f9aab4d", - "sha256:73fd30c57fa2d0a1d7a49c561c40c2f79c7d6c374cc7750e9ac7c99176f6428e", - "sha256:7f09806ed4fbea8f51585231ba742b58cbcfbfe823ea197d8c89a5e433c7e912", - "sha256:90df0cc93e1f8d2fba8365fb59a858f51a11a394d64dbf3ef844f783844cc793", - "sha256:971221ed40f058f5662a604bd1ae6e4521d84e6cad0b7b170564cc34169c8f13", - "sha256:a518c153a2b5ed6b8cc03f7ae79d5ffad7315ad4569b2d5333a13c38d64bd8d7", - "sha256:b0de590a8b0979649ebeef8bb9f54394d3a41f66c5584fff4220901739b6b2f0", - "sha256:b43f53f29816ba1db8525f006fa6f49292e9b029554b3eb56a189a70f2a40879", - "sha256:d31402aad60ed889c7e57934a03477b572a03af7794fa8fb1780f21ea8f6551f", - "sha256:de96157ec73458a7f14e3d26f17f8128c959084931e8997b9e655a39c8fde9f9", - "sha256:df6b4dca2e11865e6cfbfb708e800efb18370f5a46fd601d3755bc7f85b3a8a2", - "sha256:ecadccc7ba52193963c0475ac9f6fa28ac01e01349a2ca48509667ef41ffd2cf", - "sha256:fb81c17e0ebe3358486cd8cc3ad78adbae58af12fc2bf2bc0bb84e8090fa5ce8" - ], - "index": "pypi", - "version": "==2.8" - }, - "cycler": { - "hashes": [ - "sha256:1d8a5ae1ff6c5cf9b93e8811e581232ad8920aeec647c37316ceac982b08cb2d", - "sha256:cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8" - ], - "version": "==0.10.0" - }, - "datadog": { - "hashes": [ - "sha256:22d3c935e83de02b64efed635ac5fb45db26e152ac759105ec6d5a7ed8b9f6a9", - "sha256:bce73f33a4496b004402baa502251150e3b48a48f610ff89d4cd110b366ee0ab" - ], - "index": "pypi", - "version": "==0.33.0" - }, - "decorator": { - "hashes": [ - "sha256:54c38050039232e1db4ad7375cfce6748d7b41c29e95a081c8a6d2c30364a2ce", - "sha256:5d19b92a3c8f7f101c8dd86afd86b0f061a8ce4540ab8cd401fa2542756bce6d" - ], - "version": "==4.4.1" - }, - "defusedxml": { - "hashes": [ - "sha256:6687150770438374ab581bb7a1b327a847dd9c5749e396102de3fad4e8a3ef93", - "sha256:f684034d135af4c6cbb949b8a4d2ed61634515257a67299e5f940fbaa34377f5" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.6.0" - }, - "dictdiffer": { - "hashes": [ - "sha256:1adec0d67cdf6166bda96ae2934ddb5e54433998ceab63c984574d187cc563d2", - "sha256:d79d9a39e459fe33497c858470ca0d2e93cb96621751de06d631856adfd9c390" - ], - "index": "pypi", - "version": "==0.8.1" - }, - "dlib": { - "hashes": [ - "sha256:d0eeaca07bc4c75973ad0f739a541d8fa4003af778f0dc1c2c595d470823819a" - ], - "index": "pypi", - "version": "==19.19.0" - }, - "docutils": { - "hashes": [ - "sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0", - "sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827", - "sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.15.2" - }, - "elasticsearch": { - "hashes": [ - "sha256:0140787216646e1eb7eb001f8146aff7071d7ca438854249787b6cc221ddd266", - "sha256:283a6afa5dc08c21016c295b5237fbd9c74895b0b297ceb97c879ec7d67a5f47" - ], - "index": "pypi", - "version": "==7.1.0" - }, - "entrypoints": { - "hashes": [ - "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", - "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451" - ], - "markers": "python_version >= '2.7'", - "version": "==0.3" - }, - "fastcluster": { - "hashes": [ - "sha256:18988adb9bc07fcb5970a17ced626092d28806866f7914aa8079f1fe57d1fcdf", - "sha256:3fe5102b58736ff8ed2a7944be98fbd4837b6ba4f3acbf6c06ef3b8ccdda00f1", - "sha256:4c0d310b74bfac6121eec4b704ffe52bdca995d022b7898ce02d3609a141d7a3", - "sha256:5026d6a69819c07a9df578529c7ed6615737e70650c42c55267c6a7c57c1b2be", - "sha256:5045697238bc71e37177f6b6ae9d902c02e8947ee43657476227c92d84885a68", - "sha256:67fe1890ba5f281e145cc17444056670b60e0232650d189345001f658046f46c", - "sha256:69055a8cd51e6acafd4d0973cdeaa03620e93f548527310a2448a6d19731ef29", - "sha256:6e421e7eda88f3140c8786da80656d85c7c73b53665439970acfa7e1f54fc699", - "sha256:71b2f1c455aae6bb13aa1c9c1db1b0ccc0cdc336646005008d47fe5d584a07a9", - "sha256:7cb427be975cdadf969fe62eccd5256dccb623342e80ea0fdda8870e40ac756f", - "sha256:8dd5ef24ea7014ea2d2478627fec509a4366053bcce5b8559b72fc4f62d3990e", - "sha256:94699ce6a452e34e1ac530823dbfb5a8b97942f00abd07231cb17b3c9f4d11fb", - "sha256:9849b86b44d2307f52c85a92ecb8dd2c8365bc41d835fb34c859a3622fa52417", - "sha256:a202f44a3b06f5cf9cdba3c67d6c523288922d6e6a1cdf737292f93759aa82f7", - "sha256:aaaef36300cbf20fabea182369186e6899b122b2667e1408c981e5177a8ebc67", - "sha256:accf6df86ce86905a9a87f10cb241d8d772d11ce77a2e8721ac731a7ad11fe8c", - "sha256:b1d905eb21a40a8b80e678030b985f42bbff4d6eef4c3158cbd0c00c36966de9", - "sha256:b86f22c46e8217dcd70a58a35b6134de7fa45d5986d703a8cd0812087782d900", - "sha256:ba26b92bd991714f6edf787e2ec42f294e30d1d6b79cf0c390199cb2b5dcf952", - "sha256:c17e9d650cefdab2f4632faf0239fe5b77d8f92cde56860a3cbdce33d2963bb9", - "sha256:c29af2b6c2c8c39292fba4db1f988ae2328298d16b9dc2e8aa4b969020332f5b", - "sha256:ca988e233e6aee007616af0fc7fbf5b236a3940f334a0fd176cd165151e8aea2", - "sha256:fd1ada69e745032274632ba0ef5532c8ca631a8b1d2db819689385a5253f3129" - ], - "index": "pypi", - "version": "==1.1.26" - }, - "flask": { - "hashes": [ - "sha256:13f9f196f330c7c2c5d7a5cf91af894110ca0215ac051b5844701f2bfd934d52", - "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6" - ], - "index": "pypi", - "version": "==1.1.1" - }, - "flask-cors": { - "hashes": [ - "sha256:72170423eb4612f0847318afff8c247b38bd516b7737adfc10d1c2cdbb382d16", - "sha256:f4d97201660e6bbcff2d89d082b5b6d31abee04b1b3003ee073a6fd25ad1d69a" - ], - "index": "pypi", - "version": "==3.0.8" - }, - "flask-socketio": { - "hashes": [ - "sha256:2172dff1e42415ba480cee02c30c2fc833671ff326f1598ee3d69aa02cf768ec", - "sha256:7ff5b2f5edde23e875a8b0abf868584e5706e11741557449bc5147df2cd78268" - ], - "index": "pypi", - "version": "==4.2.1" - }, - "future": { - "hashes": [ - "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" - ], - "index": "pypi", - "version": "==0.18.2" - }, - "futures": { - "hashes": [ - "sha256:3a44f286998ae64f0cc083682fcfec16c406134a81a589a5de445d7bb7c2751b", - "sha256:51ecb45f0add83c806c68e4b06106f90db260585b25ef2abfcda0bd95c0132fd", - "sha256:c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f" - ], - "index": "pypi", - "version": "==3.1.1" - }, - "gast": { - "hashes": [ - "sha256:fe939df4583692f0512161ec1c880e0a10e71e6a232da045ab8edd3756fbadf0" - ], - "version": "==0.2.2" - }, - "geoalchemy2": { - "hashes": [ - "sha256:0d1c9ea3ec13f6a522ccc3ffd2569ac524a6c6e80bab883e8805b28c48e77143", - "sha256:4dc4c6c2bda0fc82cccab4aaff185a6570e13a5351d85e29e12984a55d4138ee" - ], - "index": "pypi", - "version": "==0.6.3" - }, - "git-pylint-commit-hook": { - "hashes": [ - "sha256:e1d39e7856b3ef0a0269121ca210dc3f5a97da158b322411e8e1185918a91b3c" - ], - "index": "pypi", - "version": "==2.5.1" - }, - "google-auth": { - "hashes": [ - "sha256:7bb2034a3a290190cf4e3eb8ebf29e5025c90f0b06a00ba4d1fb94bf0c6448f7", - "sha256:c57074e594d2c6e3e316162734e8af3e15d40252022e69414cba67de66594417" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.10.0" - }, - "google-auth-oauthlib": { - "hashes": [ - "sha256:88d2cd115e3391eb85e1243ac6902e76e77c5fe438b7276b297fbe68015458dd", - "sha256:a92a0f6f41a0fb6138454fbc02674e64f89d82a244ea32f98471733c8ef0e0e1" - ], - "version": "==0.4.1" - }, - "google-pasta": { - "hashes": [ - "sha256:41bbe63bab92408452585ff2e1673ec1e35b88e163371cbed2a18510be4e8bc5", - "sha256:644dcf3784cf7147ab01de5dc22e60a638d219d4e4a3a7464eb98997ae2fe66f", - "sha256:713813a9f7d6589e5defdaf21e80e4392eb124662f8bd829acd51a4f8735c0cb" - ], - "version": "==0.1.8" - }, - "grpcio": { - "hashes": [ - "sha256:066630f6b62bffa291dacbee56994279a6a3682b8a11967e9ccaf3cc770fc11e", - "sha256:07e95762ca6b18afbeb3aa2793e827c841152d5e507089b1db0b18304edda105", - "sha256:0a0fb2f8e3a13537106bc77e4c63005bc60124a6203034304d9101921afa4e90", - "sha256:0c61b74dcfb302613926e785cb3542a0905b9a3a86e9410d8cf5d25e25e10104", - "sha256:13383bd70618da03684a8aafbdd9e3d9a6720bf8c07b85d0bc697afed599d8f0", - "sha256:1c6e0f6b9d091e3717e9a58d631c8bb4898be3b261c2a01fe46371fdc271052f", - "sha256:1cf710c04689daa5cc1e598efba00b028215700dcc1bf66fcb7b4f64f2ea5d5f", - "sha256:2da5cee9faf17bb8daf500cd0d28a17ae881ab5500f070a6aace457f4c08cac4", - "sha256:2f78ebf340eaf28fa09aba0f836a8b869af1716078dfe8f3b3f6ff785d8f2b0f", - "sha256:33a07a1a8e817d733588dbd18e567caad1a6fe0d440c165619866cd490c7911a", - "sha256:3d090c66af9c065b7228b07c3416f93173e9839b1d40bb0ce3dd2aa783645026", - "sha256:42b903a3596a10e2a3727bae2a76f8aefd324d498424b843cfa9606847faea7b", - "sha256:4fffbb58134c4f23e5a8312ac3412db6f5e39e961dc0eb5e3115ce5aa16bf927", - "sha256:57be5a6c509a406fe0ffa6f8b86904314c77b5e2791be8123368ad2ebccec874", - "sha256:5b0fa09efb33e2af4e8822b4eb8b2cbc201d562e3e185c439be7eaeee2e8b8aa", - "sha256:5ef42dfc18f9a63a06aca938770b69470bb322e4c137cf08cf21703d1ef4ae5c", - "sha256:6a43d2f2ff8250f200fdf7aa31fa191a997922aa9ea1182453acd705ad83ab72", - "sha256:6d8ab28559be98b02f8b3a154b53239df1aa5b0d28ff865ae5be4f30e7ed4d3f", - "sha256:6e47866b7dc14ca3a12d40c1d6082e7bea964670f1c5315ea0fb8b0550244d64", - "sha256:6edda1b96541187f73aab11800d25f18ee87e53d5f96bb74473873072bf28a0e", - "sha256:7109c8738a8a3c98cfb5dda1c45642a8d6d35dc00d257ab7a175099b2b4daecd", - "sha256:8d866aafb08657c456a18c4a31c8526ea62de42427c242b58210b9eae6c64559", - "sha256:9939727d9ae01690b24a2b159ac9dbca7b7e8e6edd5af6a6eb709243cae7b52b", - "sha256:99fd873699df17cb11c542553270ae2b32c169986e475df0d68a8629b8ef4df7", - "sha256:b6fda5674f990e15e1bcaacf026428cf50bce36e708ddcbd1de9673b14aab760", - "sha256:bdb2f3dcb664f0c39ef1312cd6acf6bc6375252e4420cf8f36fff4cb4fa55c71", - "sha256:bfd7d3130683a1a0a50c456273c21ec8a604f2d043b241a55235a78a0090ee06", - "sha256:c6c2db348ac73d73afe14e0833b18abbbe920969bf2c5c03c0922719f8020d06", - "sha256:cb7a4b41b5e2611f85c3402ac364f1d689f5d7ecbc24a55ef010eedcd6cf460f", - "sha256:cd3d3e328f20f7c807a862620c6ee748e8d57ba2a8fc960d48337ed71c6d9d32", - "sha256:d1a481777952e4f99b8a6956581f3ee866d7614100d70ae6d7e07327570b85ce", - "sha256:d1d49720ed636920bb3d74cedf549382caa9ad55aea89d1de99d817068d896b2", - "sha256:d42433f0086cccd192114343473d7dbd4aae9141794f939e2b7b83efc57543db", - "sha256:d44c34463a7c481e076f691d8fa25d080c3486978c2c41dca09a8dd75296c2d7", - "sha256:d7e5b7af1350e9c8c17a7baf99d575fbd2de69f7f0b0e6ebd47b57506de6493a", - "sha256:d9542366a0917b9b48bab1fee481ac01f56bdffc52437b598c09e7840148a6a9", - "sha256:df7cdfb40179acc9790a462c049e0b8e109481164dd7ad1a388dd67ff1528759", - "sha256:e1a9d9d2e7224d981aea8da79260c7f6932bf31ce1f99b7ccfa5eceeb30dc5d0", - "sha256:ed10e5fad105ecb0b12822f924e62d0deb07f46683a0b64416b17fd143daba1d", - "sha256:f0ec5371ce2363b03531ed522bfbe691ec940f51f0e111f0500fc0f44518c69d", - "sha256:f6580a8a4f5e701289b45fd62a8f6cb5ec41e4d77082424f8b676806dcd22564", - "sha256:f7b83e4b2842d44fce3cdc0d54db7a7e0d169a598751bf393601efaa401c83e0", - "sha256:ffec45b0db18a555fdfe0c6fa2d0a3fceb751b22b31e8fcd14ceed7bde05481e" - ], - "version": "==1.26.0" - }, - "gunicorn": { - "hashes": [ - "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", - "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" - ], - "index": "pypi", - "version": "==20.0.4" - }, - "h5py": { - "hashes": [ - "sha256:063947eaed5f271679ed4ffa36bb96f57bc14f44dd4336a827d9a02702e6ce6b", - "sha256:13c87efa24768a5e24e360a40e0bc4c49bcb7ce1bb13a3a7f9902cec302ccd36", - "sha256:16ead3c57141101e3296ebeed79c9c143c32bdd0e82a61a2fc67e8e6d493e9d1", - "sha256:3dad1730b6470fad853ef56d755d06bb916ee68a3d8272b3bab0c1ddf83bb99e", - "sha256:51ae56894c6c93159086ffa2c94b5b3388c0400548ab26555c143e7cfa05b8e5", - "sha256:54817b696e87eb9e403e42643305f142cd8b940fe9b3b490bbf98c3b8a894cf4", - "sha256:549ad124df27c056b2e255ea1c44d30fb7a17d17676d03096ad5cd85edb32dc1", - "sha256:64f74da4a1dd0d2042e7d04cf8294e04ddad686f8eba9bb79e517ae582f6668d", - "sha256:6998be619c695910cb0effe5eb15d3a511d3d1a5d217d4bd0bebad1151ec2262", - "sha256:6ef7ab1089e3ef53ca099038f3c0a94d03e3560e6aff0e9d6c64c55fb13fc681", - "sha256:769e141512b54dee14ec76ed354fcacfc7d97fea5a7646b709f7400cf1838630", - "sha256:79b23f47c6524d61f899254f5cd5e486e19868f1823298bc0c29d345c2447172", - "sha256:7be5754a159236e95bd196419485343e2b5875e806fe68919e087b6351f40a70", - "sha256:84412798925dc870ffd7107f045d7659e60f5d46d1c70c700375248bf6bf512d", - "sha256:86868dc07b9cc8cb7627372a2e6636cdc7a53b7e2854ad020c9e9d8a4d3fd0f5", - "sha256:8bb1d2de101f39743f91512a9750fb6c351c032e5cd3204b4487383e34da7f75", - "sha256:a5f82cd4938ff8761d9760af3274acf55afc3c91c649c50ab18fcff5510a14a5", - "sha256:aac4b57097ac29089f179bbc2a6e14102dd210618e94d77ee4831c65f82f17c0", - "sha256:bffbc48331b4a801d2f4b7dac8a72609f0b10e6e516e5c480a3e3241e091c878", - "sha256:c0d4b04bbf96c47b6d360cd06939e72def512b20a18a8547fa4af810258355d5", - "sha256:c54a2c0dd4957776ace7f95879d81582298c5daf89e77fb8bee7378f132951de", - "sha256:cbf28ae4b5af0f05aa6e7551cee304f1d317dbed1eb7ac1d827cee2f1ef97a99", - "sha256:d35f7a3a6cefec82bfdad2785e78359a0e6a5fbb3f605dd5623ce88082ccd681", - "sha256:d3c59549f90a891691991c17f8e58c8544060fdf3ccdea267100fa5f561ff62f", - "sha256:d7ae7a0576b06cb8e8a1c265a8bc4b73d05fdee6429bffc9a26a6eb531e79d72", - "sha256:ecf4d0b56ee394a0984de15bceeb97cbe1fe485f1ac205121293fc44dcf3f31f", - "sha256:f0e25bb91e7a02efccb50aba6591d3fe2c725479e34769802fcdd4076abfa917", - "sha256:f23951a53d18398ef1344c186fb04b26163ca6ce449ebd23404b153fd111ded9", - "sha256:ff7d241f866b718e4584fa95f520cb19405220c501bd3a53ee11871ba5166ea2" - ], - "index": "pypi", - "version": "==2.10.0" - }, - "hexdump": { - "hashes": [ - "sha256:d781a43b0c16ace3f9366aade73e8ad3a7bd5137d58f0b45ab2d3f54876f20db" - ], - "index": "pypi", - "version": "==3.3" - }, - "html5lib": { - "hashes": [ - "sha256:20b159aa3badc9d5ee8f5c647e5efd02ed2a66ab8d354930bd9ff139fc1dc0a3", - "sha256:66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736" - ], - "index": "pypi", - "version": "==1.0.1" - }, - "humanfriendly": { - "hashes": [ - "sha256:23057b10ad6f782e7bc3a20e3cb6768ab919f619bbdc0dd75691121bbde5591d", - "sha256:33ee8ceb63f1db61cce8b5c800c531e1a61023ac5488ccde2ba574a85be00a85" - ], - "version": "==4.18" - }, - "idna": { - "hashes": [ - "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", - "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" - ], - "index": "pypi", - "version": "==2.8" - }, - "imageio": { - "hashes": [ - "sha256:c9763e5c187ecf74091c845626b0bdcc6130a20a0de7a86ae0108e2b5335ed3f", - "sha256:f44eb231b9df485874f2ffd22dfd0c3c711e7de076516b9374edea5c65bc67ae" - ], - "index": "pypi", - "version": "==2.6.1" - }, - "importlib-metadata": { - "hashes": [ - "sha256:073a852570f92da5f744a3472af1b61e28e9f78ccf0c9117658dc32b15de7b45", - "sha256:d95141fbfa7ef2ec65cfd945e2af7e5a6ddbd7c8d9a25e66ff3be8e3daf9f60f" - ], - "markers": "python_version == '3.7'", - "version": "==1.3.0" - }, - "ipykernel": { - "hashes": [ - "sha256:1a7def9c986f1ee018c1138d16951932d4c9d4da01dad45f9d34e9899565a22f", - "sha256:b368ad13edb71fa2db367a01e755a925d7f75ed5e09fbd3f06c85e7a8ef108a8" - ], - "index": "pypi", - "version": "==5.1.3" - }, - "ipython": { - "hashes": [ - "sha256:0f4bcf18293fb666df8511feec0403bdb7e061a5842ea6e88a3177b0ceb34ead", - "sha256:387686dd7fc9caf29d2fddcf3116c4b07a11d9025701d220c589a430b0171d8a" - ], - "index": "pypi", - "version": "==7.11.1" - }, - "ipython-genutils": { - "hashes": [ - "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", - "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" - ], - "version": "==0.2.0" - }, - "ipywidgets": { - "hashes": [ - "sha256:13ffeca438e0c0f91ae583dc22f50379b9d6b28390ac7be8b757140e9a771516", - "sha256:e945f6e02854a74994c596d9db83444a1850c01648f1574adf144fbbabe05c97" - ], - "version": "==7.5.1" - }, - "isodate": { - "hashes": [ - "sha256:2e364a3d5759479cdb2d37cce6b9376ea504db2ff90252a2e5b7cc89cc9ff2d8", - "sha256:aa4d33c06640f5352aca96e4b81afd8ab3b47337cc12089822d6f322ac772c81" - ], - "version": "==0.6.0" - }, - "isort": { - "hashes": [ - "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1", - "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.3.21" - }, - "itsdangerous": { - "hashes": [ - "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19", - "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.0" - }, - "jedi": { - "hashes": [ - "sha256:1349c1e8c107095a55386628bb3b2a79422f3a2cab8381e34ce19909e0cf5064", - "sha256:e909527104a903606dd63bea6e8e888833f0ef087057829b89a18364a856f807" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.15.2" - }, - "jinja2": { - "hashes": [ - "sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f", - "sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de" - ], - "index": "pypi", - "version": "==2.10.3" - }, - "jmespath": { - "hashes": [ - "sha256:3720a4b1bd659dd2eecad0666459b9788813e032b83e7ba58578e48254e0a0e6", - "sha256:bde2aef6f44302dfb30320115b17d030798de8c4110e28d5cf6cf91a7a31074c" - ], - "version": "==0.9.4" - }, - "joblib": { - "hashes": [ - "sha256:0630eea4f5664c463f23fbf5dcfc54a2bc6168902719fa8e19daf033022786c8", - "sha256:bdb4fd9b72915ffb49fde2229ce482dd7ae79d842ed8c2b4c932441495af1403" - ], - "index": "pypi", - "version": "==0.14.1" - }, - "json-logging-py": { - "hashes": [ - "sha256:118b1fe1f4eacaea6370e5b9710d0f6d0c0a4599aef9d5b9875a6a579974fc9a" - ], - "index": "pypi", - "version": "==0.2" - }, - "jsonschema": { - "hashes": [ - "sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163", - "sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a" - ], - "version": "==3.2.0" - }, - "jupyter": { - "hashes": [ - "sha256:3e1f86076bbb7c8c207829390305a2b1fe836d471ed54be66a3b8c41e7f46cc7", - "sha256:5b290f93b98ffbc21c0c7e749f054b3267782166d72fa5e3ed1ed4eaf34a2b78", - "sha256:d9dc4b3318f310e34c82951ea5d6683f67bed7def4b259fafbfe4f1beb1d8e5f" - ], - "index": "pypi", - "version": "==1.0.0" - }, - "jupyter-client": { - "hashes": [ - "sha256:60e6faec1031d63df57f1cc671ed673dced0ed420f4377ea33db37b1c188b910", - "sha256:d0c077c9aaa4432ad485e7733e4d91e48f87b4f4bab7d283d42bb24cbbba0a0f" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==5.3.4" - }, - "jupyter-console": { - "hashes": [ - "sha256:308ce876354924fb6c540b41d5d6d08acfc946984bf0c97777c1ddcb42e0b2f5", - "sha256:cc80a97a5c389cbd30252ffb5ce7cefd4b66bde98219edd16bf5cb6f84bb3568" - ], - "markers": "python_version >= '3.5'", - "version": "==6.0.0" - }, - "jupyter-core": { - "hashes": [ - "sha256:464769f7387d7a62a2403d067f1ddc616655b7f77f5d810c0dd62cb54bfd0fb9", - "sha256:a183e0ec2e8f6adddf62b0a3fc6a2237e3e0056d381e536d3e7c7ecc3067e244" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==4.6.1" - }, - "keras-applications": { - "hashes": [ - "sha256:5579f9a12bcde9748f4a12233925a59b93b73ae6947409ff34aa2ba258189fe5", - "sha256:df4323692b8c1174af821bf906f1e442e63fa7589bf0f1230a0b6bdc5a810c95" - ], - "version": "==1.0.8" - }, - "keras-preprocessing": { - "hashes": [ - "sha256:44aee5f2c4d80c3b29f208359fcb336df80f293a0bb6b1c738da43ca206656fb", - "sha256:5a8debe01d840de93d49e05ccf1c9b81ae30e210d34dacbcc47aeb3049b528e5" - ], - "version": "==1.1.0" - }, - "kiwisolver": { - "hashes": [ - "sha256:05b5b061e09f60f56244adc885c4a7867da25ca387376b02c1efc29cc16bcd0f", - "sha256:210d8c39d01758d76c2b9a693567e1657ec661229bc32eac30761fa79b2474b0", - "sha256:26f4fbd6f5e1dabff70a9ba0d2c4bd30761086454aa30dddc5b52764ee4852b7", - "sha256:3b15d56a9cd40c52d7ab763ff0bc700edbb4e1a298dc43715ecccd605002cf11", - "sha256:3b2378ad387f49cbb328205bda569b9f87288d6bc1bf4cd683c34523a2341efe", - "sha256:400599c0fe58d21522cae0e8b22318e09d9729451b17ee61ba8e1e7c0346565c", - "sha256:47b8cb81a7d18dbaf4fed6a61c3cecdb5adec7b4ac292bddb0d016d57e8507d5", - "sha256:53eaed412477c836e1b9522c19858a8557d6e595077830146182225613b11a75", - "sha256:58e626e1f7dfbb620d08d457325a4cdac65d1809680009f46bf41eaf74ad0187", - "sha256:5a52e1b006bfa5be04fe4debbcdd2688432a9af4b207a3f429c74ad625022641", - "sha256:5c7ca4e449ac9f99b3b9d4693debb1d6d237d1542dd6a56b3305fe8a9620f883", - "sha256:682e54f0ce8f45981878756d7203fd01e188cc6c8b2c5e2cf03675390b4534d5", - "sha256:76275ee077772c8dde04fb6c5bc24b91af1bb3e7f4816fd1852f1495a64dad93", - "sha256:79bfb2f0bd7cbf9ea256612c9523367e5ec51d7cd616ae20ca2c90f575d839a2", - "sha256:7f4dd50874177d2bb060d74769210f3bce1af87a8c7cf5b37d032ebf94f0aca3", - "sha256:8944a16020c07b682df861207b7e0efcd2f46c7488619cb55f65882279119389", - "sha256:8aa7009437640beb2768bfd06da049bad0df85f47ff18426261acecd1cf00897", - "sha256:9105ce82dcc32c73eb53a04c869b6a4bc756b43e4385f76ea7943e827f529e4d", - "sha256:933df612c453928f1c6faa9236161a1d999a26cd40abf1dc5d7ebbc6dbfb8fca", - "sha256:939f36f21a8c571686eb491acfffa9c7f1ac345087281b412d63ea39ca14ec4a", - "sha256:9491578147849b93e70d7c1d23cb1229458f71fc79c51d52dce0809b2ca44eea", - "sha256:9733b7f64bd9f807832d673355f79703f81f0b3e52bfce420fc00d8cb28c6a6c", - "sha256:a02f6c3e229d0b7220bd74600e9351e18bc0c361b05f29adae0d10599ae0e326", - "sha256:a0c0a9f06872330d0dd31b45607197caab3c22777600e88031bfe66799e70bb0", - "sha256:aa716b9122307c50686356cfb47bfbc66541868078d0c801341df31dca1232a9", - "sha256:acc4df99308111585121db217681f1ce0eecb48d3a828a2f9bbf9773f4937e9e", - "sha256:b64916959e4ae0ac78af7c3e8cef4becee0c0e9694ad477b4c6b3a536de6a544", - "sha256:d22702cadb86b6fcba0e6b907d9f84a312db9cd6934ee728144ce3018e715ee1", - "sha256:d3fcf0819dc3fea58be1fd1ca390851bdb719a549850e708ed858503ff25d995", - "sha256:d52e3b1868a4e8fd18b5cb15055c76820df514e26aa84cc02f593d99fef6707f", - "sha256:db1a5d3cc4ae943d674718d6c47d2d82488ddd94b93b9e12d24aabdbfe48caee", - "sha256:e3a21a720791712ed721c7b95d433e036134de6f18c77dbe96119eaf7aa08004", - "sha256:e8bf074363ce2babeb4764d94f8e65efd22e6a7c74860a4f05a6947afc020ff2", - "sha256:f16814a4a96dc04bf1da7d53ee8d5b1d6decfc1a92a63349bb15d37b6a263dd9", - "sha256:f2b22153870ca5cf2ab9c940d7bc38e8e9089fa0f7e5856ea195e1cf4ff43d5a", - "sha256:f790f8b3dff3d53453de6a7b7ddd173d2e020fb160baff578d578065b108a05f", - "sha256:fe51b79da0062f8e9d49ed0182a626a7dc7a0cbca0328f612c6ee5e4711c81e4" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.0" - }, - "knack": { - "hashes": [ - "sha256:b1ac92669641b902e1aef97138666a21b8852f65d83cbde03eb9ddebf82ce121", - "sha256:bd240163d4e2ce9fc8535f77519358da0afd6c0ca19f001c639c3160b57630a9" - ], - "version": "==0.6.3" - }, - "lazy-object-proxy": { - "hashes": [ - "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d", - "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449", - "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08", - "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a", - "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50", - "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd", - "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239", - "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb", - "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea", - "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e", - "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156", - "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142", - "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442", - "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62", - "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db", - "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531", - "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383", - "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a", - "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357", - "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4", - "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.4.3" - }, - "libarchive": { - "hashes": [ - "sha256:829dc298a08877f62335d528973bc034f7c1e8a03c16bfc1fa561e164e76a365" - ], - "index": "pypi", - "version": "==0.4.7" - }, - "limits": { - "hashes": [ - "sha256:98accbccf66e6e2edc0bb7b6e295e6bb8596be3588a7c385de16c8e8463644a4", - "sha256:c071295307c447f85aaa3c3ab3ce058e29d67010f4fabf278a8e163916e4deab" - ], - "version": "==1.4.1" - }, - "lru-dict": { - "hashes": [ - "sha256:365457660e3d05b76f1aba3e0f7fedbfcd6528e97c5115a351ddd0db488354cc" - ], - "index": "pypi", - "version": "==1.1.6" - }, - "markdown": { - "hashes": [ - "sha256:2e50876bcdd74517e7b71f3e7a76102050edec255b3983403f1a63e7c8a41e7a", - "sha256:56a46ac655704b91e5b7e6326ce43d5ef72411376588afa1dd90e881b83c7e8c" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==3.1.1" - }, - "markupsafe": { - "hashes": [ - "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", - "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", - "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", - "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", - "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", - "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", - "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", - "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", - "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", - "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", - "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", - "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", - "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", - "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", - "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", - "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", - "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", - "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", - "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", - "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", - "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", - "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", - "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", - "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", - "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", - "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", - "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", - "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.1.1" - }, - "matplotlib": { - "hashes": [ - "sha256:08ccc8922eb4792b91c652d3e6d46b1c99073f1284d1b6705155643e8046463a", - "sha256:161dcd807c0c3232f4dcd4a12a382d52004a498174cbfafd40646106c5bcdcc8", - "sha256:1f9e885bfa1b148d16f82a6672d043ecf11197f6c71ae222d0546db706e52eb2", - "sha256:2d6ab54015a7c0d727c33e36f85f5c5e4172059efdd067f7527f6e5d16ad01aa", - "sha256:5d2e408a2813abf664bd79431107543ecb449136912eb55bb312317edecf597e", - "sha256:61c8b740a008218eb604de518eb411c4953db0cb725dd0b32adf8a81771cab9e", - "sha256:80f10af8378fccc136da40ea6aa4a920767476cdfb3241acb93ef4f0465dbf57", - "sha256:819d4860315468b482f38f1afe45a5437f60f03eaede495d5ff89f2eeac89500", - "sha256:8cc0e44905c2c8fda5637cad6f311eb9517017515a034247ab93d0cf99f8bb7a", - "sha256:8e8e2c2fe3d873108735c6ee9884e6f36f467df4a143136209cff303b183bada", - "sha256:98c2ffeab8b79a4e3a0af5dd9939f92980eb6e3fec10f7f313df5f35a84dacab", - "sha256:d59bb0e82002ac49f4152963f8a1079e66794a4f454457fd2f0dcc7bf0797d30", - "sha256:ee59b7bb9eb75932fe3787e54e61c99b628155b0cedc907864f24723ba55b309" - ], - "index": "pypi", - "version": "==3.1.2" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "mistune": { - "hashes": [ - "sha256:59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e", - "sha256:88a1051873018da288eee8538d476dffe1262495144b33ecb586c4ab266bb8d4" - ], - "version": "==0.8.4" - }, - "mock": { - "hashes": [ - "sha256:83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3", - "sha256:d157e52d4e5b938c550f39eb2fd15610db062441a9c2747d3dbfa9298211d0f8" - ], - "index": "pypi", - "version": "==3.0.5" - }, - "more-itertools": { - "hashes": [ - "sha256:b84b238cce0d9adad5ed87e745778d20a3f8487d0f0cb8b8a586816c7496458d", - "sha256:c833ef592a0324bcc6a60e48440da07645063c453880c9477ceb22490aec1564" - ], - "markers": "python_version >= '3.5'", - "version": "==8.0.2" - }, - "mpld3": { - "hashes": [ - "sha256:4d455884a211bf99b37ecc760759435c7bb6a5955de47d8daf4967e301878ab7" - ], - "index": "pypi", - "version": "==0.3" - }, - "msgpack-python": { - "hashes": [ - "sha256:378cc8a6d3545b532dfd149da715abae4fda2a3adb6d74e525d0d5e51f46909b" - ], - "index": "pypi", - "version": "==0.5.6" - }, - "msrest": { - "hashes": [ - "sha256:56b8b5b4556fb2a92cac640df267d560889bdc9e2921187772d4691d97bc4e8d", - "sha256:f5153bfe60ee757725816aedaa0772cbfe0bddb52cd2d6db4cb8b4c3c6c6f928" - ], - "version": "==0.6.10" - }, - "msrestazure": { - "hashes": [ - "sha256:63db9f646fffc9244b332090e679d1e5f283ac491ee0cc321f5116f9450deb4a", - "sha256:fecb6a72a3eb5483e4deff38210d26ae42d3f6d488a7a275bd2423a1a014b22c" - ], - "version": "==0.6.2" - }, - "nbconvert": { - "hashes": [ - "sha256:21fb48e700b43e82ba0e3142421a659d7739b65568cc832a13976a77be16b523", - "sha256:f0d6ec03875f96df45aa13e21fd9b8450c42d7e1830418cccc008c0df725fcee" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==5.6.1" - }, - "nbformat": { - "hashes": [ - "sha256:cca9a1acfd4e049dcd6c3628d3c84db8e48a770182fb7b87d6a62f9ceacfae39", - "sha256:d1407544cf0c53ee88f504b6c732aef6e0f407a0858b405fcf133e0a25bb787b" - ], - "version": "==5.0.3" - }, - "nbstripout": { - "hashes": [ - "sha256:62f1b1fe9c7c298061089fd9bd5d297eb6209f7fbef0758631dbe58d38fc828f", - "sha256:cf745ae8c49fccdb3068b73fc3b783898d5d62ee929429e9af37a6dfefba34b7" - ], - "index": "pypi", - "version": "==0.3.7" - }, - "networkx": { - "hashes": [ - "sha256:8311ddef63cf5c5c5e7c1d0212dd141d9a1fe3f474915281b73597ed5f1d4e3d" - ], - "index": "pypi", - "version": "==2.3" - }, - "nose": { - "hashes": [ - "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", - "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", - "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" - ], - "index": "pypi", - "version": "==1.3.7" - }, - "notebook": { - "hashes": [ - "sha256:399a4411e171170173344761e7fd4491a3625659881f76ce47c50231ed714d9b", - "sha256:f67d76a68b1074a91693e95dea903ea01fd02be7c9fac5a4b870b8475caed805" - ], - "markers": "python_version >= '3.5'", - "version": "==6.0.2" - }, - "numpy": { - "hashes": [ - "sha256:1786a08236f2c92ae0e70423c45e1e62788ed33028f94ca99c4df03f5be6b3c6", - "sha256:17aa7a81fe7599a10f2b7d95856dc5cf84a4eefa45bc96123cbbc3ebc568994e", - "sha256:20b26aaa5b3da029942cdcce719b363dbe58696ad182aff0e5dcb1687ec946dc", - "sha256:2d75908ab3ced4223ccba595b48e538afa5ecc37405923d1fea6906d7c3a50bc", - "sha256:39d2c685af15d3ce682c99ce5925cc66efc824652e10990d2462dfe9b8918c6a", - "sha256:56bc8ded6fcd9adea90f65377438f9fea8c05fcf7c5ba766bef258d0da1554aa", - "sha256:590355aeade1a2eaba17617c19edccb7db8d78760175256e3cf94590a1a964f3", - "sha256:70a840a26f4e61defa7bdf811d7498a284ced303dfbc35acb7be12a39b2aa121", - "sha256:77c3bfe65d8560487052ad55c6998a04b654c2fbc36d546aef2b2e511e760971", - "sha256:9537eecf179f566fd1c160a2e912ca0b8e02d773af0a7a1120ad4f7507cd0d26", - "sha256:9acdf933c1fd263c513a2df3dceecea6f3ff4419d80bf238510976bf9bcb26cd", - "sha256:ae0975f42ab1f28364dcda3dde3cf6c1ddab3e1d4b2909da0cb0191fa9ca0480", - "sha256:b3af02ecc999c8003e538e60c89a2b37646b39b688d4e44d7373e11c2debabec", - "sha256:b6ff59cee96b454516e47e7721098e6ceebef435e3e21ac2d6c3b8b02628eb77", - "sha256:b765ed3930b92812aa698a455847141869ef755a87e099fddd4ccf9d81fffb57", - "sha256:c98c5ffd7d41611407a1103ae11c8b634ad6a43606eca3e2a5a269e5d6e8eb07", - "sha256:cf7eb6b1025d3e169989416b1adcd676624c2dbed9e3bcb7137f51bfc8cc2572", - "sha256:d92350c22b150c1cae7ebb0ee8b5670cc84848f6359cf6b5d8f86617098a9b73", - "sha256:e422c3152921cece8b6a2fb6b0b4d73b6579bd20ae075e7d15143e711f3ca2ca", - "sha256:e840f552a509e3380b0f0ec977e8124d0dc34dc0e68289ca28f4d7c1d0d79474", - "sha256:f3d0a94ad151870978fb93538e95411c83899c9dc63e6fb65542f769568ecfa5" - ], - "index": "pypi", - "version": "==1.18.1" - }, - "oauthlib": { - "hashes": [ - "sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889", - "sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==3.1.0" - }, - "opencv-python": { - "hashes": [ - "sha256:0495e9247fbbd5d88346bb4d480df27fb4000aa4799b5a15b1735968a94a5189", - "sha256:078e8ea34d06b3fa459c58a6ce966ef715cc2e913b7bd96a46beb345975aa5d6", - "sha256:0dbbd0348c8282d4e3cf472a8e2a17785f05c22a55647253fa00b539897f8fcc", - "sha256:1b302b4721ca2d55ae7e9e80acebd73499c16a82be9bebc563a7937dbd348b2d", - "sha256:1f035595ef2f296c234c2b8b9659162646b9312afd0cec7ab0217bad915ff068", - "sha256:1f7fa5433c26c637cf923c59025df12fcd56b2d205da178c7ad6954e6e50912e", - "sha256:20bd10b6f6f5de1a5e796900ab77ea57366139290f426d2039d3919d8ddf9f1c", - "sha256:2306ddd98aa52688c9667f8080349d653d465a2b838cbacb19561286046ba1e8", - "sha256:31945ea9e7324c41be925f2b21fcb523844b2399dc649010f3a3e97825dcfcd0", - "sha256:36680744ebdc66a9da0a65f1f33ec9cf5d26a98749c5701dc612b334b213997d", - "sha256:409e3a4c925accd68a5ab1cef21dd04b957c0ee2985db8f075a808dccd6e0f73", - "sha256:440a093dda50daf093d73aae2dd333c9e4a593cfe7df8cbc298b421d313e263f", - "sha256:4b0465c3df9dea074583b6b4f8cf22e5902c5c5ec213a479c6c834a8a0191cf7", - "sha256:4b5902b647e66addfa5218dbc75e7a4de2f46c253ea17b234408f5792cfc8d7f", - "sha256:4f0a5c098aad4df88ce7dc3828a857921368635e3a961e80431e60f3522a99be", - "sha256:6df586230f9146afde5b8e2f4511978f8fb6172bf0f47ba290423979baae974d", - "sha256:6e4fee2ee2bc4d911dad78e2b167da97796879aaade4be3ff42ff1993e250b15", - "sha256:70f3c6fe31af7c00c60cb91bb7351837ba6c7b3d173b855ca5dbe265b90a1606", - "sha256:78390d93834b6b7c9d9234dba68ba9c34a966f60e519efd2691e5c367dee7f8e", - "sha256:81519bba8560c68f587482c157a74cf04d5a2877d4367377d2671e66eb7a3961", - "sha256:87beeb6ad4ffcd6fbfbb464a8a75c7a1389a0642cc632ecceb504c86139567e3", - "sha256:a354096290dd57ddb2664e7b21ddb6c6c2f5297cc4d8a402ce3f6a82a24807e3", - "sha256:a4635e22637181b478d6ad337c94b596c98c16bdbae92ef90514bbf31e30ef3a", - "sha256:b23359c21c4eb84f28fbe1331723bbf1ebc34125f22480da4b16cfae989a3249", - "sha256:ba52829eafab59c5260bec012fad0e26bd05389828af0e316e278912c82dab32", - "sha256:c672596fa261766d6d0cc02377755558b92dee80a64ee8dd6f58f4e56bf7835d", - "sha256:fd6ac9a11faa5d1cbf014d059dd890ad6f0583f149e780ff7d0d3d47e68438d6" - ], - "index": "pypi", - "version": "==3.4.2.17" - }, - "opt-einsum": { - "hashes": [ - "sha256:edfada4b1d0b3b782ace8bc14e80618ff629abf53143e1e6bbf9bd00b11ece77" - ], - "markers": "python_version >= '3.5'", - "version": "==3.1.0" - }, - "osmium": { - "hashes": [ - "sha256:0178bc3dd46fd304b0a22a951df1a116d37bb0d4869bbe6c566ce1abf39be7e5", - "sha256:07f6315af25fb496125d140151e317de0486ddc20254616d2347cd5537091e07", - "sha256:090fbcf394b76c7a4e967f55977a1491efaf3276b4a27ec1262cfd13073eb497", - "sha256:0b798022ddb598ffa8c5baf979cc0fe275a9419dfdf3ca21a92ede596f99bae2", - "sha256:2170516d9c3c95432ea725ac4a0dca590fb263f80b6fc3f361a3d30eb9c41f28", - "sha256:35d9ea62e0016466eece390792644192d45dbf12c70637d293b8be408c2390cd", - "sha256:455dcd129819b1c47cfcb7c676e362c07b32dc5558bf16eddd0333f8899e331e", - "sha256:5545722ce2ead2c1e634ef23e26b694fe06f5768006195762f14ab6496fb72ed", - "sha256:68d8a9bab38657362d55ec0c2878acc40a74f4602e263c1c3b75bdfe8135c59c", - "sha256:69fd3f0da9ecb3a041075bd84702ef9237c67c09f1a0b6defb00bbb727249259", - "sha256:712910c5472726bb62a6e043179697e0a52ebb09b7e4e23dbf4a8d0e31c90e11", - "sha256:82d84dbfe437546aad4e427d9b667eb4575b35100e8ff60fd1f0752522126211", - "sha256:8475e8dc2186d0817b0254e35f502582592b8b44cd0a9478cbecd6602791ff50", - "sha256:851491cddb07e7cf25b74a29e7ceca9c0eac74c45d0a033e6085820e830e1f32", - "sha256:8ae2ce116bec61b2e51b181f61214fba06ec25ccd4d51cb42386b8b4b73ccd91", - "sha256:8ea713709267a461eaf2c6544f4fe358312558e7448480f5fd0c3fef023e996d", - "sha256:b7f774794fac9df16ad745035aa61e28a00c5a75bed3483fa77f67e34dc61920", - "sha256:bb40e3e468b47e01f759a1c5de9e5429224ca6b8fe09f690c169480afc7ea840", - "sha256:bc67305d09f391d735883efea870c37a3aa2dabf32530026a409eb506b52a2f0", - "sha256:bef1b37772b39a438c5b2e65dbc1f3417ef2a8ade829ef1f6f0179431c5bcb7c", - "sha256:df9bded041a099a72bc3bfb3732df93c36f96801c2706721d1d8623419e64321", - "sha256:e0d4a1049a5bf8445c6e8c6cbc8f247795322870a32ca63f5fdec24cbcc973c2" - ], - "index": "pypi", - "version": "==2.15.3" - }, - "pandas": { - "hashes": [ - "sha256:00dff3a8e337f5ed7ad295d98a31821d3d0fe7792da82d78d7fd79b89c03ea9d", - "sha256:22361b1597c8c2ffd697aa9bf85423afa9e1fcfa6b1ea821054a244d5f24d75e", - "sha256:255920e63850dc512ce356233081098554d641ba99c3767dde9e9f35630f994b", - "sha256:26382aab9c119735908d94d2c5c08020a4a0a82969b7e5eefb92f902b3b30ad7", - "sha256:33970f4cacdd9a0ddb8f21e151bfb9f178afb7c36eb7c25b9094c02876f385c2", - "sha256:4545467a637e0e1393f7d05d61dace89689ad6d6f66f267f86fff737b702cce9", - "sha256:52da74df8a9c9a103af0a72c9d5fdc8e0183a90884278db7f386b5692a2220a4", - "sha256:61741f5aeb252f39c3031d11405305b6d10ce663c53bc3112705d7ad66c013d0", - "sha256:6a3ac2c87e4e32a969921d1428525f09462770c349147aa8e9ab95f88c71ec71", - "sha256:7458c48e3d15b8aaa7d575be60e1e4dd70348efcd9376656b72fecd55c59a4c3", - "sha256:78bf638993219311377ce9836b3dc05f627a666d0dbc8cec37c0ff3c9ada673b", - "sha256:8153705d6545fd9eb6dd2bc79301bff08825d2e2f716d5dced48daafc2d0b81f", - "sha256:975c461accd14e89d71772e89108a050fa824c0b87a67d34cedf245f6681fc17", - "sha256:9962957a27bfb70ab64103d0a7b42fa59c642fb4ed4cb75d0227b7bb9228535d", - "sha256:adc3d3a3f9e59a38d923e90e20c4922fc62d1e5a03d083440468c6d8f3f1ae0a", - "sha256:bbe3eb765a0b1e578833d243e2814b60c825b7fdbf4cdfe8e8aae8a08ed56ecf", - "sha256:df8864824b1fe488cf778c3650ee59c3a0d8f42e53707de167ba6b4f7d35f133", - "sha256:e45055c30a608076e31a9fcd780a956ed3b1fa20db61561b8d88b79259f526f7", - "sha256:ee50c2142cdcf41995655d499a157d0a812fce55c97d9aad13bc1eef837ed36c" - ], - "markers": "python_version >= '3.5.3'", - "version": "==0.25.3" - }, - "pandocfilters": { - "hashes": [ - "sha256:b3dd70e169bb5449e6bc6ff96aea89c5eea8c5f6ab5e207fc2f521a2cf4a0da9" - ], - "version": "==1.4.2" - }, - "paramiko": { - "hashes": [ - "sha256:920492895db8013f6cc0179293147f830b8c7b21fdfc839b6bad760c27459d9f", - "sha256:9c980875fa4d2cb751604664e9a2d0f69096643f5be4db1b99599fe114a97b2f" - ], - "version": "==2.7.1" - }, - "parso": { - "hashes": [ - "sha256:55cf25df1a35fd88b878715874d2c4dc1ad3f0eebd1e0266a67e1f55efccfbe1", - "sha256:5c1f7791de6bd5dbbeac8db0ef5594b36799de198b3f7f7014643b0c5536b9d3" - ], - "version": "==0.5.2" - }, - "pbr": { - "hashes": [ - "sha256:139d2625547dbfa5fb0b81daebb39601c478c21956dc57e2e07b74450a8c506b", - "sha256:61aa52a0f18b71c5cc58232d2cf8f8d09cd67fcad60b742a60124cb8d6951488" - ], - "index": "pypi", - "version": "==5.4.4" - }, - "percache": { - "hashes": [ - "sha256:04b08b9d775b0e88666c14cfd6627691cc056ec526a4608f620595d68d1e31a2" - ], - "index": "pypi", - "version": "==0.4.4" - }, - "pexpect": { - "hashes": [ - "sha256:2094eefdfcf37a1fdbfb9aa090862c1a4878e5c7e0e7e7088bdb511c558e5cd1", - "sha256:9e2c1fd0e6ee3a49b28f95d4b33bc389c89b20af6a1255906e90ff1262ce62eb" - ], - "markers": "sys_platform != 'win32'", - "version": "==4.7.0" - }, - "pickleshare": { - "hashes": [ - "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", - "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56" - ], - "version": "==0.7.5" - }, - "pillow": { - "hashes": [ - "sha256:0a628977ac2e01ca96aaae247ec2bd38e729631ddf2221b4b715446fd45505be", - "sha256:4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946", - "sha256:54ebae163e8412aff0b9df1e88adab65788f5f5b58e625dc5c7f51eaf14a6837", - "sha256:5bfef0b1cdde9f33881c913af14e43db69815c7e8df429ceda4c70a5e529210f", - "sha256:5f3546ceb08089cedb9e8ff7e3f6a7042bb5b37c2a95d392fb027c3e53a2da00", - "sha256:5f7ae9126d16194f114435ebb79cc536b5682002a4fa57fa7bb2cbcde65f2f4d", - "sha256:62a889aeb0a79e50ecf5af272e9e3c164148f4bd9636cc6bcfa182a52c8b0533", - "sha256:7406f5a9b2fd966e79e6abdaf700585a4522e98d6559ce37fc52e5c955fade0a", - "sha256:8453f914f4e5a3d828281a6628cf517832abfa13ff50679a4848926dac7c0358", - "sha256:87269cc6ce1e3dee11f23fa515e4249ae678dbbe2704598a51cee76c52e19cda", - "sha256:875358310ed7abd5320f21dd97351d62de4929b0426cdb1eaa904b64ac36b435", - "sha256:8ac6ce7ff3892e5deaab7abaec763538ffd011f74dc1801d93d3c5fc541feee2", - "sha256:91b710e3353aea6fc758cdb7136d9bbdcb26b53cefe43e2cba953ac3ee1d3313", - "sha256:9d2ba4ed13af381233e2d810ff3bab84ef9f18430a9b336ab69eaf3cd24299ff", - "sha256:a62ec5e13e227399be73303ff301f2865bf68657d15ea50b038d25fc41097317", - "sha256:ab76e5580b0ed647a8d8d2d2daee170e8e9f8aad225ede314f684e297e3643c2", - "sha256:bf4003aa538af3f4205c5fac56eacaa67a6dd81e454ffd9e9f055fff9f1bc614", - "sha256:bf598d2e37cf8edb1a2f26ed3fb255191f5232badea4003c16301cb94ac5bdd0", - "sha256:c18f70dc27cc5d236f10e7834236aff60aadc71346a5bc1f4f83a4b3abee6386", - "sha256:c5ed816632204a2fc9486d784d8e0d0ae754347aba99c811458d69fcdfd2a2f9", - "sha256:dc058b7833184970d1248135b8b0ab702e6daa833be14035179f2acb78ff5636", - "sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865" - ], - "index": "pypi", - "version": "==7.0.0" - }, - "portalocker": { - "hashes": [ - "sha256:6f57aabb25ba176462dc7c63b86c42ad6a9b5bd3d679a9d776d0536bfb803d54", - "sha256:dac62e53e5670cb40d2ee4cdc785e6b829665932c3ee75307ad677cf5f7d2e9f" - ], - "version": "==1.5.2" - }, - "pprofile": { - "hashes": [ - "sha256:3469102f462f9fc2d889970afcf73d89c0d89a36c49a4c262c3edc302b4a22da" - ], - "index": "pypi", - "version": "==2.0.2" - }, - "prometheus-client": { - "hashes": [ - "sha256:71cd24a2b3eb335cb800c7159f423df1bd4dcd5171b234be15e3f31ec9f622da" - ], - "version": "==0.7.1" - }, - "prompt-toolkit": { - "hashes": [ - "sha256:46642344ce457641f28fc9d1c9ca939b63dadf8df128b86f1b9860e59c73a5e4", - "sha256:e7f8af9e3d70f514373bf41aa51bc33af12a6db3f71461ea47fea985defb2c31", - "sha256:f15af68f66e664eaa559d4ac8a928111eebd5feda0c11738b5998045224829db" - ], - "version": "==2.0.10" - }, - "protobuf": { - "hashes": [ - "sha256:0329e86a397db2a83f9dcbe21d9be55a47f963cdabc893c3a24f4d3a8f117c37", - "sha256:0a7219254afec0d488211f3d482d8ed57e80ae735394e584a98d8f30a8c88a36", - "sha256:14d6ac53df9cb5bb87c4f91b677c1bc5cec9c0fd44327f367a3c9562de2877c4", - "sha256:180fc364b42907a1d2afa183ccbeffafe659378c236b1ec3daca524950bb918d", - "sha256:3d7a7d8d20b4e7a8f63f62de2d192cfd8b7a53c56caba7ece95367ca2b80c574", - "sha256:3f509f7e50d806a434fe4a5fbf602516002a0f092889209fff7db82060efffc0", - "sha256:4571da974019849201fc1ec6626b9cea54bd11b6bed140f8f737c0a33ea37de5", - "sha256:557686c43fbd04f5f7c533f00feee9a37dcca7b5896e3ae3664a33864e6dd546", - "sha256:56bd1d84fbf4505c7b73f04de987eef5682e5752c811141b0186a3809bfb396f", - "sha256:680c668d00b5eff08b86aef9e5ba9a705e621ea05d39071cfea8e28cb2400946", - "sha256:6b5b947dc8b3f2aec0eaad65b0b5113fcd642c358c31357c647da6281ee31104", - "sha256:6e96dffaf4d0a9a329e528b353ba62fd9ef13599688723d96bc9c165d0b6871e", - "sha256:919f0d6f6addc836d08658eba3b52be2e92fd3e76da3ce00c325d8e9826d17c7", - "sha256:9c7b19c30cf0644afd0e4218b13f637ce54382fdcb1c8f75bf3e84e49a5f6d0a", - "sha256:a2e6f57114933882ec701807f217df2fb4588d47f71f227c0a163446b930d507", - "sha256:a6b970a2eccfcbabe1acf230fbf112face1c4700036c95e195f3554d7bcb04c1", - "sha256:bc45641cbcdea068b67438244c926f9fd3e5cbdd824448a4a64370610df7c593", - "sha256:d61b14a9090da77fe87e38ba4c6c43d3533dcbeb5d84f5474e7ac63c532dcc9c", - "sha256:d6faf5dbefb593e127463f58076b62fcfe0784187be8fe1aa9167388f24a22a1" - ], - "version": "==3.11.2" - }, - "ptyprocess": { - "hashes": [ - "sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0", - "sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f" - ], - "markers": "os_name != 'nt'", - "version": "==0.6.0" - }, - "pyasn1": { - "hashes": [ - "sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359", - "sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576", - "sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf", - "sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7", - "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d", - "sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00", - "sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8", - "sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86", - "sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12", - "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776", - "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba", - "sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2", - "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3" - ], - "version": "==0.4.8" - }, - "pyasn1-modules": { - "hashes": [ - "sha256:0c35a52e00b672f832e5846826f1fb7507907f7d52fba6faa9e3c4cbe874fe4b", - "sha256:13a6955947d8a554de78fc305a4d651f20fb5580b88612a5f0661d4f189d27ac", - "sha256:233f55c840e821e76828262db976ac894b285909d22d060c2bdb522e7bf28cc6", - "sha256:24d54188cb7abd750e0a2cba61b7b46a75608175a0c3c1b1eee08322915d8d21", - "sha256:27581362b4253b9c999882a64df974124cde12be0bf2c04148a0d68bc6bbb7b8", - "sha256:33c220a2701032261a23eea6e9881404ac6fc7ff96f183b5353fea8fc8962547", - "sha256:64f6aecf26e93f6a3ba3725b4eb9f532551747d7a63ca9ff43aef12f4bf11eac", - "sha256:7b4edf07ca2f759d7cf693184be09f22e067c2eb52b03c770d0a2e9de1c67dfd", - "sha256:9b972f81f59d896cebb9ebb1d44296f1acb28bf7869443c37551f4eed8d74f83", - "sha256:9ca5e376a6d9dee35bb3a62608dfa2e6698798aa6b8db3c7afd0eb31af0d63c7", - "sha256:b6ada4f840fe51abf5a6bd545b45bf537bea62221fa0dde2e8a553ed9f06a4e3", - "sha256:c14b107a67ee36a7f183ae9f4803ffde4a03b67f3192eab0a62e851af71371d3", - "sha256:eaf35047a0b068e3e0c2a99618b13b65c98c329661daa78c9d44a4ef0fe8139e" - ], - "version": "==0.2.7" - }, - "pycocotools": { - "git": "https://github.com/cocodataset/cocoapi.git", - "ref": "e140a084d678eacd18e85a9d8cfa45d1d5911db9", - "subdirectory": "PythonAPI", - "version": "==0.0.0" - }, - "pycparser": { - "hashes": [ - "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" - ], - "version": "==2.19" - }, - "pycurl": { - "hashes": [ - "sha256:6f08330c5cf79fa8ef68b9912b9901db7ffd34b63e225dce74db56bb21deda8e" - ], - "index": "pypi", - "version": "==7.43.0.3" - }, - "pygame": { - "hashes": [ - "sha256:0480fe82cd41a43e3eea497fa2c059c72ac54cb5d003d5aa2ed06a04541c384e", - "sha256:136a3b5711d9ec369a0407e4e08ffced3ba61aa41059e9280ffffa79c8614f65", - "sha256:2622b9dd95f445c887a36a57eade42c672598589f69a8052ccdb8eeeffa4dbb1", - "sha256:301c6428c0880ecd4a9e3951b80e539c33863b6ff356a443db1758de4f297957", - "sha256:396320aa29a925feed0b64639f77ce1418722ea7f536b4e4936083dd8d4c4535", - "sha256:398c42b605ecc514e62f68f1944a2d21e247938309f598de6cb0ad3c207324a8", - "sha256:4aaff572a273a32e70ec3593d213e59ab11c183a9916616562247930f17a5447", - "sha256:4e1065577f1b29111113be5deb2ea88553551a5e1cf33e0c08fa32768f285809", - "sha256:5f052dc2975a399aa1830c1f04c5f72856aa416bf3cd4b31375a058015a5c620", - "sha256:68ea43e51150316b9fb08e251209d4e2b4e76a340b5b6fc8cdf1a898c78f7e5b", - "sha256:698433a9fcefca0527244dc44dff9503eb26157494730b1cc80e6e4dbb246e92", - "sha256:6f714986f7987f10cb94f1be0753318e341a7ea6b12d66f37a4d5d6dd4695023", - "sha256:73cd9df328c7e72638dbcc1d18e7155225faed880a53db6bad90d1d7c0a71dfd", - "sha256:7876d1f29f66d3d7cac46479503891ee1ef409b0fbce54b0d74f3a6b33a46dba", - "sha256:854e87b8b2b76e3ed11d64985fcfdd7af919659503de99fc2b0a717b314c3cf0", - "sha256:8da13704ad45b7d5de8a8cca135a7f44c7fc6aa9f691abe7b0392468a34a8013", - "sha256:9ce22fb72298ea33dbb3a1c6c60a4a4e19d9698df6f3f5782eba4dada7b7736d", - "sha256:a37b6c59e7b8feadc51db5197052b86ceb6443f9fb2a6f7d6527620e707c558c", - "sha256:a6e8d2f99dbe1dfe72d0c019693c14d93c410f702d0b04ec9a81b36dacd55a23", - "sha256:a9ac862dd7159861f2c6443b0029089e1c0c4ec762a8074022914ec52fe4dfac", - "sha256:ae1bc3e78ed28f20878e7ca2c98663a6634e9c00d7746d39413fc18e907dc162", - "sha256:be7e70f91bd4eb35ae081062f16bf434619b3292358d9b061f8159ddc570c7f0", - "sha256:c895cf9c1b6d1cbba8cb8cc3f5427febcf8aa41a9333697741abeea1c537a350", - "sha256:e3e7e4a09dfd8b03663222d6bcadec9fef021404f4d9eecf56825342e039dfc1", - "sha256:f1f5714d2c23f6a64ef2ac4fcd36a2dd2689da85978d951a99a6ae5dfdf9bdbc", - "sha256:fa788f775680fc5d268ab00a2da29c9a22830032cfab732730298a2952cd87f3" - ], - "index": "pypi", - "version": "==1.9.6" - }, - "pygments": { - "hashes": [ - "sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b", - "sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe" - ], - "index": "pypi", - "version": "==2.5.2" - }, - "pyjwt": { - "hashes": [ - "sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e", - "sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96" - ], - "index": "pypi", - "version": "==1.7.1" - }, - "pylint": { - "hashes": [ - "sha256:3db5468ad013380e987410a8d6956226963aed94ecb5f9d3a28acca6d9ac36cd", - "sha256:886e6afc935ea2590b462664b161ca9a5e40168ea99e5300935f6591ad467df4" - ], - "index": "pypi", - "version": "==2.4.4" - }, - "pylogbeat": { - "hashes": [ - "sha256:11f3b1d04424151d406d8b844a8db6299442b4af1f10d5f622a6febf1ad5c41d", - "sha256:473494a0c798a560a8312ee662b333888181cf4db18cd8f87a8d7d1548beefd9" - ], - "version": "==1.0.2" - }, - "pymongo": { - "hashes": [ - "sha256:0369136c6e79c5edc16aa5de2b48a1b1c1fe5e6f7fc5915a2deaa98bd6e9dad5", - "sha256:08364e1bea1507c516b18b826ec790cb90433aec2f235033ec5eecfd1011633b", - "sha256:0af1d2bc8cc9503bf92ec3669a77ec3a6d7938193b583fb867b7e9696eed52e8", - "sha256:0cfd1aeeb8c0a634646ab3ebeb4ce6828b94b2e33553a69ff7e6c07c250bf201", - "sha256:15bbd2b5397f7d22498e2f2769fd698a8a247b9cc1a630ee8dabf647fb333480", - "sha256:1b4a13dff15641e58620524db15d7a323d60572b2b187261c5cb58c36d74778d", - "sha256:22fbdb908257f9aaaa372a7684f3e094a05ca52eb84f8f381c8b1827c49556fd", - "sha256:264272fd1c95fc48002ad85d5e41270831777b4180f2500943e45e12b2a3ab43", - "sha256:3372e98eebbfd05ebf020388003f8a4438bed41e0fef1ef696d2c13633c416c8", - "sha256:339d24ecdc42745d2dc09b26fda8151988e806ca81134a7bd10513c4031d91e1", - "sha256:38281855fc3961ba5510fbb503b8d16cc1fcb326e9f7ba0dd096ed4eb72a7084", - "sha256:4acdd2e16392472bfd49ca49038845c95e5254b5af862b55f7f2cc79aa258886", - "sha256:4e0c006bc6e98e861b678432e05bf64ba3eb889b6ab7e7bf1ebaecf9f1ba0e58", - "sha256:4e4284bcbe4b7be1b37f9641509085b715c478e7fbf8f820358362b5dd359379", - "sha256:4e5e94a5f9823f0bd0c56012a57650bc6772636c29d83d253260c26b908fcfd9", - "sha256:4e61f30800a40f1770b2ec56bbf5dc0f0e3f7e9250eb05fa4feb9ccb7bbe39ca", - "sha256:53577cf57ba9d93b58ab41d45250277828ff83c5286dde14f855e4b17ec19976", - "sha256:681cb31e8631882804a6cc3c8cc8f54a74ff3a82261a78e50f20c5eec05ac855", - "sha256:6dfc2710f43dd1d66991a0f160d196356732ccc8aa9dbc6875aeba78388fa142", - "sha256:72218201b13d8169be5736417987e9a0a3b10d4349e40e4db7a6a5ac670c7ef2", - "sha256:7247fbcdbf7ab574eb70743461b3cfc14d9cfae3f27a9afb6ce14d87f67dd0b5", - "sha256:72651f4b4adf50201891580506c8cca465d94d38f26ed92abfc56440662c723c", - "sha256:87b3aaf12ad6a9b5570b12d2a4b8802757cb3588a903aafd3c25f07f9caf07e3", - "sha256:87c28b7b37617c5a01eb396487f7d3b61a453e1fa0475a175ab87712d6f5d52f", - "sha256:88efe627b628f36ef53f09abb218d4630f83d8ebde7028689439559475c43dae", - "sha256:89bfbca22266f12df7fb80092b7c876734751d02b93789580b68957ad4a8bf56", - "sha256:908a3caf348a672b28b8a06fe7b4a27c2fdcf7f873df671e4027d48bcd7f971f", - "sha256:9128e7bea85f3a3041306fa14a7aa82a24b47881918500e1b8396dd1c933b5a6", - "sha256:9737d6d688a15b8d5c0bfa909638b79261e195be817b9f1be79c722bbb23cd76", - "sha256:98a8305da158f46e99e7e51db49a2f8b5fcdd7683ea7083988ccb9c4450507a6", - "sha256:99285cd44c756f0900cbdb5fe75f567c0a76a273b7e0467f23cb76f47e60aac0", - "sha256:9ed568f8026ffeb00ce31e5351e0d09d704cc19a29549ba4da0ac145d2a26fdf", - "sha256:a006162035032021dfd00a879643dc06863dac275f9210d843278566c719eebc", - "sha256:a03cb336bc8d25a11ff33b94967478a9775b0d2b23b39e952d9cc6cb93b75d69", - "sha256:a863ceb67be163060d1099b7e89b6dd83d6dd50077c7ceae31ac844c4c2baff9", - "sha256:b82628eaf0a16c1f50e1c205fd1dd406d7874037dd84643da89e91b5043b5e82", - "sha256:bc6446a41fb7eeaf2c808bab961b9bac81db0f5de69eab74eebe1b8b072399f7", - "sha256:c42d290ed54096355838421cf9d2a56e150cb533304d2439ef1adf612a986eaf", - "sha256:c43879fe427ea6aa6e84dae9fbdc5aa14428a4cfe613fe0fee2cc004bf3f307c", - "sha256:c566cbdd1863ba3ccf838656a1403c3c81fdb57cbe3fdd3515be7c9616763d33", - "sha256:c5b7a0d7e6ca986de32b269b6dbbd5162c1a776ece72936f55decb4d1b197ee9", - "sha256:ca109fe9f74da4930590bb589eb8fdf80e5d19f5cd9f337815cac9309bbd0a76", - "sha256:d0260ba68f9bafd8775b2988b5aeace6e69a37593ec256e23e150c808160c05c", - "sha256:d12d86e771fc3072a0e6bdbf4e417c63fec85ee47cb052ba7ad239403bf5e154", - "sha256:d2ce33501149b373118fcfec88a292a87ef0b333fb30c7c6aac72fe64700bdf6", - "sha256:d582ea8496e2a0e124e927a67dca55c8833f0dbfbc2c84aaf0e5949a2dd30c51", - "sha256:d68b9ab0a900582a345fb279675b0ad4fac07d6a8c2678f12910d55083b7240d", - "sha256:dbf1fa571db6006907aeaf6473580aaa76041f4f3cd1ff8a0039fd0f40b83f6d", - "sha256:e032437a7d2b89dab880c79379d88059cee8019da0ff475d924c4ccab52db88f", - "sha256:e0f5798f3ad60695465a093e3d002f609c41fef3dcb97fcefae355d24d3274cf", - "sha256:e756355704a2cf91a7f4a649aa0bbf3bbd263018b9ed08f60198c262f4ee24b6", - "sha256:e824b4b87bd88cbeb25c8babeadbbaaaf06f02bbb95a93462b7c6193a064974e", - "sha256:ea1171470b52487152ed8bf27713cc2480dc8b0cd58e282a1bff742541efbfb8", - "sha256:fa19aef44d5ed8f798a8136ff981aedfa508edac3b1bed481eca5dde5f14fd3d", - "sha256:faf83d20c041637cb277e5fdb59abc217c40ab3202dd87cc95d6fbd9ce5ffd9b", - "sha256:fceb6ae5a149a42766efb8344b0df6cfb21b55c55f360170abaddb11d43af0f1" - ], - "index": "pypi", - "version": "==3.10.0" - }, - "pymysql": { - "hashes": [ - "sha256:95f057328357e0e13a30e67857a8c694878b0175797a9a203ee7adbfb9b1ec5f", - "sha256:9ec760cbb251c158c19d6c88c17ca00a8632bac713890e465b2be01fdc30713f" - ], - "index": "pypi", - "version": "==0.9.2" - }, - "pynacl": { - "hashes": [ - "sha256:05c26f93964373fc0abe332676cb6735f0ecad27711035b9472751faa8521255", - "sha256:0c6100edd16fefd1557da078c7a31e7b7d7a52ce39fdca2bec29d4f7b6e7600c", - "sha256:0d0a8171a68edf51add1e73d2159c4bc19fc0718e79dec51166e940856c2f28e", - "sha256:1c780712b206317a746ace34c209b8c29dbfd841dfbc02aa27f2084dd3db77ae", - "sha256:2424c8b9f41aa65bbdbd7a64e73a7450ebb4aa9ddedc6a081e7afcc4c97f7621", - "sha256:2d23c04e8d709444220557ae48ed01f3f1086439f12dbf11976e849a4926db56", - "sha256:30f36a9c70450c7878053fa1344aca0145fd47d845270b43a7ee9192a051bf39", - "sha256:37aa336a317209f1bb099ad177fef0da45be36a2aa664507c5d72015f956c310", - "sha256:4943decfc5b905748f0756fdd99d4f9498d7064815c4cf3643820c9028b711d1", - "sha256:53126cd91356342dcae7e209f840212a58dcf1177ad52c1d938d428eebc9fee5", - "sha256:57ef38a65056e7800859e5ba9e6091053cd06e1038983016effaffe0efcd594a", - "sha256:5bd61e9b44c543016ce1f6aef48606280e45f892a928ca7068fba30021e9b786", - "sha256:6482d3017a0c0327a49dddc8bd1074cc730d45db2ccb09c3bac1f8f32d1eb61b", - "sha256:7d3ce02c0784b7cbcc771a2da6ea51f87e8716004512493a2b69016326301c3b", - "sha256:a14e499c0f5955dcc3991f785f3f8e2130ed504fa3a7f44009ff458ad6bdd17f", - "sha256:a39f54ccbcd2757d1d63b0ec00a00980c0b382c62865b61a505163943624ab20", - "sha256:aabb0c5232910a20eec8563503c153a8e78bbf5459490c49ab31f6adf3f3a415", - "sha256:bd4ecb473a96ad0f90c20acba4f0bf0df91a4e03a1f4dd6a4bdc9ca75aa3a715", - "sha256:bf459128feb543cfca16a95f8da31e2e65e4c5257d2f3dfa8c0c1031139c9c92", - "sha256:e2da3c13307eac601f3de04887624939aca8ee3c9488a0bb0eca4fb9401fc6b1", - "sha256:f67814c38162f4deb31f68d590771a29d5ae3b1bd64b75cf232308e5c74777e0" - ], - "index": "pypi", - "version": "==1.3.0" - }, - "pynmea2": { - "hashes": [ - "sha256:8b83fa7e3e668af5e182ef1c2fd4a535433ecadf60d7b627280172d695a1646b", - "sha256:fe786594299588d1bfbd346ece2c2c1e5b24e160dcb740813c34bfa70d0a141d" - ], - "index": "pypi", - "version": "==1.15.0" - }, - "pyopenssl": { - "hashes": [ - "sha256:621880965a720b8ece2f1b2f54ea2071966ab00e2970ad2ce11d596102063504", - "sha256:9a24494b2602aaf402be5c9e30a0b82d4a5c67528fe8fb475e3f3bc00dd69507" - ], - "version": "==19.1.0" - }, - "pyparsing": { - "hashes": [ - "sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f", - "sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.4.6" - }, - "pypolyline": { - "hashes": [ - "sha256:09cc2192bc12063c7afa2d2718b739cd4bf3f8ec29eacde0cb728c9f5f7f7858", - "sha256:21acee0e31d867bde04583907ccb7afe4b21d33a63c23adc7cf0d82b6f2feab3", - "sha256:5e0643454b4471f4f23d38530467ee7093d3b375898d5e1b054876e5a50a6b89", - "sha256:6b0a1b573fe84c9ed0aa3a4eb9903d44864f37e405cdcc7396b61e6d00a937d6", - "sha256:6bdbc9210f29d4fd44c3e4d510ffcc1276e46a50d63365831e2e422dc0b3cb43", - "sha256:8efb93097c92c5894dcaf9e784b888f9426d170ae51d62164341bbb2b832c09a", - "sha256:9c843a35b2d02b04c1226db851834b55f0de30eef47ba057fd6f8623cdef6f2d", - "sha256:ad01fedf427536f391776b329c95e5f80f2b1a5d25c54ea7713c8cdb56947106", - "sha256:e4e4c857790f6a3067dab3ae661edda99d5cee55d107b3b4d0186159431165ef", - "sha256:f8c84f0d2aa6bd9ed14bdb671fab80f79b4ba93b4347b530ae4d3b56a3fb269a" - ], - "index": "pypi", - "version": "==0.1.17" - }, - "pyproj": { - "hashes": [ - "sha256:0608ac0aed84dcf57c859df87ac315b9acce18268f62bafc04071b7b1ff1c5a9", - "sha256:18265fb755e01df1d2248f1e837d81da4c9625e8f09481d64a9d6282c96f7467", - "sha256:190540946bb6fbfce285f46c08fcfd9d03e9331a0e952a3ef2047e6b8e8d8125", - "sha256:1da7f86d3b5e80ba3dabfd2c904a41bb6997ad9b55b47a934035492eaa0f331e", - "sha256:2ebbaee33e076664058effc3f6c943ed4c19a45df3989203ac081fca4a4722e3", - "sha256:32168c57450a1e6310b7ca331983d62d88393cc3e93b866fd6ea63dac30c7d3b", - "sha256:34b8ccf42032d89ebb8e0a839ae91e943ed222dab9bf3c1373f6fb972f8bcac4", - "sha256:432b4d28030635fac72713610aad2ed7424a7f07746fa1aa620c89761eb5e7a4", - "sha256:55103aa0adf25d207efd6f7f36d79dadee7706f22c1791955cc52033b40071e3", - "sha256:6bc74337edc1239f8c59d0d5b18a7996670b8fd523712d2dac599d5b792feae2", - "sha256:6d2838bec2d9ccd31dba68c76e8e7504bf819a4d4ace86adfca1e009d8f30f19", - "sha256:763ccac4398889cb798668824d34c4135f2e84a50681465a4199554aa1bd8611", - "sha256:8dbf1633ad2abdae6f73fe8989700c74a12dc82cb8597e66af28ff3d990d9c45", - "sha256:8ddffa4bcd9008c963840e8e79f2f3124f85f18d5987d4bbd9e7f38d9839a985", - "sha256:8f225c6186b0cd2cb07fe377786425a2ddc4183ae438fe63c60b4a879c91620f", - "sha256:97844a87cac739e389d1d0c69bc3b36c1d5c50c9f91443ef68bdef8fdf007f02", - "sha256:9d7a13def19a91836a2c84e5c7fcb6dd5e2c9bb205fb75ee102ffba24d80bf32", - "sha256:abd0784a017eedb3b03cd13f51b8852f4c68aa07affbee549bbd421f9b4268bb", - "sha256:acf150ca1506fcdaa52b0570f2903216413a2a4da78dfdf5ff7ee4eb92c2f8d5", - "sha256:b41522f8b77b64553280fb93823555bc8afb2469f77b8ce0e9aeed39abb50adc", - "sha256:c1058da6c02152d8637bb739dca940c6ab72683e59db6065fdcbe9102f66ca46", - "sha256:c70e713748c9c9d4a9d7bc42e1c71a17b1fc9b75b686b408a04eaf4909ead365", - "sha256:d47caa0a89dcb39ecd405e3899e07b69d8eaa6dbf267621087a4a5328da8492a", - "sha256:ed186edb4b610ed1e5589f3ba964d61da33d0bc54e89b8cbf8751da2e18555b3", - "sha256:f2dc8c2128f20ee9ed571783ce4730b181476083c403514714e15000b8b470cf", - "sha256:fba87f98344474da6df19bbfde4ca31c7d98a007069c8ef78cb27189f4bc7f04" - ], - "index": "pypi", - "version": "==2.4.2.post1" - }, - "pyqt5": { - "hashes": [ - "sha256:2b79209aa6e4688f6ac46e6d2694236dcf91db5f3a87270150d0f82082e3d360", - "sha256:2f230f2dbd767099de7a0cb915abdf0cbc3256a0b5bb910eb09b99117db7a65b", - "sha256:3d6e315e6e2d6489a2e1e0148d00e784e277c6590c189227d6060f15b9be690a", - "sha256:812233bd155735377e2e9c7eea7a28815f357440334db51788d941e2a8b62f64", - "sha256:be10fa95e6bdc9cad616ebf368c51b3f5748138b2b3a600cf7c4f80b78cb9852" - ], - "index": "pypi", - "version": "==5.14.1" - }, - "pyqt5-sip": { - "hashes": [ - "sha256:02d94786bada670ab17a2b62ce95b3cf8e3b40c99d36007593a6334d551840bb", - "sha256:06bc66b50556fb949f14875a4c224423dbf03f972497ccb883fb19b7b7c3b346", - "sha256:091fbbe10a7aebadc0e8897a9449cda08d3c3f663460d812eca3001ca1ed3526", - "sha256:0a067ade558befe4d46335b13d8b602b5044363bfd601419b556d4ec659bca18", - "sha256:1910c1cb5a388d4e59ebb2895d7015f360f3f6eeb1700e7e33e866c53137eb9e", - "sha256:1c7ad791ec86247f35243bbbdd29cd59989afbe0ab678e0a41211f4407f21dd8", - "sha256:3c330ff1f70b3eaa6f63dce9274df996dffea82ad9726aa8e3d6cbe38e986b2f", - "sha256:482a910fa73ee0e36c258d7646ef38f8061774bbc1765a7da68c65056b573341", - "sha256:7695dfafb4f5549ce1290ae643d6508dfc2646a9003c989218be3ce42a1aa422", - "sha256:8274ed50f4ffbe91d0f4cc5454394631edfecd75dc327aa01be8bc5818a57e88", - "sha256:9047d887d97663790d811ac4e0d2e895f1bf2ecac4041691487de40c30239480", - "sha256:9f6ab1417ecfa6c1ce6ce941e0cebc03e3ec9cd9925058043229a5f003ae5e40", - "sha256:b43ba2f18999d41c3df72f590348152e14cd4f6dcea2058c734d688dfb1ec61f", - "sha256:c3ab9ea1bc3f4ce8c57ebc66fb25cd044ef92ed1ca2afa3729854ecc59658905", - "sha256:da69ba17f6ece9a85617743cb19de689f2d63025bf8001e2facee2ec9bcff18f", - "sha256:ef3c7a0bf78674b0dda86ff5809d8495019903a096c128e1f160984b37848f73", - "sha256:fabff832046643cdb93920ddaa8f77344df90768930fbe6bb33d211c4dcd0b5e" - ], - "markers": "python_version >= '3.5'", - "version": "==12.7.0" - }, - "pyrsistent": { - "hashes": [ - "sha256:f3b280d030afb652f79d67c5586157c5c1355c9a58dfc7940566e28d28f3df1b" - ], - "version": "==0.15.6" - }, - "pysdl2": { - "hashes": [ - "sha256:b52acab5493a77b08c2afee1f385769fc2005f17cfeaf1886eff22dc78da2123" - ], - "index": "pypi", - "version": "==0.9.6" - }, - "python-dateutil": { - "hashes": [ - "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c", - "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a" - ], - "index": "pypi", - "version": "==2.8.1" - }, - "python-engineio": { - "hashes": [ - "sha256:47ae4a9b3b4f2e8a68929f37a518338838e119f24c9a9121af92c49f8bea55c3", - "sha256:c3a3822deb51fdf9c7fe4d78abf807c73b83ea538036a50862d3024450746253" - ], - "version": "==3.11.2" - }, - "python-logstash": { - "hashes": [ - "sha256:10943e5df83f592b4d61b63ad1afff855ccc8c9467f78718f0a59809ba1fe68c" - ], - "index": "pypi", - "version": "==0.4.6" - }, - "python-logstash-async": { - "hashes": [ - "sha256:16a85e7c76265b06e2e42f5a2babc39811e3920aaa41119e059722d4185f1912", - "sha256:6f2da753ee2307704b0c0d2e3dc6a52e3ad0605184690b4495356e418700abaa" - ], - "index": "pypi", - "version": "==1.6.2" - }, - "python-socketio": { - "hashes": [ - "sha256:48cba5b827ac665dbf923a4f5ec590812aed5299a831fc43576a9af346272534", - "sha256:af6c23c35497960f82106e36688123ecb52ad5a77d0ca27954ff3811c4d9d562" - ], - "version": "==4.4.0" - }, - "pytz": { - "hashes": [ - "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d", - "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be" - ], - "version": "==2019.3" - }, - "pywavelets": { - "hashes": [ - "sha256:076ca8907001fdfe4205484f719d12b4a0262dfe6652fa1cfc3c5c362d14dc84", - "sha256:18a51b3f9416a2ae6e9a35c4af32cf520dd7895f2b69714f4aa2f4342fca47f9", - "sha256:1a64b40f6acb4ffbaccce0545d7fc641744f95351f62e4c6aaa40549326008c9", - "sha256:35959c041ec014648575085a97b498eafbbaa824f86f6e4a59bfdef8a3fe6308", - "sha256:55e39ec848ceec13c9fa1598253ae9dd5c31d09dfd48059462860d2b908fb224", - "sha256:6162dc0ae04669ea04b4b51420777b9ea2d30b0a9d02901b2a3b4d61d159c2e9", - "sha256:68b5c33741d26c827074b3d8f0251de1c3019bb9567b8d303eb093c822ce28f1", - "sha256:720dbcdd3d91c6dfead79c80bf8b00a1d8aa4e5d551dc528c6d5151e4efc3403", - "sha256:7947e51ca05489b85928af52a34fe67022ab5b81d4ae32a4109a99e883a0635e", - "sha256:79f5b54f9dc353e5ee47f0c3f02bebd2c899d49780633aa771fed43fa20b3149", - "sha256:80b924edbc012ded8aa8b91cb2fd6207fb1a9a3a377beb4049b8a07445cec6f0", - "sha256:889d4c5c5205a9c90118c1980df526857929841df33e4cd1ff1eff77c6817a65", - "sha256:935ff247b8b78bdf77647fee962b1cc208c51a7b229db30b9ba5f6da3e675178", - "sha256:98b2669c5af842a70cfab33a7043fcb5e7535a690a00cd251b44c9be0be418e5", - "sha256:9e2528823ccf5a0a1d23262dfefe5034dce89cd84e4e124dc553dfcdf63ebb92", - "sha256:bc5e87b72371da87c9bebc68e54882aada9c3114e640de180f62d5da95749cd3", - "sha256:be105382961745f88d8196bba5a69ee2c4455d87ad2a2e5d1eed6bd7fda4d3fd", - "sha256:c06d2e340c7bf8b9ec71da2284beab8519a3908eab031f4ea126e8ccfc3fd567", - "sha256:cfe79844526dd92e3ecc9490b5031fca5f8ab607e1e858feba232b1b788ff0ea", - "sha256:d510aef84d9852653d079c84f2f81a82d5d09815e625f35c95714e7364570ad4", - "sha256:e02a0558e0c2ac8b8bbe6a6ac18c136767ec56b96a321e0dfde2173adfa5a504" - ], - "markers": "python_version >= '3.5'", - "version": "==1.1.1" - }, - "pyyaml": { - "hashes": [ - "sha256:059b2ee3194d718896c0ad077dd8c043e5e909d9180f387ce42012662a4946d6", - "sha256:1cf708e2ac57f3aabc87405f04b86354f66799c8e62c28c5fc5f88b5521b2dbf", - "sha256:24521fa2890642614558b492b473bee0ac1f8057a7263156b02e8b14c88ce6f5", - "sha256:4fee71aa5bc6ed9d5f116327c04273e25ae31a3020386916905767ec4fc5317e", - "sha256:70024e02197337533eef7b85b068212420f950319cc8c580261963aefc75f811", - "sha256:74782fbd4d4f87ff04159e986886931456a1894c61229be9eaf4de6f6e44b99e", - "sha256:940532b111b1952befd7db542c370887a8611660d2b9becff75d39355303d82d", - "sha256:cb1f2f5e426dc9f07a7681419fe39cee823bb74f723f36f70399123f439e9b20", - "sha256:dbbb2379c19ed6042e8f11f2a2c66d39cceb8aeace421bfc29d085d93eda3689", - "sha256:e3a057b7a64f1222b56e47bcff5e4b94c4f61faac04c7c4ecb1985e18caa3994", - "sha256:e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" - ], - "index": "pypi", - "version": "==5.3" - }, - "pyzmq": { - "hashes": [ - "sha256:01b588911714a6696283de3904f564c550c9e12e8b4995e173f1011755e01086", - "sha256:0573b9790aa26faff33fba40f25763657271d26f64bffb55a957a3d4165d6098", - "sha256:0fa82b9fc3334478be95a5566f35f23109f763d1669bb762e3871a8fa2a4a037", - "sha256:1e59b7b19396f26e360f41411a5d4603356d18871049cd7790f1a7d18f65fb2c", - "sha256:2a294b4f44201bb21acc2c1a17ff87fbe57b82060b10ddb00ac03e57f3d7fcfa", - "sha256:355b38d7dd6f884b8ee9771f59036bcd178d98539680c4f87e7ceb2c6fd057b6", - "sha256:4b73d20aec63933bbda7957e30add233289d86d92a0bb9feb3f4746376f33527", - "sha256:4ec47f2b50bdb97df58f1697470e5c58c3c5109289a623e30baf293481ff0166", - "sha256:5541dc8cad3a8486d58bbed076cb113b65b5dd6b91eb94fb3e38a3d1d3022f20", - "sha256:6fca7d11310430e751f9832257866a122edf9d7b635305c5d8c51f74a5174d3d", - "sha256:7369656f89878455a5bcd5d56ca961884f5d096268f71c0750fc33d6732a25e5", - "sha256:75d73ee7ca4b289a2a2dfe0e6bd8f854979fc13b3fe4ebc19381be3b04e37a4a", - "sha256:80c928d5adcfa12346b08d31360988d843b54b94154575cccd628f1fe91446bc", - "sha256:83ce18b133dc7e6789f64cb994e7376c5aa6b4aeced993048bf1d7f9a0fe6d3a", - "sha256:8b8498ceee33a7023deb2f3db907ca41d6940321e282297327a9be41e3983792", - "sha256:8c69a6cbfa94da29a34f6b16193e7c15f5d3220cb772d6d17425ff3faa063a6d", - "sha256:8ff946b20d13a99dc5c21cb76f4b8b253eeddf3eceab4218df8825b0c65ab23d", - "sha256:972d723a36ab6a60b7806faa5c18aa3c080b7d046c407e816a1d8673989e2485", - "sha256:a6c9c42bbdba3f9c73aedbb7671815af1943ae8073e532c2b66efb72f39f4165", - "sha256:aa3872f2ebfc5f9692ef8957fe69abe92d905a029c0608e45ebfcd451ad30ab5", - "sha256:cf08435b14684f7f2ca2df32c9df38a79cdc17c20dc461927789216cb43d8363", - "sha256:d30db4566177a6205ed1badb8dbbac3c043e91b12a2db5ef9171b318c5641b75", - "sha256:d5ac84f38575a601ab20c1878818ffe0d09eb51d6cb8511b636da46d0fd8949a", - "sha256:e37f22eb4bfbf69cd462c7000616e03b0cdc1b65f2d99334acad36ea0e4ddf6b", - "sha256:e6549dd80de7b23b637f586217a4280facd14ac01e9410a037a13854a6977299", - "sha256:ed6205ca0de035f252baa0fd26fdd2bc8a8f633f92f89ca866fd423ff26c6f25", - "sha256:efdde21febb9b5d7a8e0b87ea2549d7e00fda1936459cfb27fb6fca0c36af6c1", - "sha256:f4e72646bfe79ff3adbf1314906bbd2d67ef9ccc71a3a98b8b2ccbcca0ab7bec" - ], - "index": "pypi", - "version": "==18.1.1" - }, - "qtconsole": { - "hashes": [ - "sha256:4de25b8895957d23ceacf2526b6f0a76da4e60e60115611930d387c853f3cb08", - "sha256:654f423662e7dfe6a9b26fac8ec76aedcf742c339909ac49f1f0c1a1b744bcd1" - ], - "version": "==4.6.0" - }, - "redis": { - "hashes": [ - "sha256:3613daad9ce5951e426f460deddd5caf469e08a3af633e9578fc77d362becf62", - "sha256:8d0fc278d3f5e1249967cba2eb4a5632d19e45ce5c09442b8422d15ee2c22cc2" - ], - "index": "pypi", - "version": "==3.3.11" - }, - "requests": { - "hashes": [ - "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", - "sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31" - ], - "index": "pypi", - "version": "==2.22.0" - }, - "requests-oauthlib": { - "hashes": [ - "sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d", - "sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a", - "sha256:fa6c47b933f01060936d87ae9327fead68768b69c6c9ea2109c48be30f2d4dbc" - ], - "version": "==1.3.0" - }, - "reverse-geocoder": { - "hashes": [ - "sha256:2a2e781b5f69376d922b78fe8978f1350c84fce0ddb07e02c834ecf98b57c75c" - ], - "index": "pypi", - "version": "==1.5.1" - }, - "rsa": { - "hashes": [ - "sha256:14ba45700ff1ec9eeb206a2ce76b32814958a98e372006c8fb76ba820211be66", - "sha256:1a836406405730121ae9823e19c6e806c62bbad73f890574fff50efa4122c487" - ], - "version": "==4.0" - }, - "s2sphere": { - "hashes": [ - "sha256:c2478c1ff7c601a59a7151a57b605435897514578fa6bdb8730721c182adbbaf", - "sha256:d2340c9cf458ddc9a89afd1d8048a4195ce6fa6b0095ab900d4be5271e537401" - ], - "index": "pypi", - "version": "==0.2.5" - }, - "s3transfer": { - "hashes": [ - "sha256:6efc926738a3cd576c2a79725fed9afde92378aa5c6a957e3af010cb019fac9d", - "sha256:b780f2411b824cb541dbcd2c713d0cb61c7d1bcadae204cdddda2b35cef493ba" - ], - "version": "==0.2.1" - }, - "scikit-image": { - "hashes": [ - "sha256:063d1c20fcd53762f82ee58c29783ae4e8f6fbed445b41b704fa33b6f355729d", - "sha256:0715b7940778ba5d73da3908d60ddf2eb93863f7c394493a522fe56d3859295c", - "sha256:0808ab5f8218d91a1c008036993636535a37efd67a52ab0f2e6e3f4b7e75aeda", - "sha256:2a54bea469eb1b611bee1ce36e60710f5f94f29205bc5bd67a51793909b1e62b", - "sha256:2aa962aa82d815606d7dad7f045f5d7ca55c65b4320d47e15a98fc92612c2d6c", - "sha256:2d346d49b6852cffb47cbde995e2696d5b07f688d8c057a0a4548abf3a98f920", - "sha256:3ad2efa792ab8de5fcefe6f4f5bc1ab64c411cdb5c829ce1526ab3a5a7729627", - "sha256:3af3d781ce085573ced37b2b5b9abfd32ce3d4723bd17f37e829025d189b0421", - "sha256:41e28db0136f29ecd305bef0408fdfc64be9d415e54f5099a95555c65f5c1865", - "sha256:6786b127f33470fd843e644435522fbf43bce05c9f5527946c390ccb9e1cac27", - "sha256:8b2b768b02c6b7476f2e16ddd91f827d3817aef73f82cf28bff7a8dcdfd8c55c", - "sha256:a48fb0d34a090b578b87ffebab0fe035295c1945dbc2b28e1a55ea2cf6031751", - "sha256:dd7fbd32da74d4e9967dc15845f731f16e7966cee61f5dc0e12e2abb1305068c", - "sha256:e18d73cc8893e2268b172c29f9aab530faf8cd3b7c11ae0bee3e763d719d35c5", - "sha256:e774377876cb258e8f4d63f7809863f961c98aa02263b3ff54a39483bc6f7d26" - ], - "index": "pypi", - "version": "==0.16.2" - }, - "scipy": { - "hashes": [ - "sha256:00af72998a46c25bdb5824d2b729e7dabec0c765f9deb0b504f928591f5ff9d4", - "sha256:0902a620a381f101e184a958459b36d3ee50f5effd186db76e131cbefcbb96f7", - "sha256:1e3190466d669d658233e8a583b854f6386dd62d655539b77b3fa25bfb2abb70", - "sha256:2cce3f9847a1a51019e8c5b47620da93950e58ebc611f13e0d11f4980ca5fecb", - "sha256:3092857f36b690a321a662fe5496cb816a7f4eecd875e1d36793d92d3f884073", - "sha256:386086e2972ed2db17cebf88610aab7d7f6e2c0ca30042dc9a89cf18dcc363fa", - "sha256:71eb180f22c49066f25d6df16f8709f215723317cc951d99e54dc88020ea57be", - "sha256:770254a280d741dd3436919d47e35712fb081a6ff8bafc0f319382b954b77802", - "sha256:787cc50cab3020a865640aba3485e9fbd161d4d3b0d03a967df1a2881320512d", - "sha256:8a07760d5c7f3a92e440ad3aedcc98891e915ce857664282ae3c0220f3301eb6", - "sha256:8d3bc3993b8e4be7eade6dcc6fd59a412d96d3a33fa42b0fa45dc9e24495ede9", - "sha256:9508a7c628a165c2c835f2497837bf6ac80eb25291055f56c129df3c943cbaf8", - "sha256:a144811318853a23d32a07bc7fd5561ff0cac5da643d96ed94a4ffe967d89672", - "sha256:a1aae70d52d0b074d8121333bc807a485f9f1e6a69742010b33780df2e60cfe0", - "sha256:a2d6df9eb074af7f08866598e4ef068a2b310d98f87dc23bd1b90ec7bdcec802", - "sha256:bb517872058a1f087c4528e7429b4a44533a902644987e7b2fe35ecc223bc408", - "sha256:c5cac0c0387272ee0e789e94a570ac51deb01c796b37fb2aad1fb13f85e2f97d", - "sha256:cc971a82ea1170e677443108703a2ec9ff0f70752258d0e9f5433d00dda01f59", - "sha256:dba8306f6da99e37ea08c08fef6e274b5bf8567bb094d1dbe86a20e532aca088", - "sha256:dc60bb302f48acf6da8ca4444cfa17d52c63c5415302a9ee77b3b21618090521", - "sha256:dee1bbf3a6c8f73b6b218cb28eed8dd13347ea2f87d572ce19b289d6fd3fbc59" - ], - "index": "pypi", - "version": "==1.4.1" - }, - "seaborn": { - "hashes": [ - "sha256:42e627b24e849c2d3bbfd059e00005f6afbc4a76e4895baf44ae23fe8a4b09a5", - "sha256:76c83f794ca320fb6b23a7c6192d5e185a5fcf4758966a0c0a54baee46d41e2f" - ], - "index": "pypi", - "version": "==0.9.0" - }, - "send2trash": { - "hashes": [ - "sha256:60001cc07d707fe247c94f74ca6ac0d3255aabcb930529690897ca2a39db28b2", - "sha256:f1691922577b6fa12821234aeb57599d887c4900b9ca537948d2dac34aea888b" - ], - "version": "==1.5.0" - }, - "shapely": { - "hashes": [ - "sha256:0378964902f89b8dbc332e5bdfa08e0bc2f7ab39fecaeb17fbb2a7699a44fe71", - "sha256:34e7c6f41fb27906ccdf2514ee44a5774b90b39a256b6511a6a57d11ffe64999", - "sha256:3ca69d4b12e2b05b549465822744b6a3a1095d8488cc27b2728a06d3c07d0eee", - "sha256:3e9388f29bd81fcd4fa5c35125e1fbd4975ee36971a87a90c093f032d0e9de24", - "sha256:3ef28e3f20a1c37f5b99ea8cf8dcb58e2f1a8762d65ed2d21fd92bf1d4811182", - "sha256:523c94403047eb6cacd7fc1863ebef06e26c04d8a4e7f8f182d49cd206fe787e", - "sha256:5d22a1a705c2f70f61ccadc696e33d922c1a92e00df8e1d58a6ade14dd7e3b4f", - "sha256:714b6680215554731389a1bbdae4cec61741aa4726921fa2b2b96a6f578a2534", - "sha256:7dfe1528650c3f0dc82f41a74cf4f72018288db9bfb75dcd08f6f04233ec7e78", - "sha256:ba58b21b9cf3c33725f7f530febff9ed6a6846f9d0bf8a120fc74683ff919f89", - "sha256:c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f", - "sha256:ebb4d2bee7fac3f6c891fcdafaa17f72ab9c6480f6d00de0b2dc9a5137dfe342" - ], - "index": "pypi", - "version": "==1.6.4.post2" - }, - "simplejson": { - "hashes": [ - "sha256:0fe3994207485efb63d8f10a833ff31236ed27e3b23dadd0bf51c9900313f8f2", - "sha256:17163e643dbf125bb552de17c826b0161c68c970335d270e174363d19e7ea882", - "sha256:1d1e929cdd15151f3c0b2efe953b3281b2fd5ad5f234f77aca725f28486466f6", - "sha256:1d346c2c1d7dd79c118f0cc7ec5a1c4127e0c8ffc83e7b13fc5709ff78c9bb84", - "sha256:1ea59f570b9d4916ae5540a9181f9c978e16863383738b69a70363bc5e63c4cb", - "sha256:1fbba86098bbfc1f85c5b69dc9a6d009055104354e0d9880bb00b692e30e0078", - "sha256:229edb079d5dd81bf12da952d4d825bd68d1241381b37d3acf961b384c9934de", - "sha256:22a7acb81968a7c64eba7526af2cf566e7e2ded1cb5c83f0906b17ff1540f866", - "sha256:2b4b2b738b3b99819a17feaf118265d0753d5536049ea570b3c43b51c4701e81", - "sha256:4cf91aab51b02b3327c9d51897960c554f00891f9b31abd8a2f50fd4a0071ce8", - "sha256:4fd5f79590694ebff8dc980708e1c182d41ce1fda599a12189f0ca96bf41ad70", - "sha256:5cfd495527f8b85ce21db806567de52d98f5078a8e9427b18e251c68bd573a26", - "sha256:60aad424e47c5803276e332b2a861ed7a0d46560e8af53790c4c4fb3420c26c2", - "sha256:7739940d68b200877a15a5ff5149e1599737d6dd55e302625650629350466418", - "sha256:7cce4bac7e0d66f3a080b80212c2238e063211fe327f98d764c6acbc214497fc", - "sha256:8027bd5f1e633eb61b8239994e6fc3aba0346e76294beac22a892eb8faa92ba1", - "sha256:86afc5b5cbd42d706efd33f280fec7bd7e2772ef54e3f34cf6b30777cd19a614", - "sha256:87d349517b572964350cc1adc5a31b493bbcee284505e81637d0174b2758ba17", - "sha256:8de378d589eccbc75941e480b4d5b4db66f22e4232f87543b136b1f093fff342", - "sha256:926bcbef9eb60e798eabda9cd0bbcb0fca70d2779aa0aa56845749d973eb7ad5", - "sha256:9a126c3a91df5b1403e965ba63b304a50b53d8efc908a8c71545ed72535374a3", - "sha256:ad8dd3454d0c65c0f92945ac86f7b9efb67fa2040ba1b0189540e984df904378", - "sha256:d140e9376e7f73c1f9e0a8e3836caf5eec57bbafd99259d56979da05a6356388", - "sha256:da00675e5e483ead345429d4f1374ab8b949fba4429d60e71ee9d030ced64037", - "sha256:daaf4d11db982791be74b23ff4729af2c7da79316de0bebf880fa2d60bcc8c5a", - "sha256:f4b64a1031acf33e281fd9052336d6dad4d35eee3404c95431c8c6bc7a9c0588", - "sha256:fc046afda0ed8f5295212068266c92991ab1f4a50c6a7144b69364bdee4a0159", - "sha256:fc9051d249dd5512e541f20330a74592f7a65b2d62e18122ca89bf71f94db748" - ], - "index": "pypi", - "version": "==3.17.0" - }, - "six": { - "hashes": [ - "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd", - "sha256:30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66" - ], - "index": "pypi", - "version": "==1.13.0" - }, - "sqlalchemy": { - "hashes": [ - "sha256:bfb8f464a5000b567ac1d350b9090cf081180ec1ab4aa87e7bca12dab25320ec" - ], - "index": "pypi", - "version": "==1.3.12" - }, - "subprocess32": { - "hashes": [ - "sha256:88e37c1aac5388df41cc8a8456bb49ebffd321a3ad4d70358e3518176de3a56b", - "sha256:eb2937c80497978d181efa1b839ec2d9622cf9600a039a79d0e108d1f9aec79d" - ], - "index": "pypi", - "version": "==3.5.4" - }, - "tabulate": { - "hashes": [ - "sha256:5470cc6687a091c7042cee89b2946d9235fe9f6d49c193a4ae2ac7bf386737c8" - ], - "version": "==0.8.6" - }, - "tenacity": { - "hashes": [ - "sha256:72f397c2bb1887e048726603f3f629ea16f88cb3e61e4ed3c57e98582b8e3571", - "sha256:947e728aedf06e8db665bb7898112e90d17e48cc3f3289784a2b9ccf6e56fabc" - ], - "index": "pypi", - "version": "==6.0.0" - }, - "tensorboard": { - "hashes": [ - "sha256:32d9dec38d053d7d75796eb7c2e0d77285af35f69ee1a6796ab5ecc896679fb3", - "sha256:ccae56f01acc78a138474081b631af52017c2075ffe1c453d58c49d5046ef081" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.0.2" - }, - "tensorflow-estimator": { - "hashes": [ - "sha256:aa8deab25d09a9730dfbae8ec58f4eb00ec2a90b5ca3dcbd8fa0717103d3bbb3" - ], - "version": "==2.0.1" - }, - "tensorflow-gpu": { - "hashes": [ - "sha256:6bb259ceadac6f9ccba7c07903570e4b495d6230efce8f4ab8831cede87cea42", - "sha256:73943249a1059ea8344487756939539bd32d2639f1fc0f92d6395863764b683b", - "sha256:767d775cb7b0f997b584a7441f47d76ff216cf05eb902fc56d9d3f664b03412a", - "sha256:a79fcb04092afa2737a45ff81cfc74f4423d239bfe642159eb34c90233900157", - "sha256:a87701141f8836205e20ba061246bc3a14e73f07f061a91325ca297c641995d0", - "sha256:bd6ad275b05132910b9d929cf299895c1b92cd66a01271c8e33818454d88888c", - "sha256:ccaae56548ab8a8148c1735ca176d2b2da103dc4cd8603fe86692b0b3c7530fb" - ], - "index": "pypi", - "version": "==2.0.0" - }, - "termcolor": { - "hashes": [ - "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b" - ], - "version": "==1.1.0" - }, - "terminado": { - "hashes": [ - "sha256:4804a774f802306a7d9af7322193c5390f1da0abb429e082a10ef1d46e6fb2c2", - "sha256:a43dcb3e353bc680dd0783b1d9c3fc28d529f190bc54ba9a229f72fe6e7a54d7" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.8.3" - }, - "testpath": { - "hashes": [ - "sha256:60e0a3261c149755f4399a1fff7d37523179a70fdc3abdf78de9fc2604aeec7e", - "sha256:bfcf9411ef4bf3db7579063e0546938b1edda3d69f4e1fb8756991f5951f85d4" - ], - "version": "==0.4.4" - }, - "tornado": { - "hashes": [ - "sha256:349884248c36801afa19e342a77cc4458caca694b0eda633f5878e458a44cb2c", - "sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60", - "sha256:4e73ef678b1a859f0cb29e1d895526a20ea64b5ffd510a2307b5998c7df24281", - "sha256:559bce3d31484b665259f50cd94c5c28b961b09315ccd838f284687245f416e5", - "sha256:abbe53a39734ef4aba061fca54e30c6b4639d3e1f59653f0da37a0003de148c7", - "sha256:c845db36ba616912074c5b1ee897f8e0124df269468f25e4fe21fe72f6edd7a9", - "sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5" - ], - "markers": "python_version >= '3.5'", - "version": "==6.0.3" - }, - "traitlets": { - "hashes": [ - "sha256:70b4c6a1d9019d7b4f6846832288f86998aa3b9207c6821f3578a6a6a467fe44", - "sha256:d023ee369ddd2763310e4c3eae1ff649689440d4ae59d7485eb4cfbbe3e359f7" - ], - "version": "==4.3.3" - }, - "typed-ast": { - "hashes": [ - "sha256:1170afa46a3799e18b4c977777ce137bb53c7485379d9706af8a59f2ea1aa161", - "sha256:18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e", - "sha256:262c247a82d005e43b5b7f69aff746370538e176131c32dda9cb0f324d27141e", - "sha256:2b907eb046d049bcd9892e3076c7a6456c93a25bebfe554e931620c90e6a25b0", - "sha256:354c16e5babd09f5cb0ee000d54cfa38401d8b8891eefa878ac772f827181a3c", - "sha256:48e5b1e71f25cfdef98b013263a88d7145879fbb2d5185f2a0c79fa7ebbeae47", - "sha256:4e0b70c6fc4d010f8107726af5fd37921b666f5b31d9331f0bd24ad9a088e631", - "sha256:630968c5cdee51a11c05a30453f8cd65e0cc1d2ad0d9192819df9978984529f4", - "sha256:66480f95b8167c9c5c5c87f32cf437d585937970f3fc24386f313a4c97b44e34", - "sha256:71211d26ffd12d63a83e079ff258ac9d56a1376a25bc80b1cdcdf601b855b90b", - "sha256:7954560051331d003b4e2b3eb822d9dd2e376fa4f6d98fee32f452f52dd6ebb2", - "sha256:838997f4310012cf2e1ad3803bce2f3402e9ffb71ded61b5ee22617b3a7f6b6e", - "sha256:95bd11af7eafc16e829af2d3df510cecfd4387f6453355188342c3e79a2ec87a", - "sha256:bc6c7d3fa1325a0c6613512a093bc2a2a15aeec350451cbdf9e1d4bffe3e3233", - "sha256:cc34a6f5b426748a507dd5d1de4c1978f2eb5626d51326e43280941206c209e1", - "sha256:d755f03c1e4a51e9b24d899561fec4ccaf51f210d52abdf8c07ee2849b212a36", - "sha256:d7c45933b1bdfaf9f36c579671fec15d25b06c8398f113dab64c18ed1adda01d", - "sha256:d896919306dd0aa22d0132f62a1b78d11aaf4c9fc5b3410d3c666b818191630a", - "sha256:fdc1c9bbf79510b76408840e009ed65958feba92a88833cdceecff93ae8fff66", - "sha256:ffde2fbfad571af120fcbfbbc61c72469e72f550d676c3342492a9dfdefb8f12" - ], - "markers": "python_version < '3.8' and implementation_name == 'cpython'", - "version": "==1.4.0" - }, - "urllib3": { - "hashes": [ - "sha256:a8a318824cc77d1fd4b2bec2ded92646630d7fe8619497b142c84a9e6f5a7293", - "sha256:f3c5fd51747d450d4dcf6f923c81f78f811aab8205fda64b0aba34a4e48b0745" - ], - "index": "pypi", - "version": "==1.25.7" - }, - "wcwidth": { - "hashes": [ - "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603", - "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8" - ], - "version": "==0.1.8" - }, - "webencodings": { - "hashes": [ - "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78", - "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" - ], - "version": "==0.5.1" - }, - "werkzeug": { - "hashes": [ - "sha256:7280924747b5733b246fe23972186c6b348f9ae29724135a6dfc1e53cea433e7", - "sha256:e5f4a1f98b52b18a93da705a7458e55afb26f32bff83ff5d19189f92462d65c4" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.16.0" - }, - "wheel": { - "hashes": [ - "sha256:9515fe0a94e823fd90b08d22de45d7bde57c90edce705b22f5e1ecf7e1b653c8", - "sha256:e721e53864f084f956f40f96124a74da0631ac13fbbd1ba99e8e2b5e9cafdf64" - ], - "markers": "python_version >= '3'", - "version": "==0.30.0" - }, - "widgetsnbextension": { - "hashes": [ - "sha256:079f87d87270bce047512400efd70238820751a11d2d8cb137a5a5bdbaf255c7", - "sha256:bd314f8ceb488571a5ffea6cc5b9fc6cba0adaf88a9d2386b93a489751938bcd" - ], - "version": "==3.5.1" - }, - "wrapt": { - "hashes": [ - "sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1" - ], - "version": "==1.11.2" - }, - "zipp": { - "hashes": [ - "sha256:3718b1cbcd963c7d4c5511a8240812904164b7f381b647143a89d3b98f9bcd8e", - "sha256:f06903e9f1f43b12d371004b4ac7b06ab39a44adc747266928ae6debfa7b3335" - ], - "markers": "python_version >= '2.7'", - "version": "==0.6.0" - } - } -} diff --git a/README.md b/README.md index 013397a77..73bccf297 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://i.imgur.com/UetIFyH.jpg)](#) +[![](https://i.imgur.com/UelUjKAh.png)](#) Table of Contents ======================= @@ -68,12 +68,12 @@ Supported Cars | Acura | RDX 2016-18 | AcuraWatch Plus | openpilot | 25mph5 | 12mph | | Chrysler | Pacifica 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph | | Chrysler | Pacifica Hybrid 2017-18 | Adaptive Cruise | Stock | 0mph | 9mph | -| Chrysler | Pacifica Hybrid 2019 | Adaptive Cruise | Stock | 0mph | 39mph | +| Chrysler | Pacifica Hybrid 2019-20 | Adaptive Cruise | Stock | 0mph | 39mph | | Honda | Accord 2018-19 | All | Stock | 0mph | 3mph | | Honda | Accord Hybrid 2018-19 | All | Stock | 0mph | 3mph | +| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph | | Honda | Civic Sedan/Coupe 2016-18 | Honda Sensing | openpilot | 0mph | 12mph | | Honda | Civic Sedan/Coupe 2019 | Honda Sensing | Stock | 0mph | 2mph | -| Honda | Civic Hatchback 2017-19 | Honda Sensing | Stock | 0mph | 12mph | | Honda | CR-V 2015-16 | Touring | openpilot | 25mph5 | 12mph | | Honda | CR-V 2017-19 | Honda Sensing | Stock | 0mph | 12mph | | Honda | CR-V Hybrid 2017-2019 | Honda Sensing | Stock | 0mph | 12mph | @@ -83,19 +83,22 @@ Supported Cars | Honda | Pilot 2016-18 | Honda Sensing | openpilot | 25mph5 | 12mph | | Honda | Pilot 2019 | All | openpilot | 25mph5 | 12mph | | Honda | Ridgeline 2017-19 | Honda Sensing | openpilot | 25mph5 | 12mph | -| Hyundai | Santa Fe 20191 | All | Stock | 0mph | 0mph | | Hyundai | Elantra 2017-191 | SCC + LKAS | Stock | 19mph | 34mph | | Hyundai | Genesis 20181 | All | Stock | 19mph | 34mph | +| Hyundai | Santa Fe 20191 | All | Stock | 0mph | 0mph | | Jeep | Grand Cherokee 2016-18 | Adaptive Cruise | Stock | 0mph | 9mph | | Jeep | Grand Cherokee 2019 | Adaptive Cruise | Stock | 0mph | 39mph | | Kia | Optima 20191 | SCC + LKAS | Stock | 0mph | 0mph | | Kia | Sorento 20181 | All | Stock | 0mph | 0mph | | Kia | Stinger 20181 | SCC + LKAS | Stock | 0mph | 0mph | | Lexus | CT Hybrid 2017-18 | All | Stock4| 0mph | 0mph | +| Lexus | ES 2019 | All | openpilot | 0mph | 0mph | | Lexus | ES Hybrid 2019 | All | openpilot | 0mph | 0mph | -| Lexus | RX Hybrid 2016-19 | All | Stock4| 0mph | 0mph | | Lexus | IS 2017-2019 | All | Stock | 22mph | 0mph | | Lexus | IS Hybrid 2017 | All | Stock | 0mph | 0mph | +| Lexus | RX 2016-17 | All | Stock4| 0mph | 0mph | +| Lexus | RX 2020 | All | openpilot | 0mph | 0mph | +| Lexus | RX Hybrid 2016-19 | All | Stock4| 0mph | 0mph | | Subaru | Crosstrek 2018-19 | EyeSight | Stock | 0mph | 0mph | | Subaru | Impreza 2019-20 | EyeSight | Stock | 0mph | 0mph | | Toyota | Avalon 2016 | TSS-P | Stock4| 20mph5 | 0mph | @@ -106,7 +109,7 @@ Supported Cars | Toyota | C-HR Hybrid 2017-19 | All | Stock | 0mph | 0mph | | Toyota | Corolla 2017-19 | All | Stock4| 20mph5 | 0mph | | Toyota | Corolla 2020 | All | openpilot | 0mph | 0mph | -| Toyota | Corolla Hatchback 2019 | All | openpilot | 0mph | 0mph | +| Toyota | Corolla Hatchback 2019-20 | All | openpilot | 0mph | 0mph | | Toyota | Corolla Hybrid 2020 | All | openpilot | 0mph | 0mph | | Toyota | Highlander 2017-19 | All | Stock4| 0mph | 0mph | | Toyota | Highlander Hybrid 2017-19 | All | Stock4| 0mph | 0mph | @@ -118,6 +121,7 @@ Supported Cars | Toyota | Rav4 2019 | All | openpilot | 0mph | 0mph | | Toyota | Rav4 Hybrid 2016 | TSS-P | Stock4| 0mph | 0mph | | Toyota | Rav4 Hybrid 2017-18 | All | Stock4| 0mph | 0mph | +| Toyota | Rav4 Hybrid 2019-20 | All | openpilot | 0mph | 0mph | | Toyota | Sienna 2018 | All | Stock4| 0mph | 0mph | | Volkswagen| Golf 2016-193 | Driver Assistance | Stock | 0mph | 0mph | @@ -131,9 +135,9 @@ Community Maintained Cars and Features | Make | Model (US Market Reference) | Supported Package | ACC | No ACC accel below | No ALC below | | ----------| ------------------------------| ------------------| -----------------| -------------------| -------------| | Buick | Regal 20186 | Adaptive Cruise | openpilot | 0mph | 7mph | +| Cadillac | ATS 20186 | Adaptive Cruise | openpilot | 0mph | 7mph | | Chevrolet | Malibu 20176 | Adaptive Cruise | openpilot | 0mph | 7mph | | Chevrolet | Volt 2017-186 | Adaptive Cruise | openpilot | 0mph | 7mph | -| Cadillac | ATS 20186 | Adaptive Cruise | openpilot | 0mph | 7mph | | GMC | Acadia Denali 20186| Adaptive Cruise | openpilot | 0mph | 7mph | | Holden | Astra 20176 | Adaptive Cruise | openpilot | 0mph | 7mph | @@ -242,7 +246,7 @@ Safety and Testing Testing on PC ------ -Check out [openpilot-tools](https://github.com/commaai/openpilot-tools): lots of tools you can use to replay driving data, test and develop openpilot from your pc. +Check out the tools directory in master: lots of tools you can use to replay driving data, test and develop openpilot from your pc. Community and Contributing ------ diff --git a/RELEASES.md b/RELEASES.md index 1b4caf963..b472cf9cd 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,12 @@ +Version 0.7.2 (2020-02-07) +======================== + * ECU firmware version based fingerprinting for Honda & Toyota + * New driving model: improved path prediction during turns and lane changes and better lead speed tracking + * Improve driver monitoring under extreme lighting and add low accuracy alert + * Support for 2019 Rav4 Hybrid thanks to illumiN8i! + * Support for 2016, 2017 and 2020 Lexus RX thanks to illumiN8i! + * Support for 2020 Chrysler Pacifica Hybrid thanks to adhintz! + Version 0.7.1 (2020-01-20) ======================== * comma two support! diff --git a/SConstruct b/SConstruct index 404cc4491..73c603ad5 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,7 @@ import os import subprocess import sys +import platform AddOption('--test', action='store_true', @@ -11,6 +12,8 @@ AddOption('--asan', help='turn on ASAN') arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() +if platform.system() == "Darwin": + arch = "Darwin" if arch == "aarch64": lenv = { @@ -29,7 +32,6 @@ if arch == "aarch64": "/data/data/com.termux/files/usr/lib", "/system/vendor/lib64", "/system/comma/usr/lib", - "#phonelibs/yaml-cpp/lib", "#phonelibs/nanovg", "#phonelibs/libyuv/lib", ] @@ -48,22 +50,34 @@ else: "#phonelibs/zmq/x64/include", "#external/tensorflow/include", ] - libpath = [ - "#phonelibs/capnp-cpp/x64/lib", - "#phonelibs/capnp-c/x64/lib", - "#phonelibs/yaml-cpp/x64/lib", - "#phonelibs/snpe/x86_64-linux-clang", - "#phonelibs/zmq/x64/lib", - "#phonelibs/libyuv/x64/lib", - "#external/zmq/lib", - "#external/tensorflow/lib", - "#cereal", - "#selfdrive/common", - "/usr/lib", - "/usr/local/lib", - ] + + if arch == "Darwin": + libpath = [ + "#phonelibs/capnp-cpp/mac/lib", + "#phonelibs/capnp-c/mac/lib", + "#phonelibs/libyuv/mac/lib", + "#cereal", + "#selfdrive/common", + "/usr/local/lib", + "/System/Library/Frameworks/OpenGL.framework/Libraries", + ] + else: + libpath = [ + "#phonelibs/capnp-cpp/x64/lib", + "#phonelibs/capnp-c/x64/lib", + "#phonelibs/snpe/x86_64-linux-clang", + "#phonelibs/zmq/x64/lib", + "#phonelibs/libyuv/x64/lib", + "#external/zmq/lib", + "#external/tensorflow/lib", + "#cereal", + "#selfdrive/common", + "/usr/lib", + "/usr/local/lib", + ] rpath = ["phonelibs/capnp-cpp/x64/lib", + "phonelibs/zmq/x64/lib", "external/tensorflow/lib", "cereal", "selfdrive/common"] @@ -98,7 +112,6 @@ env = Environment( "#selfdrive", "#phonelibs/bzip2", "#phonelibs/libyuv/include", - "#phonelibs/yaml-cpp/include", "#phonelibs/openmax/include", "#phonelibs/json/src", "#phonelibs/json11", @@ -195,8 +208,10 @@ SConscript(['common/SConscript']) SConscript(['common/kalman/SConscript']) SConscript(['phonelibs/SConscript']) -SConscript(['selfdrive/modeld/SConscript']) -SConscript(['selfdrive/camerad/SConscript']) +if arch != "Darwin": + SConscript(['selfdrive/camerad/SConscript']) + SConscript(['selfdrive/modeld/SConscript']) + SConscript(['selfdrive/controls/lib/cluster/SConscript']) SConscript(['selfdrive/controls/lib/lateral_mpc/SConscript']) SConscript(['selfdrive/controls/lib/longitudinal_mpc/SConscript']) diff --git a/check_code_quality.sh b/check_code_quality.sh deleted file mode 100644 index aed17230e..000000000 --- a/check_code_quality.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Only pyflakes checks (--select=F) -flake8 --select=F $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda") -RESULT=$? -if [ $RESULT -eq 0 ]; then - pylint $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda") - RESULT=$? & 3 -fi - -[ $RESULT -ne 0 ] && exit 1 -exit 0 diff --git a/common/android.py b/common/android.py index a4b8b836e..e0933e822 100644 --- a/common/android.py +++ b/common/android.py @@ -5,6 +5,9 @@ import re import struct import subprocess import random +from cereal import log + +NetworkType = log.ThermalData.NetworkType ANDROID = os.path.isfile('/EON') @@ -89,3 +92,39 @@ def parse_service_call_bytes(ret): return r except Exception: return None + +def get_network_type(): + if not ANDROID: + return NetworkType.none + + wifi_check = parse_service_call_string(service_call(["connectivity", "2"])) + if wifi_check is None: + return NetworkType.none + elif 'WIFI' in wifi_check: + return NetworkType.wifi + else: + cell_check = parse_service_call_unpack(service_call(['phone', '59']), ">q") + # from TelephonyManager.java + cell_networks = { + 0: NetworkType.none, + 1: NetworkType.cell2G, + 2: NetworkType.cell2G, + 3: NetworkType.cell3G, + 4: NetworkType.cell2G, + 5: NetworkType.cell3G, + 6: NetworkType.cell3G, + 7: NetworkType.cell3G, + 8: NetworkType.cell3G, + 9: NetworkType.cell3G, + 10: NetworkType.cell3G, + 11: NetworkType.cell2G, + 12: NetworkType.cell3G, + 13: NetworkType.cell4G, + 14: NetworkType.cell4G, + 15: NetworkType.cell3G, + 16: NetworkType.cell2G, + 17: NetworkType.cell3G, + 18: NetworkType.cell4G, + 19: NetworkType.cell4G + } + return cell_networks.get(cell_check, NetworkType.none) diff --git a/common/api/__init__.py b/common/api/__init__.py index b27520738..38fe6b247 100644 --- a/common/api/__init__.py +++ b/common/api/__init__.py @@ -1,13 +1,13 @@ import jwt import requests from datetime import datetime, timedelta - +from common.basedir import PERSIST from selfdrive.version import version class Api(): def __init__(self, dongle_id): self.dongle_id = dongle_id - with open('/persist/comma/id_rsa') as f: + with open(PERSIST+'/comma/id_rsa') as f: self.private_key = f.read() def get(self, *args, **kwargs): diff --git a/common/basedir.py b/common/basedir.py index 99760fa33..e928ded4c 100644 --- a/common/basedir.py +++ b/common/basedir.py @@ -1,4 +1,11 @@ import os BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")) +from common.android import ANDROID +if ANDROID: + PERSIST = "/persist" + PARAMS = "/data/params" +else: + PERSIST = os.path.join(BASEDIR, "persist") + PARAMS = os.path.join(BASEDIR, "persist", "params") diff --git a/common/clock.pyx b/common/clock.pyx index 6205eca10..654d53f8f 100644 --- a/common/clock.pyx +++ b/common/clock.pyx @@ -1,16 +1,22 @@ -from posix.time cimport clock_gettime, timespec, CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW +from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t -cdef double readclock(int clock_id): - cdef timespec ts - cdef double current +IF UNAME_SYSNAME == "Darwin": + # Darwin doesn't have a CLOCK_BOOTTIME + CLOCK_BOOTTIME = CLOCK_MONOTONIC_RAW +ELSE: + from posix.time cimport CLOCK_BOOTTIME - clock_gettime(clock_id, &ts) - current = ts.tv_sec + (ts.tv_nsec / 1000000000.) - return current +cdef double readclock(clockid_t clock_id): + cdef timespec ts + cdef double current + clock_gettime(clock_id, &ts) + current = ts.tv_sec + (ts.tv_nsec / 1000000000.) + return current def monotonic_time(): - return readclock(CLOCK_MONOTONIC_RAW) + return readclock(CLOCK_MONOTONIC_RAW) def sec_since_boot(): - return readclock(CLOCK_BOOTTIME) + return readclock(CLOCK_BOOTTIME) + diff --git a/common/ffi_wrapper.py b/common/ffi_wrapper.py index 2c169881c..0fbe16296 100644 --- a/common/ffi_wrapper.py +++ b/common/ffi_wrapper.py @@ -2,8 +2,14 @@ import os import sys import fcntl import hashlib +import platform from cffi import FFI +def suffix(): + if platform.system() == "Darwin": + return ".dylib" + else: + return ".so" def ffi_wrap(name, c_code, c_header, tmpdir="/tmp/ccache", cflags="", libraries=None): if libraries is None: diff --git a/common/logging_extra.py b/common/logging_extra.py index d57332780..b5d07f220 100644 --- a/common/logging_extra.py +++ b/common/logging_extra.py @@ -1,9 +1,11 @@ +import io import os import sys import copy import json import socket import logging +import traceback from threading import local from collections import OrderedDict from contextlib import contextmanager @@ -118,6 +120,42 @@ class SwagLogger(logging.Logger): else: self.info(evt) + def findCaller(self, stack_info=False, stacklevel=1): + """ + Find the stack frame of the caller so that we can note the source + file name, line number and function name. + """ + f = sys._getframe(3) + #On some versions of IronPython, currentframe() returns None if + #IronPython isn't run with -X:Frames. + if f is not None: + f = f.f_back + orig_f = f + while f and stacklevel > 1: + f = f.f_back + stacklevel -= 1 + if not f: + f = orig_f + rv = "(unknown file)", 0, "(unknown function)", None + while hasattr(f, "f_code"): + co = f.f_code + filename = os.path.normcase(co.co_filename) + if filename == _srcfile: + f = f.f_back + continue + sinfo = None + if stack_info: + sio = io.StringIO() + sio.write('Stack (most recent call last):\n') + traceback.print_stack(f, file=sio) + sinfo = sio.getvalue() + if sinfo[-1] == '\n': + sinfo = sinfo[:-1] + sio.close() + rv = (co.co_filename, f.f_lineno, co.co_name, sinfo) + break + return rv + if __name__ == "__main__": log = SwagLogger() diff --git a/common/params.py b/common/params.py index 3a4e4a2a1..009e5729d 100755 --- a/common/params.py +++ b/common/params.py @@ -29,7 +29,7 @@ import fcntl import tempfile import threading from enum import Enum - +from common.basedir import PARAMS def mkdirs_exists_ok(path): try: @@ -54,6 +54,7 @@ keys = { "AthenadPid": [TxType.PERSISTENT], "CalibrationParams": [TxType.PERSISTENT], "CarParams": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], + "CarParamsCache": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], "CarVin": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], "CommunityFeaturesToggle": [TxType.PERSISTENT], "CompletedTrainingVersion": [TxType.PERSISTENT], @@ -319,7 +320,7 @@ def write_db(params_path, key, value): lock.release() class Params(): - def __init__(self, db='/data/params'): + def __init__(self, db=PARAMS): self.db = db # create the database if it doesn't exist... @@ -327,6 +328,11 @@ class Params(): with self.transaction(write=True): pass + def clear_all(self): + shutil.rmtree(self.db, ignore_errors=True) + with self.transaction(write=True): + pass + def transaction(self, write=False): if write: return DBWriter(self.db) diff --git a/common/transformations/camera.py b/common/transformations/camera.py index 489874eb6..d8729e2f4 100644 --- a/common/transformations/camera.py +++ b/common/transformations/camera.py @@ -131,37 +131,6 @@ def img_from_device(pt_device): return pt_img.reshape(input_shape)[:,:2] -#TODO please use generic img transform below -def rotate_img(img, eulers, crop=None, intrinsics=eon_intrinsics): - import cv2 # pylint: disable=import-error - - size = img.shape[:2] - rot = orient.rot_from_euler(eulers) - quadrangle = np.array([[0, 0], - [size[1]-1, 0], - [0, size[0]-1], - [size[1]-1, size[0]-1]], dtype=np.float32) - quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=intrinsics), np.ones((4,1)))) - warped_quadrangle_full = np.einsum('ij, kj->ki', intrinsics.dot(rot), quadrangle_norm) - warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2], - warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32) - if crop: - W_border = (size[1] - crop[0])//2 - H_border = (size[0] - crop[1])//2 - outside_crop = (((warped_quadrangle[:,0] < W_border) | - (warped_quadrangle[:,0] >= size[1] - W_border)) & - ((warped_quadrangle[:,1] < H_border) | - (warped_quadrangle[:,1] >= size[0] - H_border))) - if not outside_crop.all(): - raise ValueError("warped image not contained inside crop") - else: - H_border, W_border = 0, 0 - M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle) - img_warped = cv2.warpPerspective(img, M, size[::-1]) - return img_warped[H_border: size[0] - H_border, - W_border: size[1] - W_border] - - def get_camera_frame_from_calib_frame(camera_frame_from_road_frame): camera_frame_from_ground = camera_frame_from_road_frame[:, (0, 1, 3)] calib_frame_from_ground = np.dot(eon_intrinsics, diff --git a/installer/updater/updater.cc b/installer/updater/updater.cc index e2d3e7dae..a76be8b8f 100644 --- a/installer/updater/updater.cc +++ b/installer/updater/updater.cc @@ -155,8 +155,6 @@ struct Updater { TouchState touch; int fb_w, fb_h; - EGLDisplay display; - EGLSurface surface; FramebufferState *fb = NULL; NVGcontext *vg = NULL; @@ -198,7 +196,7 @@ struct Updater { touch_init(&touch); fb = framebuffer_init("updater", 0x00001000, false, - &display, &surface, &fb_w, &fb_h); + &fb_w, &fb_h); assert(fb); vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG); @@ -708,7 +706,7 @@ struct Updater { glDisable(GL_BLEND); - eglSwapBuffers(display, surface); + framebuffer_swap(fb); assert(glGetError() == GL_NO_ERROR); diff --git a/models/dmonitoring_model_q.dlc b/models/dmonitoring_model_q.dlc new file mode 100644 index 000000000..0aee22a47 Binary files /dev/null and b/models/dmonitoring_model_q.dlc differ diff --git a/models/monitoring_model_q.dlc b/models/monitoring_model_q.dlc deleted file mode 100644 index 59104e18e..000000000 Binary files a/models/monitoring_model_q.dlc and /dev/null differ diff --git a/models/supercombo.dlc b/models/supercombo.dlc index fb48eb2ec..d7942d6df 100644 Binary files a/models/supercombo.dlc and b/models/supercombo.dlc differ diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed deleted file mode 100644 index 405e3d50f..000000000 Binary files a/panda/board/obj/panda.bin.signed and /dev/null differ diff --git a/phonelibs/eigen/COPYING.MINPACK b/phonelibs/eigen/COPYING.MINPACK index 11d8a9a6c..ae7984dae 100644 --- a/phonelibs/eigen/COPYING.MINPACK +++ b/phonelibs/eigen/COPYING.MINPACK @@ -1,52 +1,52 @@ -Minpack Copyright Notice (1999) University of Chicago. All rights reserved - -Redistribution and use in source and binary forms, with or -without modification, are permitted provided that the -following conditions are met: - -1. Redistributions of source code must retain the above -copyright notice, this list of conditions and the following -disclaimer. - -2. Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following -disclaimer in the documentation and/or other materials -provided with the distribution. - -3. The end-user documentation included with the -redistribution, if any, must include the following -acknowledgment: - - "This product includes software developed by the - University of Chicago, as Operator of Argonne National - Laboratory. - -Alternately, this acknowledgment may appear in the software -itself, if and wherever such third-party acknowledgments -normally appear. - -4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" -WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE -UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND -THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE -OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY -OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR -USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF -THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) -DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION -UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL -BE CORRECTED. - -5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT -HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF -ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, -INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF -ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF -PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER -SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT -(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, -EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE -POSSIBILITY OF SUCH LOSS OR DAMAGES. - +Minpack Copyright Notice (1999) University of Chicago. All rights reserved + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above +copyright notice, this list of conditions and the following +disclaimer. + +2. Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials +provided with the distribution. + +3. The end-user documentation included with the +redistribution, if any, must include the following +acknowledgment: + + "This product includes software developed by the + University of Chicago, as Operator of Argonne National + Laboratory. + +Alternately, this acknowledgment may appear in the software +itself, if and wherever such third-party acknowledgments +normally appear. + +4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" +WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE +UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND +THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE +OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY +OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR +USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF +THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) +DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION +UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL +BE CORRECTED. + +5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT +HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF +ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, +INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF +ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF +PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER +SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT +(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, +EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE +POSSIBILITY OF SUCH LOSS OR DAMAGES. + diff --git a/phonelibs/fastcv/aarch64/include/fastcv.h b/phonelibs/fastcv/aarch64/include/fastcv.h index 758bce78e..4827b2b6f 100644 --- a/phonelibs/fastcv/aarch64/include/fastcv.h +++ b/phonelibs/fastcv/aarch64/include/fastcv.h @@ -1,34089 +1,34089 @@ -#ifndef FASTCV_H -#define FASTCV_H - -/**============================================================================= - -@file - fastcv.h - -@brief - Public API - - -Copyright (c) 2011-2015 Qualcomm Technologies, Inc. -All Rights Reserved. -Confidential and Proprietary - Qualcomm Technologies, Inc. - -=============================================================================**/ - -/**============================================================================= -@mainpage FastCV Public API Documentation - -@version 1.7.1 - -@section Overview Overview - -FastCV provides two main features to computer vision application developers: - - First, it provides a library of frequently used computer vision (CV) - functions, optimized to run efficiently on mobile devices. - - Second, it provides a clean processor-agnostic hardware acceleration API, - under which chipset vendors can hardware accelerate FastCV functions on - their hardware. - -FastCV 1.7.1 supports Android and Windows mobile developers. -FastCV 1.7.1 is available for download for free from developer.qualcomm.com. - -FastCV 1.7.1 is released as a unified binary, a single binary containing two -implementations of the library. - - The first implementation runs on ARM processor, and is referred to as - the "FastCV for ARM." - - The second implementation runs only on Qualcomm Snapdragon - chipsets, and is called "FastCV for Snapdragon." - -Releases are generally motivated for the following reasons: - - Changes to previously released APIs - - Addition of new functions - - Performance improvements and/or bug fixes - also known as implementation - modifications - - Each motivation has a varying degree of impact on the user of the library. - The general release numbering scheme captures this variety of motivations. - - Given release ID: A.B.C - - An increase in "A" indicates that a previously released API has changed, - so a developer may encounter compilation issues which require modification - of their code in order to adhear to the modified API. Qualcomm will make - every effort to minimize these changes. Additionally, new functions and - implementation modifications may be present. - - An increase in "B" indicates that new functions have been added to the - library, so additional functionality is available, however existing APIs - have not changed. Additionally, implementation modifications may be - present. - - An increase in "C" indicates that implementation modifications only have - been made. - -@defgroup math_vector Math / Vector Operations -@details Commonly used vector & math functions - -@defgroup image_processing Image processing -@details Image filtering, convolution and scaling operations - -@defgroup image_transform Image transformation -@details Warp perspective, affine transformations - -@defgroup feature_detection Feature detection -@details Fast corner detection, harris corner detection, canny edge detection, etc. - -@defgroup object_detection Object detection -@details Object detection functions such as NCC template match, etc. - -@defgroup 3D_reconstruction 3D reconstruction -@details Homography, pose evaluation functions - -@defgroup color_conversion Color conversion -@details Commonly used formats supported: e.g., YUV, RGB, YCrCb, etc. - -@defgroup clustering_and_search Clustering and search -@details K clusters best fitting of a set of input points - -@defgroup Motion_and_Object_Tracking Motion and object tracking -@details Supports and tracking functions - -@defgroup Structural_Analysis_and_Drawing Shape and drawing -@details Contour and polygon drawing functions - -@defgroup mem_management Memory Management -@details Functions to allocate and deallocate memory for use with fastCV. - -@defgroup misc Miscellaneous -@details Support functions - -@defgroup machine_learning Machine Learning -@details Machine learning functions such as SVM prediction, etc. - -**/ - -//============================================================================== -// Defines -//============================================================================== - -#ifdef __GNUC__ - /// Macro to align memory at 4-bytes (32-bits) for GNU-based compilers. - #define FASTCV_ALIGN32( VAR ) (VAR) __attribute__ ((aligned(4))) - /// Macro to align memory at 8-bytes (64-bits) for GNU-based compilers. - #define FASTCV_ALIGN64( VAR ) (VAR) __attribute__ ((aligned(8))) - /// Macro to align memory at 16-bytes (128-bits) for GNU-based compilers. - #define FASTCV_ALIGN128( VAR ) (VAR) __attribute__ ((aligned(16))) - #ifdef BUILDING_SO - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __attribute__ ((visibility ("default"))) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#else - /// Macro to align memory at 4-bytes (32-bits) for MSVC compiler. - #define FASTCV_ALIGN32( VAR ) __declspec(align(4)) (VAR) - /// Macro to align memory at 8-bytes (64-bits) for MSVC compiler. - #define FASTCV_ALIGN64( VAR ) __declspec(align(8)) (VAR) - /// Macro to align memory at 16-bytes (128-bits) for MSVC compiler. - #define FASTCV_ALIGN128( VAR ) __declspec(align(16)) (VAR) - #ifdef BUILDING_DLL - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __declspec(dllexport) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#endif - -//============================================================================== -// Included modules -//============================================================================== - -#include -#include -typedef float float32_t; -typedef double float64_t; - -//============================================================================== -// Declarations -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines operational mode of interface to allow the end developer to -/// dictate how the target optimized implementation should behave. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Target-optimized implementation uses lowest power consuming - /// implementation. - FASTCV_OP_LOW_POWER = 0, - - /// Target-optimized implementation uses highest performance implementation. - FASTCV_OP_PERFORMANCE = 1, - - /// Target-optimized implementation offloads as much of the CPU as possible. - FASTCV_OP_CPU_OFFLOAD = 2, - - /// Target-optimized implementation uses CPU highest performance implementation. - FASTCV_OP_CPU_PERFORMANCE = 3, - - /// Values >= 0x80000000 are reserved - FASTCV_OP_RESERVED = 0x80000000 - -} fcvOperationMode; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the flip directions for matrix flip functions. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Flip horizontally. - FASTCV_FLIP_HORIZ = 1, - - /// Flip vertically. - FASTCV_FLIP_VERT = 2, - - /// Flip horizontally and vertically. - FASTCV_FLIP_BOTH = 3 - -} fcvFlipDir; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the clockwise rotation degrees for image rotation functions. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Rotate 90 degrees clockwise. - FASTCV_ROTATE_90 = 1, - - /// Rotate 180 degrees clockwise. - FASTCV_ROTATE_180 = 2, - - /// Rotate 270 degrees clockwise. - FASTCV_ROTATE_270 = 3 - -} fcvRotateDegree; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the interpolation types. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Nearest neighbor interpolation - FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR = 0, - - /// Bilinear interpolation - FASTCV_INTERPOLATION_TYPE_BILINEAR, - - /// Interpolation by area - FASTCV_INTERPOLATION_TYPE_AREA - -} fcvInterpolationType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the policy to handle integer overflow. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Do nothing to the overflow. - /// Let the overflowed number wrap around. - /// May save runtime if overflow unlikely to occur, - /// or users do not care about overflow. - FASTCV_CONVERT_POLICY_WRAP = 0, - - /// Clamped to the maximum interger if overflow, - /// clamped to the minimum integer if underflow. - /// May require more runtime than FASTCV_CONVERT_POLICY_WRAP. - FASTCV_CONVERT_POLICY_SATURATE - -} fcvConvertPolicy; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the border types. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// Border behavior undefined, left to the implementation. - FASTCV_BORDER_UNDEFINED = 0, - - /// For out-of-bound pixels, apply a user-specified constant value. - FASTCV_BORDER_CONSTANT, - - /// For out-of-bound pixels, apply values from the nearest edge pixels. - FASTCV_BORDER_REPLICATE - -} fcvBorderType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the norm for a vector. -//------------------------------------------------------------------------------ - -typedef enum -{ - /// L1 norm. The norm is the sum of absolute values of every component in a vector. - FASTCV_NORM_L1, - - /// L2 norm, i.e., the Euclidean norm of a vector. - FASTCV_NORM_L2 - -} fcvNormType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines all supported channel indices -//------------------------------------------------------------------------------ - -typedef enum -{ - /// The first channel of the image. - FASTCV_CHANNEL_0, - - /// The second channel of the image. - FASTCV_CHANNEL_1, - - /// The third channel of the image. - FASTCV_CHANNEL_2, - - /// The fourth channel of the image. - FASTCV_CHANNEL_3, - - /// The RED channel of the image. - FASTCV_CHANNEL_R, - - /// The GREEN channel of the image. - FASTCV_CHANNEL_G, - - /// The BLUE channel of the image. - FASTCV_CHANNEL_B, - - /// The ALPHA channel of the image. - FASTCV_CHANNEL_A, - - /// The LUMA channel of the image. - FASTCV_CHANNEL_Y, - - /// The Cb/U channel of the image. - FASTCV_CHANNEL_U, - - /// The Cr/V/Value channel of the image. - FASTCV_CHANNEL_V - -} fcvChannelType; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines all supported image formats based on the FOURCC definition -//------------------------------------------------------------------------------ - -typedef enum -{ - /// A single plane of 24 bit pixel as 3 interleaved 8 bit units of R then G then B data. - FASTCV_RGB, - - /// A single plane of 32 bit pixel as 4 interleaved 8 bit units of R then G then B data, then a ”don’t care?byte. - FASTCV_RGBX, - - /// A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling. - /// For a frame of width W and height H, Y plane has the size of W * H, while the UV plane has the size of W * H/2. - /// The extracted U or V plane is then expected to be W/2 * H/2. - FASTCV_NV12, - - /// A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling. - /// For a frame of width W and height H, Y plane has the size of W * H, while the VU plane has the size of W * H/2. - /// The extracted U or V plane is then expected to be W/2 * H/2. - FASTCV_NV21, - - /// A single plane of 32 bit macro pixel of U0, Y0, V0, Y1 bytes. - /// For a frame of width W and height H, its buffer size is at least 2*W * H. - /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. - FASTCV_UYVY, - - /// A single plane of 32 bit macro pixel of Y0, U0, Y1, V0 bytes. - /// For a frame of width W and height H, its buffer size is at least 2*W * H. - /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. - FASTCV_YUYV, - - /// A 3 plane of 8 bit 4:2:0 sampled Y, U, V planes. - /// For a frame of width W and height H, Y plane has the size of W * H, while the U or I plane each has a size of W/2 * H/2. - FASTCV_IYUV, - - /// A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes. - /// For a frame of width W and height H, Y or U or V plane each has the size of W * H. - FASTCV_YUV4 - -} fcvImageFormat; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the status returned by a function. -//------------------------------------------------------------------------------ -typedef enum -{ - //// Success - FASTCV_SUCCESS = 0, - - /// General failure - FASTCV_EFAIL, - - /// Unaligned pointer parameter - FASTCV_EUNALIGNPARAM, - - /// Bad parameters - FASTCV_EBADPARAM, - - /// Called at invalid state - FASTCV_EINVALSTATE, - - /// Insufficient resources, memory, thread... - FASTCV_ENORES, - - /// Unsupported feature - FASTCV_EUNSUPPORTED, - - /// Hardware QDSP failed to respond - FASTCV_EHWQDSP, - - /// Hardware GPU failed to respond - FASTCV_EHWGPU - -} fcvStatus; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the kernel functions of SVM prediction. -//------------------------------------------------------------------------------ -typedef enum -{ - FASTCV_SVM_LINEAR, - FASTCV_SVM_POLY, - FASTCV_SVM_RBF, - FASTCV_SVM_SIGMOID -} fcvSVMKernelType; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the different scaling options for the pyramid -//------------------------------------------------------------------------------ -typedef enum -{ - FASTCV_PYRAMID_SCALE_HALF, - FASTCV_PYRAMID_SCALE_ORB -} fcvPyramidScale; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the termination criteria list. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Indicates a termination after a set number of iterations - FASTCV_TERM_CRITERIA_ITERATIONS, - - /// Indicates a termination after matching against the value of eplison provided to the function - FASTCV_TERM_CRITERIA_EPSILON, - - /// Indicates that both an iterations and eplison method are employed. Whichever one matches first causes the termination. - FASTCV_TERM_CRITERIA_BOTH, -} fcvTerminationCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the normalization method in the HOG extraction process -//------------------------------------------------------------------------------ -typedef enum -{ - /// Do the regular normalization method - FASTCV_HOG_NORM_REGULAR = 0, - - /// Do re-normalization - FASTCV_HOG_NORM_RENORMALIZATION = 1, - - /// Use F-HOG method - FASTCV_HOG_NORM_FHOG = 2, - -} fcvHOGNormMethod; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines the vaiance estimator type -//------------------------------------------------------------------------------ -typedef enum -{ - /// Sums the squared deviation and devides by (n-1) - /// As known as sample variance - FASTCV_UNBIASED_VARIANCE_ESTIMATOR = 0, - - /// Sums the squared deviation and devides by n - /// As known as population variance - FASTCV_BIASED_VARIANCE_ESTIMATOR = 1, - -} fcvVarianceEstimator; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a structure to contain points correspondence data. -//------------------------------------------------------------------------------ -typedef struct -{ - /// Tuples of 3 values: xFrom,yFrom,zFrom. Float array which this points to - /// must be greater than or equal to 3 * numCorrespondences. - const float32_t* from; - /*~ FIELD fcvCorrespondences.from - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.fromStride ? fcvCorrespondences.fromStride : 3) ) */ - - /// Tuples of 2 values: xTo,yTo. Float array which this points to - /// must be greater than or equal to 2 * numCorrespondences. - const float32_t* to; - /*~ FIELD fcvCorrespondences.to - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.toStride ? fcvCorrespondences.toStride : 2) ) */ - - /// Distance in bytes between two coordinates in the from array. - /// If this parameter is set to 2 or 3, a dense array is assume (stride will - /// be sizeof(float) times 2 or 3). The minimum value of fromStride - /// should be 2. - uint32_t fromStride; - - /// Distance in bytes between two coordinates in the to array. - /// If this parameter is set to 2, a dense array is assume (stride will - /// be 2 * sizeof(float)). The minimum value of toStride - /// should be 2. - uint32_t toStride; - - /// Number of points in points correspondences. - uint32_t numCorrespondences; - - /// Array of inlier indices for corrs array. Processing will only occur on - /// the indices supplied in this array. Array which this points to must be - /// at least numIndices long. - const uint16_t* indices; - /*~ FIELD fcvCorrespondences.indices VARRAY LENGTH (fcvCorrespondences.numIndices) */ - - /// Length of indices array. - uint32_t numIndices; -} fcvCorrespondences; - - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; -} fcvPyramidLevel ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level (version2 with stride) -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; - unsigned int stride; -} fcvPyramidLevel_v2 ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure describing node of a tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodef32 -{ - /// the split value at the node - float32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodef32; - -// ----------------------------------------------------------------------------- -/// @brief -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchf32 -{ - /// square of minimal distance from query for all nodes below - float32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchf32; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8f32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const float32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indice of root nodes of trees - int32_t* trees; - - /// array of nodes of all trees - fcvKDTreeNodef32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchf32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8f32; - - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure describing node of tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodes32 -{ - /// the split value at the node - int32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodes32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchs32 -{ - /// square of minimal distance from query for all nodes below - int32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchs32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8s32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const int32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indices of root nodes of all trees - int32_t* trees; - - /// number of trees used - int32_t numTrees; - - /// array of nodes of all trees - fcvKDTreeNodes32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchs32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8s32; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of rectangle -//------------------------------------------------------------------------------ -typedef struct -{ - ///x-coordinate of the top-left corner - int32_t x; - ///y-coordinate of the top-left corner - int32_t y; - ///width of the rectangle - uint32_t width; - ///height of the rectangle - uint32_t height; -} fcvRectangleInt; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of termination criteria -//------------------------------------------------------------------------------ -typedef struct -{ - /// Maxmimum number of iteration - int32_t max_iter; - /// - float32_t epsilon; -}fcvTermCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of 2D box used for tracking -//------------------------------------------------------------------------------ -typedef struct -{ - // Center of the box - ///x-coordinate of the 2D point - int32_t x; - ///y-coordinate of the 2D point - int32_t y; - // The box size - int32_t columns; - int32_t rows; - // The orientation of the principal axis - int32_t orientation; -}fcvBox2D; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of image moments -//------------------------------------------------------------------------------ -typedef struct { - // spatial moments - float32_t m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; - // central moments - float32_t mu20, mu11, mu02, mu30, mu21, mu12, mu03; - // m00 != 0 ? 1/sqrt(m00) : 0 - float32_t inv_sqrt_m00; -} fcvMoments; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of code word -//------------------------------------------------------------------------------ -typedef struct fcvBGCodeWord -{ - /// Pointer to next codebook element - struct fcvBGCodeWord* next; - - /// Last update time - int32_t tLastUpdate; - - /// Longest period of inactivity - int32_t stale; - /// Min value of pixel for each channel - uint8_t min0, min1, min2; - - /// Max value of pixel for each channel - uint8_t max0, max1, max2; - - /// Min value of learning boundary for each channel - uint8_t learnLow0, learnLow1, learnLow2; - - /// Max value of learning boundary for each channel - uint8_t learnHigh0, learnHigh1, learnHigh2; -} fcvBGCodeWord; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for circle -//------------------------------------------------------------------------------ -typedef struct fcvCircle -{ - int32_t x; - int32_t y; - int32_t radius; -} fcvCircle; - - -typedef struct fcvPoint2D -{ - float x; - float y; -} fcvPoint2D; - -typedef struct fcvLine -{ - fcvPoint2D start; - fcvPoint2D end; -} fcvLine; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for parameters for line segment detection -//------------------------------------------------------------------------------ -typedef struct fcvLineSegment { - fcvPoint2D start, end; ///< Two ending points - float32_t normal[2]; ///< Orientation, average of the gradient direction - uint32_t nPoints; ///< (Optional) Number of pixels in pointsList - int32_t pointsStartIndex; ///< (Optional) Starting index of the pixel positions contributed to line segment fitting stored in indexBuffer - uint32_t sumMag; ///< Sum of all pixels gradient magnitude -} fcvLineSegment; - - -//------------------------------------------------------------------------------ -/// @brief -/// Parameters for fusing a depth map into a cuboid fusion block -/// -/// @details -/// This structure describes a single cuboid block that shall be fused -/// with data from a depth map. All coordinates must be pre-transformed -/// into the coordinate frame of the depth frame. -/// -//------------------------------------------------------------------------------ -typedef struct fcvDepthFusionBlockConfig { - uint32_t flags; ///< Option specified as a bit field - 0x0000:N/A, 0x0001:run clipping - float32_t ramp; ///< Fusion ramp: maximum allowed distance between volume sample position and depth map sample position - float32_t p0[3], ///< Location of the 1st sample in the volume - dX[3], ///< One sample step in X-direction in the volume - dY[3], ///< One sample step in Y-direction in the volume - dZ[3]; ///< One sample step in Z-direction in the volume - uint32_t volumeIndex; ///< Index of the volume to be updated -} fcvDepthFusionBlockConfig; - -//============================================================================== -// UTILITY FUNCTIONS -//============================================================================== - -#ifdef __cplusplus -extern "C" -{ -#endif - -//------------------------------------------------------------------------------ -/// @brief -/// Retrieves version of FastCV library. -/// -/// @param version -/// Pointer to location to put string. -/// -/// @param versionLength -/// Length of storage for version string. -/// -/// @ingroup misc -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGetVersion( char* version, - unsigned int versionLength ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Selects HW units for all routines at run-time. -/// \n\b WARNING: Should be called once at the very beginning to update mode -/// -/// @param mode -/// See enum for details. -/// -/// @return -/// 0 if successful. -/// 999 if minmum HW requirement not met. -/// other #'s if unsuccessful. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvSetOperationMode( fcvOperationMode mode ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Clean up FastCV resources. Must be called before the program exits. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCleanUp( void ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidAllocate_v2(). In the 2.0.0 release, -/// fcvPyramidAllocate_v2 will be renamed to fcvPyramidAllocate -/// and the signature of fcvPyramidAllocate as it appears now, -/// will be removed. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate( fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidAllocate() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidAllocate, -/// \a fcvPyramidAllocate_v2 will be removed, and the current signature -/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel_v2 -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param baseStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// Stride of the base level: the value assigned to pyr[0].stride -/// \n \b NOTE: stride of non-base pyramid image is the same as -/// width*bytesPerPixel of the non-base pyramid image -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate_v2( fcvPyramidLevel_v2* pyr, - uint32_t baseWidth, - uint32_t baseHeight, - uint32_t baseStride, - uint32_t bytesPerPixel, - uint32_t numLevels, - int32_t allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidAllocate_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidAllocate, -/// \a fcvPyramidAllocate_v3 will be removed, and the current signature -/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// Pointer to an array of fcvPyramidLevel_v2 -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param baseStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// Stride of the base level: the value assigned to pyr[0].stride -/// \n \b NOTE: stride of non-base pyramid image is the same as -/// width*bytesPerPixel of the non-base pyramid image -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param alignment -/// Used to specify the alignment of each pyramid level other than the base. Must be a multiple -/// of 8. If set to 0, the alignment will be set as 8 bits. -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param scale -/// Defines the type of scaling used for each pyramid level. -/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. -/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), -/// which is approximated as 0.8408964f -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete_v2 for details. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPyramidAllocate_v3(fcvPyramidLevel_v2* __restrict pyr, - uint32_t baseWidth, - uint32_t baseHeight, - uint32_t baseStride, - uint32_t bytesPerPixel, - uint32_t alignment, - uint32_t numLevels, - fcvPyramidScale scale, - int32_t allocateBase); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidDelete_v2(). In the 2.0.0 release, -/// fcvPyramidDelete_v2 will be renamed to fcvPyramidDelete -/// and the signature of fcvPyramidDelete as it appears now, -/// will be removed. -/// \n\n -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete( fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidDelete() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidDelete, -/// \a fcvPyramidDelete_v2 will be removed, and the current signature -/// for \a fcvPyramidDelete will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidDelete when transitioning to 2.0.0. -/// \n\n -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete_v2 has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete_v2( fcvPyramidLevel_v2* pyr, - uint32_t numLevels, - uint32_t startLevel ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates aligned memory. -/// -/// @param nBytes -/// Number of bytes. -/// -/// @param byteAlignment -/// Alignment specified in bytes (e.g., 16 = 128-bit alignment). -/// \n\b WARNING: must be < 255 bytes -/// -/// @return -/// SUCCESS: pointer to aligned memory -/// FAILURE: 0 -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void* -fcvMemAlloc( unsigned int nBytes, - unsigned int byteAlignment ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Frees memory allocated by fcvMemAlloc(). -/// -/// @param ptr -/// Pointer to memory. -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvMemFree( void* ptr ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Initialize the Memory sub-system in FastCV. The sub-system handles -/// temporary/scratch memory requirements from several FastCV functions -/// that do not have parameters to have this supplied by the users of those -/// functions. -/// -/// \b Important: -/// \n 1. Every call to this function should be followed by a call to -/// fcvMemDeInit(). -/// \n 2. This function (and the fcvMemDeInit) only needs to called once per -/// process. -/// \n 3. Any call to FastCV functions that uses internal temporary memory -/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory -/// allocation. -/// \n 4. A call to this function without a corresponding call to fcvMemDeInit -/// can result in memory leak. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemInit(void); - -// ----------------------------------------------------------------------------- -/// @brief -/// Initialize the Memory sub-system in FastCV with pre-allocated buffer. -/// The sub-system handles temporary/scratch memory requirements from several -/// FastCV functions that do not have parameters to have this supplied by the -/// users of those functions. -/// -/// \b Important: -/// \n 1. Every call to this function should be followed by a call to -/// fcvMemDeInit(). -/// \n 2. This function (and the fcvMemDeInit) only needs to called once per -/// process. -/// \n 3. Any call to FastCV functions that uses internal temporary memory -/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory -/// allocation. -/// \n 4. A call to this function without a corresponding call to fcvMemDeInit -/// can result in memory leak. -/// -/// @param preAllocBytes -/// Number of bytes for the pre-allocated buffer. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemInitPreAlloc( uint32_t preAllocBytes ); - -// ----------------------------------------------------------------------------- -/// @brief -/// De-Initialize the Memory sub-system initialized by fcvMemInit() function. -/// -/// \b Important: -/// \n 1. Call to this function without a corresponding call to fcvMemInit will -/// result in no-op. -/// -/// @ingroup mem_management -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvMemDeInit(void); - -//End - Utility functions - - -//============================================================================== -// FUNCTIONS -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterMedian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterMedian3x3u8_v2 will be renamed to fcvFilterMedian3x3u8 -/// and the signature of fcvFilterMedian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dstImg ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian3x3u8_v2 will be renamed to fcvFilterGaussian3x3u8 -/// and the signature of fcvFilterGaussian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Destination buffer size is srcWidth*srcHeight. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5u8_v2 will be renamed to fcvFilterGaussian5x5u8 -/// and the signature of fcvFilterGaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5u8, -/// \a fcvFilterGaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian11x11u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian11x11u8_v2 will be renamed to fcvFilterGaussian11x11u8 -/// and the signature of fcvFilterGaussian11x11u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian11x11u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian11x11u8, -/// \a fcvFilterGaussian11x11u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian11x11u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian11x11u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved) to RGB 8888. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorYCrCb420PseudoPlanarToRGB8888u8. In the 2.0.0 release, -/// the signature of fcvColorYUV420toRGB8888u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R is at LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved CrCb) to RGB 888. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV picture. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcYStride -/// Stride (in bytes) of input image Y component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2). -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param srcCStride -/// Stride (in bytes) of input image Chroma component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2) -/// \n\b WARNING: should be multiple of 4 (4 * 1-byte values). -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R in LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output RGB image (i.e., number of bytes between column 0 of -/// row 1 and column 0 of row 2) -/// \n\b WARNING: should be multiple of 32 (8 * 4-byte values). -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCbCr) 4:2:0 PesudoPlanar (Interleaved CbCr) to RGB 565. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CbCr plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cb0 Cr0 Cb1 Cr1 ... -/// -/// @param dst -/// 16-bit image of output RGB 565 values. R in LSBs. -/// 2 pixels are packed into one 32-bit output -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 4 -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB565u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V1 (YCbCr 4:4:4 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit image of input values. Stored as YCbCr H1V1 planar format in 8x8 blocks for Y,Cb,Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V2 (YCbCr 4:2:0 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H2V2 planar format in 16x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V2toRGB888u8( const uint8_t* __restrict ysrc, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V1 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit input values. Stored as YCbCr H2V1 planar format in 16x8 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V2 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H1V2 planar format in 8x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V2toRGB888u8( const uint8_t* __restrict ysrc, - - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorRGB888toYCrCbu8_v2(). In the 2.0.0 release, -/// fcvColorRGB888toYCrCbu8_v2 will be renamed to fcvColorRGB888toYCrCbu8 -/// and the signature of fcvColorRGB888toYCrCbu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb 4:4:4 (Full interleaved, similar to -/// 3-channel RGB). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvColorRGB888toYCrCbu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvColorRGB888toYCrCbu8, -/// \a fcvColorRGB888toYCrCbu8_v2 will be removed, and the current signature -/// for \a fcvColorRGB888toYCrCbu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvColorRGB888toYCrCbu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Create a 36-dimension gradient based descriptor on 17x17 patch. -/// -/// @details -/// -/// @param patch -/// Input luminance data for 17x17 patch to describe. -/// -/// @param descriptorChar -/// Output descriptor vector. 36 x 8-bit vector. Normalized and quantized to range [-127, 127] -/// -/// @param descriptorNormSq -/// Output squared norm (L2 norm) of the descriptor vector. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector A. -/// -/// @param b -/// Vector B. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct36x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct36x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct64x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct128x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct128x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with several (n) 8x8 squares -/// along a line of pixels in an image. -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the source image. -/// -/// @param imgH -/// Height in pixels of the source image. -/// -/// @param nX -/// X location on image of starting search pixel. -/// -/// @param nY -/// Y location on image of starting search pixel. -/// -/// @param nNum -/// Number of pixels (in X direction) on image to sweep. -/// -/// @param dotProducts -/// Output dot product values of nNum pixels. -/// \n\b WARNING: array size must be a multiple of 4 (e.g., 4, 8, 12, ...) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct8x8u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int nX, - int nY, - unsigned int nNum, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with 8x8 squares in 11x12 -/// rectangle around the center search pixel (iX,iY). -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the image. -/// -/// @param imgH -/// Height in pixels of the image. -/// -/// @param iX -/// X location on image of the center of the search window. -/// -/// @param iY -/// Y location on image of the center of the search window. -/// -/// @param dotProducts -/// Output 11x12 dot product values. -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct11x12u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int iX, - int iY, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterSobel3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterSobel3x3u8_v2 will be renamed to fcvFilterSobel3x3u8 -/// and the signature of fcvFilterSobel3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image of |dx|+|dy|. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterSobel3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterSobel3x3u8, -/// \a fcvFilterSobel3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterSobel3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterSobel3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image of |dx|+|dy|. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCanny3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterCanny3x3u8_v2 will be renamed to fcvFilterCanny3x3u8 -/// and the signature of fcvFilterCanny3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// is set to 3. This function will output the edge, since its working with a -/// 3x3 window, it leaves one row/col of pixels at the corners -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is in the extension lib. -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v3 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gx -/// gradient in X direction. -/// \n\b NOTE: use NULL if do not need the gradient output. -/// -/// @param gy -/// gradient in Y direction. -/// \n\b NOTE: use NULL if do not need the gradient output. -/// -/// @param gradStride -/// Output stride for gx and gy. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFilterCanny3x3u8_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int16_t* __restrict gx, - int16_t* __restrict gy, - unsigned int gradStride, - int lowThresh, - int highThresh ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageDiffu8_v2(). In the 2.0.0 release, -/// fcvImageDiffu8_v2 will be renamed to fcvImageDiffu8 -/// and the signature of fcvImageDiffu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Destination. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageDiffu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageDiffu8, -/// \a fcvImageDiffu8_v2 will be removed, and the current signature -/// for \a fcvImageDiffu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageDiffu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//-------------------------------------------------------------------------- -/// @brief -/// Compute image difference src1-src2 -/// -/// @param src1 -/// Input image1 of int16 type. Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image2, must have same size as src1 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output image, saturated for int16 type. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -////------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by promoting both src1 and src 2 to -/// floating point values and then subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Destination image in float type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. -/// dst = ( src1 >> 1) - ( src2 >> 1). -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Destination image in int8 type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleaveds16_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleaveds16_v2 will be renamed to fcvImageGradientInterleaveds16 -/// and the signature of fcvImageGradientInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientInterleaveds16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleaveds16, -/// \a fcvImageGradientInterleaveds16_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleaveds16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @param gradStride -/// Stride in bytes of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as 4*(srcWidth-2). -/// \n\b WARNING: should be multiple of 16 ( 8 * 2-byte values ), and at least as much as 4*(srcWidth-2) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize MSER. To invoke MSER functionality, 3 functions have to be called: -/// fcvMserInit, fcvMseru8, fcvMserRelease. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMseru8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param width -/// Width of the image for which MSER has to be done. -/// -/// @param height -/// Height of the image for which MSER has to be done. -/// -/// @param delta -/// Delta to be used in MSER algorithm (the difference in grayscale values -/// within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// -/// @param minArea -/// Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// -/// @param maxArea -/// Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// -/// @param maxVariation -/// Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// -/// @param minDiversity -/// Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// -/// @param mserHandle -/// Output. the mserHandle to be used in subsequent calls. -/// -/// @return -/// 1 if successful. -/// 0 if unsuccessful, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea, - unsigned int maxArea, - float maxVariation, - float minDiversity, - void ** mserHandle ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to release MSER resources. -/// -/// @param mserHandle -/// Handle to be used to free up MSER resources. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserRelease(void *mserHandle); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMseru8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMseru8_v2(). In the 2.0.0 release, -/// fcvMseru8_v2 will be renamed to fcvMseru8. -/// and the signature of fcvMseru8 as it appears now, will be removed. -/// \n\n -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up for the -/// first (*numContours) values. This memory has to be allocated by the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, - unsigned int * __restrict numPointsInContour, - unsigned int pointsArraySize, - unsigned int * __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER, with additional outputs for each contour. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvMserExtu8 (mserHandle,...); -/// fcvMserRelease(mserHandle); -/// } -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMserExtu8_v2(). In the 2.0.0 release, -/// fcvMserExtu8_v2 will be renamed to fcvMserExtu8. -/// and the signature of fcvMserExtu8 as it appears now, will be removed. -/// \n\n -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// Application dependent. OCR usually requires 100-1000 contours. -/// Segmentation usually requires 50-100 -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image)*30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region; -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, - unsigned int * __restrict numPointsInContour, - unsigned int * __restrict pointsArray, - unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint and the (optional) output of contour bound boxes. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMseru8_v2 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMseru8_v2( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint, -/// the (optional) output of contour bound boxes, and additional information. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtu8_v2 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtu8_v2( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER with a smaller memory footprint, -/// the (optional) output of contour bound boxes, and additional information. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtu8_v3 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param staPointsInPath -/// Output. Return the index of contour starting points in pathArray. -/// This memory has to be allocated by the caller. The allocated size should be maxContours*sizeof(uint32_t). -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// -/// @param pathArraySize -/// Input. The size of output pathArray in terms of how many uint16_t numbers. Must be srcWidth*srcHeight*4. -/// Note: this parameter is not measured in terms of bytes. -/// -/// @param pathArray -/// Output. This is the compressed representation of points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pathArraySize*sizeof(uint16_t). -/// For example: -/// pathArray[ staPointsInPath[0] ] : x coord of the FIRST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 1 ] : y coord of the FIRST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 2 ] : x coord of the SECOND point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 3 ] : y coord of the SECOND point in the FIRST mser region. -/// . . . -/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 2 ] : x coord of the LAST point in the FIRST mser region. -/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 1 ] : y coord of the LAST point in the FIRST mser region. -/// and -/// pathArray[ staPointsInPath[1] ] : x coord of the FIRST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 1 ] : y coord of the FIRST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 2 ] : x coord of the SECOND point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 3 ] : y coord of the SECOND point in the SECOND mser region. -/// . . . -/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 2 ] : x coord of the LAST point in the SECOND mser region. -/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 1 ] : y coord of the LAST point in the SECOND mser region. -/// . . . -/// -/// @param contourVariation -/// Output, Variation for each contour from previous grey level. -/// This will have values filled up for the first (*numContours) values. -/// This memory has to be allocated by the caller with size of maxContours. -/// -/// @param contourPolarity -/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @param contourNodeId -/// Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// -/// @param contourNodeCounter -/// Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtu8_v3( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict staPointsInPath, - uint32_t* __restrict numPointsInContour, - uint32_t pathArraySize, - uint16_t* __restrict pathArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize 8-neighbor MSER. To invoke 8-neighbor MSER functionality, 3 functions have to be called: -/// fcvMserNN8Init, fcvMserNN8u8, fcvMserRelease. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param width -/// Width of the image for which MSER has to be done. -/// -/// @param height -/// Height of the image for which MSER has to be done. -/// -/// @param delta -/// Delta to be used in MSER algorithm (the difference in grayscale values -/// within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// -/// @param minArea -/// Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// -/// @param maxArea -/// Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// -/// @param maxVariation -/// Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// -/// @param minDiversity -/// Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// -/// @param mserHandle -/// Output. the mserHandle to be used in subsequent calls. -/// -/// @return -/// 1 if successful. -/// 0 if unsuccessful, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserNN8Init(const uint32_t width, - const uint32_t height, - uint32_t delta, - uint32_t minArea , - uint32_t maxArea , - float32_t maxVariation , - float32_t minDiversity , - void **mserHandle ); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke 8-neighbor MSER. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @param numPointsInContour -/// Output, Number of points in each contour. This will have values filled up for the -/// first (*numContours) values. This memory has to be allocated by the caller. -/// -/// @param pointsArraySize -/// Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// -/// @param pointsArray -/// Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize. -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserNN8u8 ( void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke 8-neighbor MSER, , with additional outputs for each contour. -/// Image width has to be greater than 50, and image height has to be greater than 5. -/// Pixels at the image boundary are not processed. If boundary pixels are important -/// for a particular application, please consider padding the input image with dummy -/// pixels of one pixel wide. -/// Here is the typical usage: -/// void *mserHandle; -/// if (fcvMserNN8Init (width,........,&mserHandle)) -/// { -/// if ( !fcvMserExtNN8u8 (mserHandle,...) ) -/// { -/// // Error handle -/// } -/// fcvMserRelease(mserHandle); -/// } -/// -/// @param mserHandle -/// The MSER Handle returned by init. -/// -/// @param srcPtr -/// Pointer to an image array (unsigned char ) for which MSER has to be done. -/// -/// @param srcWidth -/// Width of the source image. -/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. -/// -/// @param srcHeight -/// Height of the source image. -/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. -/// -/// @param srcStride -/// Stride of the source image. -/// -/// @param maxContours -/// Maximum contours that will be returned. -/// -/// @param numContours -/// Output, Number of MSER contours in the region. -/// -/// @param recArray -/// Output, This is the bounding rectangle info for each contour. -/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. -/// Typical allocation size: 4*maxContours. -/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, -/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. -/// -/// @return -/// 1 if successful. -/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. -/// In that case, please consider increasing maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserExtNN8u8(void *mserHandle, - const uint8_t* __restrict srcPtr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxContours, - uint32_t* __restrict numContours, - uint16_t* __restrict recArray, - uint32_t* __restrict numPointsInContour, - uint32_t pointsArraySize, - uint16_t* __restrict pointsArray, - uint32_t* __restrict contourVariation, - int8_t* __restrict contourPolarity, - uint32_t* __restrict contourNodeId, - uint32_t* __restrict contourNodeCounter); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleavedf32_v2 will be renamed to fcvImageGradientInterleavedf32 -/// and the signature of fcvImageGradientInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleavedf32, -/// \a fcvImageGradientInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: should be multiple of 32 ( 8 * 4-byte values ), and at least as much as 8 * srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanars16_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanars16_v2 will be renamed to fcvImageGradientPlanars16 -/// and the signature of fcvImageGradientPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientPlanars16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanars16, -/// \a fcvImageGradientPlanars16_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanars16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanarf32_v2 will be renamed to fcvImageGradientPlanarf32 -/// and the signature of fcvImageGradientPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanarf32, -/// \a fcvImageGradientPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride of Gradient values ('dx' and 'dy' arrays) measured in bytes. -/// \n\b NOTE: if 0, srcStride is set as 4*srcWidth. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value), and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold ); - -//------------------------------------------------------------------------------ -/// @brief -/// Local Harris Max applies the Harris Corner algorithm on an 11x11 patch -/// within an image to determine if a corner is present. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If srcStride == 0, then will use srcWidth. -/// -/// @param posX -/// Center X coordinate of the search window -/// -/// @param posY -/// Center Y coordinate of the search window -/// -/// @param maxX -/// pointer to the X coordinate identified as a corner -/// -/// @param maxY -/// pointer to the Y coordinate identified as a corner -/// -/// @param maxScore -/// pointer to the Harris score associated with the corner -/// -/// @return -/// 0 if no corner is found (maxX, maxY, and maxScore are invalid) -/// or if posX and/or posY position the patch outside of the range of -/// the source image. -/// 1 if a corner is found (maxX, maxY, and maxScore are valid) -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API unsigned int -fcvLocalHarrisMaxu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Respose" of a pixel for it to be -/// regarded as a corner. -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisInMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). It is an improved version -/// which is more robust to low contrast images. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be a multiple of 8. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisAdaptiveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t border, - float32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - int32_t threshold); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. -/// \n\b ATTENTION: Compared to fcvCornerHarrisu8, this API gives more accurate results -/// in exchange for slower execution time.\n\n -/// -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// @details -/// This function extracts Harris Corner features from the image. The input is -/// an unsigned 8 bit image. Based on the values of the kernel size, the block size, -/// the sensitivity, the function generates a Harris Response map (Harris Score). -/// This map is then thresholded using the threshold parameter to locate local maxima. -/// Additionally, if the Non Maximum Suppression flag is enabled, the function performs -/// non maximum suppression of the thresholded response using the min distance parameter -/// to calculate the neighborhood. -/// -/// @param src -/// Input unsigned 8 bit image from which corner features are to be detected -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input Image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param harrisResp -/// The computed Harris Response Map of the image. If the @param normalizeResponse flag is set, -/// then all values in the map are normalized between 0 and 255. If the @param normalizeResponse flag -/// is not set, then the map is not normalized to this range. -/// This buffer MUST be allocated as srcWidth*srcHeight*sizeof(float32_t). -/// -/// @param respStride -/// Harris response stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If respStride is equal to 0, -/// it will be set to srcWidth * sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y positions of the -/// detected corners. -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners that should be detected. The function exits when the -/// maximum number of corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. If the @param normalizeResponse flag is set, then this parameter MUST be a value between -/// 0 and 255. If the @param normalizeResponse flag is not set, then this parameter can be any value in the range of -/// int32_t. This parameter is used to threshold @param harrisResp to detect corner features. -/// -/// @param sensitivity -/// This parameter represents the sensitivity threshold from the Harris Stephens -/// equation. Typical values are between 0.04 and 0.06 -/// -/// @param kernelSize -/// Size of the Sobel Kernel used to compute the gradients from the input image -/// MUST be 3,5 or 7. -/// -/// @param blockSize -/// Size of an average block for computing a derivative covariation matrix over each -/// pixel neighborhood. -/// -/// @param nmsEnabled -/// A flag to enable or disable non maximum suppression. Set flag to 1 to enable it and -/// 0 to disable. -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param minDistance -/// The radial euclidean distance to perform non-maximum suppression. -/// -/// @param normalizeResponse -/// This parameter is a flag to enable or disable normalization of the harris response. -/// If it is set, then it enables normalization of the response to the range between 0 and 255. If it -/// is not set, then the response is NOT normalized to this range. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvCornerHarrisScoreu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict harrisResp, - uint32_t respStride, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - float32_t threshold, - float32_t sensitivity, - uint32_t kernelSize, - uint32_t blockSize, - uint32_t nmsEnabled, - float32_t minDistance, - uint32_t normalizeResponse); - - -//--------------------------------------------------------------------------- -/// @brief -/// Computes affine trans. for a given set of corresponding features points -/// using a linear least square colver based on Cholkesky decomposition. -/// -/// @param corrs -/// Correspondence data struct containing coords of points in two frames -/// -/// @param affine -/// 3 x 3 affine matrix (computed best fit affine transformation) -/// -/// @ingroup 3D_reconstruction -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified affine transformation against provided points -/// correspondences. Checks which correspondence members have a projection -/// error that is smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param affine -/// Affine matrix representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 if successfull -/// -1 if error value square is >= maxsqerr -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky homography fitting on specified points correspondences. -/// \n -/// \n [x_to] [ a11 a12 a13 ] [ x_from ] -/// \n [y_to] = [ a21 a22 a23 ] * [ y_from ] -/// \n [ 1 ] [ a31 a32 a33 ] [ 1 ] -/// \n note that all the correspondences are considered, if correspondence pairs -/// are smaller than 4, the API returns. If correspondence pairs are larger than -/// 4, the API takes all the correspondences into consideration using least -/// squared method. -/// -/// @details -/// Output precision is within 3e-3 -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// 3x3 floating point matrix formatted as @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvGeomHomographyEvaluatef32_v2(). In the 2.0.0 release, -/// fcvGeomHomographyEvaluatef32_v2 will be renamed to fcvGeomHomographyEvaluatef32 -/// and the signature of fcvGeomHomographyEvaluatef32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvGeomHomographyEvaluatef32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvGeomHomographyEvaluatef32, -/// \a fcvGeomHomographyEvaluatef32_v2 will be removed, and the current signature -/// for \a fcvGeomHomographyEvaluatef32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvGeomHomographyEvaluatef32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param errinliers -/// Output array for the error of indices of correspondences that passed -/// the test. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32_v2( const fcvCorrespondences* __restrict corrs, - float32_t* __restrict homography, - float32_t maxsqerr, - uint16_t* __restrict inliers, - float32_t*__restrict errinliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky pose fitting on specified points correspondences. -/// Takes a pose and uses the correspondences to refine it using iterative -/// Gauss-Newton optimization. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param minIterations -/// Minimum number of iterations to refine. -/// -/// @param maxIterations -/// Maximum number of iterations to refine. -/// -/// @param stopCriteria -/// Improvement threshold, iterations stop if improvement is less than this -/// value. -/// -/// @param initpose -/// Pose representing initial pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param refinedpose -/// Pose representing refined pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// Final reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update and compute the differential pose based on the specified points correspondences -/// This function and fcvGeomPoseOptimizeGNf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing differential pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update the pose based on the specified points correspondences -/// using Gauss-Newton optimization. This function and fcvGeomPoseEvaluateErrorf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseOptimizeGNf32( const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the reprojection error based on the input pose. -/// This function and fcvGeomPoseOptimizef32 can be used iteratively -/// to perform poseRefine (GN or LM).. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @return -/// Reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseEvaluateErrorf32( const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Checks which members have a projection error that is smaller than the -/// given one. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing relationship between ptTo and ptFrom -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param maxSquErr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numInliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Estimates a 6DOF pose -/// \n\b NOTE: Given the coordinates of three 3D points (in world reference frame), -/// and their corresponding perspective projections in an image, -/// this algorithm determines the position and orientation of the camera in -/// the world reference frame. The function provides up to four solutions -/// that can be disambiguated using a fourth point. -/// When used in conjunction with RANSAC, this function can perform efficient outlier rejection. -/// Two degenerate cases should be avoided when using this function: -/// - Indeterminate configuration: -/// When the three points are collinear in space, there will be a family of poses mapping the -/// three points to the same image points. -/// - Unstable configuration: -/// The camera center is located on a circular cylinder passing through the three points and -/// the camera optical axis is perpendicular to the plane derived by the three points. -/// With this configuration, a small change in the position of the three points will -/// result in a large change of the estimated pose.. -/// -/// @param corrs -/// 2D-3D correspondence points -/// -/// @param pose -/// computed pose (numPoses * 12 data) -/// -/// @param numPoses (max = 4) -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorr3x3s8_v2(). In the 2.0.0 release, -/// fcvFilterCorr3x3s8_v2 will be renamed to fcvFilterCorr3x3s8 -/// and the signature of fcvFilterCorr3x3s8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param dst -/// Output convolution. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorr3x3s8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorr3x3s8, -/// \a fcvFilterCorr3x3s8_v2 will be removed, and the current signature -/// for \a fcvFilterCorr3x3s8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorr3x3s8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output convolution. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. Border values are ignored in this function. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of float32_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth*sizeof(float32_t) if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8f32( const float32_t* __restrict kernel, - uint32_t N, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of int8_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param shift -/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(int16_t) bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int16_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth*sizeof(int16_t) if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8s16( const int8_t* __restrict kernel, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// NxN correlation with non-separable kernel. -/// Border values are ignored in this function. The filling of dst starts -/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). -/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. -/// -/// @param kernel -/// 2-D NxN kernel of int8_t. -/// -/// @param N -/// Dimension of kernel. -/// -/// @param shift -/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output correlation. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as -/// srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCorrNxNu8( const int8_t* __restrict kernel, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// 9x9 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep9x9s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep9x9s16_v2 will be renamed to fcvFilterCorrSep9x9s16 -/// and the signature of fcvFilterCorrSep9x9s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel in Q15. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmp -/// Temporary image buffer used internally. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep9x9s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmp, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 9x9 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep9x9s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep9x9s16, -/// \a fcvFilterCorrSep9x9s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep9x9s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep9x9s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Size = width * heigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 11x11 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep11x11s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep11x11s16_v2 will be renamed to fcvFilterCorrSep11x11s16 -/// and the signature of fcvFilterCorrSep11x11s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be >=12 elements with kernel[11]=0 -/// \n\b WARNING: should be 128-bit aligned. -/// \n\b NOTE: Normalized to Q1.15 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep11x11s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 11x11 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep11x11s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep11x11s16, -/// \a fcvFilterCorrSep11x11s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep11x11s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep11x11s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 13x13 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep13x13s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep13x13s16_v2 will be renamed to fcvFilterCorrSep13x13s16 -/// and the signature of fcvFilterCorrSep13x13s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep13x13s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 13x13 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep13x13s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep13x13s16, -/// \a fcvFilterCorrSep13x13s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep13x13s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep13x13s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 15x15 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep15x15s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep15x15s16_v2 will be renamed to fcvFilterCorrSep15x15s16 -/// and the signature of fcvFilterCorrSep15x15s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep15x15s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 15x15 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep15x15s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep15x15s16, -/// \a fcvFilterCorrSep15x15s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep15x15s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep15x15s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 17x17 correlation with separable kernel. -/// If src and dst point to the same address, it will do in-place. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep17x17s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep17x17s16_v2 will be renamed to fcvFilterCorrSep17x17s16 -/// and the signature of fcvFilterCorrSep17x17s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dst -/// Output correlation.. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep17x17s16( const int16_t* __restrict kernel, - const int16_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* dst ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// 17x17 FIR filter (convolution) with seperable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterCorrSep17x17s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep17x17s16, -/// \a fcvFilterCorrSep17x17s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep17x17s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep17x17s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// NxN correlation with separable kernel. -/// If srcImg and dstImg point to the same address -/// and srcStride equals to dstStride, it will do in-place. -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSize -/// Seperable kernel size. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterCorrSepNxNs16( const int16_t* __restrict kernel, - int knlSize, - const int16_t* srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* dstImg, - unsigned int dstStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// MxN correlation with separable kernel. -/// -/// @param kernelX -/// 1-D kernel of int8_t. The kernel is first applied to rows. -/// kernelX has Q factor equal to shift. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSizeX -/// Seperable kernel size of kernelX. -/// \n\b NOTE: kenrelX must be <= 32. -/// -/// @param kernelY -/// 1-D kernel of int8_t. The kernel is applied to columns after kernelX -/// is applied. It could be the same buffer as kernelX which makes it a -/// NxN symetric kernel. -/// kernelY has Q factor equal to shift. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param knlSizeY -/// Seperable kernel size of kernelY. -/// -/// @param shift -/// The Q factor of kernels. Output is right-shifted by 2*shift to compensate for two rounds of filtering -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Src image stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output correlation. Can do in-place filtering (i.e. dstImg=srcImg). -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// Output stride, stride of image is the number of bytes between column 0 of -/// row 1 and column 0 of row 2 in data memory. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterCorrSepMxNu8( const int8_t* kernelX, - uint32_t knlSizeX, - const int8_t* kernelY, - uint32_t knlSizeY, - int8_t shift, - const uint8_t* srcImg, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dstImg, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageIntensityStats_v2(). In the 2.0.0 release, -/// fcvImageIntensityStats_v2 will be renamed to fcvImageIntensityStats -/// and the signature of fcvImageIntensityStats as it appears now, -/// will be removed. -/// This API is the same as fcvImageIntensityStats_v2 with -/// FASTCV_UNBIASED_VARIANCE_ESTIMATOR -/// \n\n -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// @param varianceEstimator -/// variance estimator -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageIntensityStats_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - uint32_t recWidth, - uint32_t recHeight, - float32_t* mean, - float32_t* variance, - fcvVarianceEstimator varianceEstimator); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a histogram of intensities for a rectangular region of a grayscale -/// image. Bins each pixel into a histogram of size 256, depending on the -/// intensity of the pixel (in the range 0 to 255). -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param xBegin -/// x coordinate of top left of rectangle -/// -/// @param yBegin -/// y coordinate of top left of rectangle -/// -/// @param recWidth -/// Width of rectangular region -/// -/// @param recHeight -/// Height of rectangular region -/// -/// @param histogram -/// Array of size 256 for storing the histogram -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit image and adds an -/// unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatchu8_v2(). In the 2.0.0 release, -/// fcvIntegratePatchu8_v2 will be renamed to fcvIntegratePatchu8 -/// and the signature of fcvIntegratePatchu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatchu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatchu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatchu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatchu8() and fcvIntegratePatchu8_v2() with the addition of -/// extra parameters. This function has been added to allow for backward -/// compatibility with the original function. When the 2.0.0 release of this -/// library is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 and fcvIntegratePatchu8_v3 will be removed, and -/// the current signature for \a fcvIntegratePatchu8 and fcvIntegratePatchu8_v2 -/// will be removed. Until 2.0.0, the developer should use this implementation -/// with the expectation of renaming it to \a fcvIntegratePatchu8 when -/// transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlStride -/// Stride in bytes of the Integral Image -/// \n\b WARNING: should be multiple of 8. -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdStride -/// Stride in bytes of the Squared Integral Image -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvIntegratePatchu8_v3(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchX, - uint32_t patchY, - uint32_t patchW, - uint32_t patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t intgrlStride, - uint32_t* __restrict intgrlSqrdImgOut, - uint32_t intgrlSqrdStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch12x12u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch12x12u8_v2 will be renamed to fcvIntegratePatch12x12u8 -/// and the signature of fcvIntegratePatch12x12u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatch12x12u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch12x12u8, -/// \a fcvIntegratePatch12x12u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch12x12u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch12x12u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch18x18u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch18x18u8_v2 will be renamed to fcvIntegratePatch18x18u8 -/// and the signature of fcvIntegratePatch18x18u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvIntegratePatch18x18u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch18x18u8, -/// \a fcvIntegratePatch18x18u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch18x18u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch18x18u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Integrates one line of an image or any portion of an image that is -/// contiguous in memory. -/// -/// @param src -/// Input image. Size of buffer is srcWidth bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Number of pixels. -/// \n NOTE: bit width enforces numPxls < 2^16 -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegrateImageLineu8( const uint8_t* __restrict src, - uint16_t srcWidth, - uint32_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integrates 64 contiguous pixels of an image. -/// -/// @param src -/// Input image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageLine64u8( const uint8_t* __restrict src, - uint16_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// compute approximate mean and variance for the range of NFT4 float -/// descriptors where descriptor elements along dimension are treated -/// as random vars -/// -/// @param src -/// contiguous block of descriptors of dimension 36 -/// -/// @param first -/// index of the first descriptor in range array vind for computing mean and var -/// -/// @param last -/// index of the last descriptor in range array vind for computing mean and range -/// -/// @param vind -/// array of randomized indexes of descriptors -/// -/// @param means -/// buffer for approximate means, must be 36 long -/// -/// @param vars -/// buffer for approximate variances, must be 36 long -/// -/// @param temp -/// bufffer, must be 46 long -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @remark -/// If descriptor range is > 100 then only -/// 100 samples are drawn from the range to compute -/// approximate means and variances. -/// -/// Variances computed here do not have to be true variances because their -/// values do not matter in kdtrees. The only thing that matters is that -/// the ordering relation of variances is preserved -/// -/// -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvDescriptorSampledMeanAndVar36f32( const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnCircle8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnCircle8x8u8_v2 will be renamed to fcvNCCPatchOnCircle8x8u8 -/// and the signature of fcvNCCPatchOnCircle8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvNCCPatchOnCircle8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnCircle8x8u8, -/// \a fcvNCCPatchOnCircle8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnCircle8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnCircle8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnSquare8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnSquare8x8u8_v2 will be renamed to fcvNCCPatchOnSquare8x8u8 -/// and the signature of fcvNCCPatchOnSquare8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvNCCPatchOnSquare8x8u8 with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnSquare8x8u8, -/// \a fcvNCCPatchOnSquare8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnSquare8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnSquare8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvSumOfAbsoluteDiffs8x8u8_v2(). In the 2.0.0 release, -/// fcvSumOfAbsoluteDiffs8x8u8_v2 will be renamed to fcvSumOfAbsoluteDiffs8x8u8 -/// and the signature of fcvSumOfAbsoluteDiffs8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// The dst buffer shall be width X height bytes in length. -/// Output of SAD(A,B). dst[4][4] correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvSumOfAbsoluteDiffs8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvSumOfAbsoluteDiffs8x8u8, -/// \a fcvSumOfAbsoluteDiffs8x8u8_v2 will be removed, and the current signature -/// for \a fcvSumOfAbsoluteDiffs8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvSumOfAbsoluteDiffs8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param patchStride -/// Stride of the 8x8 template buffer -/// -/// @param dstStride -/// Stride of the patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param dst -/// The dst buffer shall be at least ( width x height ) values in length. -/// Output of SAD(A,B). dst[4][4]correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2u8_v2 will be renamed to fcvScaleDownBy2u8 -/// and the signature of fcvScaleDownBy2u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy2u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2u8, -/// \a fcvScaleDownBy2u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2Gaussian5x5u8_v2 will be renamed to fcvScaleDownBy2Gaussian5x5u8 -/// and the signature of fcvScaleDownBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2Gaussian5x5u8, -/// \a fcvScaleDownBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy4u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy4u8_v2 will be renamed to fcvScaleDownBy4u8 -/// and the signature of fcvScaleDownBy4u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/16 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownBy4u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy4u8_v2, -/// \a fcvScaleDownBy4u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy4u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy4u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/4 bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/4. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/4 if not 0. -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to 2/3 width and height by averaging 3x3 pixels -/// into one.. -/// -/// @details -/// A 3x3 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// Memory must be pre-allocated at least srcWidth * srcHeight * 2 / 3 -/// dstWidth = srcWidth/3*2 -/// dstHeight = srcHeight/3*2 -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return -/// 0 if successful -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// @details -/// Uses Nearest Neighbor method -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return -/// 0 if successful -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownu8_v2(). In the 2.0.0 release, -/// fcvScaleDownu8_v2 will be renamed to fcvScaleDownu8 -/// and the signature of fcvScaleDownu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension. -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleDownu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownu8, -/// \a fcvScaleDownu8_v2 will be removed, and the current signature -/// for \a fcvScaleDownu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleUpBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleUpBy2Gaussian5x5u8_v2 will be renamed to fcvScaleUpBy2Gaussian5x5u8 -/// and the signature of fcvScaleUpBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*width) x (2*height). -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleUpBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleUpBy2Gaussian5x5u8, -/// \a fcvScaleUpBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleUpBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleUpBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*dstStride) x (2*srcHeight). -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Translate to float and normalize 36 8-bit elements -/// -/// @param src -/// Pointer to the first input vector -/// -/// @param invLen -/// Pointer to inverse length of the first input vector -/// located right after each 36 element vector -/// -/// @param numVecs -/// Number of vectors to translate -/// -/// @param reqNorm -/// Required norm -/// -/// @param srcStride -/// Step in bytes to data of the next vector -/// Each vector has 36 8-bit elements and 1 float invLen -/// -/// @param dst -/// Pointer to contiguous block for output vectors -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param stopBuild -/// Allows other threads to break this function in the middle of processing. -/// When set to 1, the function will exit on the next iteration. -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @ingroup math_vector -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against 4 others. -/// -/// @details -/// SSD of one vector (a) against 4 others (b0,b1,b2,b3) using their given -/// inverse lengths for normalization. -/// \n\n SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenB -/// Inverse of vectors b0...b3 = 1/|b0|,... 1/|b3| -/// \n\b WARNING: array should be 128-bit aligned -/// -/// @param distances -/// Output of the 4 results { SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: array should be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict a, - float invLenA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - const float* __restrict invLenB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other 36-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict a, - float invLenA, - const int8_t* const * __restrict b, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sorting of 8 float numbers -/// -/// @details -/// Perform sorting of 8 scores in ascending order (output of SumOfSquaredDiffs) -/// -/// @param inScores -/// Input 8 element float array -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param outScores -/// Output is 8 element sorted float array -/// \n\b WARNING: array should be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSort8Scoresf32( float* __restrict inScores, float* __restrict outScores ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdu8_v2 will be renamed to fcvFilterThresholdu8 -/// and the signature of fcvFilterThresholdu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is srcWidth*srcHeight bytes. -/// If src equals to dst, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFilterThresholdu8( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* dst, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8_v2( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* dst, - unsigned int dstStride, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// The binarized image will be in the two values selected by user. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v3 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// @param trueValue -/// The value in type of uint8_t assigned to the destination pixel if the source is larger than threshold -/// -/// @param falseValue -/// The value in type of uint8_t assigned to the destination pixel if the source is smaller than or equal to threshold -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdu8_v3( const uint8_t* src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* dst, - unsigned int dstStride, - unsigned int threshold, - uint8_t trueValue, - uint8_t falseValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a pair of threshold values. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdRangeu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdRangeu8_v2 will be renamed to fcvFilterThresholdRangeu8 -/// and the signature of fcvFilterThresholdRangeu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to min(0) if it's value is greater than the higher threshold -/// or smaller than the lower threshold; -/// else, set the pixel to max(255). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// The lower threshold value for binarization. -/// -/// @param highThresh -/// The higher threshold value for binarization. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdRangeu8( const uint8_t* src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dst, - uint32_t dstStride, - uint8_t lowThresh, - uint8_t highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a pair of threshold values. -/// The binarized image will be in the two values selected by user. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterThresholdRangeu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdRangeu8, -/// \a fcvFilterThresholdRangeu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdRangeu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdRangeu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to min(0) if it's value is greater than the higher threshold -/// or smaller than the lower threshold; -/// else, set the pixel to max(255). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride, it will do in-place. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param lowThresh -/// The lower threshold value for binarization. -/// -/// @param highThresh -/// The higher threshold value for binarization. -/// -/// @param trueValue -/// The value in type of uint8_t assigned to the destination pixel if the source is -/// within the range inclusively defined by the pair of threshold values -/// -/// @param falseValue -/// The value in type of uint8_t assigned to the destination pixel if the source is -/// out of the range defined by the pair of threshold values -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterThresholdRangeu8_v2( const uint8_t* src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* dst, - uint32_t dstStride, - uint8_t lowThresh, - uint8_t highThresh, - uint8_t trueValue, - uint8_t falseValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterDilate3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterDilate3x3u8_v2 will be renamed to fcvFilterDilate3x3u8 -/// and the signature of fcvFilterDilate3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterDilate3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterErode3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterErode3x3u8_v2 will be renamed to fcvFilterErode3x3u8 -/// and the signature of fcvFilterErode3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterErode3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffine8x8u8_v2(). In the 2.0.0 release, -/// fcvTransformAffine8x8u8_v2 will be renamed to fcvTransformAffine8x8u8 -/// and the signature of fcvTransformAffine8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param nPatch -/// Transformed patch. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTransformAffine8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffine8x8u8, -/// \a fcvTransformAffine8x8u8_v2 will be removed, and the current signature -/// for \a fcvTransformAffine8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffine8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as 8. -/// \n\b WARNING: must be at least as much as 8 if not 0. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcvWarpPerspectiveu8_v2 will be renamed to fcvWarpPerspectiveu8 -/// and the signature of fcvWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection matrix using -/// bilinear interpolation. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcv3ChannelWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcv3ChannelWarpPerspectiveu8_v2 will be renamed to fcv3ChannelWarpPerspectiveu8 -/// and the signature of fcv3ChannelWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight*3 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight*3 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection -/// matrix using bilinear interpolation. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcv3ChannelWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcv3ChannelWarpPerspectiveu8, -/// \a fcv3ChannelWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcv3ChannelWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcv3ChannelWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth*3. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*3 if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth*3. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth*3 if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension dim. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surface of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension 36. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * 36. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surphace of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s16_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s16_v2 will be renamed to fcvFilterGaussian5x5s16 -/// and the signature of fcvFilterGaussian5x5s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// \n\b NOTE: Size of buffer is srcWidth*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s16, -/// \a fcvFilterGaussian5x5s16_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s32_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s32_v2 will be renamed to fcvFilterGaussian5x5s32 -/// and the signature of fcvFilterGaussian5x5s32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int32_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian5x5s32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s32, -/// \a fcvFilterGaussian5x5s32_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s32 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Input Image stride in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*sizeof(int32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output Image stride in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Segments an image (3 or 1 channel) into meaningful regions, -/// depending on the color or gray scale uniformity of the neighborhood pixels. -/// -/// @param src -/// Pointer to 8-bit color (3-channel) or grayscale (1-channel) image. -/// -/// @param srcWidth -/// Width of src image, measured by pixels. -/// -/// @param srcHeight -/// Height of src image, measured by pixels. -/// -/// @param srcStride -/// Stride of src image, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. -/// -/// @param numChannel -/// Number of channels of src image. 1 for gray scale and 3 for color image. -/// -/// @param thresholdSplit -/// Threshold for region split. Higher value: larger uniform region segmented. -/// Range of 3-channel image segmentation 20~500: 20~50 for heavy over-segmentation, 50~100 for median over-segmentation, 100~150 for light over-segmentation, 150~250 for normal segmentation, 250~400 for light under-segmentation, 400~500 for heavy under-segmentation. -/// Range of 1-channel image segmentation 3~150: 3~10 for heavy over-segmentation, 10~15 for median over-segmentation, 15~25 for light over-segmentation, 25~50 for normal segmentation, 50~75 for light under-segmentation, 75~150 for heavy under-segmentation. -/// -/// @param thresholdMerge -/// Threshold for region merge, measured by the region area (pixels). Higher value: larger uniform region segmented. Range 10~1000 for VGA size image. -/// Range of 3-channel image segmentation 10~1000: 10~30 for heavy over-segmentation, 30~60 for median over-segmentation, 60~150 for light over-segmentation, 150~400 for normal segmentation, 400~600 for light under-segmentation, 600~1000 for heavy under-segmentation. -/// Same for the 1-channel image. -/// For other image size, please tune the thresholdMerge value proportional to the VGA size. -/// -/// @param segLabel -/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. -/// -/// @param segLabelStride -/// Stride of segmented labels, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. -/// -/// @param data -/// data buffer for inner function buffer allocation. The buffer size is recommended below, -/// for 3-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*18*sizeof(uint8_t) ); -/// for 1-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*16*sizeof(uint8_t) ); -/// -/// @return -/// 0 if successful. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API uint32_t -fcvImageSegmentationRegionGrow( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numChannel, - uint32_t thresholdSplit, - uint32_t thresholdMerge, - uint32_t* __restrict segLabel, - uint32_t segLabelStride, - uint8_t* __restrict data ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffineu8_v2(). In the 2.0.0 release, -/// fcvTransformAffineu8_v2 will be renamed to fcvTransformAffineu8 -/// and the signature of fcvTransformAffineu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTransformAffineu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffineu8, -/// \a fcvTransformAffineu8_v2 will be removed, and the current signature -/// for \a fcvTransformAffineu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffineu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, patchStride is set as patchWidth. -/// \n\b WARNING: must be at least as much as patchWidth if not 0. -/// -/// @return -/// 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts a 17x17 rotation corrected patch from a 25x25 image. -/// -/// @param src -/// 25x25 input image in continuous memory. -/// -/// @param dst -/// 17x17 output patch. -/// -/// @param orientation -/// Rotation angle of patch relative to src. -/// \n 10-bit fixed-point angle around unit circle. -/// \n NOTE: 0 = 0 degrees and 1024 = 360 degrees. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCopyRotated17x17u8( const uint8_t* __restrict src, - uint8_t* __restrict dst, - int orientation ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied vector. -/// -/// @param src -/// Pointer to vector to count bits that are 1. -/// -/// @param srcLength -/// Length of the vector to count bits. Assumed that the remainder of bits modulo 8 -/// will be set to 0 a priori. -/// -/// @return -/// total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu8( const uint8_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied 32-byte vector. -/// -/// @param src -/// Pointer to 32-byte vector(s) to count bits that are 1. -/// -/// @return -/// total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to count bits. -/// -/// @param b -/// Pointer to 32-byte vector to count bits. -/// -/// @param c -/// Pointer to 32-byte vector to count bits. -/// -/// @param d -/// Pointer to 32-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount32x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 64-byte vector. -/// -/// @param src -/// Pointer to 64-byte vector(s) to count bits. -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to count bits. -/// -/// @param b -/// Pointer to 64-byte vector to count bits. -/// -/// @param c -/// Pointer to 64-byte vector to count bits. -/// -/// @param d -/// Pointer to 64-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied vector of unsigned intergers. -/// -/// @param src -/// Pointer to vector(s) to count bits. -/// -/// @param srcLength -/// Number of elements in vector -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu32( const uint32_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied arbitrary length -/// vectors. -/// -/// @param a -/// Pointer to vector to compute distance. -/// -/// @param b -/// Pointer to vector to compute distance. -/// -/// @param abLength -/// Length in bits of each of the vectors. Assumed that the remainder of -/// bits modulo 8 will be set to 0 a priori. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte -/// vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// 8-bit image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// \n\b NOTE: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// Grayscale image with one byte per pixel -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: should be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvCornerFast9Scoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9Scoreu8, -/// \a fcvCornerFast9Scoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9Scoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9Scoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvCornerFast9InMaskScoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9InMaskScoreu8, -/// \a fcvCornerFast9InMaskScoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9InMaskScoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9InMaskScoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: should be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// \n\b WARNING: If border < 3, it will be default to 3. -/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is the highest threshold that can still validate the detected corner. -/// Must be greater than barrier. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight. The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key -/// points before NMS -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. Bitwidth optimized implementation -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTrackLKOpticalFlowu8_v2(). In the 2.0.0 release, -/// fcvTrackLKOpticalFlowu8_v2 will be renamed to fcvTrackLKOpticalFlowu8 -/// and the signature of fcvTrackLKOpticalFlowu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int srcWidth, - int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow (with stride so ROI can be supported) -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, -/// \a fcvTrackLKOpticalFlowu8_v2 will be removed, and the current signature -/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a ffcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input image width. -/// -/// @param height -/// Input image height. -/// -/// @param stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. -/// NOTE: should be a multiple of 8. -/// -/// @param src1Pyr -/// Image Pyramid of src1 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t width, - uint32_t height, - uint32_t stride, - const fcvPyramidLevel_v2 *src1Pyr, - const fcvPyramidLevel_v2 *src2Pyr, - const float32_t* featureXY, - float32_t* featureXY_out, - int32_t* featureStatus, - int32_t featureLen, - int32_t windowWidth, - int32_t windowHeight, - int32_t maxIterations, - int32_t nPyramidLevels); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. -/// -/// \n\b ATTENTION: This function will be removed when the 2.0.0 release of this library -/// is made. Until 2.0.0, the developer should use this implementation with the expectation of -/// using \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// \n\b NOTE: Possible status are : -/// \n TRACKED 1 -/// \n NOT_FOUND -1 -/// \n SMALL_DET -2 -/// \n MAX_ITERATIONS -3 -/// \n OUT_OF_BOUNDS -4 -/// \n LARGE_RESIDUE -5 -/// \n SMALL_EIGVAL -6 -/// \n INVALID -99 -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE : Suggest that be set to between 0.1 and 0.2, say 0.15 -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of float32 arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidCreatef32_v2(). In the 2.0.0 release, -/// fcvPyramidCreatef32_v2 will be renamed to fcvPyramidCreatef32 -/// and the signature of fcvPyramidCreatef32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param srcHeight -/// Height of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32( const float* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid (with stride). -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete_v2 -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreatef32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreatef32, -/// \a fcvPyramidCreatef32_v2 will be removed, and the current signature -/// for \a fcvPyramidCreatef32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreatef32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// width of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevel -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// \n\b NOTE: If left at 0, pyramid (non-base) image stride is the same as its srcWidth*sizeof(float32_t) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param fcvPyramidLevel_v2 -/// output pyramid (with stride) of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32_v2( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidLevel_v2* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of uint8_t arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvPyramidCreateu8_v2(). In the 2.0.0 release, -/// fcvPyramidCreateu8_v2 will be renamed to fcvPyramidCreateu8 -/// and the signature of fcvPyramidCreateu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^(numLevels-1) -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: must be a multiple of 2^(numLevels-1) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid (with stride). -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreateu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreateu8, -/// \a fcvPyramidCreateu8_v2 will be removed, and the current signature -/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// width of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: Needs to be a multiple of 2^numLevel -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: Needs to be a multiple of 2^numLevels -/// \n\b NOTE: Pyramid (non-base) image stride is the same as its width -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param fcvPyramidLevel_v2 -/// output pyramid (with stride) of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8_v2( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidLevel_v2* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds a Gaussian image pyramid. -/// DO NOT USE THIS API unless for testing purposes. -/// This API can be removed without notice. -/// -/// @details -/// This function builds a Gaussian image Pyramid given an input image. Each level -/// of the pyramid is computed by first applying a gaussian filter on the previous level, -/// and then scaling the image based on the type of scale factor selected. The memory for -/// the pyramid must be allocated using fcvPyramidAllocate_v3(), and should be -/// deallocated using fcvPyramidDelete_v2() -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvPyramidCreateu8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvPyramidCreateu8, -/// \a fcvPyramidCreateu8_v3 will be removed, and the current signature -/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// base image -/// -/// @param srcWidth -/// Width of base image -/// -/// @param srcHeight -/// Height of base image -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory (base image). -/// \n\b NOTE: The stride of pyramid levels other than the base are set to be the same as their width -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param scale -/// Defines the type of scaling used for each pyramid level. -/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. -/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), -/// which is approximated as 0.8408964f -/// -/// @param pyramidGaussian -/// output pyramid of "numLevels" images of the same type as src . -/// pyramidGaussian[0] will be the same as src . pyramidGaussian[1] is the next -/// pyramid layer, a smoothed and scaled src, and so on. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPyramidCreateu8_v3(const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numLevels, - fcvPyramidScale scale, - fcvPyramidLevel_v2* __restrict pyramidGaussian); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of int16_t from an image pyramid of uint8_t -/// -/// @param imgPyr -/// Input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of float32 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatef32( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of integer8 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei8( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16_v2 and -/// fcvImageGradientSobelPlanars16_v3 as it appears now, will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as (srcWidth*sizeof(int16_t)). -/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes central differences on 3x3 neighborhood and then convolves -/// the result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanars16_v2() with a change in behavior: no normalization -/// at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars16, -/// \a fcvImageGradientSobelPlanars16_v2 and fcvImageGradientSobelPlanars16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelPlanars16 -/// and fcvImageGradientSobelPlanars16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 and -/// fcvImageGradientSobelInterleaveds16_v2 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(int16_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// \n Compared to the original and v2 functions, this v3 functions does not normalize -/// \n the gradients (divide by 8). It just returns the actual dx, dy values. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelInterleaveds16_v2() with a change in behavior: no -/// normalization at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleaveds16, -/// \a fcvImageGradientSobelInterleaveds16_v2 and fcvImageGradientSobelInterleaveds16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelInterleaveds16 -/// and fcvImageGradientSobelInterleaveds16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the interleaved gradients array. If left at 0 gradStride is default to 4 * (srcWidth-2). -/// \n\b WARNING: should be multiple of 8. -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleavedf32_v2 will be renamed to fcvImageGradientSobelInterleavedf32 -/// and the signature of fcvImageGradientSobelInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 floats in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleavedf32, -/// \a fcvImageGradientSobelInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: should be multiple of 8, and at least as much as (srcWidth-2)*2*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars8_v2 will be renamed to fcvImageGradientSobelPlanars8 -/// and the signature of fcvImageGradientSobelPlanars8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanars8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars8, -/// \a fcvImageGradientSobelPlanars8_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanars8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32_v2 will be renamed to fcvImageGradientSobelPlanarf32 -/// and the signature of fcvImageGradientSobelPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32, -/// \a fcvImageGradientSobelPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as 4*srcWidth. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value),and at least as much as srcWidth*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32f32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32f32_v2 will be renamed to fcvImageGradientSobelPlanarf32f32 -/// and the signature of fcvImageGradientSobelPlanarf32f32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels (not bytes) between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageGradientSobelPlanarf32f32()() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32f32(), -/// \a fcvImageGradientSobelPlanarf32f32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32f32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32f32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride (in bytes) of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*4. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value). -/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, dxyStride is set as srcWidth*4. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Block Optical Flow 16x16 - Tracks all 16x16 blocks in the Region of Interest -/// (ROI) from Source-1 to Source-2. Generates Motion Vectors for blocks where -/// motion is detected. -/// -/// @details -/// -/// @param[in] src1 -/// Pointer to source image where the original blocks are present. -/// \n Dimensions should be same as \a src2, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: should be 128-bit aligned. Buffer size is srcStride*srcHeight bytes. -/// -/// @param[in] src2 -/// Pointer to second source image where motion vectors for blocks in \a img1 -/// are to be located. -/// \n Dimensions should be same as \a src1, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param[in] srcWidth -/// Width of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcHeight -/// Height of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcStride -/// Stride of source images pointed by \a src1 and \a src2. -/// -/// @param[in] roiLeft -/// Left co-ordinate (x0) of Region-of-Interest (ROI). -/// -/// @param[in] roiTop -/// Top co-orgdinate (y0) of Region-of-Interest (ROI). -/// -/// @param[in] roiRight -/// Right co-ordinate (x1) of Region-of-Interest (ROI). -/// -/// @param[in] roiBottom -/// Bottom co-ordinate (y1) of Region-of-Interest (ROI). -/// -/// @param[in] shiftSize -/// Distance in number of pixels (both horizontally and vertically) between -/// consecutive blocks for which motion vector is searched. -/// \n\b NOTE: Larger the value, less number of blocks will be tracked, and -/// hence the function will run faster. -/// -/// @param[in] searchWidth -/// Numbers of pixels horizontally on left and right of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchHeight -/// Numbers of pixels vertically on top and bottom of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchStep -/// Distance in number of pixels between consecutive search targets within -/// the above search window. -/// \n\b NOTE: Larger the value, more coarse the search will be and thus -/// will make the fucntion run faster. Smaller the value, more dense the -/// search will be, making the funciton run slower. -/// -/// @param[in] usePrevious -/// Indicates if the function should use the existing motion vectors in -/// locX and locY as the starting point for motion vector search. -/// \n\b NOTE: This parameter is redundant at the moment. -/// -/// @param[out] numMv -/// Pointer to variable that will store the count of Motion Vectors -/// generated by the function. -/// \n\b WARNING: This pointer should be Non-NULL. -/// -/// @param[out] locX -/// Pointer to an array which will store the X co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] locY -/// Pointer to an array which will store the Y co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvX -/// Pointer to an array which will store the X co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvX[i]-\a locX[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvY -/// Pointer to an array which will store the Y co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvY[i]-\a locY[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: -/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @return -/// 0 - Success, Failure otherwise. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY); - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a set of patches within the source image for the max NCCs. The search -/// regions are corresponding to the patches in the search list. -/// -/// @param patches -/// Pointer to a set of 8-bit patches, each patch takes patchWidth *patchHeight pixel -/// values which are linearly laid out in memory. -/// \n\b WARNING: patchWidth * patchHeight must be <= 256 -/// -/// @param patchWidth -/// Width in pixels of the patch. -/// -/// @param patchHeight -/// Height in pixels of the patch. -/// -/// @param src -/// Pointer to 8-bit image for search. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param srcStride -/// The stride of the imge. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param searchCenterX -/// The list of Center X coordinate of each search window -/// -/// @param searchCenterY -/// The list of Center Y coordinate of each search window -/// -/// @param searchWidth -/// Width of search range in pixels -/// \n\b WARNING: must be odd number. -/// -/// @param searchHeight -/// Height of search range in pixels -/// \n\b WARNING: must be odd number. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// the block of src or patch. -/// -/// @param bestX -/// The list of Center X location on the image of the best NCC matches. -/// The center X has (patchWidth/2) pixels to the left and -/// (patchWidth - (patchWidth/2) - 1) to the right. -/// -/// @param bestY -/// The list of Center Y location on the image of the best NCC matches. -/// The center Y has (patchWidth/2) pixels above and -/// (patchWidth - (patchWidth/2) - 1) below. -/// -/// @param bestNCC -/// NCC value of the best match blocks. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to bestX. -/// \n e.g., float x = (float)bestX + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to bestY. -/// -/// @param numSearches -/// number of patch searches in the image. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNCCPatchesOnRectu8 ( const uint8_t* __restrict patches, - uint32_t patchWidth, - uint32_t patchHeight, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint32_t * __restrict searchCenterX, - const uint32_t * __restrict searchCenterY, - uint32_t searchWidth, - uint32_t searchHeight, - int32_t filterLowVariance, - uint32_t* __restrict bestX, - uint32_t* __restrict bestY, - uint32_t* __restrict bestNCC, - int32_t findSubPixel, - float32_t* __restrict subX, - float32_t* __restrict subY, - uint32_t numSearches ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 8-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 8-bit source image 1. -/// -/// @param src2 -/// Pointer to the 8-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOru8(const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 32-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 32-bit source image 1. -/// -/// @param src2 -/// Pointer to the 32-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOrs32(const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to grayscale -/// -/// @details -/// -/// @param src -/// Source 8-bit image, BGR888 format (R is lowest byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Destination 8-bit gray-scale image. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcStride as default -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API void -fcvColorRGB888ToGrayu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integral of the image tilted by 45 degrees -/// -/// @details -/// Calculates the tilted integral image of an input image -/// and adds an zero-filled border on top. Left border not zero. -/// dst[i,j]=sum (src[m,n]), where n according to -/// descDBTargetId. -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param descDBOldIdx -/// A pointer to uint32_t [numDescDB], -/// which stores the old index of the desc before sorting -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvLinearSearchPrepare8x36s8( uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict descDBOldIdx, - uint32_t numDescDB ); - -//--------------------------------------------------------------------------- -/// @brief -/// Perform linear search of descriptor in a database -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @param srcDesc -/// A pointer to int8_t [numSrcDesc][36], -/// which stores descriptors. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param srcDescInvLenQ38 -/// A pointer to uint32_t [numSrcDec], -/// which stores the inverse length of srcDesc. -/// The value is in Q38 format. -/// -/// @param srcDescIdx -/// A pointer to the dbLUT data -/// -/// @param numSrcDesc -/// Number of source descriptor -/// -/// @param targetsToIgnore -/// A list of target IDs to be ignored -/// -/// @param numTargetsToIgnore -/// Number of targets to be ignored -/// -/// @param maxDistanceQ31 -/// Maximum distance for correspondences. -/// In Q31 format. -/// -/// @param correspondenceDBIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of featuresDB -/// as a part of correspondences. -/// -/// @param correspondenceSrcDescIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of descriptors -/// as a part of correspondences. -/// -/// @param correspondenceDistanceQ31 -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output the distances -/// as a part of correspondences. -/// In Q31 format. -/// -/// @param maxNumCorrespondences -/// Maximum number of correspondences allowed -/// -/// @param numCorrespondences -/// Number of correspondences returned by this function -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondenceSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds only extreme outer contours in a binary image. There is no nesting -/// relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 -/// for all the contours. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image without any hierarchical relationships. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and organizes them into a two-level -/// hierarchy. At the top level, there are external boundaries of the -/// components. At the second level, there are boundaries of the holes. -/// If there is another contour inside a hole of a connected component, -/// it is still put at the top level. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and reconstructs a full hierarchy of -/// nested contours -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates assistant and intermediate data for contour -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @return -/// Pointer to allocated data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void* -fcvFindContoursAllocate( uint32_t srcStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Deallocates assistant and intermediate data for contour -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursDelete( void* contourHandle ); - -//------------------------------------------------------------------------------ -/// @brief -/// Solve linear equation system -/// Ax = b -/// -/// @details -/// -/// -/// @param A -/// The matrix contains coefficients of the linear equation system -/// -/// @param numRows -/// The number of rows for the matrix A -/// -/// @param numCols -/// The number of columns for the matrix A -/// -/// @param b -/// The right side value -/// -/// @param x -/// The solution vector -/// -/// -/// @return -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates a perspective transform from four pairs of the corresponding -/// points. -/// NOTE: in order to guarantee a valid output transform, any three points -/// in src1 or src2 cannot be collinear. -/// -/// @param src1 -/// Coordinates of quadrangle vertices in the source image -/// -/// @param src2 -/// Coordinates of the corresponding quadrangle vertices in the destination -/// image -/// -/// @param transformCoefficient -/// 3x3 matrix of a perspective transform -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ -FASTCV_API void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input uint8_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for the mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSetElementsu8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input int32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementss32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input float32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsf32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param value4 -/// Fourth uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param value4 -/// Fourth int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param value4 -/// Fourth float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines an enumeration to list threshold types used in fcvAdaptiveThreshold -//------------------------------------------------------------------------------ - -typedef enum { - FCV_THRESH_BINARY = 0, // value = value > threshold ? max_value : 0 - FCV_THRESH_BINARY_INV // value = value > threshold ? 0 : max_value -} fcvThreshType; - - -//--------------------------------------------------------------------------- -/// @brief -/// Binarizes a grayscale image based on an adaptive threshold value calculated from 3x3 Gaussian kernel. -/// -/// @details -/// For each pixel, the threshold is computed adaptively based on cross-correlation with a -/// 3x3 Gaussian kernel minus value (parameter). The standard deviation is used for Gaussian kernel. -/// For FCV_THRESH_BINARY threshold type, the pixel is set as maxValue if it's value is greater than the threshold; -/// else, it is set as zero. For FCV_THRESH_BINARY_INV threshold type, the pixel is set as zero if it's value is greater than the threshold; -/// else, it is set as maxValue. -/// -/// @param src -/// Pointer to the 8-bit input image. -/// -/// @param srcWidth -/// Width of source images pointed by src. -/// -/// @param srcHeight -/// Height of source images pointed by src. -/// -/// @param srcStride -/// Stride of source image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// -/// @param maxValue -/// The maximum integer value to be used. 0>1+8) *sizeof(uint32_t) -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param integralCrStride -/// The stride of integralCr. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 integralCrStride is default to (srcWidth>>1+8) *sizeof(uint32_t) -/// \n\b NOTE: should be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function finds the foreground. -/// -/// @details -/// This function tries to find a forgound in the current image (represented by: fgIntegralY, -/// fgIntegralCb, fgIntegralCr) based on the current background model (represented by: bgIntegralY, -/// bgIntegralCb, bgIntegralCr). For example, the tuple (bgIntegralY, bgIntegralCb, bgIntegralCr) may be -/// from a picture shooting a wall. Then the tuple (fgIntegralY, fgIntegralCb, fgIntegralCr) may be -/// the wall with a paint on it. Note that all the first six parameters are indicating integral images -/// that's computed from a YUV420 image, which maybe computed from the function: -/// fcvIntegrateImageYCbCr420PseudoPlanaru8. Generally the size of fgIntegralY and bgIntegralY are -/// (srcWidth+1)*(srcHeight+1). And the size of fgIntegralU, fgIntegralV, bgIntegralU and bgIntegralV -/// are (srcWidth/2+1)*(srcHeight/2+1). The value of the outputWidth and outputHeight are usually indicating -/// the desired block size. For example, if the user wants a 20x15 blocks on a 800x480 image. Then -/// outputWidth=800/20 and outputHeight=480/15. After return, if the value in the outputMask image is -/// 255, then a moving block is indicated, otherwise a non-moving block is indicated. -/// -/// @param bgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the background image. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param bgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the background image. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param bgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the background image. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param fgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. See the details. -/// \n\b NOTE: must be a multiple of 16. -/// -/// @param srcHeight -/// The height of the source image. See the details. -/// \n\b NOTE: must be a multiple of 2. -/// -/// @param srcYStride -/// The stride of the input source image's Y channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcCbStride -/// The stride of the input source image's Cb channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcCrStride -/// The stride of the input source image's Cr channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param outputMask -/// The output mask image. Each pixel represent the motion condition for a block in the original image. -/// Size of buffer is outputMaskStride*outputHeight bytes -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param outputWidth -/// The width of the output mask image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param outputHeight -/// The height of the output mask image. -/// -/// @param outputMaskStride -/// The stride of the output mask image. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 outputMaskStride is default to outputWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param threshold -/// The threshold that's used to decide if a block is moving or not. (recommend the value of 20). -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t * __restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// The input image/patch. Must be 32 bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// The actually number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShifts32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracku8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracks32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTrackf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - -//------------------------------------------------------------------------------ -/// @brief -/// Compute a singular value decomposition of a matrix of a float type -/// A = U*diag[w]*Vt; -/// It is used for solving problems like least-squares, under-determined linear systems, matrix -/// inversion and so forth. The algorithm used here does not compute the full U and V matrices -/// however it computes a condensed version of U and V described below which is sufficient to solve -/// most problems which use SVD. -/// -/// @details -/// -/// -/// @param A -/// The input matrix of dimensions m x n -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param m -/// The number of rows of matrix A -/// -/// @param n -/// The number of columns of matrix A -/// -/// @param w -/// The pointer to the buffer that holds n singular values. When m>n it -/// contains n singular values while when m 0 and less than or equal to 8. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. -/// The dimensions of the image are dstWidth = srcWidth - 2*radius, -/// and dstHeight = srcHeight - 2*radius. - -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: dstWidth = srcWidth - 2*radius, dstHeight = srcHeight - 2*radius. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvGLBPu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t radius, - uint32_t neighbors, - uint8_t *__restrict dst, - uint32_t dstStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Refine corner location -/// -/// @details -/// Refine the detected corners location into sub-Pixels which is more precise than integer pixels -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param blockWidth -/// Width of the location search window. -/// -/// @param blockHeight -/// Height of the location search window. -/// -/// @param maxIterations -/// Maximum number of iteration to refine -/// -/// @param stopCriteria -/// Improvement threshold, iteration stop if the corner position moves less by this value -/// -/// @param xyInitial -/// Pointer to the initial input array containing the interleaved x,y position of the corner -/// -/// @param nCorners -/// Number of the corners -/// -/// @param xyOut -/// Pointer to the output array containing the refined interleaved x,y position of the corner -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvCornerRefineSubPixu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t maxIterations, - float32_t stopCriteria, - const uint32_t*__restrict xyInitial, - uint32_t nCorners, - float32_t * __restrict xyOut); - -//--------------------------------------------------------------------------- -/// @brief -/// Extract strong corners from image to track -/// -/// @details -/// Extract strong corners from image to track based on the according paper "Good Feature to Track" by J.Shi and C.Tomasi -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param distanceMin -/// Minimum Euclidean distance between the found corners -/// -/// @param border -/// Number for pixels to ignore from top,bottom -/// -/// @param barrier -/// Quality threshold -/// -/// @param xy -/// Pointer to the output array containing the interleaved x,y position of the detected features -/// -/// @maxnumcorners -/// Maximum number of features to detect -/// -/// @numcorners -/// Pointer to integer of actual detected features number -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvGoodFeatureToTracku8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t distanceMin, - uint32_t border, - float32_t barrier, - uint32_t * __restrict xy, - uint32_t maxnumcorners, - uint32_t * __restrict numcorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Find multiple maxima along the normal direction of the line -/// -/// @param src -/// 8-bit input image -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride -/// -/// @param pos -/// 2D position to start searching maximas in the input image -/// -/// @param normal -/// Normalized line normal at pos -/// -/// @param maxDistance -/// Search distance along the normal direction; [-normal*maxDistance, normal*maxDistance] -/// -/// @param maxNumMaxima -/// Maximum maxima to find, e.g., 5 -/// -/// @param minGradient -/// Minimum 1D gradient of the pixels on the search line (normal direction) -/// -/// @param maxAngleDiff -/// Cosine value threshold to filter the pixels that have large angle difference -/// -/// @param maxima -/// List of found maxima 1D positions; Actuall 2D position of maxima = (normal * 1D position) + pos -/// -/// @param numMaxima -/// Number of found maxima -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFindMultipleMaximau8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict pos, - const float32_t* __restrict normal, - uint32_t maxDistance, - uint32_t maxNumMaxima, - int32_t minGradient, - float32_t maxAngleDiff, - float32_t* __restrict maxima, - uint32_t* __restrict numMaxima); - -//------------------------------------------------------------------------------ -/// @brief -/// Extract the straight line segments from the image -/// -/// @param srcPyr -/// Pointer to an array of fcvPyramidLevel_v2. Only 2 levels at max will be used -/// to extract the straight line segments. -/// -/// @param pyrLevel -/// Image pyramid level, if it is set to 1, then do not use multi-scale approach. -/// pyrLevel should be greater than or equal to 1. -/// -/// @param doBlurImage -/// Do image-blurring inside the function (if the image is not blurred) -/// -/// @param maxLineAngle -/// Cosine threshold to stop following (extending) pixels, e.g., cos(22.5 deg) -/// maxLineAngle should be between [0.5 - 1.0] -/// -/// @param minLineLength -/// Minimum line segment length in pixels -/// -/// @param minMagnitude -/// Minimum pixel gradient magnitude, e.g., 10 -/// -/// @param maxLineNum -/// Maximum line segments from the image -/// -/// @param indexBuffer -/// Optionally store the index(:= y * image_width + x) of the pixels consisting of the line segments -/// into pointsList in fcvLineSegment structure. e.g., One can provide the buffer[maxLineNum*(image width + height)] -/// Pass NULL if it is not necessary. -/// -/// @param lineSegments -/// List of the detected line segments -/// -/// @param numLineSegments -/// Number of found line segments -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageDetectLineSegmentsu8(const fcvPyramidLevel_v2* __restrict srcPyr, - uint32_t pyrLevel, - uint32_t doBlurImage, - float32_t maxLineAngle, - uint32_t minLineLength, - uint32_t minMagnitude, - uint32_t maxLineNum, - uint32_t* __restrict indexBuffer, - fcvLineSegment* __restrict lineSegments, - uint32_t* __restrict numLineSegments); - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one L-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } -/// \n\b WARNING: should be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffsu8( const uint8_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const uint8_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one floating vector of L-elements against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-elements vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffsf32( const float32_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const float32_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * pointStride. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param numPointsUsed -/// Total number of points used for clustering, {0,1,...(numPointsUsed-1)} -/// -/// @param numClusters -/// Number of clusters -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param newClusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numPointsUsed long. -/// -/// @param sumOfClusterDistances -/// the sum of distances between each cluster center to its belonging points. The -/// size should be numClusterCenters*sizeof(float_32) -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanu8( const uint8_t* __restrict points, - int32_t numPoints, - int32_t dim, - int32_t pointStride, - int32_t numPointsUsed, - int32_t numClusters, - float32_t* __restrict clusterCenters, - int32_t clusterCenterStride, - float32_t* __restrict newClusterCenters, - uint32_t* __restrict clusterMemberCounts, - uint32_t* __restrict clusterBindings, - float32_t* sumOfClusterDistances ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one uint8_t type matrix. -/// -/// @param src -/// Source matrix.The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposeu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one uint16_t type matrix. -/// -/// @param src -/// Source matrix. The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposeu16( const uint16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix transpose of one float32_t type matrix. -/// -/// @param src -/// Source matrix. The size of src is srcStride*srcHeight. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvTransposef32( const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Flip one uint8_t type matrix. If src and dst point to the same address -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix. If src equals to dst and srcStride equals to dstStride, -/// it will do in-place flip. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFlipu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvFlipDir dir ); - -//--------------------------------------------------------------------------- -/// @brief -/// Flip one uint16_t type matrix. If src and dst point to the same address, -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// -/// @param srcHeight -/// Height of the source matrix. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix. If src equals to dst and srcStride equals to dstStride, -/// it will do in-place flip. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFlipu16( const uint16_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t * dst, - uint32_t dstStride, - fcvFlipDir dir ); - -//------------------------------------------------------------------------------ -/// @brief -/// Flips an interleaved RGB image -/// -/// @details -/// Flips one uint8_t type interleaved RGB image . If src and dst point to the same address -/// and srcStride equals to dstStride, it will do in-place flip. -/// -/// @param src -/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the image. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride of the Image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. -/// If src equals to dst and srcStride equals to dstStride,it will do in-place flip. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, dstStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dir -/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvFlipRGB888u8(const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvFlipDir dir); - -//--------------------------------------------------------------------------- -/// @brief -/// Rotate one uint8_t type image. -/// -/// @param src -/// Source image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source image. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth -/// (FASTCV_ROTATE_180) or srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param degree -/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRotateImageu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvRotateDegree degree ); - -//--------------------------------------------------------------------------- -/// @brief -/// Rotate one interleaved uint8_t type image (e.g. UV channel in NV21). -/// -/// @param src -/// Source image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Number of interleaved pairs in one row. -/// For example, srcWidth = 4 in UVUVUVUV image row. -/// -/// @param srcHeight -/// Height of the source image. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 2*srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result image. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to 2*srcWidth -/// (FASTCV_ROTATE_180) or 2*srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param degree -/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRotateImageInterleavedu8( const uint8_t * src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride, - fcvRotateDegree degree ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvElementMultiplyu8u16( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (float32_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvElementMultiplyf32( const float32_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const float32_t * src2, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix multiplication of two int8_t type matrices. -/// -/// @param src1 -/// First source matrix. The size of src1 is src1Stride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src1Width -/// Width of the first source matrix. -/// \n\b NOTE: src1Width should not be larger than 131072 -/// -/// @param src1Height -/// Height of the first source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. The size of src2 is src2Stride*src1Width. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Width -/// Width of the second source matrix. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvMatrixMultiplys8s32( const int8_t * __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int8_t * __restrict src2, - uint32_t src2Width, - uint32_t src2Stride, - int32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix multiplication of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. The size of src1 is src1Stride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src1Width -/// Width of the first source matrix. -/// -/// @param src1Height -/// Height of the first source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. The size of src2 is src2Stride*src1Width. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Width -/// Width of the second source matrix. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvMatrixMultiplyf32( const float32_t * __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Width, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two uint8_t type blocks. -/// -/// @param src1 -/// First source block. -/// -/// @param blockWidth -/// Width of the source block. -/// -/// @param blockHeight -/// Height of the source block. -/// \n\b NOTE: blockWidth*blockHeight should not be larger than 65536 -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source block. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// Block dot product (uint32_t). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API uint32_t -fcvBlockDotProductu8( const uint8_t * __restrict src1, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two float32_t type blocks. -/// -/// @param src1 -/// First source block. -/// -/// @param blockWidth -/// Width of the source block. -/// -/// @param blockHeight -/// Height of the source block. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source block. -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// Block dot product (float32_t). -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API float32_t -fcvBlockDotProductf32( const float32_t * __restrict src1, - uint32_t blockWidth, - uint32_t blockHeight, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Stride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two uint8_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAddu8u16( const uint8_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - uint16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two int16_t type matrices with saturation. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). The result will be saturated to -/// int16_t. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAdds16( const int16_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - int16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two float32_t type matrices. -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (float32_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvAddf32( const float32_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const float32_t * __restrict src2, - uint32_t src2Stride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares. This function supports bigger size patch with u64 for squared -/// integral output. -/// \n\b NOTE: No extra border lines, the integral output buffer size is the same -/// as input image buffer size. -/// -/// @details -/// sum (X,Y) = sum_{x<=X,y<=Y} I(x,y) -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param dstIntgrl -/// Integral image. -/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*4 bytes -/// -/// @param dstIntgrlSqrd -/// Integral image of squared values. -/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*8 bytes -/// -/// @param dstIntgrlStride -/// dstIntgrl Image stride (in bytes). -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*4. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @param dstIntgrlSqrdStride -/// dstIntgrlSqrd Image stride (in bytes). -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*8. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageu8u64( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t* __restrict dstIntgrl, - uint64_t* __restrict dstIntgrlSqrd, - uint32_t dstIntgrlStride, - uint32_t dstIntgrlSqrdStride); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalize the image according to histogram value of the pixel intensity. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Pointer to output image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - - -FASTCV_API void -fcvImageHistogramEqualizeu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate histogram at image patches. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageSpatialHistogramu8_v2(). In the 2.0.0 release, -/// fcvImageSpatialHistogramu8_v2 will be renamed to fcvImageSpatialHistogramu8 -/// and the signature of fcvImageSpatialHistogramu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param numPatterns -/// Number of patterns to be computed in the histogram -/// -/// @param grid_x -/// The number of grids along x dimension -/// -/// @param grid_y -/// The number of grids along y dimension -/// -/// @param histogram -/// Output histogram -/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageSpatialHistogramu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numPatterns, - uint32_t grid_x, - uint32_t grid_y, - float32_t*__restrict histogram); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 3x3 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// NOTE: it will replace the fcvFilterSobel3x3u8 in fastCV 2.0.0. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel3x3u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 5x5 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel5x5u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes the gradient of the input image by convolution with the -/// 7x7 Sobel kernel. The Sobel kernel is not normalized in this function. -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the horizontal gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// If NULL, the vertical gradient will not be calculated. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param borderType -/// Define the behavior at the border. -/// See definition of fcvBorderType. -/// -/// @param borderValue -/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. -/// Ignored otherwise. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterSobel7x7u8s16( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - uint32_t dxyStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge detection with more controls to configurate the algorithm. -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. -/// The results are stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of the input image in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param kernelSize -/// The Sobel kernel size for calculating gradient. Supported sizes are 3, 5 and 7. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the norm of the -/// gradient at the pixel locations should be greater than 'lowThresh'. -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the norm of the gradient at the pixel should be -/// greater than 'highThresh'. -/// -/// @param normType -/// The norm definition to calculate the gradient magnitude. See fcvNormType. -/// -/// @param dst -/// Output 8-bit binarized image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// Edges are marked with pixels of 0xFF. The rest pixels have values of 0. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gx -/// Buffer to store horizontal gradient. Must be (gradStride)*(srcHeight) bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gy -/// Buffer to store vertical gradient. Must be (gradStride)*(srcHeight) bytes in size. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of 'gx' and 'gy' gradient arrays, -/// is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. -/// If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterCannyu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t kernelSize, - int32_t lowThresh, - int32_t highThresh, - fcvNormType normType, - uint8_t* __restrict dst, - uint32_t dstStride, - int16_t* __restrict gx, - int16_t* __restrict gy, - uint32_t gradStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Converts the bit depth of a single-channel uint8 image to int16_t type -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param shift -/// The number of bits to be right-shifted to adjust the output -/// \n\b NOTE: range from 0 to 8 -/// -/// @param dst -/// Output image which has the same dimension as the input image in int16_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth*2 -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvConvertDepthu8s16(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t shift, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Converts the bit depth of a single-channel int16_t image to uint8_t type -/// -/// @param src -/// Input int16_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth*2 -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param shift -/// The number of bits to be left-shifted to adjust the output -/// \n\b NOTE: range from 0 to 15 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// Output image which has the same dimension as the input image in uint8_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvConvertDepths16u8(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t shift, - fcvConvertPolicy policy, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Recursive Bilateral Filtering -/// -/// @details -/// The algorithm is described in paper Recursive Bilateral Filtering, ECCV2012 by Prof Yang Qingxiong -/// Different from traditional bilateral filtering, the bilateral filtering in this algorithm is actually performed in gradient domain. -/// The results are ususally better than tradition bilateral filters. Filtering is carried out in a recursive way, and it is efficient. -/// -/// @param src -/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// \n\b WARNING: should be multiple of 8. -/// -/// @param dst -/// Output uint8_t image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// \n\b WARNING: should be multiple of 8. -/// -/// @param sigmaColor -/// Filter sigma in the color space. Typical value 0.03f. Increasing this value means increasing the influence of the neighboring -///pixels of more different Color to the smoothing result. -/// -/// @param sigmaSpace -/// Filter sigma in the coordinate space. Typical value 0.1f. Increasing this value means increasing the influence of farther -/// pixels to the smoothing result. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBilateralFilterRecursiveu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - float32_t sigmaColor, - float32_t sigmaSpace ); - -//--------------------------------------------------------------------------- -/// @brief -/// Grow the seeds within the image to meaningful regions, -/// depending on the color or gray scale uniformity of the neighborhood pixels from the seeds. -/// -/// @param src -/// Pointer to 16-bit color (3-channel) or grayscale (1-channel) image. -/// -/// @param srcWidth -/// Width of src image, measured by pixels. -/// -/// @param srcHeight -/// Height of src image, measured by pixels. -/// -/// @param srcStride -/// Stride of src image, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. -/// -/// @param numChannel -/// Number of channels of src image. 1 for gray scale and 3 for color image. -/// -/// @param threshGrow -/// Threshold to grow the seed into a region. Higher value: larger uniform region grown. -/// Range of 3-channel image segmentation: 10~150. -/// Range of 1-channel image segmentation: 3~25. -/// -/// @param pointVector -/// A 2D point vector of seeds (provided by user) within the image. For N seeds, it is saved as [x0,y0,x1,y1,...,xN-1,yN-1]. -/// -/// @param numSeed -/// Number of seed points, equal to N used in pointVector. -/// -/// @param mode -/// Mode of seed grow. 0: distance measured with neighborhood pixel. 1: distance measured with seed pixel only. -/// -/// @param segLabel -/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. Pixels not grown from any seeds are labeled 0. -/// -/// @param segLabelStride -/// Stride of segmented labels, measured by bytes. -/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. -/// -/// @return -/// 0 if successful. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvImageSegmentationSeedRegionGrows16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numChannel, - uint32_t threshGrow, - const uint32_t* __restrict pointVector, - uint32_t numSeed, - uint8_t mode, - uint32_t* __restrict segLabel, - uint32_t segLabelStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the local subtractive and contrastive normalization of the image. -/// For each pixel of the image, the mean and optionally standard deviation -/// is calculated for the patch centered around the pixel. Then the pixel is -/// normalized by the local mean and optionally standard deviation. -/// -/// @param src -/// The input image. Must be 8 bit grayscale image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of src image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param patchWidth -/// Width in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param patchHeight -/// Height in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param useStdDev (0 or 1) -/// if 1, the dst will be normalized with standard deviation. -/// -/// @param dst -/// The output image. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param dstStride -/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth. -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNormalizeLocalBoxu8( const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchWidth, - uint32_t patchHeight, - uint32_t useStdDev, - int8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the local subtractive and contrastive normalization of the image. -/// For each pixel of the image, the mean and optionally standard deviation -/// is calculated for the patch centered around the pixel. Then the pixel is -/// normalized by the local mean and optionally standard deviation. -/// -/// @param src -/// The input image. Must be 32-bit float image. Size of buffer is -/// srcStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of src image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. -/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// -/// @param patchWidth -/// Width in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param patchHeight -/// Height in pixels of the patch to calculate local mean and standard deviation. -/// -/// @param useStdDev (0 or 1) -/// if 1, the dst will be normalized with standard deviation. -/// -/// @param dst -/// The output image. -/// Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. -/// \n\b NOTE:should be 128-bit aligned. -/// -/// @param dstStride -/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth*sizeof(float32_t). -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvNormalizeLocalBoxf32( const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t patchWidth, - uint32_t patchHeight, - uint32_t useStdDev, - float32_t * __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine two channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1 and src2 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Results in dst [d0 t0 d1 t1 d2 t2 d3 t3...] -/// \n\b NOTE: Perform the same functionality as fcvInterleaveu8. -/// -/// @param src1 -/// One of the input images ( For example, Cb or Cr component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, Cb or Cr component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine2Planesu8( const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine three channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1, src2 and src3 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Data in src3 [s0 s1 s2 s3...] -/// Results in dst [d0 t0 s0 d1 t1 s1 d2 t2 s2 d3 t3 s3...] -/// -/// @param src1 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// One of the input images ( For example, R or G or B component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*3. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine3Planesu8(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Combine four channels in an interleaved fashion -/// -/// @details -/// Interleave data from src1, src2, src3 and src4 to dst. -/// Data in src1 [d0 d1 d2 d3...] -/// Data in src2 [t0 t1 t2 t3...] -/// Data in src3 [s0 s1 s2 s3...] -/// Data in src3 [r0 r1 r2 r3...] -/// Results in dst [d0 t0 s0 r0 d1 t1 s1 r1 d2 t2 s2 r2 d3 t3 s3 r3...] -/// -/// @param src1 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src4 -/// One of the input images ( For example, R or G or B or A component) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src4Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src4Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The result image (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelCombine4Planesu8(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - const uint8_t *__restrict src4, - uint32_t src4Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extract channel as a single uint8_t type plane from an interleaved or multi-planar image format -/// -/// @details -/// -/// -/// @param src1 -/// The first plane in source image. For example, an intervealved RGB/RGBA plane or the Y plane. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source image. -/// -/// @param height -/// Height of the source image. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 src1Stride is default to the size required by corresponding image format. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The second plane in souce image if available; otherwise, left at 0. -/// For example, the intervealved CbCr plane in FASTCV_NV12/FASTCV_NV21; or the Cb plane in FASTCV_IYUV/FASTCV_YUV4. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0, src2Stride is default to width for FASTCV_NV12/FASTCV_NV21/FASTCV_YUV4 and width/2 for FASTCV_IYUV. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src3 -/// The third plane in souce image if available; otherwise, left at 0. -/// For example, the Cr plane in FASTCV_IYUV/FASTCV_YUV4. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src3Stride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 src3Stride is default to width for FASTCV_YUV4, and width/2 for FASTCV_IYUV. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param srcChannel -/// The index of the image channel to be extracted. Refer to fcvChannelType for details. -/// -/// @param srcFormat -/// The format of the source image. Different image formats require different src -/// and dst size. Refer to fcvImageFormat for details. -/// -/// @param dst -/// The result image (a uint8_t type plane). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0, dstStride is default to the size required by corresponding image format. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvChannelExtractu8( const uint8_t *__restrict src1, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - const uint8_t *__restrict src3, - uint32_t src3Stride, - fcvChannelType srcChannel, - fcvImageFormat srcFormat, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with MxN median filter (M,N have to be odd numbers) -/// -/// @details -/// Borders of m pixels in horizontal direction and n in vertical direction -/// are replaced with the source pixels, where m = (M-1)/2, n = (N-1)/2 -/// The NxN median filter applies on the image area -/// | a(n,m) , a(n,m+1), ..., a(n,srcWidth-m-1) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-n-1,m), ..., ..., a(srcHeight-n-1,srcWidth-m-1) |\n -/// -/// @param src -/// Input 16-bit signed image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth * 2. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// @param M -/// Filter kernel width -/// \n\b NOTE: kernel width should be an odd number -/// -/// @param N -/// Filter kernel height -/// \n\b NOTE: kernel height should be an odd number -/// -/// @param dst -/// Output 16-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth * 2 -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterMedianMxNs16( const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t M, - uint32_t N, - int16_t* __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the convolution of an image with an M x N Kernel -/// -/// @details -/// The function computes the convolution of an unsigned char input image -/// with an M x N kernel of type short. The output is of type short -/// and is of the same size as the input image. The convolution is computed -/// based on the type of Border handling selected. -/// -/// -/// @param kernel -/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes -/// The kernel can be normalized before passing in by making use of the shift parameter. -/// -/// -/// @param M -/// Width of the kernel -/// -/// @param N -/// Height of the kernel -/// -/// @param shift -/// This parameter can be used to normalize the input kernel by converting the data into -/// fixed point values. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param dst -/// Output image which has the same dimensions as the input matrix. -/// The output is of type short, and must be allocated as dstStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If dstStride is equal to 0, -/// it will be set to srcWidth * sizeof(int16_t). -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 to 255. -/// -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterConvolveMxNu8s16( const int16_t* __restrict kernel, - uint32_t M, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue ); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the convolution of a image with an M x N Kernel -/// -/// @details -/// The function computes the convolution of an unsigned char input image -/// with an M x N kernel of type short. The output is of type unsigned char -/// and is of the same size as the input image. The convolution is computed -/// based on the type of Border handling selected. -/// -/// -/// @param kernel -/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes -/// The kernel can be normalized before passing in by making use of the shift parameter. -/// -/// -/// @param M -/// Width of the kernel -/// -/// @param N -/// Height of the kernel -/// -/// @param shift -/// This parameter can be used to normalize the input kernel by converting the data into -/// fixed point values. Shift can be considered as Q factor of kernel. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param dst -/// Output image which has the same dimensions as the input matrix. -/// The output is of type unsigned char, and must be allocated as dstStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If dstStride is equal to 0, -/// it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFilterConvolveMxNu8(const int16_t* __restrict kernel, - uint32_t M, - uint32_t N, - int8_t shift, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - - -//--------------------------------------------------------------------------- -/// @brief -/// Smooth a uint8_t image with a 3x3 box filter with border handling scheme specified by user -/// -/// @details -/// smooth with 3x3 box kernel and normalize: -/// \n[ 1 1 1 -/// \n 1 1 1 -/// \n 1 1 1 ]/9 -/// -/// @param src -/// Input uint8_t image. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param dst -/// Output image which has the same type, and size as the input image. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBoxFilter3x3u8_v2( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterErode3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 255. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterErode3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of NxN neighborhood window. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param N -/// Dimension of the neighborhood window. -/// \n\b WARNING: must be an odd number -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterErodeNxNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t N, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterDilate3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values will be set to 0. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterDilate3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of NxN neighborhood window. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param N -/// Dimension of the neighborhood window. -/// \n\b WARNING: must be an odd number -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param tmp -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * height -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterDilateNxNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t N, - uint8_t* __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterGaussian3x3u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border is blurred by 0-padding adjacent values. -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterGaussian3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// with border handling scheme specified by user -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are extrapolated according to borderType. -/// The 3x3 mask convolves with the whole image area. -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param borderType -/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, -/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, -/// border values are ignored. The 3x3 mask convolves with the following image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param borderValue -/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, -/// set this value as 0. Can take values between 0 and 255. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvFilterMedian3x3u8_v3( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate histogram at image patches. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvImageSpatialHistogramu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageSpatialHistogramu8, -/// \a fcvImageSpatialHistogramu8_v2 will be removed, and the current signature -/// for \a fcvImageSpatialHistogramu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageSpatialHistogramu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param numPatterns -/// Number of patterns to be computed in the histogram -/// -/// @param grid_x -/// The number of grids along x dimension -/// -/// @param grid_y -/// The number of grids along y dimension -/// -/// @param histogram -/// Output histogram -/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) -/// -/// @param normalize_factor -/// Scale factor with float32_t type to normalize result. When set to 0, the result is -/// normalized by (srcWidth/grid_x) * (srcHeight/grid_y) -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvImageSpatialHistogramu8_v2( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t numPatterns, - uint32_t grid_x, - uint32_t grid_y, - float32_t*__restrict histogram, - float32_t normalize_factor); - -//------------------------------------------------------------------------------ -/// @brief -/// Image downscaling using bilinear method -/// -/// @param src -/// Input image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// If left at 0, srcStride is default to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width -/// -/// @param dstHeight -/// Output image height -/// -/// @param dstStride -/// Stride of image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// If left at 0, dstStride is default to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBLu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a Table Look-up transformation to a single-channel uint8 image -/// -/// @details -/// Each pixel in the input image is used to index into a look-up table and the indexed look-up table -/// value is then put into the output image -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @param lut -/// The Look-up Table given as a 256-element array of type uint8_t -/// -/// @param dst -/// Output image which has the same dimension as the input image in uint8_t type -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to srcWidth -/// \n\b NOTE: should be a multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvTableLookupu8( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t *__restrict lut, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v3 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @interpolation -/// Specifies the interpolation method to be used. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvWarpPerspectiveu8_v3( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float *__restrict projectionMatrix, - fcvInterpolationType interpolation ); - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v4 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data should be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: should be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: should be 128-bit aligned. -/// -/// Note: -/// The projection matrix follows the so-called inverse mapping convention. -/// It is applied to the dst coordinates to produce the corresponding -/// src coordinates. In other 3rd party tools, the so-called forward mapping -/// convention may be used, where the projection matrix refers to the one -/// applied to the src coordinates to produce the dst coordinates. -/// When comparing with 3rd party results, please make sure -/// the same convention of projection matrices are assumed. If not, -/// please transform the projection matrix into an equivalent form under -/// the forward mapping convention before feeding it into 3rd party tools. -/// -/// @interpolation -/// Specifies the interpolation method to be used. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvWarpPerspectiveu8_v4( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float *__restrict projectionMatrix, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue -); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a generic geometrical transformation to a greyscale uint8 image. -/// The interpolation method is specified through a parameter. -/// -/// @details -/// The greyscale of each pixel in the destination image is obtained from a location of the source image -/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, -/// thus interpolations are involved. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// -/// @param dstHeight -/// Output image height. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param mapX -/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapX(i,j) =jj. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapY -/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapY(i,j) =ii. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapStride -/// the stride of the mapX and mapY -/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param interpolation -/// the interpolation method to derive the dst pixel value. -/// supported methods are nearest neighbor, bilinear and area. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRemapu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride, - fcvInterpolationType interpolation -); - -//--------------------------------------------------------------------------- -/// @brief -/// Applies a generic geometrical transformation to a greyscale uint8 image. -/// The interpolation method is specified through a parameter. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvRemapu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvRemapu8, -/// \a fcvRemapu8_v2 will be removed, and the current signature -/// for \a fcvRemapu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvRemapu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// The greyscale of each pixel in the destination image is obtained from a location of the source image -/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, -/// thus interpolations are involved. -/// -/// @param src -/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param srcStride -/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if srcStride is equal to 0, it will be set to srcWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// -/// @param dstHeight -/// Output image height. -/// -/// @param dstStride -/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// if dstStride is equal to 0, it will be set to dstWidth. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param mapX -/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapX(i,j) =jj. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapY -/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is -/// mapped to src(ii,jj), then mapY(i,j) =ii. -/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. -/// \n\b NOTE: should be 128-bit aligned. -/// -/// @param mapStride -/// the stride of the mapX and mapY -/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param interpolation -/// the interpolation method to derive the dst pixel value. -/// supported methods are nearest neighbor, bilinear and area. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvRemapu8_v2(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue -); - -//--------------------------------------------------------------------------- -/// @brief -/// Gradient Magnitude Computation from two int16_t type matrices. -/// -/// @details -/// The function takes two gradient matrices in int16_t and computes the -/// magnitude in int16_t. -/// \n\b NOTE: Saturation is used when computed magnitude value is larger than max limit of int16_t. -/// -/// @param src1 -/// The gradient matrix in X direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The gradient matrix in Y direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvMagnitudes16( const int16_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t *__restrict src2, - uint32_t src2Stride, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Gradient Phase Computation from two int16_t type matrices. -/// -/// @details -/// The function takes two gradient matrices in int16_t and computes the -/// phase for each pixel, storing results in a uint8_t matrix. The phase angle is translated -/// to [0, 2*PI) and then mapped to range [0, 255). -/// -/// @param src1 -/// The gradient matrix in X direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// The gradient matrix in Y direction. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvPhases16 ( const int16_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t *__restrict src2, - uint32_t src2Stride, - uint8_t *__restrict dst, - uint32_t dstStride ); - - -//-------------------------------------------------------------------------------- -/// Computes the 1D or 2D Fast Fourier Transform of a matrix. -/// -/// @details -/// Computes the 1D or 2D Fast Fourier Transform of a real valued matrix. For the -/// 2D case, The width and height of the input and output matrix must be powers of 2. -/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. -/// -/// @param src -/// An 8 bit unsigned real valued input matrix. The dimensions of the matrix must be powers -/// of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be -/// a power of 2. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. -/// \n\b NOTE: Must be a power of 2 -/// -/// @param srcHeight -/// Height of the source matrix. -/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case -/// -/// @param srcStride -/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The computed FFT matrix. The FFT coefficients are stored in interleaved fashion, i.e., -/// Re1 Im1 Re2 Im2 and so on. Hence the dimensions of the dst are (2 x srcWidth, srcHeight) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0, dstStride is set to 2 x srcWidth x sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvFFTu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Computes the 1D or 2D Inverse Fast Fourier Transform of a matrix. -/// -/// @details -/// Computes the 1D or 2D Inverse Fast Fourier Transform of a complex valued matrix. For the -/// 2D case, The width and height of the input and output matrix must be powers of 2. -/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. -/// -/// @param src -/// An 32 bit floating point complex valued input matrix. The data in the matrix must be stored -/// in an interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on. The dimensions of the matrix must -/// be powers of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be -/// a power of 2. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param srcWidth -/// Width of the source matrix. The width here is the number of floating point units in the matrix. Since -/// the data is interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on, the width is the total number of real -/// and complex units in the matrix. For example, if the Matrix has data values Re1 Im1 Re2 Im2 Re3 Im3 Re4 Im4, -/// then the width here is 8 units. -/// \n\b NOTE: Must be a power of 2 -/// -/// @param srcHeight -/// Height of the source matrix. -/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case -/// -/// @param srcStride -/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth x sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// The computed IFFT matrix. The matrix is real valued and has no imaginary components. -/// Hence the dimensions of the dst are (srcWidth / 2 , srcHeight) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0, dstStride is set to (srcWidth / 2). -/// \n\b WARNING: should be multiple of 8 -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvIFFTf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. -/// The scaling ratios are automatically determined from the specified -/// source image size and destination image size. -/// -/// @details -/// Scale up or down the source image of size srcWidth-by-srcHeight -/// to the destination image of size dstWidth-by-dstHeight. -/// NOTE: dstWidth > 0 && dstHeight > 0. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=dstWidth as default -/// -/// @param interpolation -/// The interpolation method used for scaling. Please see fcvInterpolationType. -/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: -/// Nearest neighbor interpolation. -/// FASTCV_INTERPOLATION_TYPE_BILINEAR: -/// Bilinear interpolation. -/// FASTCV_INTERPOLATION_TYPE_AREA: -/// Interpolation by area. Output values are determined by weighted averages of -/// the source pixels covered by the destination pixel. The averaging weight -/// for each source pixel is proportional to its area overlapping with -/// the destination pixel. Interpolation by area may produce more precise -/// images for scale down operations. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other values otherwise. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - fcvInterpolationType interpolation); - -//--------------------------------------------------------------------------- -/// @brief -/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. -/// The scaling ratios are automatically determined from the specified -/// source image size and destination image size. -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvScaleu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleu8, -/// \a fcvScaleu8_v2 will be removed, and the current signature -/// for \a fcvScaleu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Scale up or down the source image of size srcWidth-by-srcHeight -/// to the destination image of size dstWidth-by-dstHeight. -/// NOTE: dstWidth > 0 && dstHeight > 0. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: should be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=dstWidth as default -/// -/// @param interpolation -/// The interpolation method used for scaling. Please see fcvInterpolationType. -/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: -/// Nearest neighbor interpolation. -/// FASTCV_INTERPOLATION_TYPE_BILINEAR: -/// Bilinear interpolation. -/// FASTCV_INTERPOLATION_TYPE_AREA: -/// Interpolation by area. Output values are determined by weighted averages of -/// the source pixels covered by the destination pixel. The averaging weight -/// for each source pixel is proportional to its area overlapping with -/// the destination pixel. Interpolation by area may produce more precise -/// images for scale down operations. -/// -/// @param borderType -/// The border mode for dst pixels not mapped to the src image. -/// Supported modes are FASTCV_BORDER_UNDEFINED, FASTCV_BORDER_CONSTANT -/// and FASTCV_BORDER_REPLICATE. -/// -/// @param borderValue -/// The user-specified constant pixel value, -/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other values otherwise. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleu8_v2( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - fcvInterpolationType interpolation, - fcvBorderType borderType, - uint8_t borderValue); - -//------------------------------------------------------------------------------ -/// @brief -/// Perspective warp two images using the same transformation. -/// Bi-linear interpolation is used where applicable. -/// -/// @details -/// Perspective warp two images (or buffer) using the same transformation in one function -/// call. This can be used, for example, to warp a grayscale image and an alpha image at -/// the same time, or warp two color channels (for example u and v de-interleaved for YUV). -/// -/// @param src1 -/// First input 8-bit image. Size of buffer is src1Stride*srcHeight bytes. -/// -/// @param src2 -/// Second input 8-bit image. Size of buffer is src2Stride*srcHeight bytes. -/// -/// @param srcWidth -/// Input image width. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Stride -/// Input image 1 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// -/// @param src2Stride -/// Input image 2 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to srcWidth. -/// -/// @param dst1 -/// First warped output image (correspond to src1). Size of buffer is dst1Stride*dstHeight bytes. -/// -/// @param dst2 -/// Second warped output image (correspond to src2). Size of buffer is dst2Stride*dstHeight bytes. -/// -/// @param dstWidth -/// Dst image width. -/// -/// @param dstHeight -/// Dst image height. -/// -/// @param dst1Stride -/// Output image 1 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to dstWidth. -/// -/// @param dst2Stride -/// Output image 2 stride, i.e. the gap (in terms of bytes) between the first element -/// of a row and that of the successive row. If srcStride is equal to 0, -/// it will be set to dstWidth. -/// -/// @param warpmatrix -/// 3x3 perspective transformation matrix (generally a homography). -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcv2PlaneWarpPerspectiveu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - uint32_t src2Stride, - uint8_t* __restrict dst1, - uint8_t* __restrict dst2, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dst1Stride, - uint32_t dst2Stride, - float32_t* __restrict warpmatrix ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 3x3 Gaussian filter kernel -/// -/// @details -/// This function first blurs the input image using a 3x3 Gaussian kernel, and then downsamples -/// the image by selecting every other row and column. The dimensions of the destination image are -/// computed as follows : dstWidth = (srcWidth + 1)/2 , dstHeight = (srcHeight + 1)/2 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the input image. -/// -/// @param srcHeight -/// Height of the input image -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (srcWidth + 1) / 2 x (srcHeight + 1) / 2. -/// \n\b NOTE: border values have been taken care of w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as (srcWidth+1)/2. -/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as (srcWidth+1)/2 if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvScaleDownBy2Gaussian3x3u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one L-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other L-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param dim -/// Number of element of vector A -/// -/// @param bList -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffss8( const int8_t* __restrict a, - float32_t invLenA, - uint32_t dim, - const int8_t* const * __restrict bList, - const float32_t* __restrict invLenB, - uint32_t numB, - float32_t* __restrict distances ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Adds a scalar value to every element of a Matrix. -/// -/// @details -/// Adds a floating point scalar value to each element of the source Matrix -/// and stores the result of the addition in the corresponding element -/// of the destination matrix. -/// -/// @param src -/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The floating point scalar to be added to the source matrix. -/// -/// @param dst -/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvAddScalarf32(const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t scalar, - float32_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Adds a scalar value to every element of a Matrix. -/// -/// @details -/// Adds a signed 16-bit integer scalar value to each element of the source Matrix -/// and stores the result of the addition in the corresponding element -/// of the destination matrix. -/// \n\b NOTE : If the sum of the scalar and matrix element exceeds the maximum value -/// of a signed 16-bit integer, the result is clipped to this maximum value, while -/// if the sum goes below the minimum value of a signed 16-bit integer, it is clipped -/// to this minimum value. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The signed 16-bit integer scalar to be added to the source matrix. -/// -/// @param dst -/// Output 16-bit signed integer matrix. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvAddScalars16(const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t scalar, - int16_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Multiplies a scalar value to every element of a Matrix. -/// -/// @details -/// Multiplies a floating point scalar value to each element of the source Matrix -/// and stores the result of the multiplication in the corresponding element -/// of the destination matrix. -/// -/// @param src -/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The floating point scalar to be multiplied to the source matrix. -/// -/// @param dst -/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMultiplyScalarf32(const float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t scalar, - float32_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Multiplies a scalar value to every element of a Matrix. -/// -/// @details -/// Multiplies a signed 16-bit scalar value to each element of the source Matrix -/// and stores the result of the multiplication in the corresponding element -/// of the destination matrix. -/// \n\b NOTE : If the product of the scalar and matrix element exceeds the maximum value -/// of a signed 16-bit integer, the result is clipped to this maximum value, while -/// if the product goes below the minimum value of a signed 16-bit integer, it is clipped -/// to this minimum value. The API can also handle fractional scalars. Use fixed point conversion -/// and use the shift parameter to decide the number of bits by which the result is shifted by. This -/// affects the precision of the result. If you wish to perform pure integer multiplication, set the -/// shift parameter to 0. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param scalar -/// The signed 8-bit integer scalar to be multiplied to the source matrix. -/// -/// @param shift -/// The number of bits that the result has to be shifted by. Used to handle fractional scalar multiplication. -/// If your input scalar is a pure integer, set shift to 0. -/// -/// @param dst -/// Output signed 16-bit integer matrix. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output matrix in bytes. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMultiplyScalars16( const int16_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int8_t scalar, - int8_t shift, - int16_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 -/// and the signature of fcvMinMaxLocu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict minVal, - uint8_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 -/// and the signature of fcvMinMaxLocu16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu16(const uint16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t *__restrict minVal, - uint16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 -/// and the signature of fcvMinMaxLocs16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocs16(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t *__restrict minVal, - int16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 -/// and the signature of fcvMinMaxLocu32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu32(const uint32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t *__restrict minVal, - uint32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 -/// and the signature of fcvMinMaxLocs32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocs32(const int32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t *__restrict minVal, - int32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their location in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 -/// and the signature of fcvMinMaxLocf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. -/// -/// @param src -/// Input unsigned 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// The X coordinate of the minimum value's location returned by the function -/// -/// @param minLocY -/// The Y coordinate of the minimum value's location returned by the function -/// -/// @param maxLocX -/// The X coordinate of the maximum value's location returned by the function -/// -/// @param maxLocY -/// The Y coordinate of the maximum value's location returned by the function -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocf32(const float32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t *__restrict minVal, - float32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 -/// and the signature of fcvMinMaxLocf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(float32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocf32_v2(const float32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t *__restrict minVal, - float32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 -/// and the signature of fcvMinMaxLocu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint8_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvMinMaxLocu8_v2(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict minVal, - uint8_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 -/// and the signature of fcvMinMaxLocu16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint16_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocu16_v2(const uint16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint16_t *__restrict minVal, - uint16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 -/// and the signature of fcvMinMaxLocs16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int16_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocs16_v2(const int16_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t *__restrict minVal, - int16_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 -/// and the signature of fcvMinMaxLocu32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocu32_v2(const uint32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t *__restrict minVal, - uint32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Finds the minimum and maximum values, and their locations in a matrix -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, -/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 -/// and the signature of fcvMinMaxLocs32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Finds the minimum and maximum values in a matrix, and returns them. In addition -/// to this, it also returns the location (x,y) of the minimum and maximum values thus -/// found. If there are multiple minima/maxima, the function returns them all. If the -/// the number of minima and maxima are greater than the capacity of the minLoc and -/// maxLoc arrays, then the function returns as many locations as the capacity of these -/// arrays. -/// -/// @param src -/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Matrix. -/// -/// @param srcHeight -/// Height of the Matrix. -/// -/// @param srcStride -/// Stride of the Matrix in bytes. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int32_t) if not 0. -/// -/// @param minVal -/// This variable stores the minimum value of the src matrix found by the function -/// -/// @param maxVal -/// This variable stores the maximum value of the src matrix found by the function -/// -/// @param minLocX -/// An array of X coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param minLocY -/// An array of Y coordinates of the minimum value's location returned by the function -/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) -/// -/// @param maxLocX -/// An array of X coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param maxLocY -/// An array of Y coordinates of the maximum value's location returned by the function -/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) -/// -/// @param minCount -/// The number of minima found by the function -/// -/// @param maxCount -/// The number of maxima found by the function -/// -/// @param nMinLocSize -/// The maximum number of minima requested by the user to be found in the input image src. -/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. -/// -/// @param nMaxLocSize -/// The maximum number of maxima requested by the user to be found in the input image src. -/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvMinMaxLocs32_v2(const int32_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t *__restrict minVal, - int32_t *__restrict maxVal, - uint32_t *__restrict minLocX, - uint32_t *__restrict minLocY, - uint32_t *__restrict maxLocX, - uint32_t *__restrict maxLocY, - uint32_t *__restrict minCount, - uint32_t *__restrict maxCount, - uint32_t nMinLocSize, - uint32_t nMaxLocSize); - -//------------------------------------------------------------------------------ -/// @brief -/// Transposes an interleaved RGB image -/// -/// @details -/// Computes the transpose of an interleaved RGB image src, and stores the result in -/// dst -/// -/// @param src -/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the Image. -/// -/// @param srcHeight -/// Height of the Image. -/// -/// @param srcStride -/// Stride of the Image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. -/// -/// @param dst -/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcWidth bytes. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of the output image in bytes. -/// \n\b NOTE: if 0, srcStride is set as 3 x srcHeight. -/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcHeight if not 0. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvTransposeRGB888u8(const uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the cross-product of N pairs of 3x1 vectors -/// -/// @details -/// Computes the cross-product of N pairs of 3x1 vectors. For each pair of 3x1 vectors, -/// ai and bi, the output vector ci is given by ci = ai x bi -/// -/// @param a -/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is -/// as follows x0 y0 z0 x1 y1 z1 ....... -/// -/// @param b -/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is -/// as follows x0 y0 z0 x1 y1 z1 ....... -/// -/// @param c -/// Output buffer containing the resultant "N" 3x1 Vectors. Each 3 x 1 Vector in c is computed from the corresponding -/// 3 x 1 pairs in a & b. Must be of length N * 3. -/// -/// @param N -/// Number of vector pairs. For example if N = 10, then a, b and c will have to be 10 x 3 in length -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvCrossProduct3x1f32(const float32_t * __restrict a, - const float32_t * __restrict b, - float32_t * __restrict c, - uint32_t N); - -//------------------------------------------------------------------------------ -/// @brief -/// Solves a Linear System of Equations using LU-Decomposition -/// -/// @details -/// Solves a Linear System of Equations using LU Decomposition. Given -/// a system defined by A x = b, the function decomposes A into a lower -/// triangular matrix L and an upper triangular matrix U. It then computes x -/// by first solving L y = B by forward substitution for y, and then solving -/// the system of linear equations U x = y by backward substitution for x. -/// \n\b NOTE : Pivoting is used here to ensure that any non singular matrix -/// can be solved. This is because not all Matrices have a LU decomposition. -/// Pivoting helps to overcome this issue. -/// -/// @param A -/// Input coefficient matrix of the linear system of dimension N x N -/// \n\b WARNING: must be square. -/// -/// @param b -/// Component vector of the linear system of dimension N x 1 -/// -/// @param N -/// Dimension of the input Matrix A and component vector b -/// -/// @param pivot -/// An N x 1 pivot array which is populated as follows : For each k = 0, 1,...., N-1 -/// The ith element of pivot contains the row interchanged with row i when k = i. -/// Pivoting is used both for numerical stability and also ensuring that an LU factorization -/// exists for the input matrix A. -/// -/// @param x -/// The solution of the linear system, an N x 1 Vector. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvSolveLUf32(float32_t* __restrict A, - float32_t* __restrict b, - uint32_t N, - uint8_t* __restrict pivot, - float32_t* __restrict x); - - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise AND operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseAndu8(const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise Exclusive Or operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseXoru8( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Bitwise Not operation for each element of two uint8_t matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvBitwiseNotu8(const uint8_t * src, - uint32_t width, - uint32_t height, - uint32_t srcStride, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two uint8_t type matrices to one uint8_t matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddu8(const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of two int16_t type matrices which allows in-place operation -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAdds16_v2( const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - int16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix addition of one uint16_t type matrix and one uint8_t matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddu16u8u16 (const uint16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtractu8 ( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - uint8_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint16_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtracts16 (const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * __restrict src2, - uint32_t src2Stride, - fcvConvertPolicy policy, - int16_t * dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Matrix substration of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. - -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvSubtractu8s16 ( const uint8_t * __restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * __restrict src2, - uint32_t src2Stride, - int16_t * __restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two int16_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplys16( const int16_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const int16_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (int16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplyu8s16( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - int16_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Element-wise multiplication of two uint8_t type matrices -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param policy -/// Conversion policy that decides how data overflow should be handled -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvElementMultiplyu8( const uint8_t * src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint8_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - fcvConvertPolicy policy, - uint8_t *__restrict dst, - uint32_t dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Calculate the weighted sum of two uint8_t type matrices -/// -/// @details -/// Specifically, when 0 <= alpha <= 1 and beta = 1-alpha, the function accumulates a weighted value from -/// an input image to an output image -/// \n\b NOTE: alpha and beta should be within the range of (-128.0, 127.996) and have up to three digits decimal precision -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param alpha -/// The weight value applied to src1 matrix, provided by float32_t type -/// -/// @param beta -/// The weight value applied to src2 matrix, provided by float32_t type -/// -/// @param dst -/// the result matrix (uint8_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success, -/// other values upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddWeightedu8(const uint8_t * src1, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t src1Stride, - const uint8_t *__restrict src2, - uint32_t src2Stride, - float32_t alpha, - float32_t beta, - uint8_t * dst, - uint32_t dstStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// Add a squared value of one type uint8 matrix to the other type uint16 type matrix -/// -/// @param src1 -/// First source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param width -/// Width of the source matrix. -/// -/// @param height -/// Height of the source matrix. -/// -/// @param src1Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param src2 -/// Second source matrix. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param src2Stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. -/// \n\b WARNING: should be multiple of 8 -/// -/// @param scaleFactor -/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results -/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value -/// of scaleFactor -/// -/// @param dst -/// the result matrix (uint16_t type). -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dstStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. -/// \n\b WARNING: should be multiple of 8 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvAddSquaredu8u16(const uint8_t *__restrict src1, - uint32_t width, - uint32_t height, - uint32_t src1Stride, - const uint16_t * src2, - uint32_t src2Stride, - int8_t scaleFactor, - uint16_t * dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Swap Chroma component order. -/// -/// @details -/// This function swaps the interleaved Chroma component order from CbCr to -/// CrCb or from CrCb to CbCr. -/// -/// @param src -/// Pointer to the input image -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param srcWidth -/// Input image width in the number of CbCr or CrCb pairs. -/// -/// @param srcHeight -/// The Chroma component height. -/// -/// @param srcStride -/// Stride of input image in bytes (i.e., number of bytes between column 0 of row 0 -/// and column 0 of row 1). If left at 0, srcStride is default to srcWidth * 2. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @param dst -/// Pointer to the output image -/// \n\b WARNING: size must match input image. -/// \n\b NOTE: should be 128-bit aligned -/// -/// @param dstStride -/// Stride of output image in bytes (i.e., number of bytes between column 0 of -/// row 0 and column 0 of row 1). If left at 0, dstStride is default to -/// srcWidth * 2. -/// \n\b NOTE: should be a multiple of 8. -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorCbCrSwapu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to HSV space. -/// -/// @details -/// -/// @param src -/// Source 24-bit image, RGB888 format (R is MSB byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth*3 as default -/// -/// @param dst -/// Destination 24-bit image. HSV888 format (H is MSB byte for the pixel) -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcWidth*3 as default -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvColorRGB888ToHSV888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------/ -/// @brief -/// SVM prediction for two classes -/// -/// @details -/// The function returns the confidence scores for test vectors using the equation: -/// confidence(i) = sum_j( svCoef[j] * Kernel(vec_i, sv_j) - rho; -/// The SVM model(svCoef, sv, rho) can be obtained using the training function of libSVM or openCV. -/// -/// @param kernelType -/// kernelType options: 'FASTCV_SVM_LINEAR','FASTCV_SVM_POLY','FASTCV_SVM_RBF','FASTCV_SVM_SIGMOID'. -/// FASTCV_SVM_LINEAR: Kernel(xi, xj) = xi'*xj -/// FASTCV_SVM_POLY: Kernel(xi, xi) = (gamma * xi' * xj + coef0)^degree, (gamma>0 , degree is positive integer). -/// FASTCV_SVM_RBF: Kernel(xi,xj) = exp(-gamma*||xi-xj||^2), (gamma>0). -/// FASTCV_SVM_SIGMOID: Kernel(xi, xj) = tanh(gamma * xi' * xj + coef0) -/// -/// @param degree -/// Parameter degree of a kernel function (FASTCV_SVM_POLY). -/// \n\b NOTE: Degree should be positive integer. -/// -/// @param gamma -/// Parameter of a kernel function (FASTCV_SVM_POLY / FASTCV_SVM_RBF / FASTCV_SVM_SIGMOID). -/// \n\b NOTE: gamma > 0 for FASTCV_SVM_Ploy and FASTCV_SVM_RBF -/// -/// @param coef0 -/// Parameter coef0 of a kernel function (FASTCV_SVM_LINEAR / FASTCV_SVM_POLY / FASTCV_SVM_SIGMOID). -/// -/// @param sv -/// Support vectors. -/// -/// @param svLen -/// Feature length, (support vector length = feature length). -/// -/// @param svNum -/// Number of support vectors. -/// -/// @param svStride -/// support vector stride. -/// Stride of support vector 2D matrix (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, svStride is set as svLen*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. -/// -/// @param svCoef -/// Coefficent of support vectors, length equals to the Number of SV. -/// -/// @param rho -/// SVM bias. -/// -/// @param vec -/// Test vectors, it has same width as sv. -/// -/// @param vecNum -/// Number of test vectors. -/// -/// @param vecStride -/// Stride of test vectors. -/// Stride of test vector 2D matrix (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, vecStride is set as svLen*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. -/// -/// @param confidence -/// Output, store confidence value of each test vector. The length is vecNum. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup machine_learning -//------------------------------------------------------------------------------/ - -FASTCV_API fcvStatus -fcvSVMPredict2Classf32( fcvSVMKernelType kernelType, - uint32_t degree, - float32_t gamma, - float32_t coef0, - const float32_t* __restrict sv, - uint32_t svLen, - uint32_t svNum, - uint32_t svStride, - const float32_t* __restrict svCoef, - float32_t rho, - const float32_t* __restrict vec, - uint32_t vecNum, - uint32_t vecStride, - float32_t* __restrict confidence ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow (with stride so ROI can be supported) -/// -/// \n\b ATTENTION: This function is a duplication of -/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, -/// \a fcvTrackLKOpticalFlowu8_v3 will be removed, and the current signature -/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input image width. -/// -/// @param height -/// Input image height. -/// -/// @param stride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. -/// NOTE: should be a multiple of 8. -/// -/// @param src1Pyr -/// Image Pyramid of src1 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 (with stride) -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_estimate -/// Pointer to X,Y floating point, sub-pixel coordinates for estimated features -/// on the new frame stored as X,Y tuples. featureXY array storage must -/// has the same length as featureXY -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. Must be odd number. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. Must be odd number. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param termCriteria -/// The enum parameter to specify termination criteria. See fcvTerminationCriteria for details -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level if -/// FASTCV_TERM_CRITERIA_ITERATIONS is set as the termCriteria -/// \n\b NOTE: will be saturated to range [1, 100]; suggested value 5 or 7 -/// -/// @param maxEpsilon -/// Epsilon value in float32_t for error measure to determine the iteration -/// \n\b NOTE: the value should be within [0, 10]; suggested value 0.03*0.03 -/// -/// @param use_initial_estimate -/// The flag indicatiing if to use initial estimations stored in featureXY_estimate -/// to start the search. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvTrackLKOpticalFlowu8_v3 ( const uint8_t *__restrict src1, - const uint8_t *__restrict src2, - uint32_t width, - uint32_t height, - uint32_t stride, - const fcvPyramidLevel_v2 * __restrict src1Pyr, - const fcvPyramidLevel_v2 * __restrict src2Pyr, - const float32_t * __restrict featureXY, - const float32_t * __restrict featureXY_estimate, - float32_t * __restrict featureXY_out, - int32_t * __restrict featureStatus, - int32_t featureLen, - int32_t windowWidth, - int32_t windowHeight, - int32_t nPyramidLevels, - fcvTerminationCriteria termCriteria, - int32_t maxIterations, - float32_t maxEpsilon, - int32_t use_initial_estimate); - -//------------------------------------------------------------------------------ -/// @brief -/// Undistort a disparity image and optionally convert the undistorted disparity image into a -/// depth image. -/// -/// @param src -/// Pointer to the disparity input image -/// -/// @param srcWidth -/// Width of the disparity input image in pixel. The number of pixels in a row. -/// -/// @param srcHeight -/// Height of the disparity input image in pixel. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @param mask -/// Pointer to the returned foreground mask image. -/// It's a 1-channel image, same width and height as src. -/// If an entry set to 1, there will be a valid undistorted dispartity or depth value. -/// If an entry set to 0, there will be no valid undistorted dispartity or depth value. -/// -/// @param maskStride -/// Stride of the foreground mask image. It's the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 MaskStride is default to srcWidth. -/// \n\b NOTE: should be multiple of 8. -/// -/// @param pixelDistortion -/// Pointer to the pixel distortion value for each pixel in the image. It has the same dimensions -/// as the input image src. -/// -/// @param pixelDistortionStride -/// Stride of pixel distortion value for each pixel in the image. -/// It's the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. -/// If left at 0 pixelDistortionStride is default to srcWidth*sizeof(float32_t). -/// \n\b WARNING: should be multiple of 8 -/// -/// @param convertDepth -/// This parameter is a flag to enable or disable the conversion of disparity to depth. -/// If set to 1, then the undistorted disparity values will be converted to depth -/// and returned in the dst buffer. -/// If set to 0, then the undistorted disparity will be returned in the dst buffer. -/// -/// @param imageDistortion -/// ImageDistortion contains two elements. The First part contains the spatial distortion pattern, -/// and the second part contains the decay of the distortion effect. -/// -/// @param depthParam -/// Parameters used to transform disparity to depth values. -/// The equation is -/// undistortedDepthValue = 1 / (undistortedDisparityValue * depthParam[0] + depthParam[1]) -/// -/// @param dst -/// Output matrix which has the same width, length and channel number as src. -/// The buffer contains undistorted disparity values if convertDepth is set to 0 and -/// contains the undistorted depth values if convertDepth is set to 1 -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvUndistortDisparityConvertDepthf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict mask, - uint32_t maskStride, - const float32_t* __restrict pixelDistortion, - uint32_t pixelDistortionStride, - uint32_t convertDepth, - const float32_t* __restrict imageDistortion, - const float32_t* __restrict depthParam, - float32_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Registers an input Depth Image with an input Color Image -/// -/// @param src -/// Pointer to the input depth image -/// -/// @param srcWidth -/// The width of the input depth image. -/// -/// @param srcHeight -/// The height of the input depth image -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// \n\b NOTE: should be multiple of 8. -/// -/// @param Kdinv -/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix -/// arranged row wise. -/// -/// @param Kc -/// Kc is an array of 9 elements which represents the 3x3 color camera intrinsic parameters -/// arranged row wise -/// -/// @param Rd2c -/// Rd2c is an array of 9 element which represents the 3D Rotation (3x3) matrix from the Depth -/// Camera to the Color Camera arranged row wise -/// -/// @param Td2c -/// Td2c is an array of 3 element which represents the transform parameter from the Depth -/// Camera to the Color Camera. -/// -/// @param dst -/// Output matrix which has the same width, length and channel number as src -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API fcvStatus -fcvRegisterDepthImagef32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict Kdinv, - const float32_t* __restrict Kc, - const float32_t* __restrict Rd2c, - const float32_t* __restrict Td2c, - float32_t* __restrict dst, - uint32_t dstStride); - -//------------------------------------------------------------------------------ -/// @brief -/// Convert depth image into 3D point Cloud -/// -/// @param src -/// Pointer to the depth image -/// -/// @param srcWidth -/// Width of the depth image in pixel. The number of pixels in a row. -/// -/// @param srcHeight -/// Height of the depth image in pixel -/// -/// @param srcStride -/// Stride of depth image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). -/// \n\b NOTE: should be multiple of 8. -/// -/// @param Kdinv -/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix -/// arranged row wise. -// -/// @param dst -/// Pointer to the 3D point cloud in an interleaved fashion x0,y0,z0,x1,y1,z1. -/// It has a width of 3*srcWidth and has the same height as the src buffer. -/// -/// @param dstStride -/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 3*srcWidth*sizeof(float32_t) -/// \n\b NOTE: should be multiple of 8. -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ -FASTCV_API fcvStatus -fcvConvertDepthImageToPointCloudf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t* __restrict Kdinv, - float32_t* __restrict dst, - uint32_t dstStride); - -// ----------------------------------------------------------------------------- -/// @brief -/// Extract Histogram of Oriented Gradients (HOG) descriptor given an image's gradient strength -/// and orientation -/// -/// @param strength -/// The gradient strength at each pixel. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param width -/// Input window width. -/// -/// @param height -/// Input window height. -/// -/// @param strengthStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 strengthStride is default to width*2. -/// NOTE: should be a multiple of 8. -/// -/// @param orientation -/// Gradient orientation at each pixel. When normMethod is FASTCV_HOG_NORM_REGULAR or -/// FASTCV_HOG_NORM_RENORMALIZATION, orientation should be within range of [0, 179]; while -/// FASTCV_HOG_NORM_FHOG is used, orientation should be within [0, 359] to meet its contrast- -/// sensitive requirements. -/// \n\b WARNING: should be 128-bit aligned. -/// -/// @param orientationStride -/// Stride is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 orientationStride is default to width*2. -/// NOTE: should be a multiple of 8. -/// -/// @param cellSize -/// The size of one cell in pixels. The typical cell size is 4. -/// -/// @param blockSize -/// Block size in pixels. It must be a multiple of cellSize. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockSize is by default equal to cellSize -/// -/// @param blockStep -/// Block step in pixels when sliding the block over the image. If the blockStep -/// is a multiple of cellSize, faster approach would be taken when normMethod -/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param binSize -/// Number of bins in the gradient histogram. Typical binSize is 9. -/// -/// @param normMethod -/// The enum parameter to specify the normalization method for HOG descriptor construction. See -/// fcvHOGNormMethod for details. -/// -/// @param hogVector -/// The output descriptor vector in uint16_t. The length of the vector is obtained by fcvGetHOGVectorLengthu32 -/// -/// @return -/// FASTCV_SUCCESS upon success. -/// Other status codes upon failure. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvExtractHOGu16(const uint16_t* __restrict strength, - uint32_t width, - uint32_t height, - uint32_t strengthStride, - const uint16_t* __restrict orientation, - uint32_t orientationStride, - uint32_t cellSize, - uint32_t blockSize, - uint32_t blockStep, - uint32_t binSize, - fcvHOGNormMethod normMethod, - uint16_t* __restrict hogVector, - uint32_t flen, - void* handle); - -// ----------------------------------------------------------------------------- -/// @brief -/// Calculate the length of the output vector for HOG extraction -/// -/// @param width -/// Input window width. -/// -/// @param height -/// Input window height. -/// -/// @param cellSize -/// The size of one cell in pixels. The typical cell size is 4. -/// -/// @param blockSize -/// Block size in pixels. It must be a multiple of cellSize. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param blockStep -/// Block step in pixels when sliding the block over the image. If the blockStep -/// is a multiple of cellSize, faster approach would be taken when normMethod -/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. -/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize -/// -/// @param binSize -/// Number of bins in the gradient histogram. Typical binSize is 9. -/// -/// @param normMethod -/// The enum parameter to specify the normalization method for HOG descriptor construction. See -/// fcvHOGNormMethod for details. -/// -/// @param -/// The length of HOG vector in uint32_t -/// -/// @param hogHandle -/// Output. the hogHandle to be used in subsequent calls. -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API fcvStatus -fcvHOGInit(uint32_t width, - uint32_t height, - uint32_t cellSize, - uint32_t blockSize, - uint32_t blockStep, - uint32_t binSize, - fcvHOGNormMethod normMethod, - uint32_t *vecLength, - void **hogHandle - ); -//------------------------------------------------------------------------------ -/// @brief Function to release HOG resources. -/// @param hogHandle -/// Handle to be used to free up HOG resources. -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void fcvHOGDeInit(void* hogHandle); - - - -#ifdef __cplusplus -}//extern "C" -#endif - -#endif +#ifndef FASTCV_H +#define FASTCV_H + +/**============================================================================= + +@file + fastcv.h + +@brief + Public API + + +Copyright (c) 2011-2015 Qualcomm Technologies, Inc. +All Rights Reserved. +Confidential and Proprietary - Qualcomm Technologies, Inc. + +=============================================================================**/ + +/**============================================================================= +@mainpage FastCV Public API Documentation + +@version 1.7.1 + +@section Overview Overview + +FastCV provides two main features to computer vision application developers: + - First, it provides a library of frequently used computer vision (CV) + functions, optimized to run efficiently on mobile devices. + - Second, it provides a clean processor-agnostic hardware acceleration API, + under which chipset vendors can hardware accelerate FastCV functions on + their hardware. + +FastCV 1.7.1 supports Android and Windows mobile developers. +FastCV 1.7.1 is available for download for free from developer.qualcomm.com. + +FastCV 1.7.1 is released as a unified binary, a single binary containing two +implementations of the library. + - The first implementation runs on ARM processor, and is referred to as + the "FastCV for ARM." + - The second implementation runs only on Qualcomm Snapdragon + chipsets, and is called "FastCV for Snapdragon." + +Releases are generally motivated for the following reasons: + - Changes to previously released APIs + - Addition of new functions + - Performance improvements and/or bug fixes - also known as implementation + modifications + + Each motivation has a varying degree of impact on the user of the library. + The general release numbering scheme captures this variety of motivations. + + Given release ID: A.B.C + + An increase in "A" indicates that a previously released API has changed, + so a developer may encounter compilation issues which require modification + of their code in order to adhear to the modified API. Qualcomm will make + every effort to minimize these changes. Additionally, new functions and + implementation modifications may be present. + + An increase in "B" indicates that new functions have been added to the + library, so additional functionality is available, however existing APIs + have not changed. Additionally, implementation modifications may be + present. + + An increase in "C" indicates that implementation modifications only have + been made. + +@defgroup math_vector Math / Vector Operations +@details Commonly used vector & math functions + +@defgroup image_processing Image processing +@details Image filtering, convolution and scaling operations + +@defgroup image_transform Image transformation +@details Warp perspective, affine transformations + +@defgroup feature_detection Feature detection +@details Fast corner detection, harris corner detection, canny edge detection, etc. + +@defgroup object_detection Object detection +@details Object detection functions such as NCC template match, etc. + +@defgroup 3D_reconstruction 3D reconstruction +@details Homography, pose evaluation functions + +@defgroup color_conversion Color conversion +@details Commonly used formats supported: e.g., YUV, RGB, YCrCb, etc. + +@defgroup clustering_and_search Clustering and search +@details K clusters best fitting of a set of input points + +@defgroup Motion_and_Object_Tracking Motion and object tracking +@details Supports and tracking functions + +@defgroup Structural_Analysis_and_Drawing Shape and drawing +@details Contour and polygon drawing functions + +@defgroup mem_management Memory Management +@details Functions to allocate and deallocate memory for use with fastCV. + +@defgroup misc Miscellaneous +@details Support functions + +@defgroup machine_learning Machine Learning +@details Machine learning functions such as SVM prediction, etc. + +**/ + +//============================================================================== +// Defines +//============================================================================== + +#ifdef __GNUC__ + /// Macro to align memory at 4-bytes (32-bits) for GNU-based compilers. + #define FASTCV_ALIGN32( VAR ) (VAR) __attribute__ ((aligned(4))) + /// Macro to align memory at 8-bytes (64-bits) for GNU-based compilers. + #define FASTCV_ALIGN64( VAR ) (VAR) __attribute__ ((aligned(8))) + /// Macro to align memory at 16-bytes (128-bits) for GNU-based compilers. + #define FASTCV_ALIGN128( VAR ) (VAR) __attribute__ ((aligned(16))) + #ifdef BUILDING_SO + /// MACRO enables function to be visible in shared-library case. + #define FASTCV_API __attribute__ ((visibility ("default"))) + #else + /// MACRO empty for non-shared-library case. + #define FASTCV_API + #endif +#else + /// Macro to align memory at 4-bytes (32-bits) for MSVC compiler. + #define FASTCV_ALIGN32( VAR ) __declspec(align(4)) (VAR) + /// Macro to align memory at 8-bytes (64-bits) for MSVC compiler. + #define FASTCV_ALIGN64( VAR ) __declspec(align(8)) (VAR) + /// Macro to align memory at 16-bytes (128-bits) for MSVC compiler. + #define FASTCV_ALIGN128( VAR ) __declspec(align(16)) (VAR) + #ifdef BUILDING_DLL + /// MACRO enables function to be visible in shared-library case. + #define FASTCV_API __declspec(dllexport) + #else + /// MACRO empty for non-shared-library case. + #define FASTCV_API + #endif +#endif + +//============================================================================== +// Included modules +//============================================================================== + +#include +#include +typedef float float32_t; +typedef double float64_t; + +//============================================================================== +// Declarations +//============================================================================== + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines operational mode of interface to allow the end developer to +/// dictate how the target optimized implementation should behave. +//------------------------------------------------------------------------------ +typedef enum +{ + /// Target-optimized implementation uses lowest power consuming + /// implementation. + FASTCV_OP_LOW_POWER = 0, + + /// Target-optimized implementation uses highest performance implementation. + FASTCV_OP_PERFORMANCE = 1, + + /// Target-optimized implementation offloads as much of the CPU as possible. + FASTCV_OP_CPU_OFFLOAD = 2, + + /// Target-optimized implementation uses CPU highest performance implementation. + FASTCV_OP_CPU_PERFORMANCE = 3, + + /// Values >= 0x80000000 are reserved + FASTCV_OP_RESERVED = 0x80000000 + +} fcvOperationMode; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the flip directions for matrix flip functions. +//------------------------------------------------------------------------------ +typedef enum +{ + /// Flip horizontally. + FASTCV_FLIP_HORIZ = 1, + + /// Flip vertically. + FASTCV_FLIP_VERT = 2, + + /// Flip horizontally and vertically. + FASTCV_FLIP_BOTH = 3 + +} fcvFlipDir; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the clockwise rotation degrees for image rotation functions. +//------------------------------------------------------------------------------ +typedef enum +{ + /// Rotate 90 degrees clockwise. + FASTCV_ROTATE_90 = 1, + + /// Rotate 180 degrees clockwise. + FASTCV_ROTATE_180 = 2, + + /// Rotate 270 degrees clockwise. + FASTCV_ROTATE_270 = 3 + +} fcvRotateDegree; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the interpolation types. +//------------------------------------------------------------------------------ + +typedef enum +{ + /// Nearest neighbor interpolation + FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR = 0, + + /// Bilinear interpolation + FASTCV_INTERPOLATION_TYPE_BILINEAR, + + /// Interpolation by area + FASTCV_INTERPOLATION_TYPE_AREA + +} fcvInterpolationType; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the policy to handle integer overflow. +//------------------------------------------------------------------------------ + +typedef enum +{ + /// Do nothing to the overflow. + /// Let the overflowed number wrap around. + /// May save runtime if overflow unlikely to occur, + /// or users do not care about overflow. + FASTCV_CONVERT_POLICY_WRAP = 0, + + /// Clamped to the maximum interger if overflow, + /// clamped to the minimum integer if underflow. + /// May require more runtime than FASTCV_CONVERT_POLICY_WRAP. + FASTCV_CONVERT_POLICY_SATURATE + +} fcvConvertPolicy; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the border types. +//------------------------------------------------------------------------------ + +typedef enum +{ + /// Border behavior undefined, left to the implementation. + FASTCV_BORDER_UNDEFINED = 0, + + /// For out-of-bound pixels, apply a user-specified constant value. + FASTCV_BORDER_CONSTANT, + + /// For out-of-bound pixels, apply values from the nearest edge pixels. + FASTCV_BORDER_REPLICATE + +} fcvBorderType; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the norm for a vector. +//------------------------------------------------------------------------------ + +typedef enum +{ + /// L1 norm. The norm is the sum of absolute values of every component in a vector. + FASTCV_NORM_L1, + + /// L2 norm, i.e., the Euclidean norm of a vector. + FASTCV_NORM_L2 + +} fcvNormType; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines all supported channel indices +//------------------------------------------------------------------------------ + +typedef enum +{ + /// The first channel of the image. + FASTCV_CHANNEL_0, + + /// The second channel of the image. + FASTCV_CHANNEL_1, + + /// The third channel of the image. + FASTCV_CHANNEL_2, + + /// The fourth channel of the image. + FASTCV_CHANNEL_3, + + /// The RED channel of the image. + FASTCV_CHANNEL_R, + + /// The GREEN channel of the image. + FASTCV_CHANNEL_G, + + /// The BLUE channel of the image. + FASTCV_CHANNEL_B, + + /// The ALPHA channel of the image. + FASTCV_CHANNEL_A, + + /// The LUMA channel of the image. + FASTCV_CHANNEL_Y, + + /// The Cb/U channel of the image. + FASTCV_CHANNEL_U, + + /// The Cr/V/Value channel of the image. + FASTCV_CHANNEL_V + +} fcvChannelType; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines all supported image formats based on the FOURCC definition +//------------------------------------------------------------------------------ + +typedef enum +{ + /// A single plane of 24 bit pixel as 3 interleaved 8 bit units of R then G then B data. + FASTCV_RGB, + + /// A single plane of 32 bit pixel as 4 interleaved 8 bit units of R then G then B data, then a ”don’t care?byte. + FASTCV_RGBX, + + /// A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling. + /// For a frame of width W and height H, Y plane has the size of W * H, while the UV plane has the size of W * H/2. + /// The extracted U or V plane is then expected to be W/2 * H/2. + FASTCV_NV12, + + /// A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling. + /// For a frame of width W and height H, Y plane has the size of W * H, while the VU plane has the size of W * H/2. + /// The extracted U or V plane is then expected to be W/2 * H/2. + FASTCV_NV21, + + /// A single plane of 32 bit macro pixel of U0, Y0, V0, Y1 bytes. + /// For a frame of width W and height H, its buffer size is at least 2*W * H. + /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. + FASTCV_UYVY, + + /// A single plane of 32 bit macro pixel of Y0, U0, Y1, V0 bytes. + /// For a frame of width W and height H, its buffer size is at least 2*W * H. + /// The extracted Y plane is expected to be W * H while the U or V plane is expected to be W/2 * H. + FASTCV_YUYV, + + /// A 3 plane of 8 bit 4:2:0 sampled Y, U, V planes. + /// For a frame of width W and height H, Y plane has the size of W * H, while the U or I plane each has a size of W/2 * H/2. + FASTCV_IYUV, + + /// A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes. + /// For a frame of width W and height H, Y or U or V plane each has the size of W * H. + FASTCV_YUV4 + +} fcvImageFormat; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the status returned by a function. +//------------------------------------------------------------------------------ +typedef enum +{ + //// Success + FASTCV_SUCCESS = 0, + + /// General failure + FASTCV_EFAIL, + + /// Unaligned pointer parameter + FASTCV_EUNALIGNPARAM, + + /// Bad parameters + FASTCV_EBADPARAM, + + /// Called at invalid state + FASTCV_EINVALSTATE, + + /// Insufficient resources, memory, thread... + FASTCV_ENORES, + + /// Unsupported feature + FASTCV_EUNSUPPORTED, + + /// Hardware QDSP failed to respond + FASTCV_EHWQDSP, + + /// Hardware GPU failed to respond + FASTCV_EHWGPU + +} fcvStatus; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the kernel functions of SVM prediction. +//------------------------------------------------------------------------------ +typedef enum +{ + FASTCV_SVM_LINEAR, + FASTCV_SVM_POLY, + FASTCV_SVM_RBF, + FASTCV_SVM_SIGMOID +} fcvSVMKernelType; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the different scaling options for the pyramid +//------------------------------------------------------------------------------ +typedef enum +{ + FASTCV_PYRAMID_SCALE_HALF, + FASTCV_PYRAMID_SCALE_ORB +} fcvPyramidScale; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the termination criteria list. +//------------------------------------------------------------------------------ +typedef enum +{ + /// Indicates a termination after a set number of iterations + FASTCV_TERM_CRITERIA_ITERATIONS, + + /// Indicates a termination after matching against the value of eplison provided to the function + FASTCV_TERM_CRITERIA_EPSILON, + + /// Indicates that both an iterations and eplison method are employed. Whichever one matches first causes the termination. + FASTCV_TERM_CRITERIA_BOTH, +} fcvTerminationCriteria; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the normalization method in the HOG extraction process +//------------------------------------------------------------------------------ +typedef enum +{ + /// Do the regular normalization method + FASTCV_HOG_NORM_REGULAR = 0, + + /// Do re-normalization + FASTCV_HOG_NORM_RENORMALIZATION = 1, + + /// Use F-HOG method + FASTCV_HOG_NORM_FHOG = 2, + +} fcvHOGNormMethod; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines the vaiance estimator type +//------------------------------------------------------------------------------ +typedef enum +{ + /// Sums the squared deviation and devides by (n-1) + /// As known as sample variance + FASTCV_UNBIASED_VARIANCE_ESTIMATOR = 0, + + /// Sums the squared deviation and devides by n + /// As known as population variance + FASTCV_BIASED_VARIANCE_ESTIMATOR = 1, + +} fcvVarianceEstimator; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a structure to contain points correspondence data. +//------------------------------------------------------------------------------ +typedef struct +{ + /// Tuples of 3 values: xFrom,yFrom,zFrom. Float array which this points to + /// must be greater than or equal to 3 * numCorrespondences. + const float32_t* from; + /*~ FIELD fcvCorrespondences.from + VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ + (fcvCorrespondences.fromStride ? fcvCorrespondences.fromStride : 3) ) */ + + /// Tuples of 2 values: xTo,yTo. Float array which this points to + /// must be greater than or equal to 2 * numCorrespondences. + const float32_t* to; + /*~ FIELD fcvCorrespondences.to + VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ + (fcvCorrespondences.toStride ? fcvCorrespondences.toStride : 2) ) */ + + /// Distance in bytes between two coordinates in the from array. + /// If this parameter is set to 2 or 3, a dense array is assume (stride will + /// be sizeof(float) times 2 or 3). The minimum value of fromStride + /// should be 2. + uint32_t fromStride; + + /// Distance in bytes between two coordinates in the to array. + /// If this parameter is set to 2, a dense array is assume (stride will + /// be 2 * sizeof(float)). The minimum value of toStride + /// should be 2. + uint32_t toStride; + + /// Number of points in points correspondences. + uint32_t numCorrespondences; + + /// Array of inlier indices for corrs array. Processing will only occur on + /// the indices supplied in this array. Array which this points to must be + /// at least numIndices long. + const uint16_t* indices; + /*~ FIELD fcvCorrespondences.indices VARRAY LENGTH (fcvCorrespondences.numIndices) */ + + /// Length of indices array. + uint32_t numIndices; +} fcvCorrespondences; + + +// ----------------------------------------------------------------------------- +/// @brief +/// Structure representing an image pyramid level +//------------------------------------------------------------------------------ + +typedef struct +{ + const void* ptr; + unsigned int width; + unsigned int height; +} fcvPyramidLevel ; + +// ----------------------------------------------------------------------------- +/// @brief +/// Structure representing an image pyramid level (version2 with stride) +//------------------------------------------------------------------------------ + +typedef struct +{ + const void* ptr; + unsigned int width; + unsigned int height; + unsigned int stride; +} fcvPyramidLevel_v2 ; + +// ----------------------------------------------------------------------------- +/// @brief +/// Structure describing node of a tree; +/// Assumption is that nodes of all trees are stored in in a single array +/// and all indices refer to this array +/// @remark +/// if indices of both children are negative the node is a leaf +// ---------------------------------------------------------------------------- +typedef struct fcvKDTreeNodef32 +{ + /// the split value at the node + float32_t divVal; + + /// dimension at which the split is made; + /// if this is a leaf (both children equal to -1) then this is + /// the index of the dataset vector + int32_t divFeat; + + /// index of the child node with dataset items to the left + /// of the split value + int32_t childLeft; + + /// index of the child node with dataset items to the right + /// of the split value + int32_t childRight; + +} fcvKDTreeNodef32; + +// ----------------------------------------------------------------------------- +/// @brief +/// structure describing a branch (subtree) +/// @remark +/// branches are stored on the priority queue (heap) for backtracking +// ----------------------------------------------------------------------------- +typedef struct fcvKDTreeBranchf32 +{ + /// square of minimal distance from query for all nodes below + float32_t minDistSq; + + /// index of the top node of the branch + int32_t topNode; + +} fcvKDTreeBranchf32; + +// ----------------------------------------------------------------------------- +/// @brief +/// Structure with KDTrees data +// ----------------------------------------------------------------------------- +typedef struct fcvKDTreeDatas8f32 +{ + // info about the dataset for which KDTrees are constructed + /// the dataset of vectors + const int8_t *dataset; + + /// array with inverse lengths of dataset vectors + const float32_t* invLen; + + /// number of vectors in the dataset + int32_t numVectors; + + // info about trees + /// indice of root nodes of trees + int32_t* trees; + + /// array of nodes of all trees + fcvKDTreeNodef32* nodes; + + /// number of all nodes + int32_t numNodes; + + /// capacity of node array + int32_t maxNumNodes; + + // info used during lookups + /// priority queue + fcvKDTreeBranchf32* heap; + + /// number of branches on the priority queue + int32_t numBranches; + + /// capactiy of the priority queue + int32_t maxNumBranches; + + /// array of indices to vectors in the dataset; + /// during searches used to mark checkID; + /// should have numVectors capacity + int32_t* vind; + + /// unique ID for each lookup + int32_t checkID; + + /// number of nearest neighbors to find + int32_t numNNs; + +} fcvKDTreeDatas8f32; + + +// ----------------------------------------------------------------------------- +/// @brief +/// fixed point kdtrees +/// Structure describing node of tree; +/// Assumption is that nodes of all trees are stored in in a single array +/// and all indices refer to this array +/// @remark +/// if indices of both children are negative the node is a leaf +// ---------------------------------------------------------------------------- +typedef struct fcvKDTreeNodes32 +{ + /// the split value at the node + int32_t divVal; + + /// dimension at which the split is made; + /// if this is a leaf (both children equal to -1) then this is + /// the index of the dataset vector + int32_t divFeat; + + /// index of the child node with dataset items to the left + /// of the split value + int32_t childLeft; + + /// index of the child node with dataset items to the right + /// of the split value + int32_t childRight; + +} fcvKDTreeNodes32; + +// ----------------------------------------------------------------------------- +/// @brief +/// fixed point kdtrees +/// structure describing a branch (subtree) +/// @remark +/// branches are stored on the priority queue (heap) for backtracking +// ----------------------------------------------------------------------------- +typedef struct fcvKDTreeBranchs32 +{ + /// square of minimal distance from query for all nodes below + int32_t minDistSq; + + /// index of the top node of the branch + int32_t topNode; + +} fcvKDTreeBranchs32; + +// ----------------------------------------------------------------------------- +/// @brief +/// fixed point kdtrees +/// Structure with KDTrees data +// ----------------------------------------------------------------------------- +typedef struct fcvKDTreeDatas8s32 +{ + // info about the dataset for which KDTrees are constructed + /// the dataset of vectors + const int8_t *dataset; + + /// array with inverse lengths of dataset vectors + const int32_t* invLen; + + /// number of vectors in the dataset + int32_t numVectors; + + // info about trees + /// indices of root nodes of all trees + int32_t* trees; + + /// number of trees used + int32_t numTrees; + + /// array of nodes of all trees + fcvKDTreeNodes32* nodes; + + /// number of all nodes + int32_t numNodes; + + /// capacity of node array + int32_t maxNumNodes; + + // info used during lookups + /// priority queue + fcvKDTreeBranchs32* heap; + + /// number of branches on the priority queue + int32_t numBranches; + + /// capactiy of the priority queue + int32_t maxNumBranches; + + /// array of indices to vectors in the dataset; + /// during searches used to mark checkID; + /// should have numVectors capacity + int32_t* vind; + + /// unique ID for each lookup + int32_t checkID; + + /// number of nearest neighbors to find + int32_t numNNs; + +} fcvKDTreeDatas8s32; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct of rectangle +//------------------------------------------------------------------------------ +typedef struct +{ + ///x-coordinate of the top-left corner + int32_t x; + ///y-coordinate of the top-left corner + int32_t y; + ///width of the rectangle + uint32_t width; + ///height of the rectangle + uint32_t height; +} fcvRectangleInt; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct of termination criteria +//------------------------------------------------------------------------------ +typedef struct +{ + /// Maxmimum number of iteration + int32_t max_iter; + /// + float32_t epsilon; +}fcvTermCriteria; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct of 2D box used for tracking +//------------------------------------------------------------------------------ +typedef struct +{ + // Center of the box + ///x-coordinate of the 2D point + int32_t x; + ///y-coordinate of the 2D point + int32_t y; + // The box size + int32_t columns; + int32_t rows; + // The orientation of the principal axis + int32_t orientation; +}fcvBox2D; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct of image moments +//------------------------------------------------------------------------------ +typedef struct { + // spatial moments + float32_t m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; + // central moments + float32_t mu20, mu11, mu02, mu30, mu21, mu12, mu03; + // m00 != 0 ? 1/sqrt(m00) : 0 + float32_t inv_sqrt_m00; +} fcvMoments; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct of code word +//------------------------------------------------------------------------------ +typedef struct fcvBGCodeWord +{ + /// Pointer to next codebook element + struct fcvBGCodeWord* next; + + /// Last update time + int32_t tLastUpdate; + + /// Longest period of inactivity + int32_t stale; + /// Min value of pixel for each channel + uint8_t min0, min1, min2; + + /// Max value of pixel for each channel + uint8_t max0, max1, max2; + + /// Min value of learning boundary for each channel + uint8_t learnLow0, learnLow1, learnLow2; + + /// Max value of learning boundary for each channel + uint8_t learnHigh0, learnHigh1, learnHigh2; +} fcvBGCodeWord; + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct for circle +//------------------------------------------------------------------------------ +typedef struct fcvCircle +{ + int32_t x; + int32_t y; + int32_t radius; +} fcvCircle; + + +typedef struct fcvPoint2D +{ + float x; + float y; +} fcvPoint2D; + +typedef struct fcvLine +{ + fcvPoint2D start; + fcvPoint2D end; +} fcvLine; + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines a struct for parameters for line segment detection +//------------------------------------------------------------------------------ +typedef struct fcvLineSegment { + fcvPoint2D start, end; ///< Two ending points + float32_t normal[2]; ///< Orientation, average of the gradient direction + uint32_t nPoints; ///< (Optional) Number of pixels in pointsList + int32_t pointsStartIndex; ///< (Optional) Starting index of the pixel positions contributed to line segment fitting stored in indexBuffer + uint32_t sumMag; ///< Sum of all pixels gradient magnitude +} fcvLineSegment; + + +//------------------------------------------------------------------------------ +/// @brief +/// Parameters for fusing a depth map into a cuboid fusion block +/// +/// @details +/// This structure describes a single cuboid block that shall be fused +/// with data from a depth map. All coordinates must be pre-transformed +/// into the coordinate frame of the depth frame. +/// +//------------------------------------------------------------------------------ +typedef struct fcvDepthFusionBlockConfig { + uint32_t flags; ///< Option specified as a bit field - 0x0000:N/A, 0x0001:run clipping + float32_t ramp; ///< Fusion ramp: maximum allowed distance between volume sample position and depth map sample position + float32_t p0[3], ///< Location of the 1st sample in the volume + dX[3], ///< One sample step in X-direction in the volume + dY[3], ///< One sample step in Y-direction in the volume + dZ[3]; ///< One sample step in Z-direction in the volume + uint32_t volumeIndex; ///< Index of the volume to be updated +} fcvDepthFusionBlockConfig; + +//============================================================================== +// UTILITY FUNCTIONS +//============================================================================== + +#ifdef __cplusplus +extern "C" +{ +#endif + +//------------------------------------------------------------------------------ +/// @brief +/// Retrieves version of FastCV library. +/// +/// @param version +/// Pointer to location to put string. +/// +/// @param versionLength +/// Length of storage for version string. +/// +/// @ingroup misc +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvGetVersion( char* version, + unsigned int versionLength ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Selects HW units for all routines at run-time. +/// \n\b WARNING: Should be called once at the very beginning to update mode +/// +/// @param mode +/// See enum for details. +/// +/// @return +/// 0 if successful. +/// 999 if minmum HW requirement not met. +/// other #'s if unsuccessful. +/// +/// @ingroup misc +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvSetOperationMode( fcvOperationMode mode ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Clean up FastCV resources. Must be called before the program exits. +/// +/// @ingroup misc +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvCleanUp( void ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Allocates memory for Pyramid +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvPyramidAllocate_v2(). In the 2.0.0 release, +/// fcvPyramidAllocate_v2 will be renamed to fcvPyramidAllocate +/// and the signature of fcvPyramidAllocate as it appears now, +/// will be removed. +/// \n\n +/// +/// @param pyr +/// Pointer to an array of fcvPyramidLevel +/// +/// @param baseWidth +/// Width of the base level: the value assigned to pyr[0].width +/// +/// @param baseHeight +/// Height of the base level: the value assigned to pyr[0].height +/// +/// @param bytesPerPixel +/// Number of bytes per pixel: +/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 +/// \n for int32_t pyramid, bytesPerPixel = 4 +/// +/// @param numLevels +/// number of levels in the pyramid +/// +/// @param allocateBase +/// \n if set to 1, memory will be allocated for the base level +/// \n if set to 0, memory for the base level is allocated by the callee +/// \n\b WARNING: How this parameter is set will impact how the memory is freed. +/// Please refer to fcvPyramidDelete for details. +/// +/// @ingroup mem_management +//---------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidAllocate( fcvPyramidLevel* pyr, + unsigned int baseWidth, + unsigned int baseHeight, + unsigned int bytesPerPixel, + unsigned int numLevels, + int allocateBase ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Allocates memory for Pyramid +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidAllocate() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidAllocate, +/// \a fcvPyramidAllocate_v2 will be removed, and the current signature +/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. +/// \n\n +/// +/// @param pyr +/// Pointer to an array of fcvPyramidLevel_v2 +/// +/// @param baseWidth +/// Width of the base level: the value assigned to pyr[0].width +/// +/// @param baseHeight +/// Height of the base level: the value assigned to pyr[0].height +/// +/// @param baseStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. +/// Stride of the base level: the value assigned to pyr[0].stride +/// \n \b NOTE: stride of non-base pyramid image is the same as +/// width*bytesPerPixel of the non-base pyramid image +/// +/// @param bytesPerPixel +/// Number of bytes per pixel: +/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 +/// \n for int32_t pyramid, bytesPerPixel = 4 +/// +/// @param numLevels +/// number of levels in the pyramid +/// +/// @param allocateBase +/// \n if set to 1, memory will be allocated for the base level +/// \n if set to 0, memory for the base level is allocated by the callee +/// \n\b WARNING: How this parameter is set will impact how the memory is freed. +/// Please refer to fcvPyramidDelete for details. +/// +/// @ingroup mem_management +//---------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidAllocate_v2( fcvPyramidLevel_v2* pyr, + uint32_t baseWidth, + uint32_t baseHeight, + uint32_t baseStride, + uint32_t bytesPerPixel, + uint32_t numLevels, + int32_t allocateBase ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Allocates memory for Pyramid +/// DO NOT USE THIS API unless for testing purposes. +/// This API can be removed without notice. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidAllocate_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidAllocate, +/// \a fcvPyramidAllocate_v3 will be removed, and the current signature +/// for \a fcvPyramidAllocate will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidAllocate when transitioning to 2.0.0. +/// \n\n +/// +/// @param pyr +/// Pointer to an array of fcvPyramidLevel_v2 +/// +/// @param baseWidth +/// Width of the base level: the value assigned to pyr[0].width +/// +/// @param baseHeight +/// Height of the base level: the value assigned to pyr[0].height +/// +/// @param baseStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. +/// Stride of the base level: the value assigned to pyr[0].stride +/// \n \b NOTE: stride of non-base pyramid image is the same as +/// width*bytesPerPixel of the non-base pyramid image +/// +/// @param bytesPerPixel +/// Number of bytes per pixel: +/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 +/// \n for int32_t pyramid, bytesPerPixel = 4 +/// +/// @param alignment +/// Used to specify the alignment of each pyramid level other than the base. Must be a multiple +/// of 8. If set to 0, the alignment will be set as 8 bits. +/// +/// @param numLevels +/// number of levels in the pyramid +/// +/// @param scale +/// Defines the type of scaling used for each pyramid level. +/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. +/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), +/// which is approximated as 0.8408964f +/// +/// @param allocateBase +/// \n if set to 1, memory will be allocated for the base level +/// \n if set to 0, memory for the base level is allocated by the callee +/// \n\b WARNING: How this parameter is set will impact how the memory is freed. +/// Please refer to fcvPyramidDelete_v2 for details. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup mem_management +//---------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvPyramidAllocate_v3(fcvPyramidLevel_v2* __restrict pyr, + uint32_t baseWidth, + uint32_t baseHeight, + uint32_t baseStride, + uint32_t bytesPerPixel, + uint32_t alignment, + uint32_t numLevels, + fcvPyramidScale scale, + int32_t allocateBase); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Deallocates an array of fcvPyramidLevel. Can be used for any +/// type(f32/s8/u8). +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvPyramidDelete_v2(). In the 2.0.0 release, +/// fcvPyramidDelete_v2 will be renamed to fcvPyramidDelete +/// and the signature of fcvPyramidDelete as it appears now, +/// will be removed. +/// \n\n +/// +/// @param pyr +/// pyramid to deallocate +/// +/// @param numLevels +/// Number of levels in the pyramid +/// +/// @param startLevel +/// Start level of the pyramid +/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory +/// was allocated outside of fcvPyramidAllocate, then startLevel +/// for fcvPyramidDelete has to be set to 1 (or higher). +/// +/// @ingroup mem_management +//---------------------------------------------------------------------------- + +FASTCV_API void +fcvPyramidDelete( fcvPyramidLevel* pyr, + unsigned int numLevels, + unsigned int startLevel ); + +// ----------------------------------------------------------------------------- +/// @brief +/// Deallocates an array of fcvPyramidLevel. Can be used for any +/// type(f32/s8/u8). +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidDelete() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidDelete, +/// \a fcvPyramidDelete_v2 will be removed, and the current signature +/// for \a fcvPyramidDelete will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidDelete when transitioning to 2.0.0. +/// \n\n +/// +/// @param pyr +/// pyramid to deallocate +/// +/// @param numLevels +/// Number of levels in the pyramid +/// +/// @param startLevel +/// Start level of the pyramid +/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory +/// was allocated outside of fcvPyramidAllocate, then startLevel +/// for fcvPyramidDelete_v2 has to be set to 1 (or higher). +/// +/// @ingroup mem_management +//---------------------------------------------------------------------------- + +FASTCV_API void +fcvPyramidDelete_v2( fcvPyramidLevel_v2* pyr, + uint32_t numLevels, + uint32_t startLevel ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Allocates aligned memory. +/// +/// @param nBytes +/// Number of bytes. +/// +/// @param byteAlignment +/// Alignment specified in bytes (e.g., 16 = 128-bit alignment). +/// \n\b WARNING: must be < 255 bytes +/// +/// @return +/// SUCCESS: pointer to aligned memory +/// FAILURE: 0 +/// +/// @ingroup mem_management +//------------------------------------------------------------------------------ + +FASTCV_API void* +fcvMemAlloc( unsigned int nBytes, + unsigned int byteAlignment ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Frees memory allocated by fcvMemAlloc(). +/// +/// @param ptr +/// Pointer to memory. +/// +/// @ingroup mem_management +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvMemFree( void* ptr ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Initialize the Memory sub-system in FastCV. The sub-system handles +/// temporary/scratch memory requirements from several FastCV functions +/// that do not have parameters to have this supplied by the users of those +/// functions. +/// +/// \b Important: +/// \n 1. Every call to this function should be followed by a call to +/// fcvMemDeInit(). +/// \n 2. This function (and the fcvMemDeInit) only needs to called once per +/// process. +/// \n 3. Any call to FastCV functions that uses internal temporary memory +/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory +/// allocation. +/// \n 4. A call to this function without a corresponding call to fcvMemDeInit +/// can result in memory leak. +/// +/// @ingroup mem_management +// ----------------------------------------------------------------------------- +FASTCV_API void +fcvMemInit(void); + +// ----------------------------------------------------------------------------- +/// @brief +/// Initialize the Memory sub-system in FastCV with pre-allocated buffer. +/// The sub-system handles temporary/scratch memory requirements from several +/// FastCV functions that do not have parameters to have this supplied by the +/// users of those functions. +/// +/// \b Important: +/// \n 1. Every call to this function should be followed by a call to +/// fcvMemDeInit(). +/// \n 2. This function (and the fcvMemDeInit) only needs to called once per +/// process. +/// \n 3. Any call to FastCV functions that uses internal temporary memory +/// outside of fcvMemInit and fcvMemDeInit pair will use non-optimum memory +/// allocation. +/// \n 4. A call to this function without a corresponding call to fcvMemDeInit +/// can result in memory leak. +/// +/// @param preAllocBytes +/// Number of bytes for the pre-allocated buffer. +/// +/// @ingroup mem_management +// ----------------------------------------------------------------------------- +FASTCV_API void +fcvMemInitPreAlloc( uint32_t preAllocBytes ); + +// ----------------------------------------------------------------------------- +/// @brief +/// De-Initialize the Memory sub-system initialized by fcvMemInit() function. +/// +/// \b Important: +/// \n 1. Call to this function without a corresponding call to fcvMemInit will +/// result in no-op. +/// +/// @ingroup mem_management +// ----------------------------------------------------------------------------- +FASTCV_API void +fcvMemDeInit(void); + +//End - Utility functions + + +//============================================================================== +// FUNCTIONS +//============================================================================== + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 median filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterMedian3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterMedian3x3u8_v2 will be renamed to fcvFilterMedian3x3u8 +/// and the signature of fcvFilterMedian3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Border values are ignored. The 3x3 mask convolves with the image area +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param srcImg +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dstImg +/// Output 8-bit image. Size of buffer is srcWidth*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterMedian3x3u8( const uint8_t* __restrict srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dstImg ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 median filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterMedian3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, +/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Border values are ignored. The 3x3 mask convolves with the image area +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param srcImg +/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dstImg +/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterMedian3x3u8_v2( const uint8_t* __restrict srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dstImg, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 Gaussian filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterGaussian3x3u8_v2 will be renamed to fcvFilterGaussian3x3u8 +/// and the signature of fcvFilterGaussian3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Gaussian kernel: +/// \n 1 2 1 +/// \n 2 4 2 +/// \n 1 2 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit image. Destination buffer size is srcWidth*srcHeight. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 +/// case). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian3x3u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + int blurBorder ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 Gaussian filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, +/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 3x3 Gaussian kernel: +/// \n 1 2 1 +/// \n 2 4 2 +/// \n 1 2 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 +/// case). +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride, + int blurBorder ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian5x5u8_v2(). In the 2.0.0 release, +/// fcvFilterGaussian5x5u8_v2 will be renamed to fcvFilterGaussian5x5u8 +/// and the signature of fcvFilterGaussian5x5u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 +/// case). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian5x5u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + int blurBorder ); + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian5x5u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian5x5u8, +/// \a fcvFilterGaussian5x5u8_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian5x5u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian5x5u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 +/// case). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride, + int blurBorder ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 11x11 Gaussian filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian11x11u8_v2(). In the 2.0.0 release, +/// fcvFilterGaussian11x11u8_v2 will be renamed to fcvFilterGaussian11x11u8 +/// and the signature of fcvFilterGaussian11x11u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Convolution with 11x11 Gaussian kernel: +/// \n 1 10 45 120 210 252 210 120 45 10 1 +/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 +/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 +/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 +/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 +/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 +/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 +/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 +/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 +/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 +/// \n 1 10 45 120 210 252 210 120 45 10 , 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 +/// case). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian11x11u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + int blurBorder ); + + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 11x11 Gaussian filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian11x11u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian11x11u8, +/// \a fcvFilterGaussian11x11u8_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian11x11u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian11x11u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 11x11 Gaussian kernel: +/// \n 1 10 45 120 210 252 210 120 45 10 1 +/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 +/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 +/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 +/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 +/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 +/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 +/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 +/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 +/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 +/// \n 1 10 45 120 210 252 210 120 45 10 , 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param blurBorder +/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, +/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 +/// case). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride, + int blurBorder ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved) to RGB 8888. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvColorYCrCb420PseudoPlanarToRGB8888u8. In the 2.0.0 release, +/// the signature of fcvColorYUV420toRGB8888u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// 8-bit image of input YUV 4:2:0 values. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// The input are one Y plane followed by one interleaved and 2D (both +/// horizontally and vertically) sub-sampled CrCb plane: +/// Y plane : Y00 Y01 Y02 Y03 ... +/// Y10 Y11 Y12 Y13 ... +/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... +/// +/// @param dst +/// 32-bit image of output RGB 8888 values. R is at LSB. +/// \n\b WARNING: size must match input yuv420. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYUV420toRGB8888u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint32_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved CrCb) to RGB 888. +/// +/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release +/// of this library is made. +/// Until 2.0.0, the developer should use this implementation with the expectation of +/// moving to a different name when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// 8-bit image of input YUV picture. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// The input are one Y plane followed by one interleaved and 2D (both +/// horizontally and vertically) sub-sampled CrCb plane: +/// Y plane : Y00 Y01 Y02 Y03 ... +/// Y10 Y11 Y12 Y13 ... +/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcYStride +/// Stride (in bytes) of input image Y component (i.e., number of bytes between +/// column 0 of row 1 and column 0 of row 2). +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). +/// +/// @param srcCStride +/// Stride (in bytes) of input image Chroma component (i.e., number of bytes between +/// column 0 of row 1 and column 0 of row 2) +/// \n\b WARNING: should be multiple of 4 (4 * 1-byte values). +/// +/// @param dst +/// 32-bit image of output RGB 8888 values. R in LSB. +/// \n\b WARNING: size must match input yuv420. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output RGB image (i.e., number of bytes between column 0 of +/// row 1 and column 0 of row 2) +/// \n\b WARNING: should be multiple of 32 (8 * 4-byte values). +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcYStride, + unsigned int srcCStride, + uint32_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YUV (YCbCr) 4:2:0 PesudoPlanar (Interleaved CbCr) to RGB 565. +/// +/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release +/// of this library is made. +/// Until 2.0.0, the developer should use this implementation with the expectation of +/// moving to a different name when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// 8-bit image of input YUV 4:2:0 values. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// The input are one Y plane followed by one interleaved and 2D (both +/// horizontally and vertically) sub-sampled CbCr plane: +/// Y plane : Y00 Y01 Y02 Y03 ... +/// Y10 Y11 Y12 Y13 ... +/// Interleaved and 2D sub-sampled plane: Cb0 Cr0 Cb1 Cr1 ... +/// +/// @param dst +/// 16-bit image of output RGB 565 values. R in LSBs. +/// 2 pixels are packed into one 32-bit output +/// \n\b WARNING: size must match input yuv420. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 4 +/// +/// @param srcHeight +/// Image height. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYUV420toRGB565u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint32_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YCbCr H1V1 to RGB 888. +/// +/// @details +/// Color conversion from YCbCr H1V1 (YCbCr 4:4:4 planar) to RGB 888. +/// \n R = Y + 1.40200*(Cr-128) +/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) +/// \n B = Y + 1.77200*(CB-128) +/// +/// @param src +/// 8-bit image of input values. Stored as YCbCr H1V1 planar format in 8x8 blocks for Y,Cb,Cr. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// 8-bit image of output RGB 888 values. R in LSB. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYCrCbH1V1toRGB888u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YCbCr H2V2 to RGB 888. +/// +/// @details +/// Color conversion from YCbCr H2V2 (YCbCr 4:2:0 planar) to RGB 888. +/// \n R = Y + 1.40200*(Cr-128) +/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) +/// \n B = Y + 1.77200*(CB-128) +/// +/// @param ysrc +/// 8-bit input values. Stored as YCbCr H2V2 planar format in 16x16 blocks for Y, 8x8 blocks for Cb, Cr. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// 8-bit image of output RGB 888 values. R in LSB. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYCrCbH2V2toRGB888u8( const uint8_t* __restrict ysrc, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YCbCr H2V1 to RGB 888. +/// +/// @details +/// Color conversion from YCbCr H2V1 (YCbCr 4:2:2) to RGB 888. +/// \n R = Y + 1.40200*(Cr-128) +/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) +/// \n B = Y + 1.77200*(CB-128) +/// +/// @param src +/// 8-bit input values. Stored as YCbCr H2V1 planar format in 16x8 blocks for Y, 8x8 blocks for Cb, Cr. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// 8-bit image of output RGB 888 values. R in LSB. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYCrCbH2V1toRGB888u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from YCbCr H1V2 to RGB 888. +/// +/// @details +/// Color conversion from YCbCr H1V2 (YCbCr 4:2:2) to RGB 888. +/// \n R = Y + 1.40200*(Cr-128) +/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) +/// \n B = Y + 1.77200*(CB-128) +/// +/// @param ysrc +/// 8-bit input values. Stored as YCbCr H1V2 planar format in 8x16 blocks for Y, 8x8 blocks for Cb, Cr. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// 8-bit image of output RGB 888 values. R in LSB. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorYCrCbH1V2toRGB888u8( const uint8_t* __restrict ysrc, + + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from RGB 888 to YCrCb. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvColorRGB888toYCrCbu8_v2(). In the 2.0.0 release, +/// fcvColorRGB888toYCrCbu8_v2 will be renamed to fcvColorRGB888toYCrCbu8 +/// and the signature of fcvColorRGB888toYCrCbu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. +/// +/// @param src +/// 8-bit input values. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorRGB888toYCrCbu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Color conversion from RGB 888 to YCrCb 4:4:4 (Full interleaved, similar to +/// 3-channel RGB). +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvColorRGB888toYCrCbu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvColorRGB888toYCrCbu8, +/// \a fcvColorRGB888toYCrCbu8_v2 will be removed, and the current signature +/// for \a fcvColorRGB888toYCrCbu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvColorRGB888toYCrCbu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. +/// +/// @param src +/// 8-bit input values. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b WARNING: Must be at least 3*srcWidth. +/// +/// @param dst +/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. +/// \n\b WARNING: size must match input crcb. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b WARNING: Must be at least 3*srcWidth. +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorRGB888toYCrCbu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Create a 36-dimension gradient based descriptor on 17x17 patch. +/// +/// @details +/// +/// @param patch +/// Input luminance data for 17x17 patch to describe. +/// +/// @param descriptorChar +/// Output descriptor vector. 36 x 8-bit vector. Normalized and quantized to range [-127, 127] +/// +/// @param descriptorNormSq +/// Output squared norm (L2 norm) of the descriptor vector. +/// +/// +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, + int8_t* __restrict descriptorChar, + int32_t* __restrict descriptorNormSq ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two 8-bit vectors. +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @param abSize +/// Number of elements in A and B. +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API int32_t +fcvDotProducts8( const int8_t* __restrict a, + const int8_t* __restrict b, + unsigned int abSize ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of two 8-bit vectors. +/// +/// @param a +/// Vector A. +/// +/// @param b +/// Vector B. +/// +/// @param abSize +/// Number of elements in A and B. +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvDotProductu8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + unsigned int abSize ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two 36-byte vectors. +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API int32_t +fcvDotProduct36x1s8( const int8_t* __restrict a, + const int8_t* __restrict b ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of one 36-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @param c +/// Vector. +/// +/// @param d +/// Vector. +/// +/// @param e +/// Vector. +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvDotProduct36x4s8( const int8_t* __restrict a, + const int8_t* __restrict b, + const int8_t* __restrict c, + const int8_t* __restrict d, + const int8_t* __restrict e, + int32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 36-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// +/// @param b1 +/// Vector. +/// +/// @param b2 +/// Vector. +/// +/// @param b3 +/// Vector. +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm36x4s8( const int8_t* __restrict a, + float invLengthA, + const int8_t* __restrict b0, + const int8_t* __restrict b1, + const int8_t* __restrict b2, + const int8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of two 36-byte vectors. +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvDotProduct36x1u8( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of one 36-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @param c +/// Vector. +/// +/// @param d +/// Vector. +/// +/// @param e +/// Vector. +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProduct36x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 36-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// +/// @param b1 +/// Vector. +/// +/// @param b2 +/// Vector. +/// +/// @param b3 +/// Vector. +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm36x4u8( const uint8_t* __restrict a, + float invLengthA, + const uint8_t* __restrict b0, + const uint8_t* __restrict b1, + const uint8_t* __restrict b2, + const uint8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two 64-byte vectors. +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API int32_t +fcvDotProduct64x1s8( const int8_t* __restrict a, + const int8_t* __restrict b ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of one 64-byte vector against 4 others. +/// +/// @details +/// Dot product of vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param c +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param d +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param e +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvDotProduct64x4s8( const int8_t* __restrict a, + const int8_t* __restrict b, + const int8_t* __restrict c, + const int8_t* __restrict d, + const int8_t* __restrict e, + int32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 64-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// +/// @param b1 +/// Vector. +/// +/// @param b2 +/// Vector. +/// +/// @param b3 +/// Vector. +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm64x4s8( const int8_t* __restrict a, + float invLengthA, + const int8_t* __restrict b0, + const int8_t* __restrict b1, + const int8_t* __restrict b2, + const int8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of two 64-byte vectors. +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvDotProduct64x1u8( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of one 64-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// +/// @param b +/// Vector. +/// +/// @param c +/// Vector. +/// +/// @param d +/// Vector. +/// +/// @param e +/// Vector. +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProduct64x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 64-byte vector against 4 others. +/// +/// @details +/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// +/// @param b1 +/// Vector. +/// +/// @param b2 +/// Vector. +/// +/// @param b3 +/// Vector. +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm64x4u8( const uint8_t* __restrict a, + float invLengthA, + const uint8_t* __restrict b0, + const uint8_t* __restrict b1, + const uint8_t* __restrict b2, + const uint8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two 128-byte vectors. +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API int32_t +fcvDotProduct128x1s8( const int8_t* __restrict a, + const int8_t* __restrict b ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of one 128-byte vector against 4 others. +/// +/// @details +/// Dot product of vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param c +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param d +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param e +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvDotProduct128x4s8( const int8_t* __restrict a, + const int8_t* __restrict b, + const int8_t* __restrict c, + const int8_t* __restrict d, + const int8_t* __restrict e, + int32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 128-byte vector against 4 others. +/// +/// @details +/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b1 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b2 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b3 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm128x4s8( const int8_t* __restrict a, + float invLengthA, + const int8_t* __restrict b0, + const int8_t* __restrict b1, + const int8_t* __restrict b2, + const int8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of two 128-byte vectors. +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @return +/// Dot product . +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvDotProduct128x1u8( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of one 128-byte vector against 4 others. +/// +/// @details +/// Dot product of vector (a) against 4 others (b,c,d,e):\n +/// , , , +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param c +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param d +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param e +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProduct128x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalized dot product of one 128-byte vector against 4 others. +/// +/// @details +/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n +/// , , , +/// using their given inverse lengths for normalization. +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLengthA +/// Inverse of vector A. +/// +/// @param b0 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b1 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b2 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b3 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLengthsB +/// Pointer to an array of the inverse values of each B vector. +/// The pointer must point to 4 floating point values. +/// +/// @param dotProducts +/// Output of the 4 results { , , , }. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProductNorm128x4u8( const uint8_t* __restrict a, + float invLengthA, + const uint8_t* __restrict b0, + const uint8_t* __restrict b1, + const uint8_t* __restrict b2, + const uint8_t* __restrict b3, + float* __restrict invLengthsB, + float* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of 1 patch (8x8 byte square) with several (n) 8x8 squares +/// along a line of pixels in an image. +/// +/// @param patchPixels +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param imagePixels +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// +/// @param imgW +/// Width in pixels of the source image. +/// +/// @param imgH +/// Height in pixels of the source image. +/// +/// @param nX +/// X location on image of starting search pixel. +/// +/// @param nY +/// Y location on image of starting search pixel. +/// +/// @param nNum +/// Number of pixels (in X direction) on image to sweep. +/// +/// @param dotProducts +/// Output dot product values of nNum pixels. +/// \n\b WARNING: array size must be a multiple of 4 (e.g., 4, 8, 12, ...) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvDotProduct8x8u8( const uint8_t* __restrict patchPixels, + const uint8_t* __restrict imagePixels, + unsigned short imgW, + unsigned short imgH, + int nX, + int nY, + unsigned int nNum, + int32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dot product of 1 patch (8x8 byte square) with 8x8 squares in 11x12 +/// rectangle around the center search pixel (iX,iY). +/// +/// @param patchPixels +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param imagePixels +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// +/// @param imgW +/// Width in pixels of the image. +/// +/// @param imgH +/// Height in pixels of the image. +/// +/// @param iX +/// X location on image of the center of the search window. +/// +/// @param iY +/// Y location on image of the center of the search window. +/// +/// @param dotProducts +/// Output 11x12 dot product values. +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvDotProduct11x12u8( const uint8_t* __restrict patchPixels, + const uint8_t* __restrict imagePixels, + unsigned short imgW, + unsigned short imgH, + int iX, + int iY, + int32_t* __restrict dotProducts ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 3x3 Sobel edge filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterSobel3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterSobel3x3u8_v2 will be renamed to fcvFilterSobel3x3u8 +/// and the signature of fcvFilterSobel3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. +/// Border values are ignored. The 3x3 mask convolves with the image area +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit image of |dx|+|dy|. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: dst is saturated to 255 +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterSobel3x3u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 3x3 Sobel edge filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterSobel3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterSobel3x3u8, +/// \a fcvFilterSobel3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterSobel3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterSobel3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. +/// Border values are ignored. The 3x3 mask convolves with the image area +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image of |dx|+|dy|. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: dst is saturated to 255 +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Canny edge filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCanny3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterCanny3x3u8_v2 will be renamed to fcvFilterCanny3x3u8 +/// and the signature of fcvFilterCanny3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Canny edge detector applied to a 8 bit grayscale image. The min threshold +/// is set to 0 and the max threshold is set to 15. The aperture size used +/// is set to 3. This function will output the edge, since its working with a +/// 3x3 window, it leaves one row/col of pixels at the corners +/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge). +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit image containing the edge detection results. +/// Size of buffer is srcWidth*srcHeight bytes. +/// +/// @param lowThresh +/// For all the intermediate pixels along the edge, the magnitude of the +/// gradient at the pixel locations should be greater than 'low' +/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) +/// +/// @param highThresh +/// For an edge starting point, i.e. either the first or last +/// pixel of the edge, the magnitude of the gradient at the pixel should be +/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and +/// Y gradient). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCanny3x3u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + int lowThresh, + int highThresh ); + +//------------------------------------------------------------------------------ +/// @brief +/// Canny edge filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCanny3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, +/// \a fcvFilterCanny3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge +/// detector uses min/max threshold to classify an edge. The min threshold +/// is set to 0 and the max threshold is set to 15. The aperture size used +/// in the Canny edge detector will be same as the filter footprint in the +/// Sobel edge detector and is set to 3. This function will output the edge +/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since +/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image containing the edge detection results. +/// Size of buffer is dstStride*srcHeight bytes. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param lowThresh +/// For all the intermediate pixels along the edge, the magnitude of the +/// gradient at the pixel locations should be greater than 'low' +/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) +/// +/// @param highThresh +/// For an edge starting point, i.e. either the first or last +/// pixel of the edge, the magnitude of the gradient at the pixel should be +/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and +/// Y gradient). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride, + int lowThresh, + int highThresh ); + +//------------------------------------------------------------------------------ +/// @brief +/// Canny edge filter +/// +/// \n\b ATTENTION: This function is in the extension lib. +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCanny3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, +/// \a fcvFilterCanny3x3u8_v3 will be removed, and the current signature +/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge +/// detector uses min/max threshold to classify an edge. The min threshold +/// is set to 0 and the max threshold is set to 15. The aperture size used +/// in the Canny edge detector will be same as the filter footprint in the +/// Sobel edge detector and is set to 3. This function will output the edge +/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since +/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image containing the edge detection results. +/// Size of buffer is dstStride*srcHeight bytes. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gx +/// gradient in X direction. +/// \n\b NOTE: use NULL if do not need the gradient output. +/// +/// @param gy +/// gradient in Y direction. +/// \n\b NOTE: use NULL if do not need the gradient output. +/// +/// @param gradStride +/// Output stride for gx and gy. +/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param lowThresh +/// For all the intermediate pixels along the edge, the magnitude of the +/// gradient at the pixel locations should be greater than 'low' +/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) +/// +/// @param highThresh +/// For an edge starting point, i.e. either the first or last +/// pixel of the edge, the magnitude of the gradient at the pixel should be +/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and +/// Y gradient). +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFilterCanny3x3u8_v3( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride, + int16_t* __restrict gx, + int16_t* __restrict gy, + unsigned int gradStride, + int lowThresh, + int highThresh ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Performs image difference by subracting src2 from src1. dst=src1-src2. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageDiffu8_v2(). In the 2.0.0 release, +/// fcvImageDiffu8_v2 will be renamed to fcvImageDiffu8 +/// and the signature of fcvImageDiffu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); +/// +/// @param src1 +/// First source image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Second source image, must be same size as src1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Destination. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: Must be same size as src1 and src2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageDiffu8( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + +//------------------------------------------------------------------------------ +/// @brief +/// Performs image difference by subracting src2 from src1. dst=src1-src2. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageDiffu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageDiffu8, +/// \a fcvImageDiffu8_v2 will be removed, and the current signature +/// for \a fcvImageDiffu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageDiffu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); +/// +/// @param src1 +/// First source image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Second source image, must be same size as src1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of input image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Destination. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: Must be same size as src1 and src2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageDiffu8_v2( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +//-------------------------------------------------------------------------- +/// @brief +/// Compute image difference src1-src2 +/// +/// @param src1 +/// Input image1 of int16 type. Size of buffer is srcStride*srcHeight*2 bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Input image2, must have same size as src1 +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Stride of input image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output image, saturated for int16 type. Size of buffer is dstStride*srcHeight*2 bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @ingroup image_processing +////------------------------------------------------------------------------ +FASTCV_API void +fcvImageDiffs16( const int16_t* __restrict src1, + const int16_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dst, + unsigned int dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Performs image difference by subracting src2 from src1. dst=src1-src2. +/// +/// @details +/// +/// @param src1 +/// First source image. Size of buffer is srcStride*srcHeight*4 bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Second source image, must be same size as src1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of input image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Destination. Size of buffer is dstStride*srcHeight*4 bytes. +/// \n\b NOTE: Must be same size as src1 and src2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageDifff32( const float* __restrict src1, + const float* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Performs image difference by promoting both src1 and src 2 to +/// floating point values and then subracting src2 from src1. dst=src1-src2. +/// +/// @details +/// +/// @param src1 +/// First source image +/// +/// @param src2 +/// Second source image, must be same size as src1. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of input image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dst +/// Destination image in float type +/// \n\b NOTE: Must be same size as src1 and src2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be multiple of 8. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageDiffu8f32( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Performs image difference by subracting src2 from src1. +/// dst = ( src1 >> 1) - ( src2 >> 1). +/// +/// @details +/// +/// @param src1 +/// First source image +/// +/// @param src2 +/// Second source image, must be same size as src1. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of input image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dst +/// Destination image in int8 type +/// \n\b NOTE: Must be same size as src1 and src2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be multiple of 8. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageDiffu8s8( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int8_t* __restrict dst, + unsigned int dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientInterleaveds16_v2(). In the 2.0.0 release, +/// fcvImageGradientInterleaveds16_v2 will be renamed to fcvImageGradientInterleaveds16 +/// and the signature of fcvImageGradientInterleaveds16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gradients +/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientInterleaveds16( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict gradients + ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientInterleaveds16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientInterleaveds16, +/// \a fcvImageGradientInterleaveds16_v2 will be removed, and the current signature +/// for \a fcvImageGradientInterleaveds16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientInterleaveds16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gradients +/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. +/// +/// @param gradStride +/// Stride in bytes of the interleaved gradients array. +/// \n\b NOTE: if 0, srcStride is set as 4*(srcWidth-2). +/// \n\b WARNING: should be multiple of 16 ( 8 * 2-byte values ), and at least as much as 4*(srcWidth-2) if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict gradients, + unsigned int gradStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Function to initialize MSER. To invoke MSER functionality, 3 functions have to be called: +/// fcvMserInit, fcvMseru8, fcvMserRelease. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// fcvMseru8 (mserHandle,...); +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param width +/// Width of the image for which MSER has to be done. +/// +/// @param height +/// Height of the image for which MSER has to be done. +/// +/// @param delta +/// Delta to be used in MSER algorithm (the difference in grayscale values +/// within which the region is stable ). +/// Typical value range [0.8 8], typical value 2 +/// +/// @param minArea +/// Minimum area (number of pixels) of a mser contour. +/// Typical value range [10 50], typical value 30 +/// +/// @param maxArea +/// Maximum area (number of pixels) of a mser contour. +/// Typical value 14400 or 0.25*width*height +/// +/// @param maxVariation +/// Maximum variation in grayscale between 2 levels allowed. +/// Typical value range [0.1 1.0], typical value 0.15 +/// +/// @param minDiversity +/// Minimum diversity in grayscale between 2 levels allowed. +/// Typical value range [0.1 1.0], typical value 0.2 +/// +/// @param mserHandle +/// Output. the mserHandle to be used in subsequent calls. +/// +/// @return +/// 1 if successful. +/// 0 if unsuccessful, mserHandle is invalid. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserInit(const unsigned int width, + const unsigned int height, + unsigned int delta, + unsigned int minArea, + unsigned int maxArea, + float maxVariation, + float minDiversity, + void ** mserHandle ); + +//--------------------------------------------------------------------------- +/// @brief +/// Function to release MSER resources. +/// +/// @param mserHandle +/// Handle to be used to free up MSER resources. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvMserRelease(void *mserHandle); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke MSER. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// fcvMseru8 (mserHandle,...); +/// fcvMserRelease(mserHandle); +/// } +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMseru8_v2(). In the 2.0.0 release, +/// fcvMseru8_v2 will be renamed to fcvMseru8. +/// and the signature of fcvMseru8 as it appears now, will be removed. +/// \n\n +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up for the +/// first (*numContours) values. This memory has to be allocated by the caller. +/// +/// @param pointsArraySize +/// Size of the output points Array. +/// Typical size: (# of pixels in source image) * 30 +/// +/// @param pointsArray +/// Output. This is the points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pointArraySize. +/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, +/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region +/// and so on. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvMseru8( void *mserHandle, + const uint8_t* __restrict srcPtr, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + unsigned int maxContours, + unsigned int * __restrict numContours, + unsigned int * __restrict numPointsInContour, + unsigned int pointsArraySize, + unsigned int * __restrict pointsArray); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke MSER, with additional outputs for each contour. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// fcvMserExtu8 (mserHandle,...); +/// fcvMserRelease(mserHandle); +/// } +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMserExtu8_v2(). In the 2.0.0 release, +/// fcvMserExtu8_v2 will be renamed to fcvMserExtu8. +/// and the signature of fcvMserExtu8 as it appears now, will be removed. +/// \n\n +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// Application dependent. OCR usually requires 100-1000 contours. +/// Segmentation usually requires 50-100 +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller. +/// +/// @param pointsArraySize +/// Size of the output points Array. +/// Typical size: (# of pixels in source image)*30 +/// +/// @param pointsArray +/// Output. This is the points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pointArraySize. +/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region; +/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region +/// and so on. +/// +/// @param contourVariation +/// Output, Variation for each contour from previous grey level. +/// This will have values filled up for the first (*numContours) values. +/// This memory has to be allocated by the caller with size of maxContours. +/// +/// @param contourPolarity +/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, +/// -1 if this is a MSER- region. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @param contourNodeId +/// Output, Node id for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours +/// +/// @param contourNodeCounter +/// Output, Node counter for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvMserExtu8( void *mserHandle, + const uint8_t* __restrict srcPtr, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + unsigned int maxContours, + unsigned int * __restrict numContours, + unsigned int * __restrict numPointsInContour, + unsigned int * __restrict pointsArray, + unsigned int pointsArraySize, + unsigned int * __restrict contourVariation, + int * __restrict contourPolarity, + unsigned int * __restrict contourNodeId, + unsigned int * __restrict contourNodeCounter); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke MSER with a smaller memory footprint and the (optional) output of contour bound boxes. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// if ( !fcvMseru8_v2 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param recArray +/// Output, This is the bounding rectangle info for each contour. +/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. +/// Typical allocation size: 4*maxContours. +/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, +/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller. +/// +/// @param pointsArraySize +/// Size of the output points Array. +/// Typical size: (# of pixels in source image) * 30 +/// +/// @param pointsArray +/// Output. This is the points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pointArraySize. +/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, +/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region +/// and so on. +/// +/// @return +/// 1 if successful. +/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. +/// In that case, please consider increasing maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMseru8_v2( void *mserHandle, + const uint8_t* __restrict srcPtr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxContours, + uint32_t* __restrict numContours, + uint16_t* __restrict recArray, + uint32_t* __restrict numPointsInContour, + uint32_t pointsArraySize, + uint16_t* __restrict pointsArray); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke MSER with a smaller memory footprint, +/// the (optional) output of contour bound boxes, and additional information. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// if ( !fcvMserExtu8_v2 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param recArray +/// Output, This is the bounding rectangle info for each contour. +/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. +/// Typical allocation size: 4*maxContours. +/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, +/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller. +/// +/// @param pointsArraySize +/// Size of the output points Array. +/// Typical size: (# of pixels in source image) * 30 +/// +/// @param pointsArray +/// Output. This is the points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pointArraySize. +/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, +/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region +/// and so on. +/// +/// @param contourVariation +/// Output, Variation for each contour from previous grey level. +/// This will have values filled up for the first (*numContours) values. +/// This memory has to be allocated by the caller with size of maxContours. +/// +/// @param contourPolarity +/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, +/// -1 if this is a MSER- region. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @param contourNodeId +/// Output, Node id for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours +/// +/// @param contourNodeCounter +/// Output, Node counter for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @return +/// 1 if successful. +/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. +/// In that case, please consider increasing maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserExtu8_v2( void *mserHandle, + const uint8_t* __restrict srcPtr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxContours, + uint32_t* __restrict numContours, + uint16_t* __restrict recArray, + uint32_t* __restrict numPointsInContour, + uint32_t pointsArraySize, + uint16_t* __restrict pointsArray, + uint32_t* __restrict contourVariation, + int8_t* __restrict contourPolarity, + uint32_t* __restrict contourNodeId, + uint32_t* __restrict contourNodeCounter); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke MSER with a smaller memory footprint, +/// the (optional) output of contour bound boxes, and additional information. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserInit (width,........,&mserHandle)) +/// { +/// if ( !fcvMserExtu8_v3 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserInit. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserInit. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param recArray +/// Output, This is the bounding rectangle info for each contour. +/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. +/// Typical allocation size: 4*maxContours. +/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, +/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. +/// +/// @param staPointsInPath +/// Output. Return the index of contour starting points in pathArray. +/// This memory has to be allocated by the caller. The allocated size should be maxContours*sizeof(uint32_t). +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller. +/// +/// @param pathArraySize +/// Input. The size of output pathArray in terms of how many uint16_t numbers. Must be srcWidth*srcHeight*4. +/// Note: this parameter is not measured in terms of bytes. +/// +/// @param pathArray +/// Output. This is the compressed representation of points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pathArraySize*sizeof(uint16_t). +/// For example: +/// pathArray[ staPointsInPath[0] ] : x coord of the FIRST point in the FIRST mser region. +/// pathArray[ staPointsInPath[0] + 1 ] : y coord of the FIRST point in the FIRST mser region. +/// pathArray[ staPointsInPath[0] + 2 ] : x coord of the SECOND point in the FIRST mser region. +/// pathArray[ staPointsInPath[0] + 3 ] : y coord of the SECOND point in the FIRST mser region. +/// . . . +/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 2 ] : x coord of the LAST point in the FIRST mser region. +/// pathArray[ staPointsInPath[0] + 2*numPointsInContour[0] - 1 ] : y coord of the LAST point in the FIRST mser region. +/// and +/// pathArray[ staPointsInPath[1] ] : x coord of the FIRST point in the SECOND mser region. +/// pathArray[ staPointsInPath[1] + 1 ] : y coord of the FIRST point in the SECOND mser region. +/// pathArray[ staPointsInPath[1] + 2 ] : x coord of the SECOND point in the SECOND mser region. +/// pathArray[ staPointsInPath[1] + 3 ] : y coord of the SECOND point in the SECOND mser region. +/// . . . +/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 2 ] : x coord of the LAST point in the SECOND mser region. +/// pathArray[ staPointsInPath[1] + 2*numPointsInContour[1] - 1 ] : y coord of the LAST point in the SECOND mser region. +/// . . . +/// +/// @param contourVariation +/// Output, Variation for each contour from previous grey level. +/// This will have values filled up for the first (*numContours) values. +/// This memory has to be allocated by the caller with size of maxContours. +/// +/// @param contourPolarity +/// Output, Polarity for each contour. This value is 1 if this is a MSER+ region, +/// -1 if this is a MSER- region. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @param contourNodeId +/// Output, Node id for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours +/// +/// @param contourNodeCounter +/// Output, Node counter for each contour. This will have values filled up +/// for the first (*numContours) values. This memory has to be allocated by +/// the caller with size of maxContours. +/// +/// @return +/// 1 if successful. +/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. +/// In that case, please consider increasing maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserExtu8_v3( void *mserHandle, + const uint8_t* __restrict srcPtr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxContours, + uint32_t* __restrict numContours, + uint16_t* __restrict recArray, + uint32_t* __restrict staPointsInPath, + uint32_t* __restrict numPointsInContour, + uint32_t pathArraySize, + uint16_t* __restrict pathArray, + uint32_t* __restrict contourVariation, + int8_t* __restrict contourPolarity, + uint32_t* __restrict contourNodeId, + uint32_t* __restrict contourNodeCounter); + +//--------------------------------------------------------------------------- +/// @brief +/// Function to initialize 8-neighbor MSER. To invoke 8-neighbor MSER functionality, 3 functions have to be called: +/// fcvMserNN8Init, fcvMserNN8u8, fcvMserRelease. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserNN8Init (width,........,&mserHandle)) +/// { +/// if ( !fcvMserNN8u8 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param width +/// Width of the image for which MSER has to be done. +/// +/// @param height +/// Height of the image for which MSER has to be done. +/// +/// @param delta +/// Delta to be used in MSER algorithm (the difference in grayscale values +/// within which the region is stable ). +/// Typical value range [0.8 8], typical value 2 +/// +/// @param minArea +/// Minimum area (number of pixels) of a mser contour. +/// Typical value range [10 50], typical value 30 +/// +/// @param maxArea +/// Maximum area (number of pixels) of a mser contour. +/// Typical value 14400 or 0.25*width*height +/// +/// @param maxVariation +/// Maximum variation in grayscale between 2 levels allowed. +/// Typical value range [0.1 1.0], typical value 0.15 +/// +/// @param minDiversity +/// Minimum diversity in grayscale between 2 levels allowed. +/// Typical value range [0.1 1.0], typical value 0.2 +/// +/// @param mserHandle +/// Output. the mserHandle to be used in subsequent calls. +/// +/// @return +/// 1 if successful. +/// 0 if unsuccessful, mserHandle is invalid. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserNN8Init(const uint32_t width, + const uint32_t height, + uint32_t delta, + uint32_t minArea , + uint32_t maxArea , + float32_t maxVariation , + float32_t minDiversity , + void **mserHandle ); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke 8-neighbor MSER. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserNN8Init (width,........,&mserHandle)) +/// { +/// if ( !fcvMserNN8u8 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param recArray +/// Output, This is the bounding rectangle info for each contour. +/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. +/// Typical allocation size: 4*maxContours. +/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, +/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. +/// +/// @param numPointsInContour +/// Output, Number of points in each contour. This will have values filled up for the +/// first (*numContours) values. This memory has to be allocated by the caller. +/// +/// @param pointsArraySize +/// Size of the output points Array. +/// Typical size: (# of pixels in source image) * 30 +/// +/// @param pointsArray +/// Output. This is the points in all the contours. This is a linear array, whose memory +/// has to be allocated by the caller. +/// Typical allocation size: pointArraySize. +/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, +/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region +/// and so on. +/// +/// @return +/// 1 if successful. +/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. +/// In that case, please consider increasing maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserNN8u8 ( void *mserHandle, + const uint8_t* __restrict srcPtr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxContours, + uint32_t* __restrict numContours, + uint16_t* __restrict recArray, + uint32_t* __restrict numPointsInContour, + uint32_t pointsArraySize, + uint16_t* __restrict pointsArray); + +///--------------------------------------------------------------------------- +/// @brief +/// Function to invoke 8-neighbor MSER, , with additional outputs for each contour. +/// Image width has to be greater than 50, and image height has to be greater than 5. +/// Pixels at the image boundary are not processed. If boundary pixels are important +/// for a particular application, please consider padding the input image with dummy +/// pixels of one pixel wide. +/// Here is the typical usage: +/// void *mserHandle; +/// if (fcvMserNN8Init (width,........,&mserHandle)) +/// { +/// if ( !fcvMserExtNN8u8 (mserHandle,...) ) +/// { +/// // Error handle +/// } +/// fcvMserRelease(mserHandle); +/// } +/// +/// @param mserHandle +/// The MSER Handle returned by init. +/// +/// @param srcPtr +/// Pointer to an image array (unsigned char ) for which MSER has to be done. +/// +/// @param srcWidth +/// Width of the source image. +/// \n\b NOTE: srcWidth must be <= the width passed to fcvMserNN8Init. +/// +/// @param srcHeight +/// Height of the source image. +/// \n\b NOTE: srcHeight must be <= the height passed to fcvMserNN8Init. +/// +/// @param srcStride +/// Stride of the source image. +/// +/// @param maxContours +/// Maximum contours that will be returned. +/// +/// @param numContours +/// Output, Number of MSER contours in the region. +/// +/// @param recArray +/// Output, This is the bounding rectangle info for each contour. +/// If recArray is specified as NULL, MSER will skip finding the bounding rectangles of the contours. +/// Typical allocation size: 4*maxContours. +/// rectArray[0..3] defines the xMin, xMax, yMax, yMin positions of the first MSER contour, +/// rectArray[4..7] defines the xMin, xMax, yMax, yMin positions of the second MSER contour, and so on. +/// +/// @return +/// 1 if successful. +/// 0 if failure, e.g., to indicate detected contours are greater than maxContours. +/// In that case, please consider increasing maxContours. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvMserExtNN8u8(void *mserHandle, + const uint8_t* __restrict srcPtr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxContours, + uint32_t* __restrict numContours, + uint16_t* __restrict recArray, + uint32_t* __restrict numPointsInContour, + uint32_t pointsArraySize, + uint16_t* __restrict pointsArray, + uint32_t* __restrict contourVariation, + int8_t* __restrict contourPolarity, + uint32_t* __restrict contourNodeId, + uint32_t* __restrict contourNodeCounter); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientInterleavedf32_v2(). In the 2.0.0 release, +/// fcvImageGradientInterleavedf32_v2 will be renamed to fcvImageGradientInterleavedf32 +/// and the signature of fcvImageGradientInterleavedf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param gradients +/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientInterleavedf32( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict gradients ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientInterleavedf32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientInterleavedf32, +/// \a fcvImageGradientInterleavedf32_v2 will be removed, and the current signature +/// for \a fcvImageGradientInterleavedf32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientInterleavedf32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gradients +/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param gradStride +/// Stride (in bytes) of the interleaved gradients array. +/// \n\b NOTE: if 0, srcStride is set as (srcWidth-2)*2*sizeof(float). +/// \n\b WARNING: should be multiple of 32 ( 8 * 4-byte values ), and at least as much as 8 * srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict gradients, + unsigned int gradStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientPlanars16_v2(). In the 2.0.0 release, +/// fcvImageGradientPlanars16_v2 will be renamed to fcvImageGradientPlanars16 +/// and the signature of fcvImageGradientPlanars16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientPlanars16( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientPlanars16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientPlanars16, +/// \a fcvImageGradientPlanars16_v2 will be removed, and the current signature +/// for \a fcvImageGradientPlanars16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientPlanars16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' arrays. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + unsigned int dxyStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientPlanarf32_v2(). In the 2.0.0 release, +/// fcvImageGradientPlanarf32_v2 will be renamed to fcvImageGradientPlanarf32 +/// and the signature of fcvImageGradientPlanarf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (width)*(height) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (width)*(height) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientPlanarf32( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict dx, + float* __restrict dy ); + + + +//--------------------------------------------------------------------------- +/// @brief +/// Creates 2D gradient from source illuminance data. +/// This function considers only the left/right neighbors +/// for x-gradients and top/bottom neighbors for y-gradients. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientPlanarf32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientPlanarf32, +/// \a fcvImageGradientPlanarf32_v2 will be removed, and the current signature +/// for \a fcvImageGradientPlanarf32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientPlanarf32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride of Gradient values ('dx' and 'dy' arrays) measured in bytes. +/// \n\b NOTE: if 0, srcStride is set as 4*srcWidth. +/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value), and at least as much as 4*srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict dx, + float* __restrict dy, + unsigned int dxyStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts FAST corners from the image. This function tests the whole image +/// for corners (apart from the border). FAST-9 looks for continuous segments on the +/// pixel ring of 9 pixels or more. +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// \n\b WARNING: should be a multiple of 8. +/// \n\b WARNING: must be <= 2048. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, srcStride is set to width. +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n e.g. struct { int x, y; } xy; +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + unsigned int nCornersMax, + uint32_t* __restrict nCorners ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts FAST corners from the image. This function takes a bit mask so +/// that only image areas masked with '0' are tested for corners (if these +/// areas are also not part of the border). FAST-9 looks for continuous segments on the +/// pixel ring of 9 pixels or more. +/// +/// @param src +/// pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// image width +/// \n\b WARNING: must be <= 2048. +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param srcHeight +/// image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of corners +/// is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param mask +/// Per-pixel mask for each pixel represented in input image. +/// If a bit set to 0, pixel will be a candidate for corner detection. +/// If a bit set to 1, pixel will be ignored. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9InMasku8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + const uint8_t* __restrict mask, + unsigned int maskWidth, + unsigned int maskHeight ); + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts FAST corners from the image. This function tests the whole image +/// for corners (apart from the border). FAST-10 looks for continuous segments on the +/// pixel ring of 10 pixels or more. +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// \n\b WARNING: should be a multiple of 8. +/// \n\b WARNING: must be <= 2048. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, srcStride is set to width. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n e.g. struct { int x, y; } xy; +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exists when the maximum number of +/// corners is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast10u8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t barrier, + uint32_t border, + uint32_t* __restrict xy, + uint32_t nCornersMax, + uint32_t* __restrict nCorners); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts FAST corners from the image. This function takes a bit mask so +/// that only image areas masked with '0' are tested for corners (if these +/// areas are also not part of the border). FAST-10 looks for continuous segments on the +/// pixel ring of 10 pixels or more. +/// +/// @param src +/// pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// image width +/// \n\b WARNING: must be <= 2048. +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param srcHeight +/// image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exists when the maximum number of corners +/// is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param mask +/// Per-pixel mask for each pixel represented in input image. +/// If a bit set to 0, pixel will be a candidate for corner detection. +/// If a bit set to 1, pixel will be ignored. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast10InMasku8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t barrier, + uint32_t border, + uint32_t* __restrict xy, + uint32_t nCornersMax, + uint32_t* __restrict nCorners, + const uint8_t* __restrict mask, + uint32_t maskWidth, + uint32_t maskHeight ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts Harris corners from the image. This function tests the whole +/// image for corners (apart from the border). +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param threshold +/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be +/// regarded as a corner. +/// +/// @return +/// 0 if successful. +/// +/// +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerHarrisu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + unsigned int border, + uint32_t* __restrict xy, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + int threshold ); + +//------------------------------------------------------------------------------ +/// @brief +/// Local Harris Max applies the Harris Corner algorithm on an 11x11 patch +/// within an image to determine if a corner is present. +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If srcStride == 0, then will use srcWidth. +/// +/// @param posX +/// Center X coordinate of the search window +/// +/// @param posY +/// Center Y coordinate of the search window +/// +/// @param maxX +/// pointer to the X coordinate identified as a corner +/// +/// @param maxY +/// pointer to the Y coordinate identified as a corner +/// +/// @param maxScore +/// pointer to the Harris score associated with the corner +/// +/// @return +/// 0 if no corner is found (maxX, maxY, and maxScore are invalid) +/// or if posX and/or posY position the patch outside of the range of +/// the source image. +/// 1 if a corner is found (maxX, maxY, and maxScore are valid) +/// +/// +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API unsigned int +fcvLocalHarrisMaxu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + unsigned int posX, + unsigned int posY, + unsigned int *maxX, + unsigned int *maxY, + int *maxScore); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts Harris corners from the image. This function takes a bit mask so +/// that only image areas masked with '0' are tested for corners (if these +/// areas are also not part of the border). +/// +/// @param src +/// pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// image width +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param srcHeight +/// image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of corners +/// is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param threshold +/// Minimum "Harris Score" or "Harris Corner Respose" of a pixel for it to be +/// regarded as a corner. +/// +/// @param mask +/// Per-pixel mask for each pixel represented in input image. +/// If a bit set to 0, pixel will be a candidate for corner detection. +/// If a bit set to 1, pixel will be ignored. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @return +/// 0 if successful. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerHarrisInMasku8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + unsigned int border, + uint32_t* __restrict xy, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + int threshold, + const uint8_t* __restrict mask, + unsigned int maskWidth, + unsigned int maskHeight ); + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts Harris corners from the image. This function tests the whole +/// image for corners (apart from the border). It is an improved version +/// which is more robust to low contrast images. +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be a multiple of 8. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y position of the +/// detected corners +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param threshold +/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be +/// regarded as a corner. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerHarrisAdaptiveu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t border, + float32_t* __restrict xy, + uint32_t nCornersMax, + uint32_t* __restrict nCorners, + int32_t threshold); + + +//------------------------------------------------------------------------------ +/// @brief +/// Extracts Harris corners from the image. +/// \n\b ATTENTION: Compared to fcvCornerHarrisu8, this API gives more accurate results +/// in exchange for slower execution time.\n\n +/// +/// DO NOT USE THIS API unless for testing purposes. +/// This API can be removed without notice. +/// +/// @details +/// This function extracts Harris Corner features from the image. The input is +/// an unsigned 8 bit image. Based on the values of the kernel size, the block size, +/// the sensitivity, the function generates a Harris Response map (Harris Score). +/// This map is then thresholded using the threshold parameter to locate local maxima. +/// Additionally, if the Non Maximum Suppression flag is enabled, the function performs +/// non maximum suppression of the thresholded response using the min distance parameter +/// to calculate the neighborhood. +/// +/// @param src +/// Input unsigned 8 bit image from which corner features are to be detected +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input Image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param harrisResp +/// The computed Harris Response Map of the image. If the @param normalizeResponse flag is set, +/// then all values in the map are normalized between 0 and 255. If the @param normalizeResponse flag +/// is not set, then the map is not normalized to this range. +/// This buffer MUST be allocated as srcWidth*srcHeight*sizeof(float32_t). +/// +/// @param respStride +/// Harris response stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If respStride is equal to 0, +/// it will be set to srcWidth * sizeof(float32_t). +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param xy +/// pointer to the output array containing the interleaved x,y positions of the +/// detected corners. +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners that should be detected. The function exits when the +/// maximum number of corners is exceeded. +/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param threshold +/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be +/// regarded as a corner. If the @param normalizeResponse flag is set, then this parameter MUST be a value between +/// 0 and 255. If the @param normalizeResponse flag is not set, then this parameter can be any value in the range of +/// int32_t. This parameter is used to threshold @param harrisResp to detect corner features. +/// +/// @param sensitivity +/// This parameter represents the sensitivity threshold from the Harris Stephens +/// equation. Typical values are between 0.04 and 0.06 +/// +/// @param kernelSize +/// Size of the Sobel Kernel used to compute the gradients from the input image +/// MUST be 3,5 or 7. +/// +/// @param blockSize +/// Size of an average block for computing a derivative covariation matrix over each +/// pixel neighborhood. +/// +/// @param nmsEnabled +/// A flag to enable or disable non maximum suppression. Set flag to 1 to enable it and +/// 0 to disable. +/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key +/// points before NMS +/// +/// @param minDistance +/// The radial euclidean distance to perform non-maximum suppression. +/// +/// @param normalizeResponse +/// This parameter is a flag to enable or disable normalization of the harris response. +/// If it is set, then it enables normalization of the response to the range between 0 and 255. If it +/// is not set, then the response is NOT normalized to this range. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvCornerHarrisScoreu8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t* __restrict harrisResp, + uint32_t respStride, + uint32_t* __restrict xy, + uint32_t nCornersMax, + uint32_t* __restrict nCorners, + float32_t threshold, + float32_t sensitivity, + uint32_t kernelSize, + uint32_t blockSize, + uint32_t nmsEnabled, + float32_t minDistance, + uint32_t normalizeResponse); + + +//--------------------------------------------------------------------------- +/// @brief +/// Computes affine trans. for a given set of corresponding features points +/// using a linear least square colver based on Cholkesky decomposition. +/// +/// @param corrs +/// Correspondence data struct containing coords of points in two frames +/// +/// @param affine +/// 3 x 3 affine matrix (computed best fit affine transformation) +/// +/// @ingroup 3D_reconstruction +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, + float* __restrict affine ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Evaluates specified affine transformation against provided points +/// correspondences. Checks which correspondence members have a projection +/// error that is smaller than the given one (maxSquErr). +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param affine +/// Affine matrix representing relationship between ptTo and ptFrom +/// correspondences stored as 3x3 floating point matrix formatted as +/// @todo r0h0, r0h1 +/// Pointer storage must be at least a 9-element floating point array. +/// +/// @param maxsqerr +/// Maximum error value squared. +/// +/// @param inliers +/// Output array for those indices that passed the test - the array MUST +/// be able to store numIndices items. +/// +/// @param numinliers +/// Output number of corrs that passed the test. +/// +/// @return +/// 0 if successfull +/// -1 if error value square is >= maxsqerr +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, + float* __restrict affine, + float maxsqerr, + uint16_t* __restrict inliers, + int32_t* numinliers ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Performs cholesky homography fitting on specified points correspondences. +/// \n +/// \n [x_to] [ a11 a12 a13 ] [ x_from ] +/// \n [y_to] = [ a21 a22 a23 ] * [ y_from ] +/// \n [ 1 ] [ a31 a32 a33 ] [ 1 ] +/// \n note that all the correspondences are considered, if correspondence pairs +/// are smaller than 4, the API returns. If correspondence pairs are larger than +/// 4, the API takes all the correspondences into consideration using least +/// squared method. +/// +/// @details +/// Output precision is within 3e-3 +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param homography +/// 3x3 floating point matrix formatted as @todo r0h0, r0h1 +/// Pointer storage must be at least a 9-element floating point array. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, + float* __restrict homography ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Evaluates specified homography against provided points correspondences. +/// Check which correspondence members have a projection error that is +/// smaller than the given one (maxSquErr). +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvGeomHomographyEvaluatef32_v2(). In the 2.0.0 release, +/// fcvGeomHomographyEvaluatef32_v2 will be renamed to fcvGeomHomographyEvaluatef32 +/// and the signature of fcvGeomHomographyEvaluatef32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param homography +/// Homography representing relationship between ptTo and ptFrom +/// correspondences stored as 3x3 floating point matrix formatted as +/// @todo r0h0, r0h1 +/// Pointer storage must be at least a 9-element floating point array. +/// +/// @param maxsqerr +/// Maximum error value squared. +/// +/// @param inliers +/// Output array for those indices that passed the test - the array MUST +/// be able to store numIndices items. +/// +/// @param numinliers +/// Output number of corrs that passed the test. +/// +/// @return +/// 0 that error is less than maximum error, -1 greater or equal to maximum +/// error. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, + float* __restrict homography, + float maxsqerr, + uint16_t* __restrict inliers, + int32_t* numinliers ); + +//------------------------------------------------------------------------------ +/// @brief +/// Evaluates specified homography against provided points correspondences. +/// Check which correspondence members have a projection error that is +/// smaller than the given one (maxSquErr). +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvGeomHomographyEvaluatef32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvGeomHomographyEvaluatef32, +/// \a fcvGeomHomographyEvaluatef32_v2 will be removed, and the current signature +/// for \a fcvGeomHomographyEvaluatef32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvGeomHomographyEvaluatef32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param homography +/// Homography representing relationship between ptTo and ptFrom +/// correspondences stored as 3x3 floating point matrix formatted as +/// @todo r0h0, r0h1 +/// Pointer storage must be at least a 9-element floating point array. +/// +/// @param maxsqerr +/// Maximum error value squared. +/// +/// @param inliers +/// Output array for those indices that passed the test - the array MUST +/// be able to store numIndices items. +/// +/// @param errinliers +/// Output array for the error of indices of correspondences that passed +/// the test. +/// +/// @param numinliers +/// Output number of corrs that passed the test. +/// +/// @return +/// 0 that error is less than maximum error, -1 greater or equal to maximum +/// error. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomHomographyEvaluatef32_v2( const fcvCorrespondences* __restrict corrs, + float32_t* __restrict homography, + float32_t maxsqerr, + uint16_t* __restrict inliers, + float32_t*__restrict errinliers, + int32_t* numinliers ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Performs cholesky pose fitting on specified points correspondences. +/// Takes a pose and uses the correspondences to refine it using iterative +/// Gauss-Newton optimization. +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param minIterations +/// Minimum number of iterations to refine. +/// +/// @param maxIterations +/// Maximum number of iterations to refine. +/// +/// @param stopCriteria +/// Improvement threshold, iterations stop if improvement is less than this +/// value. +/// +/// @param initpose +/// Pose representing initial pose +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @param refinedpose +/// Pose representing refined pose +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @return +/// Final reprojection error. +/// +/// +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API float +fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, + short minIterations, + short maxIterations, + float stopCriteria, + float* initpose, + float* refinedpose ); + +//------------------------------------------------------------------------------ +/// @brief +/// Update and compute the differential pose based on the specified points correspondences +/// This function and fcvGeomPoseOptimizeGNf32 +/// can be used iteratively to perform poseRefine GN. +/// +/// @param projected +/// 2D position after projection +/// +/// @param reprojErr +/// 2D reprojection error in camera coordinates (not in pixels!) +/// +/// @param invz +/// Inverse depth (z) +/// +/// @param reprojVariance +/// Reprojection variance in camera coordinates +/// +/// @param numpts +/// Number of points +/// +/// @param pose +/// Pose representing differential pose +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomPoseUpdatef32( + const float* __restrict projected, + const float* __restrict reprojErr, + const float* __restrict invz, + const float* __restrict reprojVariance, + unsigned int numpts, + float* __restrict pose ); + +//------------------------------------------------------------------------------ +/// @brief +/// Update the pose based on the specified points correspondences +/// using Gauss-Newton optimization. This function and fcvGeomPoseEvaluateErrorf32 +/// can be used iteratively to perform poseRefine GN. +/// +/// @param projected +/// 2D position after projection +/// +/// @param reprojErr +/// 2D reprojection error in camera coordinates (not in pixels!) +/// +/// @param invz +/// Inverse depth (z) +/// +/// @param reprojVariance +/// Reprojection variance in camera coordinates +/// +/// @param numpts +/// Number of points +/// +/// @param pose +/// Pose representing updated pose +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomPoseOptimizeGNf32( const float* __restrict projected, + const float* __restrict reprojErr, + const float* __restrict invz, + const float* __restrict reprojVariance, + unsigned int numpts, + float* __restrict pose ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Calculate the reprojection error based on the input pose. +/// This function and fcvGeomPoseOptimizef32 can be used iteratively +/// to perform poseRefine (GN or LM).. +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param pose +/// Pose representing updated pose +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @param projected +/// 2D position after projection +/// +/// @param reprojErr +/// 2D reprojection error in camera coordinates (not in pixels!) +/// +/// @param invz +/// Inverse depth (z) +/// +/// @param reprojVariance +/// Reprojection variance in camera coordinates +/// +/// @return +/// Reprojection error. +/// +/// +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API float +fcvGeomPoseEvaluateErrorf32( const fcvCorrespondences* __restrict corrs, + const float* __restrict pose, + float* __restrict projected, + float* __restrict reprojErr, + float* __restrict invz, + float* __restrict reprojVariance ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Checks which members have a projection error that is smaller than the +/// given one. +/// +/// @param corrs +/// Pointer to correspondences structure. +/// +/// @param pose +/// Pose representing relationship between ptTo and ptFrom +/// correspondences stored as a +/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation +/// matrix and t is the translation vector. The matrix stored in pose is row +/// major ordering: \n +/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the +/// matrix is: \n +/// | a11, a12, a13 , a14|\n +/// | a21, a22, a23, a24 |\n +/// | a31, a32, a33, a34 |\n +/// Pointer storage must be at least a 12-element floating point array. +/// +/// @param maxSquErr +/// Maximum error value squared. +/// +/// @param inliers +/// Output array for those indices that passed the test - the array MUST +/// be able to store numIndices items. +/// +/// @param numInliers +/// Output number of corrs that passed the test. +/// +/// @return +/// 0 that error is less than maximum error, -1 greater or equal to maximum +/// error. +/// +/// +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, + const float* pose, + float maxSquErr, + uint16_t* __restrict inliers, + uint32_t* numInliers ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Estimates a 6DOF pose +/// \n\b NOTE: Given the coordinates of three 3D points (in world reference frame), +/// and their corresponding perspective projections in an image, +/// this algorithm determines the position and orientation of the camera in +/// the world reference frame. The function provides up to four solutions +/// that can be disambiguated using a fourth point. +/// When used in conjunction with RANSAC, this function can perform efficient outlier rejection. +/// Two degenerate cases should be avoided when using this function: +/// - Indeterminate configuration: +/// When the three points are collinear in space, there will be a family of poses mapping the +/// three points to the same image points. +/// - Unstable configuration: +/// The camera center is located on a circular cylinder passing through the three points and +/// the camera optical axis is perpendicular to the plane derived by the three points. +/// With this configuration, a small change in the position of the three points will +/// result in a large change of the estimated pose.. +/// +/// @param corrs +/// 2D-3D correspondence points +/// +/// @param pose +/// computed pose (numPoses * 12 data) +/// +/// @param numPoses (max = 4) +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, + float* pose, + int32_t* numPoses ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 3x3 correlation with non-separable kernel. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorr3x3s8_v2(). In the 2.0.0 release, +/// fcvFilterCorr3x3s8_v2 will be renamed to fcvFilterCorr3x3s8 +/// and the signature of fcvFilterCorr3x3s8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 2-D 3x3 kernel. +/// \n\b NOTE: Normalized to Q4.4 +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: must be an even number +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE: must be an even number +/// +/// @param dst +/// Output convolution. Border values are ignored in this function. +/// Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorr3x3s8( const int8_t* __restrict kernel, + const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 3x3 correlation with non-separable kernel. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorr3x3s8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorr3x3s8, +/// \a fcvFilterCorr3x3s8_v2 will be removed, and the current signature +/// for \a fcvFilterCorr3x3s8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorr3x3s8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 2-D 3x3 kernel. +/// \n\b NOTE: Normalized to Q4.4 +/// +/// @param src +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: must be an even number +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE: must be an even number +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output convolution. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. Border values are ignored in this function. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, + const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// NxN correlation with non-separable kernel. +/// Border values are ignored in this function. The filling of dst starts +/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). +/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. +/// +/// @param kernel +/// 2-D NxN kernel of float32_t. +/// +/// @param N +/// Dimension of kernel. +/// +/// @param src +/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Src image stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as +/// srcWidth*sizeof(float32_t) if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterCorrNxNu8f32( const float32_t* __restrict kernel, + uint32_t N, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t* __restrict dst, + uint32_t dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// NxN correlation with non-separable kernel. +/// Border values are ignored in this function. The filling of dst starts +/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). +/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. +/// +/// @param kernel +/// 2-D NxN kernel of int8_t. +/// +/// @param N +/// Dimension of kernel. +/// +/// @param shift +/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. +/// +/// @param src +/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Src image stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output correlation. Size of buffer is dstStride*srcHeight*sizeof(int16_t) bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int16_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as +/// srcWidth*sizeof(int16_t) if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterCorrNxNu8s16( const int8_t* __restrict kernel, + uint32_t N, + int8_t shift, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t* __restrict dst, + uint32_t dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// NxN correlation with non-separable kernel. +/// Border values are ignored in this function. The filling of dst starts +/// at (N/2,N/2) and ends at (srcWidth-1-N/2,srcHeight-1-N/2). +/// \n\b NOTE: The border is N/2 wide pixel strips at top, bottom, left and right of image. +/// +/// @param kernel +/// 2-D NxN kernel of int8_t. +/// +/// @param N +/// Dimension of kernel. +/// +/// @param shift +/// The right shift count used to normalize output. Shift can be considered as Q factor of kernel. +/// +/// @param src +/// Input image of unit8_t. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Src image stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output correlation. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as +/// srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterCorrNxNu8( const int8_t* __restrict kernel, + uint32_t N, + int8_t shift, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// 9x9 correlation with separable kernel. +/// If src and dst point to the same address, it will do in-place. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorrSep9x9s16_v2(). In the 2.0.0 release, +/// fcvFilterCorrSep9x9s16_v2 will be renamed to fcvFilterCorrSep9x9s16 +/// and the signature of fcvFilterCorrSep9x9s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 1-D kernel in Q15. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param tmp +/// Temporary image buffer used internally. +/// Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dst +/// Output correlation. Border values are ignored in this function. +/// Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorrSep9x9s16( const int16_t* __restrict kernel, + const int16_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict tmp, + int16_t* dst ); + + +//--------------------------------------------------------------------------- +/// @brief +/// 9x9 FIR filter (convolution) with seperable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorrSep9x9s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorrSep9x9s16, +/// \a fcvFilterCorrSep9x9s16_v2 will be removed, and the current signature +/// for \a fcvFilterCorrSep9x9s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorrSep9x9s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: Size = width * heigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API void +fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 11x11 correlation with separable kernel. +/// If src and dst point to the same address, it will do in-place. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorrSep11x11s16_v2(). In the 2.0.0 release, +/// fcvFilterCorrSep11x11s16_v2 will be renamed to fcvFilterCorrSep11x11s16 +/// and the signature of fcvFilterCorrSep11x11s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: array must be >=12 elements with kernel[11]=0 +/// \n\b WARNING: should be 128-bit aligned. +/// \n\b NOTE: Normalized to Q1.15 +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dst +/// Output correlation. Border values are ignored in this function. +/// Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorrSep11x11s16( const int16_t* __restrict kernel, + const int16_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict tmpImg, + int16_t* dst ); + + +//--------------------------------------------------------------------------- +/// @brief +/// 11x11 FIR filter (convolution) with seperable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorrSep11x11s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorrSep11x11s16, +/// \a fcvFilterCorrSep11x11s16_v2 will be removed, and the current signature +/// for \a fcvFilterCorrSep11x11s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorrSep11x11s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcImg +/// Input image. Size of buffer is srStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API void +fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 13x13 correlation with separable kernel. +/// If src and dst point to the same address, it will do in-place. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorrSep13x13s16_v2(). In the 2.0.0 release, +/// fcvFilterCorrSep13x13s16_v2 will be renamed to fcvFilterCorrSep13x13s16 +/// and the signature of fcvFilterCorrSep13x13s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: Normalized to Q1.15 +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dst +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorrSep13x13s16( const int16_t* __restrict kernel, + const int16_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict tmpImg, + int16_t* dst ); + + +//--------------------------------------------------------------------------- +/// @brief +/// 13x13 FIR filter (convolution) with seperable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorrSep13x13s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorrSep13x13s16, +/// \a fcvFilterCorrSep13x13s16_v2 will be removed, and the current signature +/// for \a fcvFilterCorrSep13x13s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorrSep13x13s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API void +fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 15x15 correlation with separable kernel. +/// If src and dst point to the same address, it will do in-place. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorrSep15x15s16_v2(). In the 2.0.0 release, +/// fcvFilterCorrSep15x15s16_v2 will be renamed to fcvFilterCorrSep15x15s16 +/// and the signature of fcvFilterCorrSep15x15s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: array must be 16 elements with kernel[15]=0 +/// \n\b NOTE: Normalized to Q1.15 +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Must be same size as src +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dst +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Must be same size as src +/// \n\b NOTE: data should be 128-bit aligned +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorrSep15x15s16( const int16_t* __restrict kernel, + const int16_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict tmpImg, + int16_t* dst ); + + +//--------------------------------------------------------------------------- +/// @brief +/// 15x15 FIR filter (convolution) with seperable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorrSep15x15s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorrSep15x15s16, +/// \a fcvFilterCorrSep15x15s16_v2 will be removed, and the current signature +/// for \a fcvFilterCorrSep15x15s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorrSep15x15s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: array must be 16 elements with kernel[15]=0 +/// \n\b NOTE: Normalized to Q1.15 +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API void +fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// 17x17 correlation with separable kernel. +/// If src and dst point to the same address, it will do in-place. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterCorrSep17x17s16_v2(). In the 2.0.0 release, +/// fcvFilterCorrSep17x17s16_v2 will be renamed to fcvFilterCorrSep17x17s16 +/// and the signature of fcvFilterCorrSep17x17s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: Normalized to Q1.15 +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// \n\b WARNING: must be > 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dst +/// Output correlation.. Border values are ignored in this function. +/// \n\b NOTE: Must be same size as src +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterCorrSep17x17s16( const int16_t* __restrict kernel, + const int16_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict tmpImg, + int16_t* dst ); + + + +//--------------------------------------------------------------------------- +/// @brief +/// 17x17 FIR filter (convolution) with seperable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterCorrSep17x17s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterCorrSep17x17s16, +/// \a fcvFilterCorrSep17x17s16_v2 will be removed, and the current signature +/// for \a fcvFilterCorrSep17x17s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterCorrSep17x17s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API void +fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// NxN correlation with separable kernel. +/// If srcImg and dstImg point to the same address +/// and srcStride equals to dstStride, it will do in-place. +/// +/// @param kernel +/// 1-D kernel. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param knlSize +/// Seperable kernel size. +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image tile width. +/// +/// @param srcHeight +/// Image tile height. +/// +/// @param srcStride +/// source Image width +/// +/// @param tmpImg +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstImg +/// Output correlation. Border values are ignored in this function. +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// dst Image width +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFilterCorrSepNxNs16( const int16_t* __restrict kernel, + int knlSize, + const int16_t* srcImg, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict tmpImg, + int16_t* dstImg, + unsigned int dstStride ); + + +//--------------------------------------------------------------------------- +/// @brief +/// MxN correlation with separable kernel. +/// +/// @param kernelX +/// 1-D kernel of int8_t. The kernel is first applied to rows. +/// kernelX has Q factor equal to shift. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param knlSizeX +/// Seperable kernel size of kernelX. +/// \n\b NOTE: kenrelX must be <= 32. +/// +/// @param kernelY +/// 1-D kernel of int8_t. The kernel is applied to columns after kernelX +/// is applied. It could be the same buffer as kernelX which makes it a +/// NxN symetric kernel. +/// kernelY has Q factor equal to shift. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param knlSizeY +/// Seperable kernel size of kernelY. +/// +/// @param shift +/// The Q factor of kernels. Output is right-shifted by 2*shift to compensate for two rounds of filtering +/// +/// @param srcImg +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Src image stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dstImg +/// Output correlation. Can do in-place filtering (i.e. dstImg=srcImg). +/// \n\b NOTE: Size = dstStride * srcHeigth +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @param dstStride +/// Output stride, stride of image is the number of bytes between column 0 of +/// row 1 and column 0 of row 2 in data memory. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvFilterCorrSepMxNu8( const int8_t* kernelX, + uint32_t knlSizeX, + const int8_t* kernelY, + uint32_t knlSizeY, + int8_t shift, + const uint8_t* srcImg, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* dstImg, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculates the mean and variance of intensities of a rectangle in a +/// grayscale image. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageIntensityStats_v2(). In the 2.0.0 release, +/// fcvImageIntensityStats_v2 will be renamed to fcvImageIntensityStats +/// and the signature of fcvImageIntensityStats as it appears now, +/// will be removed. +/// This API is the same as fcvImageIntensityStats_v2 with +/// FASTCV_UNBIASED_VARIANCE_ESTIMATOR +/// \n\n +/// +/// @param src +/// pointer to 8-bit grayscale image +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of source image +/// \n\b WARNING: should be multiple of 8. +/// +/// @param xBegin +/// x coordinate of top left of rectangle +/// +/// @param yBegin +/// y coordinate of top left of rectangle +/// +/// @param recWidth +/// width of rectangular region +/// +/// @param recHeight +/// height of rectangular region +/// +/// @param mean +/// output of mean of region +/// +/// @param variance +/// output of variance of region +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageIntensityStats( const uint8_t* __restrict src, + unsigned int srcWidth, + int xBegin, + int yBegin, + unsigned int recWidth, + unsigned int recHeight, + float* mean, + float* variance ); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculates the mean and variance of intensities of a rectangle in a +/// grayscale image. +/// +/// @param src +/// pointer to 8-bit grayscale image +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of source image +/// \n\b WARNING: should be multiple of 8. +/// +/// @param xBegin +/// x coordinate of top left of rectangle +/// +/// @param yBegin +/// y coordinate of top left of rectangle +/// +/// @param recWidth +/// width of rectangular region +/// +/// @param recHeight +/// height of rectangular region +/// +/// @param mean +/// output of mean of region +/// +/// @param variance +/// output of variance of region +/// +/// @param varianceEstimator +/// variance estimator +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvImageIntensityStats_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + int xBegin, + int yBegin, + uint32_t recWidth, + uint32_t recHeight, + float32_t* mean, + float32_t* variance, + fcvVarianceEstimator varianceEstimator); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a histogram of intensities for a rectangular region of a grayscale +/// image. Bins each pixel into a histogram of size 256, depending on the +/// intensity of the pixel (in the range 0 to 255). +/// +/// @details +/// +/// @param src +/// pointer to 8-bit grayscale image +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of source image +/// \n\b WARNING: should be multiple of 8. +/// +/// @param xBegin +/// x coordinate of top left of rectangle +/// +/// @param yBegin +/// y coordinate of top left of rectangle +/// +/// @param recWidth +/// Width of rectangular region +/// +/// @param recHeight +/// Height of rectangular region +/// +/// @param histogram +/// Array of size 256 for storing the histogram +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageIntensityHistogram( const uint8_t* __restrict src, + unsigned int srcWidth, + int xBegin, + int yBegin, + unsigned int recWidth, + unsigned int recHeight, + int32_t* histogram ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 8-bit image and adds an +/// unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvIntegratePatchu8_v2(). In the 2.0.0 release, +/// fcvIntegratePatchu8_v2 will be renamed to fcvIntegratePatchu8 +/// and the signature of fcvIntegratePatchu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegratePatchu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + int patchX, + int patchY, + unsigned int patchW, + unsigned int patchH, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 8-bit patch values and their +/// squares and adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvIntegratePatchu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvIntegratePatchu8, +/// \a fcvIntegratePatchu8_v2 will be removed, and the current signature +/// for \a fcvIntegratePatchu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvIntegratePatchu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegratePatchu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int patchX, + int patchY, + unsigned int patchW, + unsigned int patchH, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 8-bit patch values and their +/// squares and adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvIntegratePatchu8() and fcvIntegratePatchu8_v2() with the addition of +/// extra parameters. This function has been added to allow for backward +/// compatibility with the original function. When the 2.0.0 release of this +/// library is made, this function will be renamed to: \a fcvIntegratePatchu8, +/// \a fcvIntegratePatchu8_v2 and fcvIntegratePatchu8_v3 will be removed, and +/// the current signature for \a fcvIntegratePatchu8 and fcvIntegratePatchu8_v2 +/// will be removed. Until 2.0.0, the developer should use this implementation +/// with the expectation of renaming it to \a fcvIntegratePatchu8 when +/// transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) +/// +/// @param intgrlStride +/// Stride in bytes of the Integral Image +/// \n\b WARNING: should be multiple of 8. +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) +/// +/// @param intgrlSqrdStride +/// Stride in bytes of the Squared Integral Image +/// \n\b WARNING: should be multiple of 8. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvIntegratePatchu8_v3(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t patchX, + uint32_t patchY, + uint32_t patchW, + uint32_t patchH, + uint32_t* __restrict intgrlImgOut, + uint32_t intgrlStride, + uint32_t* __restrict intgrlSqrdImgOut, + uint32_t intgrlSqrdStride); + + +//--------------------------------------------------------------------------- +/// @brief +/// Builds an integral image of the incoming 12x12 8-bit patch values and +/// their squares. It also adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvIntegratePatch12x12u8_v2(). In the 2.0.0 release, +/// fcvIntegratePatch12x12u8_v2 will be renamed to fcvIntegratePatch12x12u8 +/// and the signature of fcvIntegratePatch12x12u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (12+1)(12+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (12+1)(12+1) +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvIntegratePatch12x12u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + int patchX, + int patchY, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Builds an integral image of the incoming 12x12 8-bit patch values and +/// their squares. It also adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvIntegratePatch12x12u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvIntegratePatch12x12u8, +/// \a fcvIntegratePatch12x12u8_v2 will be removed, and the current signature +/// for \a fcvIntegratePatch12x12u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvIntegratePatch12x12u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (12+1)(12+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (12+1)(12+1) +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int patchX, + int patchY, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 18x18 8-bit patch values and +/// their squares. It also adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvIntegratePatch18x18u8_v2(). In the 2.0.0 release, +/// fcvIntegratePatch18x18u8_v2 will be renamed to fcvIntegratePatch18x18u8 +/// and the signature of fcvIntegratePatch18x18u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (18+1)(18+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (18+1)(18+1) +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegratePatch18x18u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + int patchX, + int patchY, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 18x18 8-bit patch values and +/// their squares. It also adds an unfilled border on top and to the left. +/// \n NOTE: border usually zero filled elsewhere. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvIntegratePatch18x18u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvIntegratePatch18x18u8, +/// \a fcvIntegratePatch18x18u8_v2 will be removed, and the current signature +/// for \a fcvIntegratePatch18x18u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvIntegratePatch18x18u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// sum (X,Y) = sum_{x (18+1)(18+1) +/// +/// @param intgrlSqrdImgOut +/// Integral image of squared values. +/// \n\b NOTE: Memory must be > (18+1)(18+1) +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int patchX, + int patchY, + uint32_t* __restrict intgrlImgOut, + uint32_t* __restrict intgrlSqrdImgOut ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Integrates one line of an image or any portion of an image that is +/// contiguous in memory. +/// +/// @param src +/// Input image. Size of buffer is srcWidth bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Number of pixels. +/// \n NOTE: bit width enforces numPxls < 2^16 +/// +/// @param intgrl +/// Sum of values from specified pixels. +/// +/// @param intgrlSqrd +/// Sum of squared values from specified pixels. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvIntegrateImageLineu8( const uint8_t* __restrict src, + uint16_t srcWidth, + uint32_t* intgrl, + uint32_t* intgrlSqrd ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Integrates 64 contiguous pixels of an image. +/// +/// @param src +/// Input image. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param intgrl +/// Sum of values from specified pixels. +/// +/// @param intgrlSqrd +/// Sum of squared values from specified pixels. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegrateImageLine64u8( const uint8_t* __restrict src, + uint16_t* intgrl, + uint32_t* intgrlSqrd ); + + +//------------------------------------------------------------------------------ +/// @brief +/// compute approximate mean and variance for the range of NFT4 float +/// descriptors where descriptor elements along dimension are treated +/// as random vars +/// +/// @param src +/// contiguous block of descriptors of dimension 36 +/// +/// @param first +/// index of the first descriptor in range array vind for computing mean and var +/// +/// @param last +/// index of the last descriptor in range array vind for computing mean and range +/// +/// @param vind +/// array of randomized indexes of descriptors +/// +/// @param means +/// buffer for approximate means, must be 36 long +/// +/// @param vars +/// buffer for approximate variances, must be 36 long +/// +/// @param temp +/// bufffer, must be 46 long +/// +/// @return +/// 0 - success +/// EFAULT - invalid address +/// EINVAL - invalid argument +/// +/// @remark +/// If descriptor range is > 100 then only +/// 100 samples are drawn from the range to compute +/// approximate means and variances. +/// +/// Variances computed here do not have to be true variances because their +/// values do not matter in kdtrees. The only thing that matters is that +/// the ordering relation of variances is preserved +/// +/// +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API int +fcvDescriptorSampledMeanAndVar36f32( const float* __restrict src, + int first, + int last, + int32_t* vind, + float* __restrict means, + float* __restrict vars, + float* __restrict temp ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Searches a 8x8 patch within radius around a center pixel for the max NCC. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvNCCPatchOnCircle8x8u8_v2(). In the 2.0.0 release, +/// fcvNCCPatchOnCircle8x8u8_v2 will be renamed to fcvNCCPatchOnCircle8x8u8 +/// and the signature of fcvNCCPatchOnCircle8x8u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param patch +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param src +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width in pixels of the image. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height in pixels of the image. +/// +/// @param search_center_x +/// X location of search center in pixels of the image. +/// +/// @param search_center_y +/// Y location of search center in pixels of the image. +/// +/// @param search_radius +/// Radius of search in pixels. Must be <=5. +/// +/// @param best_x +/// Center X location on the image of the best NCC match. The center X has +/// 4 pixels to the left and 3 to the right. +/// +/// @param best_y +/// Center Y location on the image of the best NCC match. The center Y has +/// 4 pixels above and 3 pixels below. +/// +/// @param bestNCC +/// Largest value of the normalized cross-correlation found in the NCC search. +/// It's quantized to integer value in Q7 (between -128 and 128). +/// +/// @param findSubPixel (0 or 1) +/// Use parabolic interpolation of NCC values to find sub-pixel estimates. +/// +/// @param subX +/// Sub-pixel estimate for optimal NCC relative to best_x. +/// \n e.g., float x = (float)best_x + subX; +/// +/// @param subY +/// Sub-pixel estimate for optimal NCC relative to best_y. +/// +/// @return +/// 0 = OK \n +/// 1 = "search_radius" too large\n +/// 2 = invalid "search_center_x,y"\n +/// 3 = not found\n +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch, + const uint8_t* __restrict src, + unsigned short srcWidth, + unsigned short srcHeight, + unsigned short search_center_x, + unsigned short search_center_y, + unsigned short search_radius, + uint16_t* best_x, + uint16_t* best_y, + uint32_t* bestNCC, + int findSubPixel, + float* subX, + float* subY ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Searches a 8x8 patch within radius around a center pixel for the max NCC. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvNCCPatchOnCircle8x8u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvNCCPatchOnCircle8x8u8, +/// \a fcvNCCPatchOnCircle8x8u8_v2 will be removed, and the current signature +/// for \a fcvNCCPatchOnCircle8x8u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvNCCPatchOnCircle8x8u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param patch +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param src +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width in pixels of the image. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height in pixels of the image. +/// +/// @param search_center_x +/// X location of search center in pixels of the image. +/// +/// @param search_center_y +/// Y location of search center in pixels of the image. +/// +/// @param search_radius +/// Radius of search in pixels. Must be <=5. +/// +/// @param filterLowVariance +/// Minimum variance. Used to as threshold to compare against variance of +/// 8x8 block of src or patch. +/// +/// @param best_x +/// Center X location on the image of the best NCC match. The center X has +/// 4 pixels to the left and 3 to the right. +/// +/// @param best_y +/// Center Y location on the image of the best NCC match. The center Y has +/// 4 pixels above and 3 pixels below. +/// +/// @param bestNCC +/// Largest value of the normalized cross-correlation found in the NCC search. +/// It's quantized to integer value in Q7 (between -128 and 128). +/// +/// @param findSubPixel (0 or 1) +/// Use parabolic interpolation of NCC values to find sub-pixel estimates. +/// +/// @param subX +/// Sub-pixel estimate for optimal NCC relative to best_x. +/// \n e.g., float x = (float)best_x + subX; +/// +/// @param subY +/// Sub-pixel estimate for optimal NCC relative to best_y. +/// +/// @return +/// 0 = OK \n +/// 1 = "search_radius" too large\n +/// 2 = invalid "search_center_x,y"\n +/// 3 = not found\n +/// 4 = Patch has too low variance\n +/// 5 = Image region has too low variance\n +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch, + const uint8_t* __restrict src, + unsigned short srcWidth, + unsigned short srcHeight, + unsigned short search_center_x, + unsigned short search_center_y, + unsigned short search_radius, + int filterLowVariance, + uint16_t* best_x, + uint16_t* best_y, + uint32_t* bestNCC, + int findSubPixel, + float* subX, + float* subY ); + + + + +//------------------------------------------------------------------------------ +/// @brief +/// Searches a 8x8 patch within square region around a center pixel +/// for the max NCC. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvNCCPatchOnSquare8x8u8_v2(). In the 2.0.0 release, +/// fcvNCCPatchOnSquare8x8u8_v2 will be renamed to fcvNCCPatchOnSquare8x8u8 +/// and the signature of fcvNCCPatchOnSquare8x8u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param patch +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param src +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width in pixels of the image. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height in pixels of the image. +/// +/// @param search_center_x +/// Center X coordinate of the search window +/// +/// @param search_center_y +/// Center Y coordinate of the search window +/// +/// @param search_w +/// Width of search square in pixels +/// \n\b WARNING: must be 11 or less. +/// +/// @param best_x +/// Center X location on the image of the best NCC match. The center X has +/// 4 pixels to the left and 3 to the right. +/// +/// @param best_y +/// Center Y location on the image of the best NCC match. The center Y has +/// 4 pixels above and 3 pixels below. +/// +/// @param bestNCC +/// NCC value of the best match block. +/// It's quantized to integer value in Q7 (between -128 and 128). +/// +/// @param doSubPixel (0 or 1) +/// Use parabolic interpolation of NCC values to find sub-pixel estimates. +/// +/// @param subX +/// Sub-pixel estimate for optimal NCC relative to best_x. +/// \n e.g., float x = (float)best_x + subX; +/// +/// @param subY +/// Sub-pixel estimate for optimal NCC relative to best_y. +/// +/// @return +/// 0 = OK \n +/// 1 = "search_radius" too large\n +/// 2 = invalid "search_center_x,y"\n +/// 3 = not found\n +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch, + const uint8_t* __restrict src, + unsigned short srcWidth, + unsigned short srcHeight, + unsigned short search_center_x, + unsigned short search_center_y, + unsigned short search_w, + uint16_t* best_x, + uint16_t* best_y, + uint32_t* bestNCC, + int doSubPixel, + float* subX, + float* subY ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Searches a 8x8 patch within square region around a center pixel +/// for the max NCC. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvNCCPatchOnSquare8x8u8 with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvNCCPatchOnSquare8x8u8, +/// \a fcvNCCPatchOnSquare8x8u8_v2 will be removed, and the current signature +/// for \a fcvNCCPatchOnSquare8x8u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvNCCPatchOnSquare8x8u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param patch +/// Pointer to 8-bit patch pixel values linearly laid out in memory. +/// +/// @param src +/// Pointer to 8-bit image pixel values linearly laid out in memory. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width in pixels of the image. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height in pixels of the image. +/// +/// @param search_center_x +/// Center X coordinate of the search window +/// +/// @param search_center_y +/// Center Y coordinate of the search window +/// +/// @param search_w +/// Width of search square in pixels +/// \n\b WARNING: must be 11 or less. +/// +/// @param filterLowVariance +/// Minimum variance. Used to as threshold to compare against variance of +/// 8x8 block of src or patch. +/// +/// @param best_x +/// Center X location on the image of the best NCC match. The center X has +/// 4 pixels to the left and 3 to the right. +/// +/// @param best_y +/// Center Y location on the image of the best NCC match. The center Y has +/// 4 pixels above and 3 pixels below. +/// +/// @param bestNCC +/// NCC value of the best match block. +/// It's quantized to integer value in Q7 (between -128 and 128). +/// +/// @param doSubPixel (0 or 1) +/// Use parabolic interpolation of NCC values to find sub-pixel estimates. +/// +/// @param subX +/// Sub-pixel estimate for optimal NCC relative to best_x. +/// \n e.g., float x = (float)best_x + subX; +/// +/// @param subY +/// Sub-pixel estimate for optimal NCC relative to best_y. +/// +/// @return +/// 0 = OK \n +/// 1 = "search_radius" too large\n +/// 2 = invalid "search_center_x,y"\n +/// 3 = not found\n +/// 4 = Patch has too low variance\n +/// 5 = Image region has too low variance\n +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch, + const uint8_t* __restrict src, + unsigned short srcWidth, + unsigned short srcHeight, + unsigned short search_center_x, + unsigned short search_center_y, + unsigned short search_w, + int filterLowVariance, + uint16_t* best_x, + uint16_t* best_y, + uint32_t* bestNCC, + int doSubPixel, + float* subX, + float* subY ); + + + +//------------------------------------------------------------------------------ +/// @brief +/// Sum of absolute differences of an image against an 8x8 template. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvSumOfAbsoluteDiffs8x8u8_v2(). In the 2.0.0 release, +/// fcvSumOfAbsoluteDiffs8x8u8_v2 will be renamed to fcvSumOfAbsoluteDiffs8x8u8 +/// and the signature of fcvSumOfAbsoluteDiffs8x8u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and +/// the results are put in dst. +/// +/// @param patch +/// 8x8 template +/// +/// @param src +/// Reference Image. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the src image. +/// +/// @param srcHeight +/// Height of the src image. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param dst +/// The dst buffer shall be width X height bytes in length. +/// Output of SAD(A,B). dst[4][4] correspondes to the 0,0 pixel of the template +/// aligned with the 0,0 pixel of src. The dst border values not covered by +/// entire 8x8 patch window will remain unmodified by the function. The caller +/// should either initialize these to 0 or ignore. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, + const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint16_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Sum of absolute differences of an image against an 8x8 template. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvSumOfAbsoluteDiffs8x8u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvSumOfAbsoluteDiffs8x8u8, +/// \a fcvSumOfAbsoluteDiffs8x8u8_v2 will be removed, and the current signature +/// for \a fcvSumOfAbsoluteDiffs8x8u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvSumOfAbsoluteDiffs8x8u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and +/// the results are put in dst. +/// +/// @param patch +/// 8x8 template +/// +/// @param patchStride +/// Stride of the 8x8 template buffer +/// +/// @param dstStride +/// Stride of the patch (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// +/// @param src +/// Reference Image. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the src image. +/// +/// @param srcHeight +/// Height of the src image. +/// +/// @param srcStride +/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// +/// @param dst +/// The dst buffer shall be at least ( width x height ) values in length. +/// Output of SAD(A,B). dst[4][4]correspondes to the 0,0 pixel of the template +/// aligned with the 0,0 pixel of src. The dst border values not covered by +/// entire 8x8 patch window will remain unmodified by the function. The caller +/// should either initialize these to 0 or ignore. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of destination (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// +/// +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, + unsigned int patchStride, + const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint16_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Down-scale the image to half width and height by averaging 2x2 pixels +/// into one. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvScaleDownBy2u8_v2(). In the 2.0.0 release, +/// fcvScaleDownBy2u8_v2 will be renamed to fcvScaleDownBy2u8 +/// and the signature of fcvScaleDownBy2u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// A box filter downsampling the next pixel, the pixel below, and the next +/// pixel to the pixel below into one pixel.\n +/// | px00 px01 px02 px03 |\n +/// | px10 px11 px12 px13 |\n +/// to:\n +/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE:must be a multiple of 2 +/// +/// @param dst +/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDownBy2u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Down-scale the image to half width and height by averaging 2x2 pixels +/// into one. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleDownBy2u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleDownBy2u8, +/// \a fcvScaleDownBy2u8_v2 will be removed, and the current signature +/// for \a fcvScaleDownBy2u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvScaleDownBy2u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// A box filter downsampling the next pixel, the pixel below, and the next +/// pixel to the pixel below into one pixel.\n +/// | px00 px01 px02 px03 |\n +/// | px10 px11 px12 px13 |\n +/// to:\n +/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE:must be a multiple of 2 +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight/2 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvScaleDownBy2Gaussian5x5u8_v2(). In the 2.0.0 release, +/// fcvScaleDownBy2Gaussian5x5u8_v2 will be renamed to fcvScaleDownBy2Gaussian5x5u8 +/// and the signature of fcvScaleDownBy2Gaussian5x5u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Downsamples the image using a 5x5 Gaussian filter kernel. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE:must be a multiple of 2 +/// +/// @param dst +/// Output 8-bit downscale image of size (width / 2) x (height / 2). +/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleDownBy2Gaussian5x5u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleDownBy2Gaussian5x5u8, +/// \a fcvScaleDownBy2Gaussian5x5u8_v2 will be removed, and the current signature +/// for \a fcvScaleDownBy2Gaussian5x5u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvScaleDownBy2Gaussian5x5u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Downsamples the image using a 5x5 Gaussian filter kernel. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit downscale image of size (width / 2) x (height / 2). +/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale the image to quarter width and height by averaging 4x4 pixels +/// into one.. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvScaleDownBy4u8_v2(). In the 2.0.0 release, +/// fcvScaleDownBy4u8_v2 will be renamed to fcvScaleDownBy4u8 +/// and the signature of fcvScaleDownBy4u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// A 4x4 downsampling box filter across adjacent pixels is applied. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE:must be a multiple of 4 +/// +/// @param dst +/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/16 bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDownBy4u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale the image to quarter width and height by averaging 4x4 pixels +/// into one.. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleDownBy4u8_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleDownBy4u8_v2, +/// \a fcvScaleDownBy4u8_v2 will be removed, and the current signature +/// for \a fcvScaleDownBy4u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvScaleDownBy4u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// A 4x4 downsampling box filter across adjacent pixels is applied. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE:must be a multiple of 4 +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight/4 bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth/4. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/4 if not 0. +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale the image to 2/3 width and height by averaging 3x3 pixels +/// into one.. +/// +/// @details +/// A 3x3 downsampling box filter across adjacent pixels is applied. +/// +/// @param src +/// Input 8-bit image. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 +/// +/// @param srcHeight +/// Image height. +/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. +/// +/// @param dst +/// Output 8-bit image. +/// \n\b WARNING: should be 128-bit aligned. +/// Memory must be pre-allocated at least srcWidth * srcHeight * 2 / 3 +/// dstWidth = srcWidth/3*2 +/// dstHeight = srcHeight/3*2 +/// +/// @param dstStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. +/// +/// @return +/// 0 if successful +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDown3To2u8( const uint8_t* __restrict src, + unsigned srcWidth, + unsigned srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride); + +//--------------------------------------------------------------------------- +/// @brief +/// Downsample Horizontaly and/or Vertically by an *integer* scale. +/// +/// @details +/// Uses Nearest Neighbor method +/// +/// @param src +/// Input 8-bit image. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Source Image height. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. +/// +/// @param dst +/// Output 8-bit image. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Destination Image width. +/// +/// @param dstHeight +/// Destination Image height. +/// +/// @param dstStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. +/// +/// @return +/// 0 if successful +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvScaleDownNNu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + unsigned int dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Downsample Horizontaly and/or Vertically by an *integer* scale. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvScaleDownu8_v2(). In the 2.0.0 release, +/// fcvScaleDownu8_v2 will be renamed to fcvScaleDownu8 +/// and the signature of fcvScaleDownu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Uses an box averaging filter of size MxN where M is the scale factor +/// in horizontal dimension and N is the scale factor in the vertical +/// dimension. +/// \n \b NOTE: input dimensions should be multiple of output dimensions. +/// \n NOTE: On different processors, some output pixel values may be off by 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Source Image height. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstWidth*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Destination Image width. +/// +/// @param dstHeight +/// Destination Image height. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleDownu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Downsample Horizontaly and/or Vertically by an *integer* scale. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleDownu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleDownu8, +/// \a fcvScaleDownu8_v2 will be removed, and the current signature +/// for \a fcvScaleDownu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvScaleDownu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Uses an box averaging filter of size MxN where M is the scale factor +/// in horizontal dimension and N is the scale factor in the vertical +/// dimension +/// \n \b NOTE: input dimensions should be multiple of output dimensions. +/// \n NOTE: On different processors, some output pixel values may be off by 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Source Image height. +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Destination Image width. +/// +/// @param dstHeight +/// Destination Image height. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleDownu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + unsigned int dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvScaleUpBy2Gaussian5x5u8_v2(). In the 2.0.0 release, +/// fcvScaleUpBy2Gaussian5x5u8_v2 will be renamed to fcvScaleUpBy2Gaussian5x5u8 +/// and the signature of fcvScaleUpBy2Gaussian5x5u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Upsamples the image using a 5x5 Gaussian filter kernel. +/// /n/b NOTE: border values have been taken care with Gaussion coefficients. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit upsampled image of size (2*width) x (2*height). +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleUpBy2Gaussian5x5u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleUpBy2Gaussian5x5u8, +/// \a fcvScaleUpBy2Gaussian5x5u8_v2 will be removed, and the current signature +/// for \a fcvScaleUpBy2Gaussian5x5u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvScaleUpBy2Gaussian5x5u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Upsamples the image using a 5x5 Gaussian filter kernel. +/// /n/b NOTE: border values have been taken care with Gaussion coefficients. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit upsampled image of size (2*dstStride) x (2*srcHeight). +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*2 if not 0. +/// +/// +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Translate to float and normalize 36 8-bit elements +/// +/// @param src +/// Pointer to the first input vector +/// +/// @param invLen +/// Pointer to inverse length of the first input vector +/// located right after each 36 element vector +/// +/// @param numVecs +/// Number of vectors to translate +/// +/// @param reqNorm +/// Required norm +/// +/// @param srcStride +/// Step in bytes to data of the next vector +/// Each vector has 36 8-bit elements and 1 float invLen +/// +/// @param dst +/// Pointer to contiguous block for output vectors +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param stopBuild +/// Allows other threads to break this function in the middle of processing. +/// When set to 1, the function will exit on the next iteration. +/// +/// @return +/// 0 - success +/// EFAULT - invalid address +/// EINVAL - invalid argument +/// +/// @ingroup math_vector +// ----------------------------------------------------------------------------- + +FASTCV_API int +fcvVecNormalize36s8f32( const int8_t* __restrict src, + unsigned int srcStride, + const float* __restrict invLen, + unsigned int numVecs, + float reqNorm, + float* __restrict dst, + int32_t* stopBuild ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Sum of squared differences of one 36-byte vector against 4 others. +/// +/// @details +/// SSD of one vector (a) against 4 others (b0,b1,b2,b3) using their given +/// inverse lengths for normalization. +/// \n\n SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenA +/// Inverse of vector A = 1/|A| +/// +/// @param b0 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b1 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b2 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param b3 +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenB +/// Inverse of vectors b0...b3 = 1/|b0|,... 1/|b3| +/// \n\b WARNING: array should be 128-bit aligned +/// +/// @param distances +/// Output of the 4 results { SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) }. +/// \n ACCURACY: 1.0e-6 +/// \n\b WARNING: array should be 128-bit aligned +/// +/// +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict a, + float invLenA, + const int8_t* __restrict b0, + const int8_t* __restrict b1, + const int8_t* __restrict b2, + const int8_t* __restrict b3, + const float* __restrict invLenB, + float* __restrict distances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Sum of squared differences of one 36-byte vector against N others. +/// +/// @details +/// SSD of one vector (a) against N other 36-byte vectors +/// ( b[0], b[1], ..., b[n-1] ) +/// using their given inverse lengths for normalization. +/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenA +/// Inverse of vector A = 1/|A| +/// +/// @param b +/// Vectors b[0]...b[n-1]. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param invLenB +/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param numB +/// Number of B vectors. +/// +/// @param distances +/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. +/// \n ACCURACY: 1.0e-6 +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict a, + float invLenA, + const int8_t* const * __restrict b, + const float* __restrict invLenB, + unsigned int numB, + float* __restrict distances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Sorting of 8 float numbers +/// +/// @details +/// Perform sorting of 8 scores in ascending order (output of SumOfSquaredDiffs) +/// +/// @param inScores +/// Input 8 element float array +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param outScores +/// Output is 8 element sorted float array +/// \n\b WARNING: array should be 128-bit aligned +/// +/// +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSort8Scoresf32( float* __restrict inScores, float* __restrict outScores ); + +//------------------------------------------------------------------------------ +/// @brief +/// Binarizes a grayscale image based on a threshold value. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterThresholdu8_v2(). In the 2.0.0 release, +/// fcvFilterThresholdu8_v2 will be renamed to fcvFilterThresholdu8 +/// and the signature of fcvFilterThresholdu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Sets the pixel to max(255) if it's value is greater than the threshold; +/// else, set the pixel to min(0). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit binarized image. Size of buffer is srcWidth*srcHeight bytes. +/// If src equals to dst, it will do in-place. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param threshold +/// Threshold value for binarization. +/// \n\b WARNING: must be larger than 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFilterThresholdu8( const uint8_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* dst, + unsigned int threshold ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Binarizes a grayscale image based on a threshold value. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterThresholdu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterThresholdu8, +/// \a fcvFilterThresholdu8_v2 will be removed, and the current signature +/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Sets the pixel to max(255) if it's value is greater than the threshold; +/// else, set the pixel to min(0). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. +/// If src equals to dst and srcStride equals to dstStride, it will do in-place. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param threshold +/// Threshold value for binarization. +/// \n\b WARNING: must be larger than 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterThresholdu8_v2( const uint8_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* dst, + unsigned int dstStride, + unsigned int threshold ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Binarizes a grayscale image based on a threshold value. +/// The binarized image will be in the two values selected by user. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterThresholdu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterThresholdu8, +/// \a fcvFilterThresholdu8_v3 will be removed, and the current signature +/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Sets the pixel to max(255) if it's value is greater than the threshold; +/// else, set the pixel to min(0). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. +/// If src equals to dst and srcStride equals to dstStride, it will do in-place. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param threshold +/// Threshold value for binarization. +/// \n\b WARNING: must be larger than 0. +/// +/// @param trueValue +/// The value in type of uint8_t assigned to the destination pixel if the source is larger than threshold +/// +/// @param falseValue +/// The value in type of uint8_t assigned to the destination pixel if the source is smaller than or equal to threshold +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterThresholdu8_v3( const uint8_t* src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* dst, + unsigned int dstStride, + unsigned int threshold, + uint8_t trueValue, + uint8_t falseValue); + + +//------------------------------------------------------------------------------ +/// @brief +/// Binarizes a grayscale image based on a pair of threshold values. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterThresholdRangeu8_v2(). In the 2.0.0 release, +/// fcvFilterThresholdRangeu8_v2 will be renamed to fcvFilterThresholdRangeu8 +/// and the signature of fcvFilterThresholdRangeu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Sets the pixel to min(0) if it's value is greater than the higher threshold +/// or smaller than the lower threshold; +/// else, set the pixel to max(255). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. +/// If src equals to dst and srcStride equals to dstStride, it will do in-place. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param lowThresh +/// The lower threshold value for binarization. +/// +/// @param highThresh +/// The higher threshold value for binarization. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterThresholdRangeu8( const uint8_t* src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* dst, + uint32_t dstStride, + uint8_t lowThresh, + uint8_t highThresh ); + +//------------------------------------------------------------------------------ +/// @brief +/// Binarizes a grayscale image based on a pair of threshold values. +/// The binarized image will be in the two values selected by user. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterThresholdRangeu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterThresholdRangeu8, +/// \a fcvFilterThresholdRangeu8_v2 will be removed, and the current signature +/// for \a fcvFilterThresholdRangeu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterThresholdRangeu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Sets the pixel to min(0) if it's value is greater than the higher threshold +/// or smaller than the lower threshold; +/// else, set the pixel to max(255). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. +/// If src equals to dst and srcStride equals to dstStride, it will do in-place. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param lowThresh +/// The lower threshold value for binarization. +/// +/// @param highThresh +/// The higher threshold value for binarization. +/// +/// @param trueValue +/// The value in type of uint8_t assigned to the destination pixel if the source is +/// within the range inclusively defined by the pair of threshold values +/// +/// @param falseValue +/// The value in type of uint8_t assigned to the destination pixel if the source is +/// out of the range defined by the pair of threshold values +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterThresholdRangeu8_v2( const uint8_t* src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* dst, + uint32_t dstStride, + uint8_t lowThresh, + uint8_t highThresh, + uint8_t trueValue, + uint8_t falseValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterDilate3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterDilate3x3u8_v2 will be renamed to fcvFilterDilate3x3u8 +/// and the signature of fcvFilterDilate3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit dilated image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterDilate3x3u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterDilate3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, +/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Erode a grayscale image by taking the local minima of 3x3 neighborhood window. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterErode3x3u8_v2(). In the 2.0.0 release, +/// fcvFilterErode3x3u8_v2 will be renamed to fcvFilterErode3x3u8 +/// and the signature of fcvFilterErode3x3u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output 8-bit eroded image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterErode3x3u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst ); + +//------------------------------------------------------------------------------ +/// @brief +/// Erode a grayscale image by taking the local minima of 3x3 nbhd window. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterErode3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, +/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Warps the patch centered at nPos in the input image using the affine +/// transform in nAffine +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvTransformAffine8x8u8_v2(). In the 2.0.0 release, +/// fcvTransformAffine8x8u8_v2 will be renamed to fcvTransformAffine8x8u8 +/// and the signature of fcvTransformAffine8x8u8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param nPos[ 2 ] +/// Position in the image in 32 bit fixed point (Q16) +/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and +/// \n leave function. Otherwise, return 0. +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param nAffine[ 2 ][ 2 ] +/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored +/// in nAffine is using row major ordering: \n +/// a11, a12, a21, a22 where the matrix is: \n +/// | a11, a12 |\n +/// | a21, a22 |\n +/// +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param nPatch +/// Transformed patch. +/// +/// @return +/// 0 if the transformation is valid +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvTransformAffine8x8u8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + const int32_t* __restrict nPos, + const int32_t* __restrict nAffine, + uint8_t* __restrict nPatch ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Warps the patch centered at nPos in the input image using the affine +/// transform in nAffine +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvTransformAffine8x8u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvTransformAffine8x8u8, +/// \a fcvTransformAffine8x8u8_v2 will be removed, and the current signature +/// for \a fcvTransformAffine8x8u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvTransformAffine8x8u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: must be at least as much as srcWidth if not 0. +/// +/// @param nPos[ 2 ] +/// Position in the image in 32 bit fixed point (Q16) +/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and +/// \n leave function. Otherwise, return 0. +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param nAffine[ 2 ][ 2 ] +/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored +/// in nAffine is using row major ordering: \n +/// a11, a12, a21, a22 where the matrix is: \n +/// | a11, a12 |\n +/// | a21, a22 |\n +/// +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param patch +/// Transformed patch. +/// +/// @param patchStride +/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// \n\b NOTE: if 0, srcStride is set as 8. +/// \n\b WARNING: must be at least as much as 8 if not 0. +/// +/// @return +/// 0 if the transformation is valid +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API int +fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + const int32_t* __restrict nPos, + const int32_t* __restrict nAffine, + uint8_t* __restrict patch, + unsigned int patchStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Warps a grayscale image using the a perspective projection transformation +/// matrix (also known as a homography). This type of transformation is an +/// invertible transformation which maps straight lines to straight lines. +/// Bi-linear interpolation is used where applicable. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvWarpPerspectiveu8_v2(). In the 2.0.0 release, +/// fcvWarpPerspectiveu8_v2 will be renamed to fcvWarpPerspectiveu8 +/// and the signature of fcvWarpPerspectiveu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Warps an image taking into consideration the perspective scaling. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dst +/// Warped output image. Size of buffer is dstWidth*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Dst image width. +/// \n\b NOTE: data should be multiple of 8. +/// +/// @param dstHeight +/// Dst image height. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvWarpPerspectiveu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + float* __restrict projectionMatrix ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Warps a grayscale image using the a perspective projection transformation +/// matrix (also known as a homography). This type of transformation is an +/// invertible transformation which maps straight lines to straight lines. +/// Bi-linear interpolation is used where applicable. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvWarpPerspectiveu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, +/// \a fcvWarpPerspectiveu8_v2 will be removed, and the current signature +/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Warps an image taking into consideration the perspective scaling. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcStride +/// Input image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Warped output image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Dst image width. +/// \n\b NOTE: data should be multiple of 8. +/// +/// @param dstHeight +/// Dst image height. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param dstStride +/// Output image stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + unsigned int dstStride, + float* __restrict projectionMatrix ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Warps a 3 color channel image based on a 3x3 perspective projection matrix using +/// bilinear interpolation. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcv3ChannelWarpPerspectiveu8_v2(). In the 2.0.0 release, +/// fcv3ChannelWarpPerspectiveu8_v2 will be renamed to fcv3ChannelWarpPerspectiveu8 +/// and the signature of fcv3ChannelWarpPerspectiveu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight*3 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Input image height. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param dst +/// Warped output image. Size of buffer is dstWidth*dstHeight*3 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstWidth +/// Output image width. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param dstHeight +/// Output image height. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API void +fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + float* __restrict projectionMatrix ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Warps a 3 color channel image based on a 3x3 perspective projection +/// matrix using bilinear interpolation. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcv3ChannelWarpPerspectiveu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcv3ChannelWarpPerspectiveu8, +/// \a fcv3ChannelWarpPerspectiveu8_v2 will be removed, and the current signature +/// for \a fcv3ChannelWarpPerspectiveu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcv3ChannelWarpPerspectiveu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcHeight +/// Input image height. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcStride +/// Input image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth*3. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*3 if not 0. +/// +/// @param dst +/// Warped output image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Output image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dstHeight +/// Output image height. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dstStride +/// Output image stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as dstWidth*3. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth*3 if not 0. +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API void +fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + uint8_t* __restrict dst, + unsigned int dstWidth, + unsigned int dstHeight, + unsigned int dstStride, + float* __restrict projectionMatrix ); + + +//--------------------------------------------------------------------------- +/// @brief +/// General function for computing cluster centers and cluster bindings +/// for a set of points of dimension dim. +/// +/// @param points +/// Array of all points. Array size must be greater than +/// numPoints * dim. +/// +/// @param numPoints +/// Number of points in points array. +/// +/// @param dim +/// dimension, e.g. 36 +/// +/// @param pointStride +/// Byte distance between adjacent points in array +/// +/// @param indices +/// Array of point indices in points array. Processing will only +/// occur on points whose indices are in this array. Each index in array +/// must be smaller numPoints. +/// +/// @param numIndices +/// Length of indices array. numIndieces must be <= numPoints. +/// +/// @param numClusters +/// Number of cluster centers +/// +/// @param clusterCenters +/// current cluster centers; +/// elements are distant by clusterCenterStride +/// +/// @param clusterCenterStride +/// byte distance between adjacent cluster centers in array +/// +/// @param newClusterCenters +/// array for new cluster centers; should be numClusterCenters long +/// +/// @param clusterMemberCounts +/// Element counts for each cluster; should be numClusterCenters long +/// +/// @param clusterBindings +/// Output indices of the clusters to which each vector belongs to, array must +/// be numIndices long. +/// +/// @param sumOfClusterDistances +/// Array for sum of distances of cluster elements to cluster centers; +/// Must be numClusters long +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// @remark +/// This is general clusterer. There are no assumptions on points other +/// than they belong to a vector space +/// +/// +/// +/// @ingroup clustering_and_search +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvClusterEuclideanf32( const float* __restrict points, + int numPoints, // actually not used but helpful + int dim, + int pointStride, + const size_t* __restrict indices, + int numIndices, + int numClusters, + float* __restrict clusterCenters, + int clusterCenterStride, + float* __restrict newClusterCenters, + size_t* __restrict clusterMemberCounts, + size_t* __restrict clusterBindings, + float* sumOfClusterDistances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Function for computing cluster centers and cluster bindings +/// for a set of normalized points of dimension dim. Cluster centers +/// are also normalized (see remark below) +/// +/// @param points +/// Array of all points. Array size must be greater than +/// numPoints * dim. +/// +/// @param numPoints +/// Number of points in points array. +/// +/// @param dim +/// dimension, e.g. 36 +/// +/// @param pointStride +/// Byte distance between adjacent points in array +/// +/// @param indices +/// Array of point indices in points array. Processing will only +/// occur on points whose indices are in this array. Each index in array +/// must be smaller numPoints. +/// +/// @param numIndices +/// Length of indices array. numIndieces must be <= numPoints. +/// +/// @param numClusters +/// Number of cluster centers +/// +/// @param clusterCenters +/// current cluster centers; +/// elements are distant by clusterCenterStride +/// +/// @param clusterCenterStride +/// byte distance between adjacent cluster centers in array +/// +/// @param newClusterCenters +/// array for new cluster centers; should be numClusterCenters long +/// +/// @param clusterMemberCounts +/// Element counts for each cluster; should be numClusterCenters long +/// +/// @param clusterBindings +/// Output indices of the clusters to which each vector belongs to, a +/// rray must be numIndices long. +/// +/// @param sumOfClusterDistances +/// Array for sum of distances of cluster elements to cluster centers; +/// Must be numClusters long +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// @remark +/// this function assumes that points are normalized (e.g. NFT4 +/// descriptors). Cluster centers are also normalized. Normalized points +/// are on a surface of unit sphere which is not a vector space but +/// curved manifold of dimension (dim-1) embeded in Euclidean vector space +/// of dimension dim +/// +/// @ingroup clustering_and_search +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvClusterEuclideanNormedf32( const float* __restrict points, + int numPoints, + int dim, + int pointStride, + const size_t* __restrict indices, + int numIndices, + int numClusters, + float* __restrict clusterCenters, + int clusterCenterStride, + float* __restrict newClusterCenters, + size_t* __restrict clusterMemberCounts, + size_t* __restrict clusterBindings, + float* sumOfClusterDistances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Function for computing cluster centers and cluster bindings +/// for a set of normalized points of dimension 36. Cluster centers +/// are also normalized (see remark below) +/// +/// @param points +/// Array of all points. Array size must be greater than +/// numPoints * 36. +/// +/// @param numPoints +/// Number of points in points array. +/// +/// @param pointStride +/// Byte distance between adjacent points in array +/// +/// @param indices +/// Array of point indices in points array. Processing will only +/// occur on points whose indices are in this array. Each index in array +/// must be smaller numPoints. +/// +/// @param numIndices +/// Length of indices array. numIndieces must be <= numPoints. +/// +/// @param numClusters +/// Number of cluster centers +/// +/// @param clusterCenters +/// current cluster centers; +/// elements are distant by clusterCenterStride +/// +/// @param clusterCenterStride +/// byte distance between adjacent cluster centers in array +/// +/// @param newClusterCenters +/// array for new cluster centers; should be numClusterCenters long +/// +/// @param clusterMemberCounts +/// Element counts for each cluster; should be numClusterCenters long +/// +/// @param clusterBindings +/// Output indices of the clusters to which each vector belongs to, a +/// rray must be numIndices long. +/// +/// @param sumOfClusterDistances +/// Array for sum of distances of cluster elements to cluster centers; +/// Must be numClusters long +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// @remark +/// this function assumes that points are normalized (e.g. NFT4 +/// descriptors). Cluster centers are also normalized. Normalized points +/// are on a surphace of unit sphere which is not a vector space but +/// curved manifold of dimension (dim-1) embeded in Euclidean vector space +/// of dimension dim +/// +/// @ingroup clustering_and_search +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvClusterEuclideanNormed36f32( const float* __restrict points, + int numPoints, + int pointStride, + const size_t* __restrict indices, + int numIndices, + int numClusters, + float* __restrict clusterCenters, + int clusterCenterStride, + float* __restrict newClusterCenters, + size_t* __restrict clusterMemberCounts, + size_t* __restrict clusterBindings, + float* sumOfClusterDistances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Blur with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian5x5s16_v2(). In the 2.0.0 release, +/// fcvFilterGaussian5x5s16_v2 will be renamed to fcvFilterGaussian5x5s16 +/// and the signature of fcvFilterGaussian5x5s16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). +/// \n\b NOTE: Size of buffer is srcWidth*srcHeight*2 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output int data. Size of buffer is srcWidth*srcHeight*2 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param blurBorder +/// If set to 0, border is ignored. +/// If set to 1, border is blurred by 0-padding adjacent values. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFilterGaussian5x5s16( const int16_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + int16_t* __restrict dst, + int blurBorder ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Blur with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian5x5s16() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s16, +/// \a fcvFilterGaussian5x5s16_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian5x5s16 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian5x5s16 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). +/// Size of buffer is srcStride*srcHeight*2 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth*2. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. +/// +/// @param dst +/// Output int data. Size of buffer is dstStride*srcHeight*2 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. +/// +/// @param blurBorder +/// If set to 0, border is ignored. +/// If set to 1, border is blurred by 0-padding adjacent values. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dst, + unsigned int dstStride, + int blurBorder ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Blur with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian5x5s32_v2(). In the 2.0.0 release, +/// fcvFilterGaussian5x5s32_v2 will be renamed to fcvFilterGaussian5x5s32 +/// and the signature of fcvFilterGaussian5x5s32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). +/// Size of buffer is srcWidth*srcHeight*4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param dst +/// Output int data. Size of buffer is srcWidth*srcHeight*4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param blurBorder +/// If set to 0, border is ignored. +/// If set to 1, border is blurred by 0-padding adjacent values. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFilterGaussian5x5s32( const int32_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + int32_t* __restrict dst, + int blurBorder ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Blur with 5x5 Gaussian filter +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian5x5s32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s32, +/// \a fcvFilterGaussian5x5s32_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian5x5s32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian5x5s32 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 5x5 Gaussian kernel: +/// \n 1 4 6 4 1 +/// \n 4 16 24 16 4 +/// \n 6 24 36 24 6 +/// \n 4 16 24 16 4 +/// \n 1 4 6 4 1 +/// +/// @param src +/// Input int data (can be sq. of gradient, etc). +/// Size of buffer is srcStride*srcHeight*4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Input Image stride in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth*sizeof(int32_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output int data. Size of buffer is dstStride*srcHeight*4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output Image stride in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth*sizeof(int32_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param blurBorder +/// If set to 0, border is ignored. +/// If set to 1, border is blurred by 0-padding adjacent values. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int32_t* __restrict dst, + unsigned int dstStride, + int blurBorder ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Segments an image (3 or 1 channel) into meaningful regions, +/// depending on the color or gray scale uniformity of the neighborhood pixels. +/// +/// @param src +/// Pointer to 8-bit color (3-channel) or grayscale (1-channel) image. +/// +/// @param srcWidth +/// Width of src image, measured by pixels. +/// +/// @param srcHeight +/// Height of src image, measured by pixels. +/// +/// @param srcStride +/// Stride of src image, measured by bytes. +/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. +/// +/// @param numChannel +/// Number of channels of src image. 1 for gray scale and 3 for color image. +/// +/// @param thresholdSplit +/// Threshold for region split. Higher value: larger uniform region segmented. +/// Range of 3-channel image segmentation 20~500: 20~50 for heavy over-segmentation, 50~100 for median over-segmentation, 100~150 for light over-segmentation, 150~250 for normal segmentation, 250~400 for light under-segmentation, 400~500 for heavy under-segmentation. +/// Range of 1-channel image segmentation 3~150: 3~10 for heavy over-segmentation, 10~15 for median over-segmentation, 15~25 for light over-segmentation, 25~50 for normal segmentation, 50~75 for light under-segmentation, 75~150 for heavy under-segmentation. +/// +/// @param thresholdMerge +/// Threshold for region merge, measured by the region area (pixels). Higher value: larger uniform region segmented. Range 10~1000 for VGA size image. +/// Range of 3-channel image segmentation 10~1000: 10~30 for heavy over-segmentation, 30~60 for median over-segmentation, 60~150 for light over-segmentation, 150~400 for normal segmentation, 400~600 for light under-segmentation, 600~1000 for heavy under-segmentation. +/// Same for the 1-channel image. +/// For other image size, please tune the thresholdMerge value proportional to the VGA size. +/// +/// @param segLabel +/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. +/// +/// @param segLabelStride +/// Stride of segmented labels, measured by bytes. +/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. +/// +/// @param data +/// data buffer for inner function buffer allocation. The buffer size is recommended below, +/// for 3-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*18*sizeof(uint8_t) ); +/// for 1-channel image: *data = (uint8_t *) malloc ( srcWidth*srcHeight*16*sizeof(uint8_t) ); +/// +/// @return +/// 0 if successful. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- +FASTCV_API uint32_t +fcvImageSegmentationRegionGrow( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numChannel, + uint32_t thresholdSplit, + uint32_t thresholdMerge, + uint32_t* __restrict segLabel, + uint32_t segLabelStride, + uint8_t* __restrict data ); + +//--------------------------------------------------------------------------- +/// @brief +/// Warps the patch centered at nPos in the input image using the affine +/// transform in nAffine +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvTransformAffineu8_v2(). In the 2.0.0 release, +/// fcvTransformAffineu8_v2 will be renamed to fcvTransformAffineu8 +/// and the signature of fcvTransformAffineu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcWidth*srcHeight bytes. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param position[ 2 ] +/// Position in the image +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param affine[ 2 ][ 2 ] +/// Transformation matrix. The matrix stored +/// in affine is using row major ordering: \n +/// a11, a12, a21, a22 where the matrix is: \n +/// | a11, a12 |\n +/// | a21, a22 |\n +/// +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param patch +/// Transformed patch. +/// +/// @param patchWidth +/// Patch width. +/// +/// @param patchHeight +/// Patch height. +/// +/// @return +/// 0 if the transformation is valid +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvTransformAffineu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + const float* __restrict position, + const float* __restrict affine, + uint8_t* __restrict patch, + unsigned int patchWidth, + unsigned int patchHeight ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Warps the patch centered at nPos in the input image using the affine +/// transform in nAffine +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvTransformAffineu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvTransformAffineu8, +/// \a fcvTransformAffineu8_v2 will be removed, and the current signature +/// for \a fcvTransformAffineu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvTransformAffineu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: must be at least as much as srcWidth if not 0. +/// +/// @param position[ 2 ] +/// Position in the image +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param affine[ 2 ][ 2 ] +/// Transformation matrix. The matrix stored +/// in affine is using row major ordering: \n +/// a11, a12, a21, a22 where the matrix is: \n +/// | a11, a12 |\n +/// | a21, a22 |\n +/// +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param patch +/// Transformed patch. +/// +/// @param patchWidth +/// Patch width. +/// +/// @param patchHeight +/// Patch height. +/// +/// @param patchStride +/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N +/// and column 0 of row N+1. +/// \n\b NOTE: if 0, patchStride is set as patchWidth. +/// \n\b WARNING: must be at least as much as patchWidth if not 0. +/// +/// @return +/// 0 if the transformation is valid +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvTransformAffineu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + const float* __restrict position, + const float* __restrict affine, + uint8_t* __restrict patch, + unsigned int patchWidth, + unsigned int patchHeight, + unsigned int patchStride ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts a 17x17 rotation corrected patch from a 25x25 image. +/// +/// @param src +/// 25x25 input image in continuous memory. +/// +/// @param dst +/// 17x17 output patch. +/// +/// @param orientation +/// Rotation angle of patch relative to src. +/// \n 10-bit fixed-point angle around unit circle. +/// \n NOTE: 0 = 0 degrees and 1024 = 360 degrees. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvCopyRotated17x17u8( const uint8_t* __restrict src, + uint8_t* __restrict dst, + int orientation ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts "1" bits in supplied vector. +/// +/// @param src +/// Pointer to vector to count bits that are 1. +/// +/// @param srcLength +/// Length of the vector to count bits. Assumed that the remainder of bits modulo 8 +/// will be set to 0 a priori. +/// +/// @return +/// total number of "1" bits in supplied vector +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvBitCountu8( const uint8_t* __restrict src, + unsigned int srcLength ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts "1" bits in supplied 32-byte vector. +/// +/// @param src +/// Pointer to 32-byte vector(s) to count bits that are 1. +/// +/// @return +/// total number of "1" bits in supplied vector +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvBitCount32x1u8( const uint8_t* __restrict src ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts bits in supplied 4, 32-byte vectors. +/// +/// @param a +/// Pointer to 32-byte vector to count bits. +/// +/// @param b +/// Pointer to 32-byte vector to count bits. +/// +/// @param c +/// Pointer to 32-byte vector to count bits. +/// +/// @param d +/// Pointer to 32-byte vector to count bits. +/// +/// @param bitCount +/// Array to store the four resultant bit counts. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvBitCount32x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + uint32_t* __restrict bitCount ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts bits in supplied 64-byte vector. +/// +/// @param src +/// Pointer to 64-byte vector(s) to count bits. +/// +/// @return +/// Bit count. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvBitCount64x1u8( const uint8_t* __restrict src ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts bits in supplied 4, 64-byte vectors. +/// +/// @param a +/// Pointer to 64-byte vector to count bits. +/// +/// @param b +/// Pointer to 64-byte vector to count bits. +/// +/// @param c +/// Pointer to 64-byte vector to count bits. +/// +/// @param d +/// Pointer to 64-byte vector to count bits. +/// +/// @param bitCount +/// Array to store the four resultant bit counts. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvBitCount64x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + uint32_t* __restrict bitCount ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Counts bits in supplied vector of unsigned intergers. +/// +/// @param src +/// Pointer to vector(s) to count bits. +/// +/// @param srcLength +/// Number of elements in vector +/// +/// @return +/// Bit count. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvBitCountu32( const uint32_t* __restrict src, + unsigned int srcLength ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between the two supplied arbitrary length +/// vectors. +/// +/// @param a +/// Pointer to vector to compute distance. +/// +/// @param b +/// Pointer to vector to compute distance. +/// +/// @param abLength +/// Length in bits of each of the vectors. Assumed that the remainder of +/// bits modulo 8 will be set to 0 a priori. +/// +/// @return +/// Hamming distance between the two vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvHammingDistanceu8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + unsigned int abLength ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between the two supplied 32-byte vectors. +/// +/// @param a +/// Pointer to 32-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 32-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @return +/// Hamming distance between the two vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between the two supplied 64-byte vectors. +/// +/// @param a +/// Pointer to 64-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 64-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @return +/// Hamming distance between the two vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between the two supplied 32-byte vectors. +/// +/// @param a +/// Pointer to 32-byte vector to compute distance. +/// +/// @param b +/// Pointer to 32-byte vector to compute distance. +/// +/// @return +/// Hamming distance between the two vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvHammingDistance32x1u8( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between the two supplied 64-byte vectors. +/// +/// @param a +/// Pointer to 64-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 64-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @return +/// Hamming distance between the two vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API uint32_t +fcvHammingDistance64x1u8( const uint8_t* __restrict a, + const uint8_t* __restrict b ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between A and each of B,C,D,E 32-byte vectors. +/// +/// @param a +/// Pointer to 32-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param c +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param d +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param e +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param hammingDistances +/// Array to store each Hamming distance between the vectors. +/// \n\b WARNING: should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvHammingDistance32x4u8a4( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict hammingDistances ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between A and each of B,C,D,E 64-byte +/// vectors. +/// +/// @param a +/// Pointer to 32-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param c +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param d +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param e +/// Pointer to 32-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param hammingDistances +/// Array to store each Hamming distance between the vectors. +/// \n\b WARNING: should be 128-bit aligned +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvHammingDistance64x4u8a4( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict hammingDistances ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the Hamming distance between A and each of B,C,D,E 64-byte vectors. +/// +/// @param a +/// Pointer to 64-byte vector to compute distance. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param b +/// Pointer to 64-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param c +/// Pointer to 64-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param d +/// Pointer to 64-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param e +/// Pointer to 64-byte vector to compute distance from A. +/// \n\b WARNING: must be 32-bit aligned +/// +/// @param hammingDistances +/// Array to store each Hamming distance between the vectors. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvHammingDistance64x4u8( const uint8_t* __restrict a, + const uint8_t* __restrict b, + const uint8_t* __restrict c, + const uint8_t* __restrict d, + const uint8_t* __restrict e, + uint32_t* __restrict hammingDistances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image +/// +/// @param src +/// 8-bit image +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width +/// \n\b NOTE: should be a multiple of 8. +/// \n\b WARNING: must be <= 2048. +/// +/// @param srcHeight +/// image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9Scoreu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + unsigned int nCornersMax, + uint32_t* __restrict nCorners ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image +/// +/// @param src +/// Grayscale image with one byte per pixel +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// image width +/// \n\b NOTE: should be a multiple of 8. +/// \n\b WARNING: must be <= 2048. +/// +/// @param srcHeight +/// image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// Pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param mask +/// Per-pixel mask for each pixel represented in input image. +/// If a bit set to 0, pixel will be a candidate for corner detection. +/// If a bit set to 1, pixel will be ignored. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + const uint8_t* __restrict mask, + unsigned int maskWidth, + unsigned int maskHeight ); + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvCornerFast9Scoreu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvCornerFast9Scoreu8, +/// \a fcvCornerFast9Scoreu8_v2 will be removed, and the current signature +/// for \a fcvCornerFast9Scoreu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvCornerFast9Scoreu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// non-maximum suppression can be enabled to reduce the number of false corners. +/// +/// @param src +/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// Pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: should be 128-bit aligned. +/// \n\b NOTE: size of buffer is @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. +/// +/// @param nCorners +/// Pointer to an integer storing the number of corners detected +/// +/// @param nmsEnabled +/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) +/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key +/// points before NMS +/// +/// @param tempBuf +/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. +/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + uint32_t nmsEnabled, + void* __restrict tempBuf); + + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels +/// to be ignored by the detector. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvCornerFast9InMaskScoreu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvCornerFast9InMaskScoreu8, +/// \a fcvCornerFast9InMaskScoreu8_v2 will be removed, and the current signature +/// for \a fcvCornerFast9InMaskScoreu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvCornerFast9InMaskScoreu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// non-maximum suppression can be enabled to reduce the number of false corners. +/// +/// @param src +/// 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// Pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: should be 128-bit aligned. +/// \n\b NOTE: size of buffer is @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. +/// +/// @param nCorners +/// Pointer to an integer storing the number of corners detected +/// +/// @param mask +/// Mask used to omit regions of the image. For allowed mask sizes refer to +/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple +/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image +/// will be ignored. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param nmsEnabled +/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) +/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key +/// points before NMS +/// +/// @param tempBuf +/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. +/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int barrier, + unsigned int border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + unsigned int nCornersMax, + uint32_t* __restrict nCorners, + const uint8_t* __restrict mask, + unsigned int maskWidth, + unsigned int maskHeight, + uint32_t nmsEnabled, + void* __restrict tempBuf); + + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image +/// +/// @details +/// non-maximum suppression can be enabled to reduce the number of false corners. +/// +/// @param src +/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// Pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: should be 128-bit aligned. +/// \n\b NOTE: size of buffer is @param nCornersMax +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param nmsEnabled +/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) +/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key +/// points before NMS +/// +/// @param tempBuf +/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. +/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvCornerFast10Scoreu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t barrier, + uint32_t border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + uint32_t nCornersMax, + uint32_t* __restrict nCorners, + uint32_t nmsEnabled, + void* __restrict tempBuf); + +//--------------------------------------------------------------------------- +/// @brief +/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels +/// to be ignored by the detector. +/// +/// @param src +/// 8-bit grayscale image where keypoints are detected +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// image width +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param barrier +/// FAST threshold. The threshold is used to compare difference between intensity value of +/// the central pixel and pixels on a circle surrounding this pixel. +/// +/// @param border +/// Number for pixels to ignore from top,bottom,right,left of the image +/// \n\b WARNING: If border < 3, it will be default to 3. +/// \n\b WARNING: srcWidth and srcHeight must be > 2 x border +/// +/// @param xy +/// Pointer to the output array cointaining the interleaved x,y position of the +/// detected corners. +/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param scores +/// Pointer to the output array containing the scores of the detected corners. +/// The score is the highest threshold that can still validate the detected corner. +/// Must be greater than barrier. A higher score value indicates a stronger corner feature. +/// For example, a corner of score 108 is stronger than a corner of score 50. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param nCornersMax +/// Maximum number of corners. The function exits when the maximum number of +/// corners is exceeded. +/// \n\b NOTE: This number should account for the number of key points before non-maximum suppression. +/// +/// @param nCorners +/// pointer to an integer storing the number of corners detected +/// +/// @param mask +/// Mask used to omit regions of the image. For allowed mask sizes refer to +/// @param maskWidth and @param maskHeight. The mask is so defined to work with multiple +/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image +/// will be ignored. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param maskWidth +/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param maskHeight +/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, +/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. +/// +/// @param nmsEnabled +/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) +/// \n\b NOTE: When NMS is enabled, be sure to assign large enough nCornersMax to store raw key +/// points before NMS +/// +/// @param tempBuf +/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. +/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t barrier, + uint32_t border, + uint32_t* __restrict xy, + uint32_t* __restrict scores, + uint32_t nCornersMax, + uint32_t* __restrict nCorners, + const uint8_t* __restrict mask, + uint32_t maskWidth, + uint32_t maskHeight, + uint32_t nmsEnabled, + void* __restrict tempBuf); + +// ----------------------------------------------------------------------------- +/// @brief +/// Optical flow. Bitwidth optimized implementation +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvTrackLKOpticalFlowu8_v2(). In the 2.0.0 release, +/// fcvTrackLKOpticalFlowu8_v2 will be renamed to fcvTrackLKOpticalFlowu8 +/// and the signature of fcvTrackLKOpticalFlowu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src1 +/// Input image from frame #1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Input image from frame #2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param src1Pyr +/// Image Pyradmid of src1 +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 +/// +/// @param src2Pyr +/// Image Pyradmid of src2 +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 +/// +/// @param dx1Pyr +/// Horizontal Sobel gradient pyramid for src1 +/// \n\b NOTE: To be left NULL. In this case the function will +/// build the pyramid internally. +/// +/// @param dy1Pyr +/// Vertical Sobel grading pyraid for src1 +/// \n\b NOTE: To be left NULL. In this case the function will +/// build the pyramid internally. +/// +/// @param featureXY +/// Pointer to X,Y floating point, sub-pixel coordinates for features to +/// track. Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureXY_out +/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features +/// Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureStatus +/// Pointer to integer array for status of each feature defined in +/// featureXY. featureStatus array storage must +/// be >= featureLen. +/// +/// @param featureLen +/// Number of features in featuresXY and featureStatus array. +/// +/// @param windowWidth +/// Width of window for optical flow searching. Must be odd number. +/// \n\b NOTE: suggested value 5, 7 or 9 +/// +/// @param windowHeight +/// Height of window for optical flow searching. Must be odd number. +/// \n\b NOTE:: suggested value 5, 7 or 9 +/// +/// @param maxIterations +/// Maximum number of LK iterations to perform per pyramid level. +/// \n\b NOTE: suggested value 5 or 7 +/// +/// @param nPyramidLevels +/// Number of pyramid levels. +/// \n\b NOTE: suggested value 3 or 4 depending on size of image +/// +/// @param maxResidue +/// Maximum feature residue above which feature is declared lost. +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param minDisplacement +/// Minimum displacement solved below which iterations are stopped. +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param minEigenvalue +/// Threshold for feature goodness. If it is set it to 0, the check is disabled. +/// \n\b NOTE: If good features are passed to the function, then it is suggested +/// that you set it to 0 to have faster function time +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param lightingNormalized +/// if 1 Enable lightning normalization +/// \n if 0 Disable lightning normalization +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API void +fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + int srcWidth, + int srcHeight, + const fcvPyramidLevel* src1Pyr, + const fcvPyramidLevel* src2Pyr, + const fcvPyramidLevel* dx1Pyr, + const fcvPyramidLevel* dy1Pyr, + const float* featureXY, + float* featureXY_out, + int32_t* featureStatus, + int featureLen, + int windowWidth, + int windowHeight, + int maxIterations, + int nPyramidLevels, + float maxResidue, + float minDisplacement, + float minEigenvalue, + int lightingNormalized ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Optical flow (with stride so ROI can be supported) +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, +/// \a fcvTrackLKOpticalFlowu8_v2 will be removed, and the current signature +/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a ffcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src1 +/// Input image from frame #1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Input image from frame #2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param width +/// Input image width. +/// +/// @param height +/// Input image height. +/// +/// @param stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. +/// NOTE: should be a multiple of 8. +/// +/// @param src1Pyr +/// Image Pyramid of src1 (with stride) +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 +/// +/// @param src2Pyr +/// Image Pyradmid of src2 (with stride) +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v2 +/// +/// @param featureXY +/// Pointer to X,Y floating point, sub-pixel coordinates for features to +/// track. Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureXY_out +/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features +/// Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureStatus +/// Pointer to integer array for status of each feature defined in +/// featureXY. featureStatus array storage must +/// be >= featureLen. +/// +/// @param featureLen +/// Number of features in featuresXY and featureStatus array. +/// +/// @param windowWidth +/// Width of window for optical flow searching. Must be odd number. +/// \n\b NOTE: suggested value 5, 7 or 9 +/// +/// @param windowHeight +/// Height of window for optical flow searching. Must be odd number. +/// \n\b NOTE:: suggested value 5, 7 or 9 +/// +/// @param maxIterations +/// Maximum number of LK iterations to perform per pyramid level. +/// \n\b NOTE: suggested value 5 or 7 +/// +/// @param nPyramidLevels +/// Number of pyramid levels. +/// \n\b NOTE: suggested value 3 or 4 depending on size of image +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API void +fcvTrackLKOpticalFlowu8_v2( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + uint32_t width, + uint32_t height, + uint32_t stride, + const fcvPyramidLevel_v2 *src1Pyr, + const fcvPyramidLevel_v2 *src2Pyr, + const float32_t* featureXY, + float32_t* featureXY_out, + int32_t* featureStatus, + int32_t featureLen, + int32_t windowWidth, + int32_t windowHeight, + int32_t maxIterations, + int32_t nPyramidLevels); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Optical flow. +/// +/// \n\b ATTENTION: This function will be removed when the 2.0.0 release of this library +/// is made. Until 2.0.0, the developer should use this implementation with the expectation of +/// using \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src1 +/// Input image from frame #1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Input image from frame #2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param src1Pyr +/// Image Pyradmid of src1 +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 +/// +/// @param src2Pyr +/// Image Pyradmid of src2 +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 +/// +/// @param dx1Pyr +/// Horizontal Sobel gradient pyramid for src1 +/// \n\b NOTE: To be left NULL. In this case the function will +/// build the pyramid internally. +/// +/// @param dy1Pyr +/// Vertical Sobel grading pyraid for src1 +/// \n\b NOTE: To be left NULL. In this case the function will +/// build the pyramid internally. +/// +/// @param featureXY +/// Pointer to X,Y floating point, sub-pixel coordinates for features to +/// track. Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureXY_out +/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features +/// Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureStatus +/// Pointer to integer array for status of each feature defined in +/// featureXY. featureStatus array storage must +/// be >= featureLen. +/// \n\b NOTE: Possible status are : +/// \n TRACKED 1 +/// \n NOT_FOUND -1 +/// \n SMALL_DET -2 +/// \n MAX_ITERATIONS -3 +/// \n OUT_OF_BOUNDS -4 +/// \n LARGE_RESIDUE -5 +/// \n SMALL_EIGVAL -6 +/// \n INVALID -99 +/// +/// @param featureLen +/// Number of features in featuresXY and featureStatus array. +/// +/// @param windowWidth +/// Width of window for optical flow searching. Must be odd number. +/// \n\b NOTE: suggested value 5, 7 or 9 +/// +/// @param windowHeight +/// Height of window for optical flow searching. Must be odd number. +/// \n\b NOTE:: suggested value 5, 7 or 9 +/// +/// @param maxIterations +/// Maximum number of LK iterations to perform per pyramid level. +/// \n\b NOTE: suggested value 5 or 7 +/// +/// @param nPyramidLevels +/// Number of pyramid levels. +/// \n\b NOTE: suggested value 3 or 4 depending on size of image +/// +/// @param maxResidue +/// Maximum feature residue above which feature is declared lost. +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param minDisplacement +/// Minimum displacement solved below which iterations are stopped. +/// \n\b NOTE : Suggest that be set to between 0.1 and 0.2, say 0.15 +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param minEigenvalue +/// Threshold for feature goodness. If it is set it to 0, the check is disabled. +/// \n\b NOTE: If good features are passed to the function, then it is suggested +/// that you set it to 0 to have faster function time +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @param lightingNormalized +/// if 1 Enable lightning normalization +/// \n if 0 Disable lightning normalization +/// \n\b NOTE: obsolete parameters, set to 0 +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + unsigned int srcWidth, + unsigned int srcHeight, + const fcvPyramidLevel* src1Pyr, + const fcvPyramidLevel* src2Pyr, + const fcvPyramidLevel* dx1Pyr, + const fcvPyramidLevel* dy1Pyr, + const float* featureXY, + float* featureXY_out, + int32_t* featureStatus, + int featureLen, + int windowWidth, + int windowHeight, + int maxIterations, + int nPyramidLevels, + float maxResidue, + float minDisplacement, + float minEigenvalue, + int lightingNormalized ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Builds an image pyramid of float32 arising from a single +/// original image - that are successively downscaled w.r.t. the +/// pre-set levels. +/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvPyramidCreatef32_v2(). In the 2.0.0 release, +/// fcvPyramidCreatef32_v2 will be renamed to fcvPyramidCreatef32 +/// and the signature of fcvPyramidCreatef32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Base image. Size of buffer is srcWidth*srcHeight*4 bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of base image +/// \n\b WARNING: must be a multiple of 2^numLevels +/// +/// @param srcHeight +/// Height of base image +/// \n\b WARNING: must be a multiple of 2^numLevels +/// +/// @param numLevels +/// Number of levels of the pyramid +/// +/// @param pyramid +/// Output pyramid of numLevels+1 images of the same type as src . +/// pyramid[0] will be the same as src . pyramid[1] is the next +/// pyramid layer, a smoothed and down-sized src , and so on. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidCreatef32( const float* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int numLevels, + fcvPyramidLevel* pyramid ); + +// ----------------------------------------------------------------------------- +/// @brief +/// Builds an image pyramid (with stride). +/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete_v2 +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidCreatef32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidCreatef32, +/// \a fcvPyramidCreatef32_v2 will be removed, and the current signature +/// for \a fcvPyramidCreatef32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidCreatef32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// base image +/// +/// @param srcWidth +/// width of base image +/// \n\b NOTE: Needs to be a multiple of 2^numLevels +/// +/// @param srcHeight +/// height of base image +/// \n\b NOTE: Needs to be a multiple of 2^numLevel +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory (base image). +/// \n\b NOTE: Needs to be a multiple of 2^numLevels +/// \n\b NOTE: If left at 0, pyramid (non-base) image stride is the same as its srcWidth*sizeof(float32_t) +/// +/// @param numLevels +/// Number of levels of the pyramid +/// +/// @param fcvPyramidLevel_v2 +/// output pyramid (with stride) of numLevels+1 images of the same type as src . +/// pyramid[0] will be the same as src . pyramid[1] is the next +/// pyramid layer, a smoothed and down-sized src , and so on. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidCreatef32_v2( const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numLevels, + fcvPyramidLevel_v2* pyramid ); + +// ----------------------------------------------------------------------------- +/// @brief +/// Builds an image pyramid of uint8_t arising from a single +/// original image - that are successively downscaled w.r.t. the +/// pre-set levels. +/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvPyramidCreateu8_v2(). In the 2.0.0 release, +/// fcvPyramidCreateu8_v2 will be renamed to fcvPyramidCreateu8 +/// and the signature of fcvPyramidCreateu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Base image. Size of buffer is srcWidth*srcHeight bytes. +/// +/// @param srcWidth +/// Width of base image +/// \n\b WARNING: must be a multiple of 2^(numLevels-1) +/// +/// @param srcHeight +/// height of base image +/// \n\b NOTE: must be a multiple of 2^(numLevels-1) +/// +/// @param numLevels +/// Number of levels of the pyramid +/// +/// @param pyramid +/// Output pyramid of numLevels+1 images of the same type as src . +/// pyramid[0] will be the same as src . pyramid[1] is the next +/// pyramid layer, a smoothed and down-sized src , and so on. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidCreateu8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int numLevels, + fcvPyramidLevel* pyramid ); + +// ----------------------------------------------------------------------------- +/// @brief +/// Builds an image pyramid (with stride). +/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidCreateu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidCreateu8, +/// \a fcvPyramidCreateu8_v2 will be removed, and the current signature +/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// base image +/// +/// @param srcWidth +/// width of base image +/// \n\b NOTE: Needs to be a multiple of 2^numLevels +/// +/// @param srcHeight +/// height of base image +/// \n\b NOTE: Needs to be a multiple of 2^numLevel +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory (base image). +/// \n\b NOTE: Needs to be a multiple of 2^numLevels +/// \n\b NOTE: Pyramid (non-base) image stride is the same as its width +/// +/// @param numLevels +/// Number of levels of the pyramid +/// +/// @param fcvPyramidLevel_v2 +/// output pyramid (with stride) of numLevels+1 images of the same type as src . +/// pyramid[0] will be the same as src . pyramid[1] is the next +/// pyramid layer, a smoothed and down-sized src , and so on. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidCreateu8_v2( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numLevels, + fcvPyramidLevel_v2* pyramid ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Builds a Gaussian image pyramid. +/// DO NOT USE THIS API unless for testing purposes. +/// This API can be removed without notice. +/// +/// @details +/// This function builds a Gaussian image Pyramid given an input image. Each level +/// of the pyramid is computed by first applying a gaussian filter on the previous level, +/// and then scaling the image based on the type of scale factor selected. The memory for +/// the pyramid must be allocated using fcvPyramidAllocate_v3(), and should be +/// deallocated using fcvPyramidDelete_v2() +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvPyramidCreateu8_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvPyramidCreateu8, +/// \a fcvPyramidCreateu8_v3 will be removed, and the current signature +/// for \a fcvPyramidCreateu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvPyramidCreateu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// base image +/// +/// @param srcWidth +/// Width of base image +/// +/// @param srcHeight +/// Height of base image +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory (base image). +/// \n\b NOTE: The stride of pyramid levels other than the base are set to be the same as their width +/// +/// @param numLevels +/// Number of levels of the pyramid +/// +/// @param scale +/// Defines the type of scaling used for each pyramid level. +/// FASTCV_PYRAMID_SCALE_HALF downscales each level of the pyramid by a factor of 2. +/// FASTCV_PYRAMID_SCALE_ORB downscales each level of the pyramid by a factor of 1/(2)^(1/4), +/// which is approximated as 0.8408964f +/// +/// @param pyramidGaussian +/// output pyramid of "numLevels" images of the same type as src . +/// pyramidGaussian[0] will be the same as src . pyramidGaussian[1] is the next +/// pyramid layer, a smoothed and scaled src, and so on. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvPyramidCreateu8_v3(const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numLevels, + fcvPyramidScale scale, + fcvPyramidLevel_v2* __restrict pyramidGaussian); + +// ----------------------------------------------------------------------------- +/// @brief +/// Creates a gradient pyramid of int16_t from an image pyramid of uint8_t +/// +/// @param imgPyr +/// Input Image Pyramid +/// +/// @param dxPyr +/// Horizontal Sobel gradient pyramid +/// +/// @param dyPyr +/// Verical Sobel gradient pyramid +/// +/// @param numLevels +/// Number of levels in the pyramids +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, + fcvPyramidLevel* dxPyr, + fcvPyramidLevel* dyPyr, + unsigned int numLevels ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Creates a gradient pyramid of float32 from an image pyramid of uint8_t +/// +/// @param imgPyr +/// input Image Pyramid +/// +/// @param dxPyr +/// Horizontal Sobel gradient pyramid +/// +/// @param dyPyr +/// Verical Sobel gradient pyramid +/// +/// @param numLevels +/// Number of levels in the pyramids +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidSobelGradientCreatef32( const fcvPyramidLevel* imgPyr, + fcvPyramidLevel* dxPyr, + fcvPyramidLevel* dyPyr, + unsigned int numLevels ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Creates a gradient pyramid of integer8 from an image pyramid of uint8_t +/// +/// @param imgPyr +/// input Image Pyramid +/// +/// @param dxPyr +/// Horizontal Sobel gradient pyramid +/// +/// @param dyPyr +/// Verical Sobel gradient pyramid +/// +/// @param numLevels +/// Number of levels in the pyramids +/// +/// @ingroup image_processing +// ----------------------------------------------------------------------------- + +FASTCV_API int +fcvPyramidSobelGradientCreatei8( const fcvPyramidLevel* imgPyr, + fcvPyramidLevel* dxPyr, + fcvPyramidLevel* dyPyr, + unsigned int numLevels ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, +/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 +/// and the signature of fcvImageGradientSobelPlanars16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, +/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 +/// and the signature of fcvImageGradientSobelPlanars16_v2 and +/// fcvImageGradientSobelPlanars16_v3 as it appears now, will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. +/// \n\b NOTE: if 0, dxyStride is set as (srcWidth*sizeof(int16_t)). +/// \n\b WARNING: should be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + unsigned int dxyStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data without normalization. +/// This function computes central differences on 3x3 neighborhood and then convolves +/// the result with Sobel kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelPlanars16_v2() with a change in behavior: no normalization +/// at the end of the calculation. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars16, +/// \a fcvImageGradientSobelPlanars16_v2 and fcvImageGradientSobelPlanars16_v3 +/// will be removed, and the current signature for \a fcvImageGradientSobelPlanars16 +/// and fcvImageGradientSobelPlanars16_v3 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelPlanars16 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. The number of pixels in a row. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + unsigned int dxyStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, +/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 +/// and the signature of fcvImageGradientSobelInterleaveds16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param gradients +/// Buffer to store horizontal and vertical gradient. Must be +/// (width-2)*(height-2) *2 in size. +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict gradients ); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, +/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 +/// and the signature of fcvImageGradientSobelInterleaveds16 and +/// fcvImageGradientSobelInterleaveds16_v2 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gradients +/// Buffer to store horizontal and vertical gradient. Must be +/// gradStride*(height-2) *2 bytes in size. +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param gradStride +/// Stride (in bytes) of the interleaved gradients array. +/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(int16_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as 4*srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict gradients, + unsigned int gradStride ); + +// ----------------------------------------------------------------------------- +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// \n Compared to the original and v2 functions, this v3 functions does not normalize +/// \n the gradients (divide by 8). It just returns the actual dx, dy values. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelInterleaveds16_v2() with a change in behavior: no +/// normalization at the end of the calculation. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleaveds16, +/// \a fcvImageGradientSobelInterleaveds16_v2 and fcvImageGradientSobelInterleaveds16_v3 +/// will be removed, and the current signature for \a fcvImageGradientSobelInterleaveds16 +/// and fcvImageGradientSobelInterleaveds16_v3 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelInterleaveds16 when transitioning to 2.0.0. +/// \n\n +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. The number of pixels in a row. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param gradients +/// Buffer to store horizontal and vertical gradient. Must be +/// gradStride*(height-2) *2 bytes in size. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param gradStride +/// Stride (in bytes) is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the interleaved gradients array. If left at 0 gradStride is default to 4 * (srcWidth-2). +/// \n\b WARNING: should be multiple of 8. +/// +/// @ingroup image_processing +// ----------------------------------------------------------------------------- +FASTCV_API void +fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int16_t* __restrict gradients, + unsigned int gradStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelInterleavedf32_v2(). In the 2.0.0 release, +/// fcvImageGradientSobelInterleavedf32_v2 will be renamed to fcvImageGradientSobelInterleavedf32 +/// and the signature of fcvImageGradientSobelInterleavedf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param gradients +/// Buffer to store horizontal and vertical gradient. Must be +/// (width-2)*(height-2) *2 floats in size. +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict gradients); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelInterleavedf32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleavedf32, +/// \a fcvImageGradientSobelInterleavedf32_v2 will be removed, and the current signature +/// for \a fcvImageGradientSobelInterleavedf32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelInterleavedf32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gradients +/// Buffer to store horizontal and vertical gradient. Must be +/// gradStride*(height-2) *2 bytes in size. +/// Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param gradStride +/// Stride (in bytes) of the interleaved gradients array. +/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(float). +/// \n\b WARNING: should be multiple of 8, and at least as much as (srcWidth-2)*2*sizeof(float) if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* __restrict gradients, + unsigned int gradStride); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function +/// computes central differences on 3x3 neighborhood and then convolves the +/// result with Sobel kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, +/// fcvImageGradientSobelPlanars8_v2 will be renamed to fcvImageGradientSobelPlanars8 +/// and the signature of fcvImageGradientSobelPlanars8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int8_t* __restrict dx, + int8_t* __restrict dy); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function +/// computes central differences on 3x3 neighborhood and then convolves the +/// result with Sobel kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelPlanars8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars8, +/// \a fcvImageGradientSobelPlanars8_v2 will be removed, and the current signature +/// for \a fcvImageGradientSobelPlanars8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelPlanars8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + int8_t* __restrict dx, + int8_t* __restrict dy, + unsigned int dxyStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelPlanarf32_v2(). In the 2.0.0 release, +/// fcvImageGradientSobelPlanarf32_v2 will be renamed to fcvImageGradientSobelPlanarf32 +/// and the signature of fcvImageGradientSobelPlanarf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (width)*(height) in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* dx, + float* dy); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelPlanarf32() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32, +/// \a fcvImageGradientSobelPlanarf32_v2 will be removed, and the current signature +/// for \a fcvImageGradientSobelPlanarf32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelPlanarf32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. +/// \n\b NOTE: if 0, dxyStride is set as 4*srcWidth. +/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value),and at least as much as srcWidth*sizeof(float) if not 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* dx, + float* dy, + unsigned int dxyStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageGradientSobelPlanarf32f32_v2(). In the 2.0.0 release, +/// fcvImageGradientSobelPlanarf32f32_v2 will be renamed to fcvImageGradientSobelPlanarf32f32 +/// and the signature of fcvImageGradientSobelPlanarf32f32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight floats. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels (not bytes) between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (width)*(height) floats in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (width)*(height) floats in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageGradientSobelPlanarf32f32( const float * __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* dx, + float* dy); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data. This function computes +/// central differences on 3x3 neighborhood and then convolves the result with Sobel +/// kernel +/// \n +/// \n [ -1 0 +1 ] [ -1 -2 -1 ] +/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src +/// \n [ -1 0 +1 ] [ +1 +2 +1 ] +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageGradientSobelPlanarf32f32()() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32f32(), +/// \a fcvImageGradientSobelPlanarf32f32_v2 will be removed, and the current signature +/// for \a fcvImageGradientSobelPlanarf32f32 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageGradientSobelPlanarf32f32 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight floats. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride (in bytes) of image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. +/// \n\b NOTE: if 0, srcStride is set as srcWidth*4. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right +/// contains undefined values. Gradient output is scaled by 1/8. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. +/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes per gradient value). +/// \n\b WARNING: should be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. +/// \n\b NOTE: if 0, dxyStride is set as srcWidth*4. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, + unsigned int srcWidth, + unsigned int srcHeight, + unsigned int srcStride, + float* dx, + float* dy, + unsigned int dxyStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Block Optical Flow 16x16 - Tracks all 16x16 blocks in the Region of Interest +/// (ROI) from Source-1 to Source-2. Generates Motion Vectors for blocks where +/// motion is detected. +/// +/// @details +/// +/// @param[in] src1 +/// Pointer to source image where the original blocks are present. +/// \n Dimensions should be same as \a src2, and equal to \a srcWidth, +/// \a srcHeight, \a srcStride. +/// \n\b WARNING: should be 128-bit aligned. Buffer size is srcStride*srcHeight bytes. +/// +/// @param[in] src2 +/// Pointer to second source image where motion vectors for blocks in \a img1 +/// are to be located. +/// \n Dimensions should be same as \a src1, and equal to \a srcWidth, +/// \a srcHeight, \a srcStride. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param[in] srcWidth +/// Width of source images pointed by \a src1 and \a src2. +/// +/// @param[in] srcHeight +/// Height of source images pointed by \a src1 and \a src2. +/// +/// @param[in] srcStride +/// Stride of source images pointed by \a src1 and \a src2. +/// +/// @param[in] roiLeft +/// Left co-ordinate (x0) of Region-of-Interest (ROI). +/// +/// @param[in] roiTop +/// Top co-orgdinate (y0) of Region-of-Interest (ROI). +/// +/// @param[in] roiRight +/// Right co-ordinate (x1) of Region-of-Interest (ROI). +/// +/// @param[in] roiBottom +/// Bottom co-ordinate (y1) of Region-of-Interest (ROI). +/// +/// @param[in] shiftSize +/// Distance in number of pixels (both horizontally and vertically) between +/// consecutive blocks for which motion vector is searched. +/// \n\b NOTE: Larger the value, less number of blocks will be tracked, and +/// hence the function will run faster. +/// +/// @param[in] searchWidth +/// Numbers of pixels horizontally on left and right of the source block (src2) where a +/// match is searched for. For example, if searchWidth is 8 and searchHeight +/// is 8, then the search area for any given block will be 32x32 around +/// the location of that block. +/// +/// @param[in] searchHeight +/// Numbers of pixels vertically on top and bottom of the source block (src2) where a +/// match is searched for. For example, if searchWidth is 8 and searchHeight +/// is 8, then the search area for any given block will be 32x32 around +/// the location of that block. +/// +/// @param[in] searchStep +/// Distance in number of pixels between consecutive search targets within +/// the above search window. +/// \n\b NOTE: Larger the value, more coarse the search will be and thus +/// will make the fucntion run faster. Smaller the value, more dense the +/// search will be, making the funciton run slower. +/// +/// @param[in] usePrevious +/// Indicates if the function should use the existing motion vectors in +/// locX and locY as the starting point for motion vector search. +/// \n\b NOTE: This parameter is redundant at the moment. +/// +/// @param[out] numMv +/// Pointer to variable that will store the count of Motion Vectors +/// generated by the function. +/// \n\b WARNING: This pointer should be Non-NULL. +/// +/// @param[out] locX +/// Pointer to an array which will store the X co-ordinates of the +/// original Block for which a Motion Vector is generated. +/// \n\b NOTE: The array will contain \a numMv valid entries. +/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: +/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; +/// \n\b WARNING: This pointer should be Non-NULL, and the array size should +/// be >= number of 16x16 blocks in ROI. +/// +/// @param[out] locY +/// Pointer to an array which will store the Y co-ordinates of the +/// original Block for which a Motion Vector is generated. +/// \n\b NOTE: The array will contain \a numMv valid entries. +/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: +/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; +/// \n\b WARNING: This pointer should be Non-NULL, and the array size should +/// be >= number of 16x16 blocks in ROI. +/// +/// @param[out] mvX +/// Pointer to an array which will store the X co-ordinates of the block in \a src2 +/// corresponding block in \a src1. (\a mvX[i]-\a locX[i]) will give the motion +/// vector for the block in \a src1. +/// \n\b NOTE: The array will contain \a numMv valid entries. +/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: +/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; +/// \n\b WARNING: This pointer should be Non-NULL, and the array size should +/// be >= number of 16x16 blocks in ROI. +/// +/// @param[out] mvY +/// Pointer to an array which will store the Y co-ordinates of the block in \a src2 +/// corresponding block in \a src1. (\a mvY[i]-\a locY[i]) will give the motion +/// vector for the block in \a src1. +/// \n\b NOTE: The array will contain \a numMv valid entries. +/// \n\b NOTE: the maximum number of MVs is related to ROI size and shiftSize, as follows: +/// (roiRight-roiLeft)/shiftSize * (roiBottom-roiTop)/shiftSize; +/// \n\b WARNING: This pointer should be Non-NULL, and the array size should +/// be >= number of 16x16 blocks in ROI. +/// +/// @return +/// 0 - Success, Failure otherwise. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API int +fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t roiLeft, + uint32_t roiTop, + uint32_t roiRight, + uint32_t roiBottom, + uint32_t shiftSize, + uint32_t searchWidth, + uint32_t searchHeight, + uint32_t searchStep, + uint32_t usePrevious, + uint32_t * numMv, + uint32_t * locX, + uint32_t * locY, + uint32_t * mvX, + uint32_t * mvY); + +//------------------------------------------------------------------------------ +/// @brief +/// Searches a set of patches within the source image for the max NCCs. The search +/// regions are corresponding to the patches in the search list. +/// +/// @param patches +/// Pointer to a set of 8-bit patches, each patch takes patchWidth *patchHeight pixel +/// values which are linearly laid out in memory. +/// \n\b WARNING: patchWidth * patchHeight must be <= 256 +/// +/// @param patchWidth +/// Width in pixels of the patch. +/// +/// @param patchHeight +/// Height in pixels of the patch. +/// +/// @param src +/// Pointer to 8-bit image for search. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width in pixels of the image. +/// +/// @param srcHeight +/// Height in pixels of the image. +/// +/// @param srcStride +/// The stride of the imge. Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param searchCenterX +/// The list of Center X coordinate of each search window +/// +/// @param searchCenterY +/// The list of Center Y coordinate of each search window +/// +/// @param searchWidth +/// Width of search range in pixels +/// \n\b WARNING: must be odd number. +/// +/// @param searchHeight +/// Height of search range in pixels +/// \n\b WARNING: must be odd number. +/// +/// @param filterLowVariance +/// Minimum variance. Used to as threshold to compare against variance of +/// the block of src or patch. +/// +/// @param bestX +/// The list of Center X location on the image of the best NCC matches. +/// The center X has (patchWidth/2) pixels to the left and +/// (patchWidth - (patchWidth/2) - 1) to the right. +/// +/// @param bestY +/// The list of Center Y location on the image of the best NCC matches. +/// The center Y has (patchWidth/2) pixels above and +/// (patchWidth - (patchWidth/2) - 1) below. +/// +/// @param bestNCC +/// NCC value of the best match blocks. +/// It's quantized to integer value in Q7 (between -128 and 128). +/// +/// @param findSubPixel (0 or 1) +/// Use parabolic interpolation of NCC values to find sub-pixel estimates. +/// +/// @param subX +/// Sub-pixel estimate for optimal NCC relative to bestX. +/// \n e.g., float x = (float)bestX + subX; +/// +/// @param subY +/// Sub-pixel estimate for optimal NCC relative to bestY. +/// +/// @param numSearches +/// number of patch searches in the image. +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup object_detection +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvNCCPatchesOnRectu8 ( const uint8_t* __restrict patches, + uint32_t patchWidth, + uint32_t patchHeight, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const uint32_t * __restrict searchCenterX, + const uint32_t * __restrict searchCenterY, + uint32_t searchWidth, + uint32_t searchHeight, + int32_t filterLowVariance, + uint32_t* __restrict bestX, + uint32_t* __restrict bestY, + uint32_t* __restrict bestNCC, + int32_t findSubPixel, + float32_t* __restrict subX, + float32_t* __restrict subY, + uint32_t numSearches ); + +//------------------------------------------------------------------------------ +/// @brief +/// Performs per-element bitwise-OR operation on two 8-bit single channel images. +/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. +/// +/// @param src1 +/// Pointer to the 8-bit source image 1. +/// +/// @param src2 +/// Pointer to the 8-bit source image 2. +/// +/// @param srcWidth +/// Width of source images pointed by src1 and src2. +/// +/// @param srcHeight +/// Height of source images pointed by src1 and src2. +/// +/// @param srcStride +/// Stride of source images (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param dst +/// Pointer to the 8-bit destination image. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param mask +/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. +/// The mask is optional. If there is no mask, the value is NULL. +/// +/// @param maskStride +/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If there is no mask, the value is 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvBitwiseOru8(const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * __restrict dst, + uint32_t dstStride, + uint8_t * __restrict mask, + uint32_t maskStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Performs per-element bitwise-OR operation on two 32-bit single channel images. +/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. +/// +/// @param src1 +/// Pointer to the 32-bit source image 1. +/// +/// @param src2 +/// Pointer to the 32-bit source image 2. +/// +/// @param srcWidth +/// Width of source images pointed by src1 and src2. +/// +/// @param srcHeight +/// Height of source images pointed by src1 and src2. +/// +/// @param srcStride +/// Stride of source images (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param dst +/// Pointer to the 8-bit destination image. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param mask +/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. +/// The mask is optional. If there is no mask, the value is NULL. +/// +/// @param maskStride +/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If there is no mask, the value is 0. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvBitwiseOrs32(const int32_t* __restrict src1, + const int32_t* __restrict src2, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t * __restrict dst, + uint32_t dstStride, + uint8_t * __restrict mask, + uint32_t maskStride); + + +//------------------------------------------------------------------------------ +/// @brief +/// Converts an image from RGB space to grayscale +/// +/// @details +/// +/// @param src +/// Source 8-bit image, BGR888 format (R is lowest byte for the pixel) +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source image width. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Source image height. +/// +/// @param srcStride +/// Stride of source image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, srcStride=srcWidth as default +/// +/// @param dst +/// Destination 8-bit gray-scale image. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, dstStride=srcStride as default +/// +/// +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ +FASTCV_API void +fcvColorRGB888ToGrayu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride); + + +//------------------------------------------------------------------------------ +/// @brief +/// Integral of the image tilted by 45 degrees +/// +/// @details +/// Calculates the tilted integral image of an input image +/// and adds an zero-filled border on top. Left border not zero. +/// dst[i,j]=sum (src[m,n]), where n according to +/// descDBTargetId. +/// +/// @param dbLUT +/// A pointer to uint32_t [numDBLUT][2], +/// which stores the starting index of descDB and +/// the number of descriptors +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param numDBLUT +/// The size of dbLUT +/// +/// @param descDB +/// A pointer to int8_t [numDescDB][36], +/// which stores descriptors +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param descDBInvLenQ38 +/// A pointer to uint32_t [numDescDB], +/// which stores the inverse length of descDB. +/// The value is in Q38 format. +/// +/// @param descDBTargetId +/// A pointer to uint16_t [numDescDB], +/// which stores the target id. +/// +/// @param descDBOldIdx +/// A pointer to uint32_t [numDescDB], +/// which stores the old index of the desc before sorting +/// +/// @param numDescDB +/// Number of descriptor in the database. +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvLinearSearchPrepare8x36s8( uint32_t * __restrict dbLUT, + uint32_t numDBLUT, + int8_t * __restrict descDB, + uint32_t * __restrict descDBInvLenQ38, + uint16_t * __restrict descDBTargetId, + uint32_t * __restrict descDBOldIdx, + uint32_t numDescDB ); + +//--------------------------------------------------------------------------- +/// @brief +/// Perform linear search of descriptor in a database +/// +/// @param dbLUT +/// A pointer to uint32_t [numDBLUT][2], +/// which stores the starting index of descDB and +/// the number of descriptors +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param numDBLUT +/// The size of dbLUT +/// +/// @param descDB +/// A pointer to int8_t [numDescDB][36], +/// which stores descriptors +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param descDBInvLenQ38 +/// A pointer to uint32_t [numDescDB], +/// which stores the inverse length of descDB. +/// The value is in Q38 format. +/// +/// @param descDBTargetId +/// A pointer to uint16_t [numDescDB], +/// which stores the target id. +/// +/// @param numDescDB +/// Number of descriptor in the database. +/// +/// @param srcDesc +/// A pointer to int8_t [numSrcDesc][36], +/// which stores descriptors. +/// \n\b WARNING: must be 64-bit aligned. +/// +/// @param srcDescInvLenQ38 +/// A pointer to uint32_t [numSrcDec], +/// which stores the inverse length of srcDesc. +/// The value is in Q38 format. +/// +/// @param srcDescIdx +/// A pointer to the dbLUT data +/// +/// @param numSrcDesc +/// Number of source descriptor +/// +/// @param targetsToIgnore +/// A list of target IDs to be ignored +/// +/// @param numTargetsToIgnore +/// Number of targets to be ignored +/// +/// @param maxDistanceQ31 +/// Maximum distance for correspondences. +/// In Q31 format. +/// +/// @param correspondenceDBIdx +/// A pointer to uint32_t [maxNumCorrespondences], +/// which will be used by this function to output indices of featuresDB +/// as a part of correspondences. +/// +/// @param correspondenceSrcDescIdx +/// A pointer to uint32_t [maxNumCorrespondences], +/// which will be used by this function to output indices of descriptors +/// as a part of correspondences. +/// +/// @param correspondenceDistanceQ31 +/// A pointer to uint32_t [maxNumCorrespondences], +/// which will be used by this function to output the distances +/// as a part of correspondences. +/// In Q31 format. +/// +/// @param maxNumCorrespondences +/// Maximum number of correspondences allowed +/// +/// @param numCorrespondences +/// Number of correspondences returned by this function +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvLinearSearch8x36s8( + const uint32_t * __restrict dbLUT, + uint32_t numDBLUT, + const int8_t * __restrict descDB, + const uint32_t * __restrict descDBInvLenQ38, + const uint16_t * __restrict descDBTargetId, + uint32_t numDescDB, + const int8_t * __restrict srcDesc, + const uint32_t * __restrict srcDescInvLenQ38, + const uint32_t * __restrict srcDescIdx, + uint32_t numSrcDesc, + const uint16_t * __restrict targetsToIgnore, + uint32_t numTargetsToIgnore, + uint32_t maxDistanceQ31, + uint32_t * __restrict correspondenceDBIdx, + uint32_t * __restrict correspondenceSrcDescIdx, + uint32_t * __restrict correspondenceDistanceQ31, + uint32_t maxNumCorrespondences, + uint32_t * __restrict numCorrespondences ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds only extreme outer contours in a binary image. There is no nesting +/// relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 +/// for all the contours. +/// +/// @param src +/// Grayscale image with one byte per pixel. Non-zero pixels are treated as +/// 1's. Zero pixels remain 0's, so the image is treated as binary. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param maxNumContours +/// Maximum number of contours can be found +/// +/// @param numContours +/// Number of actually found contours +/// +/// @param numContourPoints +/// Number of points in each found contour +/// +/// @param contourStartPoints +/// Pointers to the start point of each found contour +/// +/// @param pointBuffer +/// Pointer to point buffer for contour points' coordinates. It should +/// be allocated before calling this function. +/// +/// @param pointBufferSize +/// Size of point buffer in terms of uint32_t +/// +/// @param hierarchy +/// Information about the image topology. It has numContours elements. +/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], +/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the +/// next and previous contours at the same hierarchical level, the first +/// child contour and the parent contour, respectively. If for a contour i +/// there are no next, previous, parent, or nested contours, the corresponding +/// elements of hierarchy[i] will be negative. +/// +/// @param contourHandle +/// Pointer to assistant and intermediate data. It should be allocated by +/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindContoursExternalu8( uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxNumContours, + uint32_t* __restrict numContours, + uint32_t* __restrict numContourPoints, + uint32_t** __restrict contourStartPoints, + uint32_t* __restrict pointBuffer, + uint32_t pointBufferSize, + int32_t hierarchy[][4], + void* contourHandle ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds contours in a binary image without any hierarchical relationships. +/// +/// @param src +/// Grayscale image with one byte per pixel. Non-zero pixels are treated as +/// 1's. Zero pixels remain 0's, so the image is treated as binary. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param maxNumContours +/// Maximum number of contours can be found +/// +/// @param numContours +/// Number of actually found contours +/// +/// @param numContourPoints +/// Number of points in each found contour +/// +/// @param contourStartPoints +/// Pointers to the start point of each found contour +/// +/// @param pointBuffer +/// Pointer to point buffer for contour points' coordinates. It should +/// be allocated before calling this function. +/// +/// @param pointBufferSize +/// Size of point buffer in terms of uint32_t +/// +/// @param contourHandle +/// Pointer to assistant and intermediate data. It should be allocated by +/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindContoursListu8( uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxNumContours, + uint32_t* __restrict numContours, + uint32_t* __restrict numContourPoints, + uint32_t** __restrict contourStartPoints, + uint32_t* __restrict pointBuffer, + uint32_t pointBufferSize, + void* contourHandle ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds contours in a binary image and organizes them into a two-level +/// hierarchy. At the top level, there are external boundaries of the +/// components. At the second level, there are boundaries of the holes. +/// If there is another contour inside a hole of a connected component, +/// it is still put at the top level. +/// +/// @param src +/// Grayscale image with one byte per pixel. Non-zero pixels are treated as +/// 1's. Zero pixels remain 0's, so the image is treated as binary. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param maxNumContours +/// Maximum number of contours can be found (<= 126) +/// +/// @param numContours +/// Number of actually found contours +/// +/// @param holeFlag +/// Hole flag for each found contour to indicate whether it is a hole or not +/// +/// @param numContourPoints +/// Number of points in each found contour +/// +/// @param contourStartPoints +/// Pointers to the start point of each found contour +/// +/// @param pointBuffer +/// Pointer to point buffer for contour points' coordinates. It should +/// be allocated before calling this function. +/// +/// @param pointBufferSize +/// Size of point buffer in terms of uint32_t +/// +/// @param hierarchy +/// Information about the image topology. It has numContours elements. +/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], +/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the +/// next and previous contours at the same hierarchical level, the first +/// child contour and the parent contour, respectively. If for a contour i +/// there are no next, previous, parent, or nested contours, the corresponding +/// elements of hierarchy[i] will be negative. +/// +/// @param contourHandle +/// Pointer to assistant and intermediate data. It should be allocated by +/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindContoursCcompu8( uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxNumContours, + uint32_t* __restrict numContours, + uint32_t* __restrict holeFlag, + uint32_t* __restrict numContourPoints, + uint32_t** __restrict contourStartPoints, + uint32_t* __restrict pointBuffer, + uint32_t pointBufferSize, + int32_t hierarchy[][4], + void* contourHandle ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds contours in a binary image and reconstructs a full hierarchy of +/// nested contours +/// +/// @param src +/// Grayscale image with one byte per pixel. Non-zero pixels are treated as +/// 1's. Zero pixels remain 0's, so the image is treated as binary. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @param numContours +/// Number of actually found contours +/// +/// @param maxNumContours +/// Maximum number of contours can be found (<= 126) +/// +/// @param holeFlag +/// Hole flag for each found contour to indicate whether it is a hole or not +/// +/// @param numContourPoints +/// Number of points in each found contour +/// +/// @param contourStartPoints +/// Pointers to the start point of each found contour +/// +/// @param pointBuffer +/// Pointer to point buffer for contour points' coordinates. It should +/// be allocated before calling this function. +/// +/// @param pointBufferSize +/// Size of point buffer in terms of uint32_t +/// +/// @param hierarchy +/// Information about the image topology. It has numContours elements. +/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], +/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the +/// next and previous contours at the same hierarchical level, the first +/// child contour and the parent contour, respectively. If for a contour i +/// there are no next, previous, parent, or nested contours, the corresponding +/// elements of hierarchy[i] will be negative. +/// +/// @param contourHandle +/// Pointer to assistant and intermediate data. It should be allocated by +/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindContoursTreeu8( uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t maxNumContours, + uint32_t* __restrict numContours, + uint32_t* __restrict holeFlag, + uint32_t* __restrict numContourPoints, + uint32_t** __restrict contourStartPoints, + uint32_t* __restrict pointBuffer, + uint32_t pointBufferSize, + int32_t hierarchy[][4], + void* contourHandle ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Allocates assistant and intermediate data for contour +/// +/// @param srcStride +/// Stride of image (i.e., how many pixels between column 0 of row 1 and +/// column 0 of row 2). +/// +/// @return +/// Pointer to allocated data +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void* +fcvFindContoursAllocate( uint32_t srcStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Deallocates assistant and intermediate data for contour +/// +/// @param contourHandle +/// Pointer to assistant and intermediate data +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindContoursDelete( void* contourHandle ); + +//------------------------------------------------------------------------------ +/// @brief +/// Solve linear equation system +/// Ax = b +/// +/// @details +/// +/// +/// @param A +/// The matrix contains coefficients of the linear equation system +/// +/// @param numRows +/// The number of rows for the matrix A +/// +/// @param numCols +/// The number of columns for the matrix A +/// +/// @param b +/// The right side value +/// +/// @param x +/// The solution vector +/// +/// +/// @return +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSolvef32(const float32_t * __restrict A, + int32_t numCols, + int32_t numRows, + const float32_t * __restrict b, + float32_t * __restrict x); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculates a perspective transform from four pairs of the corresponding +/// points. +/// NOTE: in order to guarantee a valid output transform, any three points +/// in src1 or src2 cannot be collinear. +/// +/// @param src1 +/// Coordinates of quadrangle vertices in the source image +/// +/// @param src2 +/// Coordinates of the corresponding quadrangle vertices in the destination +/// image +/// +/// @param transformCoefficient +/// 3x3 matrix of a perspective transform +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ +FASTCV_API void +fcvGetPerspectiveTransformf32( const float32_t src1[8], + const float32_t src2[8], + float32_t transformCoefficient[9] ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a uint8_t single channel array to a given value. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value +/// the input uint8_t value +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed. +/// +/// @param maskStride +/// Stride for the mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSetElementsu8( uint8_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + uint8_t value, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of an int32_t single channel array to a given value. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value +/// the input int32_t value +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementss32( int32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + int32_t value, + const uint8_t * __restrict mask , + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a float32_t single channel array to a given value. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value +/// the input float32_t value +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsf32( float32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + float32_t value, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a uint8_t 4-channel array to a given 4-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First uint8_t value of the Scalar +/// +/// @param value2 +/// Second uint8_t value of the Scalar +/// +/// @param value3 +/// Third uint8_t value of the Scalar +/// +/// @param value4 +/// Fourth uint8_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc4u8( uint8_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + uint8_t value1, + uint8_t value2, + uint8_t value3, + uint8_t value4, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of an int32_t 4-channel array to a given 4-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First int32_t value of the Scalar +/// +/// @param value2 +/// Second int32_t value of the Scalar +/// +/// @param value3 +/// Third int32_t value of the Scalar +/// +/// @param value4 +/// Fourth int32_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed. +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc4s32( int32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + int32_t value1, + int32_t value2, + int32_t value3, + int32_t value4, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a float32_t 4-channel array to a given 4-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First float32_t value of the Scalar +/// +/// @param value2 +/// Second float32_t value of the Scalar +/// +/// @param value3 +/// Third float32_t value of the Scalar +/// +/// @param value4 +/// Fourth float32_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc4f32( float32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + float32_t value1, + float32_t value2, + float32_t value3, + float32_t value4, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a uint8_t 3-channel array to a given 3-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First uint8_t value of the Scalar +/// +/// @param value2 +/// Second uint8_t value of the Scalar +/// +/// @param value3 +/// Third uint8_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc3u8( uint8_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + uint8_t value1, + uint8_t value2, + uint8_t value3, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of an int32_t 3-channel array to a given 3-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First int32_t value of the Scalar +/// +/// @param value2 +/// Second int32_t value of the Scalar +/// +/// @param value3 +/// Third int32_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed. +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc3s32( int32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + int32_t value1, + int32_t value2, + int32_t value3, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + +//------------------------------------------------------------------------------ +/// @brief +/// Sets every element of a float32_t 3-channel array to a given 3-element scalar. +/// +/// @details +/// A non-zero element of the mask array indicates the corresponding element +/// of the destination array to be changed. The mask itself equals to zero means that +/// all elements of the dst array need to be changed. The mask is assumed to +/// have the same width and height( in terms of pixels) as the destination array. +/// +/// @param dst +/// The destination matrix +/// +/// @param dstWidth +/// Destination matrix width +/// +/// @param dstHeight +/// Destination matrix height +/// +/// @param dstStride +/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param value1 +/// First float32_t value of the Scalar +/// +/// @param value2 +/// Second float32_t value of the Scalar +/// +/// @param value3 +/// Third float32_t value of the Scalar +/// +/// @param mask +/// Operation mask, 8-bit single channel array; specifies elements of the src +/// array to be changed +/// +/// @param maskStride +/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @return +/// No return value +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API void +fcvSetElementsc3f32( float32_t * __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + float32_t value1, + float32_t value2, + float32_t value3, + const uint8_t * __restrict mask, + uint32_t maskStride + ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Defines an enumeration to list threshold types used in fcvAdaptiveThreshold +//------------------------------------------------------------------------------ + +typedef enum { + FCV_THRESH_BINARY = 0, // value = value > threshold ? max_value : 0 + FCV_THRESH_BINARY_INV // value = value > threshold ? 0 : max_value +} fcvThreshType; + + +//--------------------------------------------------------------------------- +/// @brief +/// Binarizes a grayscale image based on an adaptive threshold value calculated from 3x3 Gaussian kernel. +/// +/// @details +/// For each pixel, the threshold is computed adaptively based on cross-correlation with a +/// 3x3 Gaussian kernel minus value (parameter). The standard deviation is used for Gaussian kernel. +/// For FCV_THRESH_BINARY threshold type, the pixel is set as maxValue if it's value is greater than the threshold; +/// else, it is set as zero. For FCV_THRESH_BINARY_INV threshold type, the pixel is set as zero if it's value is greater than the threshold; +/// else, it is set as maxValue. +/// +/// @param src +/// Pointer to the 8-bit input image. +/// +/// @param srcWidth +/// Width of source images pointed by src. +/// +/// @param srcHeight +/// Height of source images pointed by src. +/// +/// @param srcStride +/// Stride of source image (i.e., number of bytes between column 0 +/// of row 0 and column 0 of row 1). +/// +/// @param maxValue +/// The maximum integer value to be used. 0>1+8) *sizeof(uint32_t) +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param integralCrStride +/// The stride of integralCr. (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). If left at 0 integralCrStride is default to (srcWidth>>1+8) *sizeof(uint32_t) +/// \n\b NOTE: should be a multiple of 8. +/// +/// @return +/// No return value. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvIntegrateImageYCbCr420PseudoPlanaru8( + const uint8_t* __restrict srcY, + const uint8_t* __restrict srcC, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcYStride, + uint32_t srcCStride, + uint32_t* __restrict integralY, + uint32_t* __restrict integralCb, + uint32_t* __restrict integralCr, + uint32_t integralYStride, + uint32_t integralCbStride, + uint32_t integralCrStride); + + +//--------------------------------------------------------------------------- +/// @brief +/// This function finds the foreground. +/// +/// @details +/// This function tries to find a forgound in the current image (represented by: fgIntegralY, +/// fgIntegralCb, fgIntegralCr) based on the current background model (represented by: bgIntegralY, +/// bgIntegralCb, bgIntegralCr). For example, the tuple (bgIntegralY, bgIntegralCb, bgIntegralCr) may be +/// from a picture shooting a wall. Then the tuple (fgIntegralY, fgIntegralCb, fgIntegralCr) may be +/// the wall with a paint on it. Note that all the first six parameters are indicating integral images +/// that's computed from a YUV420 image, which maybe computed from the function: +/// fcvIntegrateImageYCbCr420PseudoPlanaru8. Generally the size of fgIntegralY and bgIntegralY are +/// (srcWidth+1)*(srcHeight+1). And the size of fgIntegralU, fgIntegralV, bgIntegralU and bgIntegralV +/// are (srcWidth/2+1)*(srcHeight/2+1). The value of the outputWidth and outputHeight are usually indicating +/// the desired block size. For example, if the user wants a 20x15 blocks on a 800x480 image. Then +/// outputWidth=800/20 and outputHeight=480/15. After return, if the value in the outputMask image is +/// 255, then a moving block is indicated, otherwise a non-moving block is indicated. +/// +/// @param bgIntegralY +/// The input image/patch that's indicating the Y channel of the integral image of the background image. +/// Size of buffer is srcYStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param bgIntegralCb +/// The input image/patch that's indicating the Cb channel of the integral image of the background image. +/// Size of buffer is srcCbStride*srcHeight/2 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param bgIntegralCr +/// The input image/patch that's indicating the Cr channel of the integral image of the background image. +/// Size of buffer is srcCrStride*srcHeight/2 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param fgIntegralY +/// The input image/patch that's indicating the Y channel of the integral image of the image +/// on which we want to find the foreground. +/// Size of buffer is srcYStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param fgIntegralCb +/// The input image/patch that's indicating the Cb channel of the integral image of the image +/// on which we want to find the foreground. +/// Size of buffer is srcCbStride*srcHeight/2 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param fgIntegralCr +/// The input image/patch that's indicating the Cr channel of the integral image of the image +/// on which we want to find the foreground. +/// Size of buffer is srcCrStride*srcHeight/2 bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row. See the details. +/// \n\b NOTE: must be a multiple of 16. +/// +/// @param srcHeight +/// The height of the source image. See the details. +/// \n\b NOTE: must be a multiple of 2. +/// +/// @param srcYStride +/// The stride of the input source image's Y channel. (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth+8)*sizeof(uint32_t). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcCbStride +/// The stride of the input source image's Cb channel. (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcCrStride +/// The stride of the input source image's Cr channel. (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param outputMask +/// The output mask image. Each pixel represent the motion condition for a block in the original image. +/// Size of buffer is outputMaskStride*outputHeight bytes +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param outputWidth +/// The width of the output mask image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param outputHeight +/// The height of the output mask image. +/// +/// @param outputMaskStride +/// The stride of the output mask image. (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). If left at 0 outputMaskStride is default to outputWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param threshold +/// The threshold that's used to decide if a block is moving or not. (recommend the value of 20). +/// +/// @return +/// No return value. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvFindForegroundIntegrateImageYCbCr420u32( + const uint32_t * __restrict bgIntegralY, + const uint32_t * __restrict bgIntegralCb, + const uint32_t * __restrict bgIntegralCr, + const uint32_t * __restrict fgIntegralY, + const uint32_t * __restrict fgIntegralCb, + const uint32_t * __restrict fgIntegralCr, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcYStride, + uint32_t srcCbStride, + uint32_t srcCrStride, + uint8_t * __restrict outputMask, + uint32_t outputWidth, + uint32_t outputHeight, + uint32_t outputMaskStride, + float32_t threshold ); + + +//--------------------------------------------------------------------------- +/// @brief +/// This function calculates the average value of an image. +/// +/// @details +/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. +/// +/// @param src +/// The input image/patch. Must be 32 bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param avgValue +/// The output average value. +/// +/// @return +/// No return value. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvAverages32( + const int32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t* __restrict avgValue); + +//--------------------------------------------------------------------------- +/// @brief +/// This function calculates the average value of an image. +/// +/// @details +/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. +/// +/// @param src +/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param avgValue +/// The output average value. +/// +/// @return +/// No return value. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvAverageu8( + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t* __restrict avgValue); + + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the meanshift procedure and obtains the final converged position +/// +/// @details +/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. +/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the MeanShift which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @return +/// The actually number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvMeanShiftu8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria); + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the meanshift procedure and obtains the final converged position +/// +/// @details +/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. +/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the MeanShift which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @return +/// Number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvMeanShifts32(const int32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria); + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the meanshift procedure and obtains the final converged position +/// +/// @details +/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. +/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the MeanShift which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @return +/// Number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvMeanShiftf32(const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria); + + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the ConAdaTrack procedure and find the object center, size and orientation +/// +/// @details +/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. +/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the object search which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @param circuBox +/// The circumscribed box around the object +/// +/// @return +/// Number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvConAdaTracku8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria, + fcvBox2D* circuBox); + + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the ConAdaTrack procedure and find the object center, size and orientation +/// +/// @details +/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. +/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the object search which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @param circuBox +/// The circumscribed box around the object +/// +/// @return +/// Number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvConAdaTracks32(const int32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria, + fcvBox2D* circuBox); + + +//------------------------------------------------------------------------------ +/// @brief +/// Applies the ConAdaTrack procedure and find the object center, size and orientation +/// +/// @details +/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. +/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. +/// +/// @param src +/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. +/// Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// The width of the input source image. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// The height of the input source image. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param window +/// Pointer to the initial search window position which also returns the final converged window position. +/// +/// @param criteria +/// The criteria used to finish the object search which consists of two termination criteria: +/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations +/// +/// @param circuBox +/// The circumscribed box around the object +/// +/// @return +/// Number of iterations +/// +/// @ingroup Motion_and_Object_Tracking +//------------------------------------------------------------------------------ +FASTCV_API uint32_t +fcvConAdaTrackf32(const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + fcvRectangleInt* window, + fcvTermCriteria criteria, + fcvBox2D* circuBox); + +//------------------------------------------------------------------------------ +/// @brief +/// Compute a singular value decomposition of a matrix of a float type +/// A = U*diag[w]*Vt; +/// It is used for solving problems like least-squares, under-determined linear systems, matrix +/// inversion and so forth. The algorithm used here does not compute the full U and V matrices +/// however it computes a condensed version of U and V described below which is sufficient to solve +/// most problems which use SVD. +/// +/// @details +/// +/// +/// @param A +/// The input matrix of dimensions m x n +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param m +/// The number of rows of matrix A +/// +/// @param n +/// The number of columns of matrix A +/// +/// @param w +/// The pointer to the buffer that holds n singular values. When m>n it +/// contains n singular values while when m 0 and less than or equal to 8. +/// +/// @param dst +/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. +/// The dimensions of the image are dstWidth = srcWidth - 2*radius, +/// and dstHeight = srcHeight - 2*radius. + +/// +/// @param dstStride +/// Stride of the output image in bytes. +/// \n\b NOTE: dstWidth = srcWidth - 2*radius, dstHeight = srcHeight - 2*radius. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvGLBPu8(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t radius, + uint32_t neighbors, + uint8_t *__restrict dst, + uint32_t dstStride); + + +//--------------------------------------------------------------------------- +/// @brief +/// Refine corner location +/// +/// @details +/// Refine the detected corners location into sub-Pixels which is more precise than integer pixels +/// +/// @param src +/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param blockWidth +/// Width of the location search window. +/// +/// @param blockHeight +/// Height of the location search window. +/// +/// @param maxIterations +/// Maximum number of iteration to refine +/// +/// @param stopCriteria +/// Improvement threshold, iteration stop if the corner position moves less by this value +/// +/// @param xyInitial +/// Pointer to the initial input array containing the interleaved x,y position of the corner +/// +/// @param nCorners +/// Number of the corners +/// +/// @param xyOut +/// Pointer to the output array containing the refined interleaved x,y position of the corner +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvCornerRefineSubPixu8( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t blockWidth, + uint32_t blockHeight, + uint32_t maxIterations, + float32_t stopCriteria, + const uint32_t*__restrict xyInitial, + uint32_t nCorners, + float32_t * __restrict xyOut); + +//--------------------------------------------------------------------------- +/// @brief +/// Extract strong corners from image to track +/// +/// @details +/// Extract strong corners from image to track based on the according paper "Good Feature to Track" by J.Shi and C.Tomasi +/// +/// @param src +/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param distanceMin +/// Minimum Euclidean distance between the found corners +/// +/// @param border +/// Number for pixels to ignore from top,bottom +/// +/// @param barrier +/// Quality threshold +/// +/// @param xy +/// Pointer to the output array containing the interleaved x,y position of the detected features +/// +/// @maxnumcorners +/// Maximum number of features to detect +/// +/// @numcorners +/// Pointer to integer of actual detected features number +/// +/// @ingroup feature_detection +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvGoodFeatureToTracku8( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t distanceMin, + uint32_t border, + float32_t barrier, + uint32_t * __restrict xy, + uint32_t maxnumcorners, + uint32_t * __restrict numcorners); + + +//------------------------------------------------------------------------------ +/// @brief +/// Find multiple maxima along the normal direction of the line +/// +/// @param src +/// 8-bit input image +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride +/// +/// @param pos +/// 2D position to start searching maximas in the input image +/// +/// @param normal +/// Normalized line normal at pos +/// +/// @param maxDistance +/// Search distance along the normal direction; [-normal*maxDistance, normal*maxDistance] +/// +/// @param maxNumMaxima +/// Maximum maxima to find, e.g., 5 +/// +/// @param minGradient +/// Minimum 1D gradient of the pixels on the search line (normal direction) +/// +/// @param maxAngleDiff +/// Cosine value threshold to filter the pixels that have large angle difference +/// +/// @param maxima +/// List of found maxima 1D positions; Actuall 2D position of maxima = (normal * 1D position) + pos +/// +/// @param numMaxima +/// Number of found maxima +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFindMultipleMaximau8(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const float32_t* __restrict pos, + const float32_t* __restrict normal, + uint32_t maxDistance, + uint32_t maxNumMaxima, + int32_t minGradient, + float32_t maxAngleDiff, + float32_t* __restrict maxima, + uint32_t* __restrict numMaxima); + +//------------------------------------------------------------------------------ +/// @brief +/// Extract the straight line segments from the image +/// +/// @param srcPyr +/// Pointer to an array of fcvPyramidLevel_v2. Only 2 levels at max will be used +/// to extract the straight line segments. +/// +/// @param pyrLevel +/// Image pyramid level, if it is set to 1, then do not use multi-scale approach. +/// pyrLevel should be greater than or equal to 1. +/// +/// @param doBlurImage +/// Do image-blurring inside the function (if the image is not blurred) +/// +/// @param maxLineAngle +/// Cosine threshold to stop following (extending) pixels, e.g., cos(22.5 deg) +/// maxLineAngle should be between [0.5 - 1.0] +/// +/// @param minLineLength +/// Minimum line segment length in pixels +/// +/// @param minMagnitude +/// Minimum pixel gradient magnitude, e.g., 10 +/// +/// @param maxLineNum +/// Maximum line segments from the image +/// +/// @param indexBuffer +/// Optionally store the index(:= y * image_width + x) of the pixels consisting of the line segments +/// into pointsList in fcvLineSegment structure. e.g., One can provide the buffer[maxLineNum*(image width + height)] +/// Pass NULL if it is not necessary. +/// +/// @param lineSegments +/// List of the detected line segments +/// +/// @param numLineSegments +/// Number of found line segments +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup feature_detection +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvImageDetectLineSegmentsu8(const fcvPyramidLevel_v2* __restrict srcPyr, + uint32_t pyrLevel, + uint32_t doBlurImage, + float32_t maxLineAngle, + uint32_t minLineLength, + uint32_t minMagnitude, + uint32_t maxLineNum, + uint32_t* __restrict indexBuffer, + fcvLineSegment* __restrict lineSegments, + uint32_t* __restrict numLineSegments); + +//--------------------------------------------------------------------------- +/// @brief +/// Sum of squared differences of one L-byte vector against N others. +/// +/// @details +/// SSD of one vector (a) against N other L-byte vectors +/// ( b[0], b[1], ..., b[n-1] ) +/// using their given inverse lengths for normalization. +/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenA +/// Inverse of vector A = 1/|A| +/// +/// @param dim +/// Number of element of vector A +/// +/// @param bList +/// Vectors b[0]...b[n-1]. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param invLenB +/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param numB +/// Number of B vectors. +/// +/// @param distances +/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } +/// \n\b WARNING: should be 128-bit aligned. +/// +/// +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfSquaredDiffsu8( const uint8_t* __restrict a, + float32_t invLenA, + uint32_t dim, + const uint8_t* const * __restrict bList, + const float32_t* __restrict invLenB, + uint32_t numB, + float32_t* __restrict distances ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Sum of squared differences of one floating vector of L-elements against N others. +/// +/// @details +/// SSD of one vector (a) against N other L-elements vectors +/// ( b[0], b[1], ..., b[n-1] ) +/// using their given inverse lengths for normalization. +/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenA +/// Inverse of vector A = 1/|A| +/// +/// @param dim +/// Number of element of vector A +/// +/// @param bList +/// Vectors b[0]...b[n-1]. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param invLenB +/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param numB +/// Number of B vectors. +/// +/// @param distances +/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) } +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfSquaredDiffsf32( const float32_t* __restrict a, + float32_t invLenA, + uint32_t dim, + const float32_t* const * __restrict bList, + const float32_t* __restrict invLenB, + uint32_t numB, + float32_t* __restrict distances ); + +//--------------------------------------------------------------------------- +/// @brief +/// General function for computing cluster centers and cluster bindings +/// for a set of points of dimension dim. +/// +/// @param points +/// Array of all points. Array size must be greater than +/// numPoints * pointStride. +/// +/// @param numPoints +/// Number of points in points array. +/// +/// @param dim +/// dimension, e.g. 36 +/// +/// @param pointStride +/// Byte distance between adjacent points in array +/// +/// @param numPointsUsed +/// Total number of points used for clustering, {0,1,...(numPointsUsed-1)} +/// +/// @param numClusters +/// Number of clusters +/// +/// @param clusterCenters +/// current cluster centers; +/// elements are distant by clusterCenterStride +/// +/// @param clusterCenterStride +/// byte distance between adjacent cluster centers in array +/// +/// @param newClusterCenters +/// array for new cluster centers; should be numClusterCenters long +/// +/// @param newClusterMemberCounts +/// Element counts for each cluster; should be numClusterCenters long +/// +/// @param clusterBindings +/// Output indices of the clusters to which each vector belongs to, array must +/// be numPointsUsed long. +/// +/// @param sumOfClusterDistances +/// the sum of distances between each cluster center to its belonging points. The +/// size should be numClusterCenters*sizeof(float_32) +/// +/// @return +/// 0 if successfully clustered, otherwise error code +/// +/// @remark +/// This is general clusterer. There are no assumptions on points other +/// than they belong to a vector space +/// +/// @ingroup clustering_and_search +//--------------------------------------------------------------------------- + +FASTCV_API int +fcvClusterEuclideanu8( const uint8_t* __restrict points, + int32_t numPoints, + int32_t dim, + int32_t pointStride, + int32_t numPointsUsed, + int32_t numClusters, + float32_t* __restrict clusterCenters, + int32_t clusterCenterStride, + float32_t* __restrict newClusterCenters, + uint32_t* __restrict clusterMemberCounts, + uint32_t* __restrict clusterBindings, + float32_t* sumOfClusterDistances ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix transpose of one uint8_t type matrix. +/// +/// @param src +/// Source matrix.The size of src is srcStride*srcHeight. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// +/// @param srcHeight +/// Height of the source matrix. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvTransposeu8( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix transpose of one uint16_t type matrix. +/// +/// @param src +/// Source matrix. The size of src is srcStride*srcHeight. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// +/// @param srcHeight +/// Height of the source matrix. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvTransposeu16( const uint16_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint16_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix transpose of one float32_t type matrix. +/// +/// @param src +/// Source matrix. The size of src is srcStride*srcHeight. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// +/// @param srcHeight +/// Height of the source matrix. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// Transpose of the source matrix. The size of dst is dstStride*srcWidth. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcHeight*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvTransposef32( const float32_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Flip one uint8_t type matrix. If src and dst point to the same address +/// and srcStride equals to dstStride, it will do in-place flip. +/// +/// @param src +/// Source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// +/// @param srcHeight +/// Height of the source matrix. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix. If src equals to dst and srcStride equals to dstStride, +/// it will do in-place flip. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dir +/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFlipu8( const uint8_t * src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * dst, + uint32_t dstStride, + fcvFlipDir dir ); + +//--------------------------------------------------------------------------- +/// @brief +/// Flip one uint16_t type matrix. If src and dst point to the same address, +/// and srcStride equals to dstStride, it will do in-place flip. +/// +/// @param src +/// Source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// +/// @param srcHeight +/// Height of the source matrix. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix. If src equals to dst and srcStride equals to dstStride, +/// it will do in-place flip. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dir +/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvFlipu16( const uint16_t * src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint16_t * dst, + uint32_t dstStride, + fcvFlipDir dir ); + +//------------------------------------------------------------------------------ +/// @brief +/// Flips an interleaved RGB image +/// +/// @details +/// Flips one uint8_t type interleaved RGB image . If src and dst point to the same address +/// and srcStride equals to dstStride, it will do in-place flip. +/// +/// @param src +/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the image. +/// +/// @param srcHeight +/// Height of the source image. +/// +/// @param srcStride +/// Stride of the Image in bytes. +/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. +/// +/// @param dst +/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcHeight bytes. +/// If src equals to dst and srcStride equals to dstStride,it will do in-place flip. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of the output image in bytes. +/// \n\b NOTE: if 0, dstStride is set as 3 x srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. +/// +/// @param dir +/// Flip direction (FASTCV_FLIP_HORIZ, FASTCV_FLIP_VERT or FASTCV_FLIP_BOTH). +/// +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvFlipRGB888u8(const uint8_t * src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * dst, + uint32_t dstStride, + fcvFlipDir dir); + +//--------------------------------------------------------------------------- +/// @brief +/// Rotate one uint8_t type image. +/// +/// @param src +/// Source image. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source image. +/// +/// @param srcHeight +/// Height of the source image. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result image. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth +/// (FASTCV_ROTATE_180) or srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). +/// \n\b WARNING: should be multiple of 8 +/// +/// @param degree +/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvRotateImageu8( const uint8_t * src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * dst, + uint32_t dstStride, + fcvRotateDegree degree ); + +//--------------------------------------------------------------------------- +/// @brief +/// Rotate one interleaved uint8_t type image (e.g. UV channel in NV21). +/// +/// @param src +/// Source image. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Number of interleaved pairs in one row. +/// For example, srcWidth = 4 in UVUVUVUV image row. +/// +/// @param srcHeight +/// Height of the source image. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 2*srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result image. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to 2*srcWidth +/// (FASTCV_ROTATE_180) or 2*srcHeight (FASTCV_ROTATE_90 or FASTCV_ROTATE_270). +/// \n\b WARNING: should be multiple of 8 +/// +/// @param degree +/// Rotate degree (FASTCV_ROTATE_90, FASTCV_ROTATE_180 or FASTCV_ROTATE_270). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvRotateImageInterleavedu8( const uint8_t * src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * dst, + uint32_t dstStride, + fcvRotateDegree degree ); + +//--------------------------------------------------------------------------- +/// @brief +/// Element-wise multiplication of two uint8_t type matrices. +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvElementMultiplyu8u16( const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * src2, + uint32_t src2Stride, + uint16_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Element-wise multiplication of two float32_t type matrices. +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (float32_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvElementMultiplyf32( const float32_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const float32_t * src2, + uint32_t src2Stride, + float32_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix multiplication of two int8_t type matrices. +/// +/// @param src1 +/// First source matrix. The size of src1 is src1Stride*src1Height. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src1Width +/// Width of the first source matrix. +/// \n\b NOTE: src1Width should not be larger than 131072 +/// +/// @param src1Height +/// Height of the first source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. The size of src2 is src2Stride*src1Width. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Width +/// Width of the second source matrix. +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvMatrixMultiplys8s32( const int8_t * __restrict src1, + uint32_t src1Width, + uint32_t src1Height, + uint32_t src1Stride, + const int8_t * __restrict src2, + uint32_t src2Width, + uint32_t src2Stride, + int32_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix multiplication of two float32_t type matrices. +/// +/// @param src1 +/// First source matrix. The size of src1 is src1Stride*src1Height. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src1Width +/// Width of the first source matrix. +/// +/// @param src1Height +/// Height of the first source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. The size of src2 is src2Stride*src1Width. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Width +/// Width of the second source matrix. +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (int32_t type). The size of dst is dstStride*src1Height. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to src2Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvMatrixMultiplyf32( const float32_t * __restrict src1, + uint32_t src1Width, + uint32_t src1Height, + uint32_t src1Stride, + const float32_t * __restrict src2, + uint32_t src2Width, + uint32_t src2Stride, + float32_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two uint8_t type blocks. +/// +/// @param src1 +/// First source block. +/// +/// @param blockWidth +/// Width of the source block. +/// +/// @param blockHeight +/// Height of the source block. +/// \n\b NOTE: blockWidth*blockHeight should not be larger than 65536 +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source block. +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// Block dot product (uint32_t). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API uint32_t +fcvBlockDotProductu8( const uint8_t * __restrict src1, + uint32_t blockWidth, + uint32_t blockHeight, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Dot product of two float32_t type blocks. +/// +/// @param src1 +/// First source block. +/// +/// @param blockWidth +/// Width of the source block. +/// +/// @param blockHeight +/// Height of the source block. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to src1Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source block. +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to src2Width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// Block dot product (float32_t). +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API float32_t +fcvBlockDotProductf32( const float32_t * __restrict src1, + uint32_t blockWidth, + uint32_t blockHeight, + uint32_t src1Stride, + const float32_t * __restrict src2, + uint32_t src2Stride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of two uint8_t type matrices. +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvAddu8u16( const uint8_t * __restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride, + uint16_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of two int16_t type matrices with saturation. +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (int16_t type). The result will be saturated to +/// int16_t. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvAdds16( const int16_t * __restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t * __restrict src2, + uint32_t src2Stride, + int16_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of two float32_t type matrices. +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (float32_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API void +fcvAddf32( const float32_t * __restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const float32_t * __restrict src2, + uint32_t src2Stride, + float32_t * __restrict dst, + uint32_t dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Builds an integral image of the incoming 8-bit patch values and their +/// squares. This function supports bigger size patch with u64 for squared +/// integral output. +/// \n\b NOTE: No extra border lines, the integral output buffer size is the same +/// as input image buffer size. +/// +/// @details +/// sum (X,Y) = sum_{x<=X,y<=Y} I(x,y) +/// +/// @param src +/// Input image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). +/// +/// @param dstIntgrl +/// Integral image. +/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*4 bytes +/// +/// @param dstIntgrlSqrd +/// Integral image of squared values. +/// \n\b NOTE: Memory must be >= srcWidth*srcHeight*8 bytes +/// +/// @param dstIntgrlStride +/// dstIntgrl Image stride (in bytes). +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*4. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). +/// +/// @param dstIntgrlSqrdStride +/// dstIntgrlSqrd Image stride (in bytes). +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth*8. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values). +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvIntegrateImageu8u64( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t* __restrict dstIntgrl, + uint64_t* __restrict dstIntgrlSqrd, + uint32_t dstIntgrlStride, + uint32_t dstIntgrlSqrdStride); + + + + +//------------------------------------------------------------------------------ +/// @brief +/// Normalize the image according to histogram value of the pixel intensity. +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param dst +/// Pointer to output image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + + +FASTCV_API void +fcvImageHistogramEqualizeu8( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculate histogram at image patches. +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvImageSpatialHistogramu8_v2(). In the 2.0.0 release, +/// fcvImageSpatialHistogramu8_v2 will be renamed to fcvImageSpatialHistogramu8 +/// and the signature of fcvImageSpatialHistogramu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param numPatterns +/// Number of patterns to be computed in the histogram +/// +/// @param grid_x +/// The number of grids along x dimension +/// +/// @param grid_y +/// The number of grids along y dimension +/// +/// @param histogram +/// Output histogram +/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API void +fcvImageSpatialHistogramu8(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numPatterns, + uint32_t grid_x, + uint32_t grid_y, + float32_t*__restrict histogram); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data without normalization. +/// This function computes the gradient of the input image by convolution with the +/// 3x3 Sobel kernel. The Sobel kernel is not normalized in this function. +/// +/// NOTE: it will replace the fcvFilterSobel3x3u8 in fastCV 2.0.0. +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. The number of pixels in a row. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the horizontal gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the vertical gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param borderType +/// Define the behavior at the border. +/// See definition of fcvBorderType. +/// +/// @param borderValue +/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. +/// Ignored otherwise. +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterSobel3x3u8s16( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + uint32_t dxyStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data without normalization. +/// This function computes the gradient of the input image by convolution with the +/// 5x5 Sobel kernel. The Sobel kernel is not normalized in this function. +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. The number of pixels in a row. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the horizontal gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the vertical gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param borderType +/// Define the behavior at the border. +/// See definition of fcvBorderType. +/// +/// @param borderValue +/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. +/// Ignored otherwise. +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterSobel5x5u8s16( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + uint32_t dxyStride, + fcvBorderType borderType, + uint8_t borderValue); + + +//------------------------------------------------------------------------------ +/// @brief +/// Creates a 2D gradient image from source luminance data without normalization. +/// This function computes the gradient of the input image by convolution with the +/// 7x7 Sobel kernel. The Sobel kernel is not normalized in this function. +/// +/// @param src +/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of src data to create gradient. The number of pixels in a row. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Height of src data to create gradient. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param dx +/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the horizontal gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dy +/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. +/// If NULL, the vertical gradient will not be calculated. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dxyStride +/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param borderType +/// Define the behavior at the border. +/// See definition of fcvBorderType. +/// +/// @param borderValue +/// Specifies the constant value for the borderType FASTCV_BORDER_CONSTANT. +/// Ignored otherwise. +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterSobel7x7u8s16( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t* __restrict dx, + int16_t* __restrict dy, + uint32_t dxyStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Canny edge detection with more controls to configurate the algorithm. +/// +/// @details +/// Canny edge detector applied to a 8 bit grayscale image. +/// The results are stored as a binarized image (0x0 - not an edge, 0xFF - edge). +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of the input image in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param kernelSize +/// The Sobel kernel size for calculating gradient. Supported sizes are 3, 5 and 7. +/// +/// @param lowThresh +/// For all the intermediate pixels along the edge, the norm of the +/// gradient at the pixel locations should be greater than 'lowThresh'. +/// +/// @param highThresh +/// For an edge starting point, i.e. either the first or last +/// pixel of the edge, the norm of the gradient at the pixel should be +/// greater than 'highThresh'. +/// +/// @param normType +/// The norm definition to calculate the gradient magnitude. See fcvNormType. +/// +/// @param dst +/// Output 8-bit binarized image containing the edge detection results. +/// Size of buffer is dstStride*srcHeight bytes. +/// Edges are marked with pixels of 0xFF. The rest pixels have values of 0. +/// +/// @param dstStride +/// Stride of the output image in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param gx +/// Buffer to store horizontal gradient. Must be (gradStride)*(srcHeight) bytes in size. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param gy +/// Buffer to store vertical gradient. Must be (gradStride)*(srcHeight) bytes in size. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param gradStride +/// Stride (in bytes) of 'gx' and 'gy' gradient arrays, +/// is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in the gradient arrays dx or dy. +/// If left at 0 gradStride is default to 2 * srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterCannyu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t kernelSize, + int32_t lowThresh, + int32_t highThresh, + fcvNormType normType, + uint8_t* __restrict dst, + uint32_t dstStride, + int16_t* __restrict gx, + int16_t* __restrict gy, + uint32_t gradStride); + + +//--------------------------------------------------------------------------- +/// @brief +/// Converts the bit depth of a single-channel uint8 image to int16_t type +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if srcStride is equal to 0, it will be set to srcWidth +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param shift +/// The number of bits to be right-shifted to adjust the output +/// \n\b NOTE: range from 0 to 8 +/// +/// @param dst +/// Output image which has the same dimension as the input image in int16_t type +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if dstStride is equal to 0, it will be set to srcWidth*2 +/// \n\b NOTE: should be a multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvConvertDepthu8s16(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t shift, + int16_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Converts the bit depth of a single-channel int16_t image to uint8_t type +/// +/// @param src +/// Input int16_t image. The size of buffer is srcStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if srcStride is equal to 0, it will be set to srcWidth*2 +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param shift +/// The number of bits to be left-shifted to adjust the output +/// \n\b NOTE: range from 0 to 15 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// Output image which has the same dimension as the input image in uint8_t type +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if dstStride is equal to 0, it will be set to srcWidth +/// \n\b NOTE: should be a multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvConvertDepths16u8(const int16_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t shift, + fcvConvertPolicy policy, + uint8_t *__restrict dst, + uint32_t dstStride ); + + +//--------------------------------------------------------------------------- +/// @brief +/// Recursive Bilateral Filtering +/// +/// @details +/// The algorithm is described in paper Recursive Bilateral Filtering, ECCV2012 by Prof Yang Qingxiong +/// Different from traditional bilateral filtering, the bilateral filtering in this algorithm is actually performed in gradient domain. +/// The results are ususally better than tradition bilateral filters. Filtering is carried out in a recursive way, and it is efficient. +/// +/// @param src +/// Input uint8_t image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// \n\b WARNING: should be multiple of 8. +/// +/// @param dst +/// Output uint8_t image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// \n\b WARNING: should be multiple of 8. +/// +/// @param sigmaColor +/// Filter sigma in the color space. Typical value 0.03f. Increasing this value means increasing the influence of the neighboring +///pixels of more different Color to the smoothing result. +/// +/// @param sigmaSpace +/// Filter sigma in the coordinate space. Typical value 0.1f. Increasing this value means increasing the influence of farther +/// pixels to the smoothing result. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvBilateralFilterRecursiveu8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + float32_t sigmaColor, + float32_t sigmaSpace ); + +//--------------------------------------------------------------------------- +/// @brief +/// Grow the seeds within the image to meaningful regions, +/// depending on the color or gray scale uniformity of the neighborhood pixels from the seeds. +/// +/// @param src +/// Pointer to 16-bit color (3-channel) or grayscale (1-channel) image. +/// +/// @param srcWidth +/// Width of src image, measured by pixels. +/// +/// @param srcHeight +/// Height of src image, measured by pixels. +/// +/// @param srcStride +/// Stride of src image, measured by bytes. +/// WARNING: should be multiple of 8, and at least as much as srcWidth*numChannel if not 0. +/// +/// @param numChannel +/// Number of channels of src image. 1 for gray scale and 3 for color image. +/// +/// @param threshGrow +/// Threshold to grow the seed into a region. Higher value: larger uniform region grown. +/// Range of 3-channel image segmentation: 10~150. +/// Range of 1-channel image segmentation: 3~25. +/// +/// @param pointVector +/// A 2D point vector of seeds (provided by user) within the image. For N seeds, it is saved as [x0,y0,x1,y1,...,xN-1,yN-1]. +/// +/// @param numSeed +/// Number of seed points, equal to N used in pointVector. +/// +/// @param mode +/// Mode of seed grow. 0: distance measured with neighborhood pixel. 1: distance measured with seed pixel only. +/// +/// @param segLabel +/// Segmented labels. 1 channel with same size of src. Pixel belonging to the same region is uniformly labeled by a non-zero number. Pixels not grown from any seeds are labeled 0. +/// +/// @param segLabelStride +/// Stride of segmented labels, measured by bytes. +/// WARNING: should be multiple of 8, and at least as much as srcWidth*4 if not 0. +/// +/// @return +/// 0 if successful. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvImageSegmentationSeedRegionGrows16( const int16_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numChannel, + uint32_t threshGrow, + const uint32_t* __restrict pointVector, + uint32_t numSeed, + uint8_t mode, + uint32_t* __restrict segLabel, + uint32_t segLabelStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Calculate the local subtractive and contrastive normalization of the image. +/// For each pixel of the image, the mean and optionally standard deviation +/// is calculated for the patch centered around the pixel. Then the pixel is +/// normalized by the local mean and optionally standard deviation. +/// +/// @param src +/// The input image. Must be 8 bit grayscale image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE:should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of src image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. +/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth. +/// +/// @param patchWidth +/// Width in pixels of the patch to calculate local mean and standard deviation. +/// +/// @param patchHeight +/// Height in pixels of the patch to calculate local mean and standard deviation. +/// +/// @param useStdDev (0 or 1) +/// if 1, the dst will be normalized with standard deviation. +/// +/// @param dst +/// The output image. +/// Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE:should be 128-bit aligned. +/// +/// @param dstStride +/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth. +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvNormalizeLocalBoxu8( const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t patchWidth, + uint32_t patchHeight, + uint32_t useStdDev, + int8_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculate the local subtractive and contrastive normalization of the image. +/// For each pixel of the image, the mean and optionally standard deviation +/// is calculated for the patch centered around the pixel. Then the pixel is +/// normalized by the local mean and optionally standard deviation. +/// +/// @param src +/// The input image. Must be 32-bit float image. Size of buffer is +/// srcStride*srcHeight*sizeof(float32_t) bytes. +/// \n\b NOTE:should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width, the number of pixels in a row +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Stride of src image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. +/// \n\b NOTE: should be a multiple of 8. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). +/// +/// @param patchWidth +/// Width in pixels of the patch to calculate local mean and standard deviation. +/// +/// @param patchHeight +/// Height in pixels of the patch to calculate local mean and standard deviation. +/// +/// @param useStdDev (0 or 1) +/// if 1, the dst will be normalized with standard deviation. +/// +/// @param dst +/// The output image. +/// Size of buffer is dstStride*srcHeight*sizeof(float32_t) bytes. +/// \n\b NOTE:should be 128-bit aligned. +/// +/// @param dstStride +/// The stride of the output image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: should be a multiple of 8. If left at 0 dstStride is default to srcWidth*sizeof(float32_t). +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvNormalizeLocalBoxf32( const float32_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t patchWidth, + uint32_t patchHeight, + uint32_t useStdDev, + float32_t * __restrict dst, + uint32_t dstStride); + +//--------------------------------------------------------------------------- +/// @brief +/// Combine two channels in an interleaved fashion +/// +/// @details +/// Interleave data from src1 and src2 to dst. +/// Data in src1 [d0 d1 d2 d3...] +/// Data in src2 [t0 t1 t2 t3...] +/// Results in dst [d0 t0 d1 t1 d2 t2 d3 t3...] +/// \n\b NOTE: Perform the same functionality as fcvInterleaveu8. +/// +/// @param src1 +/// One of the input images ( For example, Cb or Cr component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source image. +/// +/// @param height +/// Height of the source image. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// One of the input images ( For example, Cb or Cr component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// The result image (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvChannelCombine2Planesu8( const uint8_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + uint8_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Combine three channels in an interleaved fashion +/// +/// @details +/// Interleave data from src1, src2 and src3 to dst. +/// Data in src1 [d0 d1 d2 d3...] +/// Data in src2 [t0 t1 t2 t3...] +/// Data in src3 [s0 s1 s2 s3...] +/// Results in dst [d0 t0 s0 d1 t1 s1 d2 t2 s2 d3 t3 s3...] +/// +/// @param src1 +/// One of the input images ( For example, R or G or B component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source image. +/// +/// @param height +/// Height of the source image. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// One of the input images ( For example, R or G or B component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src3 +/// One of the input images ( For example, R or G or B component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src3Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// The result image (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*3. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvChannelCombine3Planesu8(const uint8_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + const uint8_t *__restrict src3, + uint32_t src3Stride, + uint8_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Combine four channels in an interleaved fashion +/// +/// @details +/// Interleave data from src1, src2, src3 and src4 to dst. +/// Data in src1 [d0 d1 d2 d3...] +/// Data in src2 [t0 t1 t2 t3...] +/// Data in src3 [s0 s1 s2 s3...] +/// Data in src3 [r0 r1 r2 r3...] +/// Results in dst [d0 t0 s0 r0 d1 t1 s1 r1 d2 t2 s2 r2 d3 t3 s3 r3...] +/// +/// @param src1 +/// One of the input images ( For example, R or G or B or A component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source image. +/// +/// @param height +/// Height of the source image. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// One of the input images ( For example, R or G or B or A component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src3 +/// One of the input images ( For example, R or G or B or A component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src3Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src3Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src4 +/// One of the input images ( For example, R or G or B or A component) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src4Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src4Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// The result image (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*4. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvChannelCombine4Planesu8(const uint8_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + const uint8_t *__restrict src3, + uint32_t src3Stride, + const uint8_t *__restrict src4, + uint32_t src4Stride, + uint8_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Extract channel as a single uint8_t type plane from an interleaved or multi-planar image format +/// +/// @details +/// +/// +/// @param src1 +/// The first plane in source image. For example, an intervealved RGB/RGBA plane or the Y plane. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source image. +/// +/// @param height +/// Height of the source image. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. +/// If left at 0 src1Stride is default to the size required by corresponding image format. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// The second plane in souce image if available; otherwise, left at 0. +/// For example, the intervealved CbCr plane in FASTCV_NV12/FASTCV_NV21; or the Cb plane in FASTCV_IYUV/FASTCV_YUV4. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. +/// If left at 0, src2Stride is default to width for FASTCV_NV12/FASTCV_NV21/FASTCV_YUV4 and width/2 for FASTCV_IYUV. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src3 +/// The third plane in souce image if available; otherwise, left at 0. +/// For example, the Cr plane in FASTCV_IYUV/FASTCV_YUV4. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src3Stride +/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. +/// If left at 0 src3Stride is default to width for FASTCV_YUV4, and width/2 for FASTCV_IYUV. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param srcChannel +/// The index of the image channel to be extracted. Refer to fcvChannelType for details. +/// +/// @param srcFormat +/// The format of the source image. Different image formats require different src +/// and dst size. Refer to fcvImageFormat for details. +/// +/// @param dst +/// The result image (a uint8_t type plane). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. +/// If left at 0, dstStride is default to the size required by corresponding image format. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvChannelExtractu8( const uint8_t *__restrict src1, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + const uint8_t *__restrict src3, + uint32_t src3Stride, + fcvChannelType srcChannel, + fcvImageFormat srcFormat, + uint8_t *__restrict dst, + uint32_t dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with MxN median filter (M,N have to be odd numbers) +/// +/// @details +/// Borders of m pixels in horizontal direction and n in vertical direction +/// are replaced with the source pixels, where m = (M-1)/2, n = (N-1)/2 +/// The NxN median filter applies on the image area +/// | a(n,m) , a(n,m+1), ..., a(n,srcWidth-m-1) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-n-1,m), ..., ..., a(srcHeight-n-1,srcWidth-m-1) |\n +/// +/// @param src +/// Input 16-bit signed image. Size of buffer is srcStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth * 2. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. +/// +/// @param M +/// Filter kernel width +/// \n\b NOTE: kernel width should be an odd number +/// +/// @param N +/// Filter kernel height +/// \n\b NOTE: kernel height should be an odd number +/// +/// @param dst +/// Output 16-bit image. Size of buffer is dstStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as srcWidth * 2 +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*2 if not 0. +/// +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterMedianMxNs16( const int16_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t M, + uint32_t N, + int16_t* __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Computes the convolution of an image with an M x N Kernel +/// +/// @details +/// The function computes the convolution of an unsigned char input image +/// with an M x N kernel of type short. The output is of type short +/// and is of the same size as the input image. The convolution is computed +/// based on the type of Border handling selected. +/// +/// +/// @param kernel +/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes +/// The kernel can be normalized before passing in by making use of the shift parameter. +/// +/// +/// @param M +/// Width of the kernel +/// +/// @param N +/// Height of the kernel +/// +/// @param shift +/// This parameter can be used to normalize the input kernel by converting the data into +/// fixed point values. Shift can be considered as Q factor of kernel. +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param dst +/// Output image which has the same dimensions as the input matrix. +/// The output is of type short, and must be allocated as dstStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If dstStride is equal to 0, +/// it will be set to srcWidth * sizeof(int16_t). +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values will be set to 0. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 to 255. +/// +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvFilterConvolveMxNu8s16( const int16_t* __restrict kernel, + uint32_t M, + uint32_t N, + int8_t shift, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue ); + +//--------------------------------------------------------------------------- +/// @brief +/// Computes the convolution of a image with an M x N Kernel +/// +/// @details +/// The function computes the convolution of an unsigned char input image +/// with an M x N kernel of type short. The output is of type unsigned char +/// and is of the same size as the input image. The convolution is computed +/// based on the type of Border handling selected. +/// +/// +/// @param kernel +/// Input M x N short kernel matrix. The size of buffer is M*N*sizeof(int16_t) bytes +/// The kernel can be normalized before passing in by making use of the shift parameter. +/// +/// +/// @param M +/// Width of the kernel +/// +/// @param N +/// Height of the kernel +/// +/// @param shift +/// This parameter can be used to normalize the input kernel by converting the data into +/// fixed point values. Shift can be considered as Q factor of kernel. +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param dst +/// Output image which has the same dimensions as the input matrix. +/// The output is of type unsigned char, and must be allocated as dstStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If dstStride is equal to 0, +/// it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values will be set to 0. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvFilterConvolveMxNu8(const int16_t* __restrict kernel, + uint32_t M, + uint32_t N, + int8_t shift, + const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + + +//--------------------------------------------------------------------------- +/// @brief +/// Smooth a uint8_t image with a 3x3 box filter with border handling scheme specified by user +/// +/// @details +/// smooth with 3x3 box kernel and normalize: +/// \n[ 1 1 1 +/// \n 1 1 1 +/// \n 1 1 1 ]/9 +/// +/// @param src +/// Input uint8_t image. +/// +/// @param srcWidth +/// Input image width. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param dst +/// Output image which has the same type, and size as the input image. +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values will be set to 0. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvBoxFilter3x3u8_v2( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Erode a grayscale image by taking the local minima of 3x3 nbhd window +/// with border handling scheme specified by user +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterErode3x3u8_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, +/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values will be set to 255. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterErode3x3u8_v3( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Erode a grayscale image by taking the local minima of NxN neighborhood window. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param N +/// Dimension of the neighborhood window. +/// \n\b WARNING: must be an odd number +/// +/// @param dst +/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterErodeNxNu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t N, + uint8_t* __restrict dst, + uint32_t dstStride); + + +//------------------------------------------------------------------------------ +/// @brief +/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window +/// with border handling scheme specified by user +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterDilate3x3u8_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, +/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values will be set to 0. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterDilate3x3u8_v3( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Dilate a grayscale image by taking the local maxima of NxN neighborhood window. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param N +/// Dimension of the neighborhood window. +/// \n\b WARNING: must be an odd number +/// +/// @param dst +/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of output image. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param tmp +/// Temporary image scratch space used internally. +/// \n\b NOTE: Size = width * height +/// \n\b NOTE: data should be 128-bit aligned +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterDilateNxNu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t N, + uint8_t* __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 Gaussian filter +/// with border handling scheme specified by user +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterGaussian3x3u8_v2() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, +/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Convolution with 3x3 Gaussian kernel: +/// \n 1 2 1 +/// \n 2 4 2 +/// \n 1 2 1 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as dstWidth if not 0. +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border is blurred by 0-padding adjacent values. +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterGaussian3x3u8_v3( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Blurs an image with 3x3 median filter +/// with border handling scheme specified by user +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvFilterMedian3x3u8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, +/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature +/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Border values are extrapolated according to borderType. +/// The 3x3 mask convolves with the whole image area. +/// +/// @param srcImg +/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param srcHeight +/// Image height. +/// +/// @param srcStride +/// Image stride. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param dstImg +/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. +/// \n\b NOTE: data should be 128-bit aligned. +/// +/// @param dstStride +/// Output stride. +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param borderType +/// This parameter specifies how the border is handled. Can be set to FASTCV_BORDER_CONSTANT, +/// FASTCV_BORDER_REPLICATE or FASTCV_BORDER_UNDEFINED. In the case of FASTCV_BORDER_UNDEFINED, +/// border values are ignored. The 3x3 mask convolves with the following image area +/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n +/// | ... , ..., ..., ... |\n +/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n +/// +/// @param borderValue +/// Used to define the border value in case FASTCV_BORDER_CONSTANT is chosen. For other modes, +/// set this value as 0. Can take values between 0 and 255. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvFilterMedian3x3u8_v3( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Calculate histogram at image patches. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvImageSpatialHistogramu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvImageSpatialHistogramu8, +/// \a fcvImageSpatialHistogramu8_v2 will be removed, and the current signature +/// for \a fcvImageSpatialHistogramu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvImageSpatialHistogramu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src +/// Pointer to grayscale image with one byte per pixel +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Image width +/// +/// @param srcHeight +/// Image height +/// +/// @param srcStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param numPatterns +/// Number of patterns to be computed in the histogram +/// +/// @param grid_x +/// The number of grids along x dimension +/// +/// @param grid_y +/// The number of grids along y dimension +/// +/// @param histogram +/// Output histogram +/// \n\b NOTE: Memory must be at least numPatterns*grid_x*grid_y*sizeof(float32_t) +/// +/// @param normalize_factor +/// Scale factor with float32_t type to normalize result. When set to 0, the result is +/// normalized by (srcWidth/grid_x) * (srcHeight/grid_y) +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_processing +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvImageSpatialHistogramu8_v2( const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t numPatterns, + uint32_t grid_x, + uint32_t grid_y, + float32_t*__restrict histogram, + float32_t normalize_factor); + +//------------------------------------------------------------------------------ +/// @brief +/// Image downscaling using bilinear method +/// +/// @param src +/// Input image +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Stride of input image (i.e., number of bytes between column 0 +/// of row 0 and column 0 of row 1). +/// If left at 0, srcStride is default to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param dst +/// Output image +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstWidth +/// Output image width +/// +/// @param dstHeight +/// Output image height +/// +/// @param dstStride +/// Stride of image (i.e., number of bytes between column 0 +/// of row 0 and column 0 of row 1). +/// If left at 0, dstStride is default to dstWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @return +/// No return value. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvScaleDownBLu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride); + +//--------------------------------------------------------------------------- +/// @brief +/// Applies a Table Look-up transformation to a single-channel uint8 image +/// +/// @details +/// Each pixel in the input image is used to index into a look-up table and the indexed look-up table +/// value is then put into the output image +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width +/// +/// @param srcHeight +/// Input image height +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if srcStride is equal to 0, it will be set to srcWidth +/// \n\b NOTE: should be a multiple of 8 +/// +/// @param lut +/// The Look-up Table given as a 256-element array of type uint8_t +/// +/// @param dst +/// Output image which has the same dimension as the input image in uint8_t type +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if dstStride is equal to 0, it will be set to srcWidth +/// \n\b NOTE: should be a multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvTableLookupu8( const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const uint8_t *__restrict lut, + uint8_t *__restrict dst, + uint32_t dstStride ); + +//------------------------------------------------------------------------------ +/// @brief +/// Warps a grayscale image using the a perspective projection transformation +/// matrix (also known as a homography). This type of transformation is an +/// invertible transformation which maps straight lines to straight lines. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvWarpPerspectiveu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, +/// \a fcvWarpPerspectiveu8_v3 will be removed, and the current signature +/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Warps an image taking into consideration the perspective scaling. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcStride +/// Input image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Warped output image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Dst image width. +/// \n\b NOTE: data should be multiple of 8. +/// +/// @param dstHeight +/// Dst image height. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param dstStride +/// Output image stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @interpolation +/// Specifies the interpolation method to be used. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvWarpPerspectiveu8_v3( const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t *__restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + float *__restrict projectionMatrix, + fcvInterpolationType interpolation ); + +//------------------------------------------------------------------------------ +/// @brief +/// Warps a grayscale image using the a perspective projection transformation +/// matrix (also known as a homography). This type of transformation is an +/// invertible transformation which maps straight lines to straight lines. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvWarpPerspectiveu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, +/// \a fcvWarpPerspectiveu8_v4 will be removed, and the current signature +/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Warps an image taking into consideration the perspective scaling. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcStride +/// Input image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Warped output image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Dst image width. +/// \n\b NOTE: data should be multiple of 8. +/// +/// @param dstHeight +/// Dst image height. +/// \n\b NOTE: should be multiple of 8 +/// +/// @param dstStride +/// Output image stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as dstWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. +/// +/// @param projectionMatrix +/// 3x3 perspective transformation matrix (generally a homography). The +/// matrix stored in homography is row major ordering: \n +/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n +/// | a11, a12, a13 |\n +/// | a21, a22, a23 |\n +/// | a31, a32, a33 |\n +/// \n\b WARNING: should be 128-bit aligned. +/// +/// Note: +/// The projection matrix follows the so-called inverse mapping convention. +/// It is applied to the dst coordinates to produce the corresponding +/// src coordinates. In other 3rd party tools, the so-called forward mapping +/// convention may be used, where the projection matrix refers to the one +/// applied to the src coordinates to produce the dst coordinates. +/// When comparing with 3rd party results, please make sure +/// the same convention of projection matrices are assumed. If not, +/// please transform the projection matrix into an equivalent form under +/// the forward mapping convention before feeding it into 3rd party tools. +/// +/// @interpolation +/// Specifies the interpolation method to be used. +/// +/// @param borderType +/// The border mode for dst pixels not mapped to the src image. +/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. +/// +/// @param borderValue +/// The user-specified constant pixel value, +/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvWarpPerspectiveu8_v4( const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t *__restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + float *__restrict projectionMatrix, + fcvInterpolationType interpolation, + fcvBorderType borderType, + uint8_t borderValue +); + +//--------------------------------------------------------------------------- +/// @brief +/// Applies a generic geometrical transformation to a greyscale uint8 image. +/// The interpolation method is specified through a parameter. +/// +/// @details +/// The greyscale of each pixel in the destination image is obtained from a location of the source image +/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, +/// thus interpolations are involved. +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if srcStride is equal to 0, it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param dst +/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstWidth +/// Output image width. +/// +/// @param dstHeight +/// Output image height. +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if dstStride is equal to 0, it will be set to dstWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param mapX +/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is +/// mapped to src(ii,jj), then mapX(i,j) =jj. +/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param mapY +/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is +/// mapped to src(ii,jj), then mapY(i,j) =ii. +/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param mapStride +/// the stride of the mapX and mapY +/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param interpolation +/// the interpolation method to derive the dst pixel value. +/// supported methods are nearest neighbor, bilinear and area. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvRemapu8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + const float32_t* __restrict mapX, + const float32_t* __restrict mapY, + uint32_t mapStride, + fcvInterpolationType interpolation +); + +//--------------------------------------------------------------------------- +/// @brief +/// Applies a generic geometrical transformation to a greyscale uint8 image. +/// The interpolation method is specified through a parameter. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvRemapu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvRemapu8, +/// \a fcvRemapu8_v2 will be removed, and the current signature +/// for \a fcvRemapu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvRemapu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// The greyscale of each pixel in the destination image is obtained from a location of the source image +/// through a per-element mapping as defined in the mapping matrices. The mapping has subpixel precision, +/// thus interpolations are involved. +/// +/// @param src +/// Input uint8_t image. The size of buffer is srcStride*srcHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param srcWidth +/// Input image width. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param srcStride +/// Input image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if srcStride is equal to 0, it will be set to srcWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param dst +/// Output image which has the same type, and size as the input image. The size of buffer is dstStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param dstWidth +/// Output image width. +/// +/// @param dstHeight +/// Output image height. +/// +/// @param dstStride +/// Output image stride, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row +/// if dstStride is equal to 0, it will be set to dstWidth. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param mapX +/// a floating point matrix, each element is the column coordinate of the mapped location in the src image. E.g. if dst(i,j) is +/// mapped to src(ii,jj), then mapX(i,j) =jj. +/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param mapY +/// a floating point matrix, each element is the row coordinate of the mapped location in the src image.E.g. if dst(i,j) is +/// mapped to src(ii,jj), then mapY(i,j) =ii. +/// the matrix has the same width, height as the dst image. The size of buffer is mapStride*dstHeight bytes. +/// \n\b NOTE: should be 128-bit aligned. +/// +/// @param mapStride +/// the stride of the mapX and mapY +/// if mapStride is equal to 0, it will be set to dstWidth*sizeof(float32_t). +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param interpolation +/// the interpolation method to derive the dst pixel value. +/// supported methods are nearest neighbor, bilinear and area. +/// +/// @param borderType +/// The border mode for dst pixels not mapped to the src image. +/// Supported modes are FASTCV_BORDER_UNDEFINED and FASTCV_BORDER_CONSTANT. +/// +/// @param borderValue +/// The user-specified constant pixel value, +/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvRemapu8_v2(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + const float32_t* __restrict mapX, + const float32_t* __restrict mapY, + uint32_t mapStride, + fcvInterpolationType interpolation, + fcvBorderType borderType, + uint8_t borderValue +); + +//--------------------------------------------------------------------------- +/// @brief +/// Gradient Magnitude Computation from two int16_t type matrices. +/// +/// @details +/// The function takes two gradient matrices in int16_t and computes the +/// magnitude in int16_t. +/// \n\b NOTE: Saturation is used when computed magnitude value is larger than max limit of int16_t. +/// +/// @param src1 +/// The gradient matrix in X direction. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// The gradient matrix in Y direction. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvMagnitudes16( const int16_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t *__restrict src2, + uint32_t src2Stride, + int16_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Gradient Phase Computation from two int16_t type matrices. +/// +/// @details +/// The function takes two gradient matrices in int16_t and computes the +/// phase for each pixel, storing results in a uint8_t matrix. The phase angle is translated +/// to [0, 2*PI) and then mapped to range [0, 255). +/// +/// @param src1 +/// The gradient matrix in X direction. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// The gradient matrix in Y direction. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvPhases16 ( const int16_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t *__restrict src2, + uint32_t src2Stride, + uint8_t *__restrict dst, + uint32_t dstStride ); + + +//-------------------------------------------------------------------------------- +/// Computes the 1D or 2D Fast Fourier Transform of a matrix. +/// +/// @details +/// Computes the 1D or 2D Fast Fourier Transform of a real valued matrix. For the +/// 2D case, The width and height of the input and output matrix must be powers of 2. +/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. +/// +/// @param src +/// An 8 bit unsigned real valued input matrix. The dimensions of the matrix must be powers +/// of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be +/// a power of 2. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. +/// \n\b NOTE: Must be a power of 2 +/// +/// @param srcHeight +/// Height of the source matrix. +/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case +/// +/// @param srcStride +/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// The computed FFT matrix. The FFT coefficients are stored in interleaved fashion, i.e., +/// Re1 Im1 Re2 Im2 and so on. Hence the dimensions of the dst are (2 x srcWidth, srcHeight) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0, dstStride is set to 2 x srcWidth x sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvFFTu8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t* __restrict dst, + uint32_t dstStride); + +//--------------------------------------------------------------------------- +/// @brief +/// Computes the 1D or 2D Inverse Fast Fourier Transform of a matrix. +/// +/// @details +/// Computes the 1D or 2D Inverse Fast Fourier Transform of a complex valued matrix. For the +/// 2D case, The width and height of the input and output matrix must be powers of 2. +/// For the 1D case, the height of the matrices must be 1, while the width must be a power of 2. +/// +/// @param src +/// An 32 bit floating point complex valued input matrix. The data in the matrix must be stored +/// in an interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on. The dimensions of the matrix must +/// be powers of 2 for the 2D case, and in the 1D case, the height must be 1, while the width must be +/// a power of 2. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param srcWidth +/// Width of the source matrix. The width here is the number of floating point units in the matrix. Since +/// the data is interleaved fashion, i.e., Re1 Im1 Re2 Im2 and so on, the width is the total number of real +/// and complex units in the matrix. For example, if the Matrix has data values Re1 Im1 Re2 Im2 Re3 Im3 Re4 Im4, +/// then the width here is 8 units. +/// \n\b NOTE: Must be a power of 2 +/// +/// @param srcHeight +/// Height of the source matrix. +/// \n\b NOTE: Must be a power of 2 for the 2D case, and must be set to 1 for the 1D case +/// +/// @param srcStride +/// Stride of the input matrix. Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is set to srcWidth x sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// The computed IFFT matrix. The matrix is real valued and has no imaginary components. +/// Hence the dimensions of the dst are (srcWidth / 2 , srcHeight) +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride of the output matrix. Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0, dstStride is set to (srcWidth / 2). +/// \n\b WARNING: should be multiple of 8 +/// +/// @ingroup image_transform +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvIFFTf32( const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. +/// The scaling ratios are automatically determined from the specified +/// source image size and destination image size. +/// +/// @details +/// Scale up or down the source image of size srcWidth-by-srcHeight +/// to the destination image of size dstWidth-by-dstHeight. +/// NOTE: dstWidth > 0 && dstHeight > 0. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Source Image height. +/// +/// @param srcStride +/// Stride of source image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, srcStride=srcWidth as default +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Destination Image width. +/// +/// @param dstHeight +/// Destination Image height. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, dstStride=dstWidth as default +/// +/// @param interpolation +/// The interpolation method used for scaling. Please see fcvInterpolationType. +/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: +/// Nearest neighbor interpolation. +/// FASTCV_INTERPOLATION_TYPE_BILINEAR: +/// Bilinear interpolation. +/// FASTCV_INTERPOLATION_TYPE_AREA: +/// Interpolation by area. Output values are determined by weighted averages of +/// the source pixels covered by the destination pixel. The averaging weight +/// for each source pixel is proportional to its area overlapping with +/// the destination pixel. Interpolation by area may produce more precise +/// images for scale down operations. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other values otherwise. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvScaleu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + fcvInterpolationType interpolation); + +//--------------------------------------------------------------------------- +/// @brief +/// Scale an image Horizontaly and/or Vertically by arbitrary ratio. +/// The scaling ratios are automatically determined from the specified +/// source image size and destination image size. +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvScaleu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvScaleu8, +/// \a fcvScaleu8_v2 will be removed, and the current signature +/// for \a fcvScaleu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @details +/// Scale up or down the source image of size srcWidth-by-srcHeight +/// to the destination image of size dstWidth-by-dstHeight. +/// NOTE: dstWidth > 0 && dstHeight > 0. +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source Image width. +/// \n\b WARNING: should be multiple of 8. +/// +/// @param srcHeight +/// Source Image height. +/// +/// @param srcStride +/// Stride of source image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, srcStride=srcWidth as default +/// +/// @param dst +/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstWidth +/// Destination Image width. +/// +/// @param dstHeight +/// Destination Image height. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, dstStride=dstWidth as default +/// +/// @param interpolation +/// The interpolation method used for scaling. Please see fcvInterpolationType. +/// FASTCV_INTERPOLATION_TYPE_NEAREST_NEIGHBOR: +/// Nearest neighbor interpolation. +/// FASTCV_INTERPOLATION_TYPE_BILINEAR: +/// Bilinear interpolation. +/// FASTCV_INTERPOLATION_TYPE_AREA: +/// Interpolation by area. Output values are determined by weighted averages of +/// the source pixels covered by the destination pixel. The averaging weight +/// for each source pixel is proportional to its area overlapping with +/// the destination pixel. Interpolation by area may produce more precise +/// images for scale down operations. +/// +/// @param borderType +/// The border mode for dst pixels not mapped to the src image. +/// Supported modes are FASTCV_BORDER_UNDEFINED, FASTCV_BORDER_CONSTANT +/// and FASTCV_BORDER_REPLICATE. +/// +/// @param borderValue +/// The user-specified constant pixel value, +/// in case FASTCV_BORDER_CONSTANT is chosen for borderType. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other values otherwise. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvScaleu8_v2( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dstStride, + fcvInterpolationType interpolation, + fcvBorderType borderType, + uint8_t borderValue); + +//------------------------------------------------------------------------------ +/// @brief +/// Perspective warp two images using the same transformation. +/// Bi-linear interpolation is used where applicable. +/// +/// @details +/// Perspective warp two images (or buffer) using the same transformation in one function +/// call. This can be used, for example, to warp a grayscale image and an alpha image at +/// the same time, or warp two color channels (for example u and v de-interleaved for YUV). +/// +/// @param src1 +/// First input 8-bit image. Size of buffer is src1Stride*srcHeight bytes. +/// +/// @param src2 +/// Second input 8-bit image. Size of buffer is src2Stride*srcHeight bytes. +/// +/// @param srcWidth +/// Input image width. +/// +/// @param srcHeight +/// Input image height. +/// +/// @param src1Stride +/// Input image 1 stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to srcWidth. +/// +/// @param src2Stride +/// Input image 2 stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to srcWidth. +/// +/// @param dst1 +/// First warped output image (correspond to src1). Size of buffer is dst1Stride*dstHeight bytes. +/// +/// @param dst2 +/// Second warped output image (correspond to src2). Size of buffer is dst2Stride*dstHeight bytes. +/// +/// @param dstWidth +/// Dst image width. +/// +/// @param dstHeight +/// Dst image height. +/// +/// @param dst1Stride +/// Output image 1 stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to dstWidth. +/// +/// @param dst2Stride +/// Output image 2 stride, i.e. the gap (in terms of bytes) between the first element +/// of a row and that of the successive row. If srcStride is equal to 0, +/// it will be set to dstWidth. +/// +/// @param warpmatrix +/// 3x3 perspective transformation matrix (generally a homography). +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcv2PlaneWarpPerspectiveu8( const uint8_t* __restrict src1, + const uint8_t* __restrict src2, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t src1Stride, + uint32_t src2Stride, + uint8_t* __restrict dst1, + uint8_t* __restrict dst2, + uint32_t dstWidth, + uint32_t dstHeight, + uint32_t dst1Stride, + uint32_t dst2Stride, + float32_t* __restrict warpmatrix ); + +//------------------------------------------------------------------------------ +/// @brief +/// Downscale a grayscale image by a factor of two using a 3x3 Gaussian filter kernel +/// +/// @details +/// This function first blurs the input image using a 3x3 Gaussian kernel, and then downsamples +/// the image by selecting every other row and column. The dimensions of the destination image are +/// computed as follows : dstWidth = (srcWidth + 1)/2 , dstHeight = (srcHeight + 1)/2 +/// +/// @param src +/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Width of the input image. +/// +/// @param srcHeight +/// Height of the input image +/// +/// @param srcStride +/// Image stride (in bytes). +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. +/// +/// @param dst +/// Output 8-bit downscale image of size (srcWidth + 1) / 2 x (srcHeight + 1) / 2. +/// \n\b NOTE: border values have been taken care of w.r.t. the pixel coordinate. +/// +/// @param dstStride +/// Output stride (in bytes). +/// \n\b NOTE: if 0, dstStride is set as (srcWidth+1)/2. +/// \n\b WARNING: should be multiple of 8 (8 * 1-byte values), and at least as much as (srcWidth+1)/2 if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup image_transform +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvScaleDownBy2Gaussian3x3u8(const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride); + +//--------------------------------------------------------------------------- +/// @brief +/// Sum of squared differences of one L-byte vector against N others. +/// +/// @details +/// SSD of one vector (a) against N other L-byte vectors +/// ( b[0], b[1], ..., b[n-1] ) +/// using their given inverse lengths for normalization. +/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) +/// +/// @param a +/// Vector. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param invLenA +/// Inverse of vector A = 1/|A| +/// +/// @param dim +/// Number of element of vector A +/// +/// @param bList +/// Vectors b[0]...b[n-1]. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param invLenB +/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param numB +/// Number of B vectors. +/// +/// @param distances +/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvSumOfSquaredDiffss8( const int8_t* __restrict a, + float32_t invLenA, + uint32_t dim, + const int8_t* const * __restrict bList, + const float32_t* __restrict invLenB, + uint32_t numB, + float32_t* __restrict distances ); + + + +//------------------------------------------------------------------------------ +/// @brief +/// Adds a scalar value to every element of a Matrix. +/// +/// @details +/// Adds a floating point scalar value to each element of the source Matrix +/// and stores the result of the addition in the corresponding element +/// of the destination matrix. +/// +/// @param src +/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param scalar +/// The floating point scalar to be added to the source matrix. +/// +/// @param dst +/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. +/// +/// @param dstStride +/// Stride of the output matrix in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvAddScalarf32(const float32_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t scalar, + float32_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Adds a scalar value to every element of a Matrix. +/// +/// @details +/// Adds a signed 16-bit integer scalar value to each element of the source Matrix +/// and stores the result of the addition in the corresponding element +/// of the destination matrix. +/// \n\b NOTE : If the sum of the scalar and matrix element exceeds the maximum value +/// of a signed 16-bit integer, the result is clipped to this maximum value, while +/// if the sum goes below the minimum value of a signed 16-bit integer, it is clipped +/// to this minimum value. +/// +/// @param src +/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param scalar +/// The signed 16-bit integer scalar to be added to the source matrix. +/// +/// @param dst +/// Output 16-bit signed integer matrix. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of the output matrix in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvAddScalars16(const int16_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t scalar, + int16_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Multiplies a scalar value to every element of a Matrix. +/// +/// @details +/// Multiplies a floating point scalar value to each element of the source Matrix +/// and stores the result of the multiplication in the corresponding element +/// of the destination matrix. +/// +/// @param src +/// Input floating point matrix. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param scalar +/// The floating point scalar to be multiplied to the source matrix. +/// +/// @param dst +/// Output 32-bit floating point matrix. Size of buffer is dstStride*srcHeight bytes. +/// +/// @param dstStride +/// Stride of the output matrix in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMultiplyScalarf32(const float32_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t scalar, + float32_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Multiplies a scalar value to every element of a Matrix. +/// +/// @details +/// Multiplies a signed 16-bit scalar value to each element of the source Matrix +/// and stores the result of the multiplication in the corresponding element +/// of the destination matrix. +/// \n\b NOTE : If the product of the scalar and matrix element exceeds the maximum value +/// of a signed 16-bit integer, the result is clipped to this maximum value, while +/// if the product goes below the minimum value of a signed 16-bit integer, it is clipped +/// to this minimum value. The API can also handle fractional scalars. Use fixed point conversion +/// and use the shift parameter to decide the number of bits by which the result is shifted by. This +/// affects the precision of the result. If you wish to perform pure integer multiplication, set the +/// shift parameter to 0. +/// +/// @param src +/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param scalar +/// The signed 8-bit integer scalar to be multiplied to the source matrix. +/// +/// @param shift +/// The number of bits that the result has to be shifted by. Used to handle fractional scalar multiplication. +/// If your input scalar is a pure integer, set shift to 0. +/// +/// @param dst +/// Output signed 16-bit integer matrix. Size of buffer is dstStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of the output matrix in bytes. +/// \n\b NOTE: if 0, dstStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMultiplyScalars16( const int16_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int8_t scalar, + int8_t shift, + int16_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 +/// and the signature of fcvMinMaxLocu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocu8(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t *__restrict minVal, + uint8_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 +/// and the signature of fcvMinMaxLocu16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocu16(const uint16_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint16_t *__restrict minVal, + uint16_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, +/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 +/// and the signature of fcvMinMaxLocs16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocs16(const int16_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t *__restrict minVal, + int16_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 +/// and the signature of fcvMinMaxLocu32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocu32(const uint32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t *__restrict minVal, + uint32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 +/// and the signature of fcvMinMaxLocs32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocs32(const int32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t *__restrict minVal, + int32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their location in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 +/// and the signature of fcvMinMaxLocf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. +/// +/// @param src +/// Input unsigned 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// The X coordinate of the minimum value's location returned by the function +/// +/// @param minLocY +/// The Y coordinate of the minimum value's location returned by the function +/// +/// @param maxLocX +/// The X coordinate of the maximum value's location returned by the function +/// +/// @param maxLocY +/// The Y coordinate of the maximum value's location returned by the function +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocf32(const float32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t *__restrict minVal, + float32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocf32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocf32_v2 will be renamed to fcvMinMaxLocf32 +/// and the signature of fcvMinMaxLocf32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input 32-bit floating point matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(float32_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvMinMaxLocf32_v2(const float32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + float32_t *__restrict minVal, + float32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); + + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu8_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu8_v2 will be renamed to fcvMinMaxLocu8 +/// and the signature of fcvMinMaxLocu8 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input unsigned 8-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint8_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvMinMaxLocu8_v2(const uint8_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t *__restrict minVal, + uint8_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu16_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu16_v2 will be renamed to fcvMinMaxLocu16 +/// and the signature of fcvMinMaxLocu16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input unsigned 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint16_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvMinMaxLocu16_v2(const uint16_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint16_t *__restrict minVal, + uint16_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocs16_v2(). In the 2.0.0 release, +/// fcvMinMaxLocs16_v2 will be renamed to fcvMinMaxLocs16 +/// and the signature of fcvMinMaxLocs16 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input signed 16-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int16_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvMinMaxLocs16_v2(const int16_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int16_t *__restrict minVal, + int16_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocu32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocu32_v2 will be renamed to fcvMinMaxLocu32 +/// and the signature of fcvMinMaxLocu32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input unsigned 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(uint32_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvMinMaxLocu32_v2(const uint32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint32_t *__restrict minVal, + uint32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); + +//------------------------------------------------------------------------------ +/// @brief +/// Finds the minimum and maximum values, and their locations in a matrix +/// +/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future +/// release of this library (2.0.0). The new interface is specified in the +/// function: fcvMinMaxLocs32_v2(). In the 2.0.0 release, +/// fcvMinMaxLocs32_v2 will be renamed to fcvMinMaxLocs32 +/// and the signature of fcvMinMaxLocs32 as it appears now, +/// will be removed. +/// \n\n +/// +/// @details +/// Finds the minimum and maximum values in a matrix, and returns them. In addition +/// to this, it also returns the location (x,y) of the minimum and maximum values thus +/// found. If there are multiple minima/maxima, the function returns them all. If the +/// the number of minima and maxima are greater than the capacity of the minLoc and +/// maxLoc arrays, then the function returns as many locations as the capacity of these +/// arrays. +/// +/// @param src +/// Input signed 32-bit integer matrix. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Matrix. +/// +/// @param srcHeight +/// Height of the Matrix. +/// +/// @param srcStride +/// Stride of the Matrix in bytes. +/// \n\b NOTE: if 0, srcStride is set as srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as srcWidth*sizeof(int32_t) if not 0. +/// +/// @param minVal +/// This variable stores the minimum value of the src matrix found by the function +/// +/// @param maxVal +/// This variable stores the maximum value of the src matrix found by the function +/// +/// @param minLocX +/// An array of X coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param minLocY +/// An array of Y coordinates of the minimum value's location returned by the function +/// Must have @param nMinLocSize elements, i.e., allocated as nMinLocSize*sizeof(uint32_t) +/// +/// @param maxLocX +/// An array of X coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param maxLocY +/// An array of Y coordinates of the maximum value's location returned by the function +/// Must have @param nMaxLocSize elements, i.e., allocated as nMaxLocSize*sizeof(uint32_t) +/// +/// @param minCount +/// The number of minima found by the function +/// +/// @param maxCount +/// The number of maxima found by the function +/// +/// @param nMinLocSize +/// The maximum number of minima requested by the user to be found in the input image src. +/// The minLocX and minLocY arrays MUST be allocated to have atleast nMinLocSize elements. +/// +/// @param nMaxLocSize +/// The maximum number of maxima requested by the user to be found in the input image src. +/// The maxLocX and maxLocY arrays MUST be allocated to have atleast nMaxLocSize elements. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvMinMaxLocs32_v2(const int32_t *__restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + int32_t *__restrict minVal, + int32_t *__restrict maxVal, + uint32_t *__restrict minLocX, + uint32_t *__restrict minLocY, + uint32_t *__restrict maxLocX, + uint32_t *__restrict maxLocY, + uint32_t *__restrict minCount, + uint32_t *__restrict maxCount, + uint32_t nMinLocSize, + uint32_t nMaxLocSize); + +//------------------------------------------------------------------------------ +/// @brief +/// Transposes an interleaved RGB image +/// +/// @details +/// Computes the transpose of an interleaved RGB image src, and stores the result in +/// dst +/// +/// @param src +/// Input unsigned 8-bit integer image. Size of buffer is srcStride*srcHeight bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Width of the Image. +/// +/// @param srcHeight +/// Height of the Image. +/// +/// @param srcStride +/// Stride of the Image in bytes. +/// \n\b NOTE: if 0, srcStride is set as 3 x srcWidth. +/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcWidth if not 0. +/// +/// @param dst +/// Output unsigned 8-bit integer image. Size of buffer is dstStride*srcWidth bytes. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of the output image in bytes. +/// \n\b NOTE: if 0, srcStride is set as 3 x srcHeight. +/// \n\b WARNING: should be multiple of 8, and at least as much as 3 x srcHeight if not 0. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvTransposeRGB888u8(const uint8_t * __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t * __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Computes the cross-product of N pairs of 3x1 vectors +/// +/// @details +/// Computes the cross-product of N pairs of 3x1 vectors. For each pair of 3x1 vectors, +/// ai and bi, the output vector ci is given by ci = ai x bi +/// +/// @param a +/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is +/// as follows x0 y0 z0 x1 y1 z1 ....... +/// +/// @param b +/// Input buffer containing "N" 3x1 Vectors. Must be of length N * 3. The layout of the array is +/// as follows x0 y0 z0 x1 y1 z1 ....... +/// +/// @param c +/// Output buffer containing the resultant "N" 3x1 Vectors. Each 3 x 1 Vector in c is computed from the corresponding +/// 3 x 1 pairs in a & b. Must be of length N * 3. +/// +/// @param N +/// Number of vector pairs. For example if N = 10, then a, b and c will have to be 10 x 3 in length +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvCrossProduct3x1f32(const float32_t * __restrict a, + const float32_t * __restrict b, + float32_t * __restrict c, + uint32_t N); + +//------------------------------------------------------------------------------ +/// @brief +/// Solves a Linear System of Equations using LU-Decomposition +/// +/// @details +/// Solves a Linear System of Equations using LU Decomposition. Given +/// a system defined by A x = b, the function decomposes A into a lower +/// triangular matrix L and an upper triangular matrix U. It then computes x +/// by first solving L y = B by forward substitution for y, and then solving +/// the system of linear equations U x = y by backward substitution for x. +/// \n\b NOTE : Pivoting is used here to ensure that any non singular matrix +/// can be solved. This is because not all Matrices have a LU decomposition. +/// Pivoting helps to overcome this issue. +/// +/// @param A +/// Input coefficient matrix of the linear system of dimension N x N +/// \n\b WARNING: must be square. +/// +/// @param b +/// Component vector of the linear system of dimension N x 1 +/// +/// @param N +/// Dimension of the input Matrix A and component vector b +/// +/// @param pivot +/// An N x 1 pivot array which is populated as follows : For each k = 0, 1,...., N-1 +/// The ith element of pivot contains the row interchanged with row i when k = i. +/// Pivoting is used both for numerical stability and also ensuring that an LU factorization +/// exists for the input matrix A. +/// +/// @param x +/// The solution of the linear system, an N x 1 Vector. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvSolveLUf32(float32_t* __restrict A, + float32_t* __restrict b, + uint32_t N, + uint8_t* __restrict pivot, + float32_t* __restrict x); + + +//--------------------------------------------------------------------------- +/// @brief +/// Bitwise AND operation for each element of two uint8_t matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvBitwiseAndu8(const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + uint8_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Bitwise Exclusive Or operation for each element of two uint8_t matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvBitwiseXoru8( const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + uint8_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Bitwise Not operation for each element of two uint8_t matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvBitwiseNotu8(const uint8_t * src, + uint32_t width, + uint32_t height, + uint32_t srcStride, + uint8_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of two uint8_t type matrices to one uint8_t matrix +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvAddu8(const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride, + fcvConvertPolicy policy, + uint8_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of two int16_t type matrices which allows in-place operation +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvAdds16_v2( const int16_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t * __restrict src2, + uint32_t src2Stride, + fcvConvertPolicy policy, + int16_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix addition of one uint16_t type matrix and one uint8_t matrix +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (uint16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvAddu16u8u16 (const uint16_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride, + fcvConvertPolicy policy, + uint16_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix substration of two uint8_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvSubtractu8 ( const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride, + fcvConvertPolicy policy, + uint8_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix substration of two uint16_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvSubtracts16 (const int16_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t * __restrict src2, + uint32_t src2Stride, + fcvConvertPolicy policy, + int16_t * dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Matrix substration of two uint8_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. + +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvSubtractu8s16 ( const uint8_t * __restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * __restrict src2, + uint32_t src2Stride, + int16_t * __restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Element-wise multiplication of two int16_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param scaleFactor +/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results +/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value +/// of scaleFactor +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvElementMultiplys16( const int16_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const int16_t * src2, + uint32_t src2Stride, + int8_t scaleFactor, + fcvConvertPolicy policy, + int16_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Element-wise multiplication of two uint8_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param scaleFactor +/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results +/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value +/// of scaleFactor +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (int16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvElementMultiplyu8s16( const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * src2, + uint32_t src2Stride, + int8_t scaleFactor, + fcvConvertPolicy policy, + int16_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Element-wise multiplication of two uint8_t type matrices +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param scaleFactor +/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results +/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value +/// of scaleFactor +/// +/// @param policy +/// Conversion policy that decides how data overflow should be handled +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvElementMultiplyu8( const uint8_t * src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint8_t * src2, + uint32_t src2Stride, + int8_t scaleFactor, + fcvConvertPolicy policy, + uint8_t *__restrict dst, + uint32_t dstStride ); + +//--------------------------------------------------------------------------- +/// @brief +/// Calculate the weighted sum of two uint8_t type matrices +/// +/// @details +/// Specifically, when 0 <= alpha <= 1 and beta = 1-alpha, the function accumulates a weighted value from +/// an input image to an output image +/// \n\b NOTE: alpha and beta should be within the range of (-128.0, 127.996) and have up to three digits decimal precision +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param alpha +/// The weight value applied to src1 matrix, provided by float32_t type +/// +/// @param beta +/// The weight value applied to src2 matrix, provided by float32_t type +/// +/// @param dst +/// the result matrix (uint8_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success, +/// other values upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvAddWeightedu8(const uint8_t * src1, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t src1Stride, + const uint8_t *__restrict src2, + uint32_t src2Stride, + float32_t alpha, + float32_t beta, + uint8_t * dst, + uint32_t dstStride); + + +//--------------------------------------------------------------------------- +/// @brief +/// Add a squared value of one type uint8 matrix to the other type uint16 type matrix +/// +/// @param src1 +/// First source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param width +/// Width of the source matrix. +/// +/// @param height +/// Height of the source matrix. +/// +/// @param src1Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src1Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param src2 +/// Second source matrix. +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param src2Stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 src2Stride is default to width. +/// \n\b WARNING: should be multiple of 8 +/// +/// @param scaleFactor +/// The number of bits to be shifted to scale the result. When scaleFactor > 0, results +/// are right-shifted; when scaleFactor < 0, results are left-shifted by absolute value +/// of scaleFactor +/// +/// @param dst +/// the result matrix (uint16_t type). +/// \n\b NOTE: array should be 128-bit aligned +/// +/// @param dstStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 dstStride is default to width*2. +/// \n\b WARNING: should be multiple of 8 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup math_vector +//--------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvAddSquaredu8u16(const uint8_t *__restrict src1, + uint32_t width, + uint32_t height, + uint32_t src1Stride, + const uint16_t * src2, + uint32_t src2Stride, + int8_t scaleFactor, + uint16_t * dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Swap Chroma component order. +/// +/// @details +/// This function swaps the interleaved Chroma component order from CbCr to +/// CrCb or from CrCb to CbCr. +/// +/// @param src +/// Pointer to the input image +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param srcWidth +/// Input image width in the number of CbCr or CrCb pairs. +/// +/// @param srcHeight +/// The Chroma component height. +/// +/// @param srcStride +/// Stride of input image in bytes (i.e., number of bytes between column 0 of row 0 +/// and column 0 of row 1). If left at 0, srcStride is default to srcWidth * 2. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @param dst +/// Pointer to the output image +/// \n\b WARNING: size must match input image. +/// \n\b NOTE: should be 128-bit aligned +/// +/// @param dstStride +/// Stride of output image in bytes (i.e., number of bytes between column 0 of +/// row 0 and column 0 of row 1). If left at 0, dstStride is default to +/// srcWidth * 2. +/// \n\b NOTE: should be a multiple of 8. +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ + +FASTCV_API void +fcvColorCbCrSwapu8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride ); + + +//------------------------------------------------------------------------------ +/// @brief +/// Converts an image from RGB space to HSV space. +/// +/// @details +/// +/// @param src +/// Source 24-bit image, RGB888 format (R is MSB byte for the pixel) +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param srcWidth +/// Source image width. +/// +/// @param srcHeight +/// Source image height. +/// +/// @param srcStride +/// Stride of source image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, srcStride=srcWidth*3 as default +/// +/// @param dst +/// Destination 24-bit image. HSV888 format (H is MSB byte for the pixel) +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param dstStride +/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// If set to 0, dstStride=srcWidth*3 as default +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup color_conversion +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvColorRGB888ToHSV888u8( const uint8_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + uint8_t* __restrict dst, + uint32_t dstStride); + + +//------------------------------------------------------------------------------/ +/// @brief +/// SVM prediction for two classes +/// +/// @details +/// The function returns the confidence scores for test vectors using the equation: +/// confidence(i) = sum_j( svCoef[j] * Kernel(vec_i, sv_j) - rho; +/// The SVM model(svCoef, sv, rho) can be obtained using the training function of libSVM or openCV. +/// +/// @param kernelType +/// kernelType options: 'FASTCV_SVM_LINEAR','FASTCV_SVM_POLY','FASTCV_SVM_RBF','FASTCV_SVM_SIGMOID'. +/// FASTCV_SVM_LINEAR: Kernel(xi, xj) = xi'*xj +/// FASTCV_SVM_POLY: Kernel(xi, xi) = (gamma * xi' * xj + coef0)^degree, (gamma>0 , degree is positive integer). +/// FASTCV_SVM_RBF: Kernel(xi,xj) = exp(-gamma*||xi-xj||^2), (gamma>0). +/// FASTCV_SVM_SIGMOID: Kernel(xi, xj) = tanh(gamma * xi' * xj + coef0) +/// +/// @param degree +/// Parameter degree of a kernel function (FASTCV_SVM_POLY). +/// \n\b NOTE: Degree should be positive integer. +/// +/// @param gamma +/// Parameter of a kernel function (FASTCV_SVM_POLY / FASTCV_SVM_RBF / FASTCV_SVM_SIGMOID). +/// \n\b NOTE: gamma > 0 for FASTCV_SVM_Ploy and FASTCV_SVM_RBF +/// +/// @param coef0 +/// Parameter coef0 of a kernel function (FASTCV_SVM_LINEAR / FASTCV_SVM_POLY / FASTCV_SVM_SIGMOID). +/// +/// @param sv +/// Support vectors. +/// +/// @param svLen +/// Feature length, (support vector length = feature length). +/// +/// @param svNum +/// Number of support vectors. +/// +/// @param svStride +/// support vector stride. +/// Stride of support vector 2D matrix (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, svStride is set as svLen*sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. +/// +/// @param svCoef +/// Coefficent of support vectors, length equals to the Number of SV. +/// +/// @param rho +/// SVM bias. +/// +/// @param vec +/// Test vectors, it has same width as sv. +/// +/// @param vecNum +/// Number of test vectors. +/// +/// @param vecStride +/// Stride of test vectors. +/// Stride of test vector 2D matrix (i.e., how many bytes between column 0 of row 1 and +/// column 0 of row 2). +/// \n\b NOTE: if 0, vecStride is set as svLen*sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8, and at least as much as svLen if not 0. +/// +/// @param confidence +/// Output, store confidence value of each test vector. The length is vecNum. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup machine_learning +//------------------------------------------------------------------------------/ + +FASTCV_API fcvStatus +fcvSVMPredict2Classf32( fcvSVMKernelType kernelType, + uint32_t degree, + float32_t gamma, + float32_t coef0, + const float32_t* __restrict sv, + uint32_t svLen, + uint32_t svNum, + uint32_t svStride, + const float32_t* __restrict svCoef, + float32_t rho, + const float32_t* __restrict vec, + uint32_t vecNum, + uint32_t vecStride, + float32_t* __restrict confidence ); + + +// ----------------------------------------------------------------------------- +/// @brief +/// Optical flow (with stride so ROI can be supported) +/// +/// \n\b ATTENTION: This function is a duplication of +/// fcvTrackLKOpticalFlowu8() with the addition of extra parameters. +/// This function has been added to allow for backward compatibility +/// with the original function. When the 2.0.0 release of this library +/// is made, this function will be renamed to: \a fcvTrackLKOpticalFlowu8, +/// \a fcvTrackLKOpticalFlowu8_v3 will be removed, and the current signature +/// for \a fcvTrackLKOpticalFlowu8 will be removed. Until 2.0.0, the +/// developer should use this implementation with the expectation of +/// renaming it to \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. +/// \n\n +/// +/// @param src1 +/// Input image from frame #1. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param src2 +/// Input image from frame #2. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param width +/// Input image width. +/// +/// @param height +/// Input image height. +/// +/// @param stride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to width. +/// NOTE: should be a multiple of 8. +/// +/// @param src1Pyr +/// Image Pyramid of src1 (with stride) +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 +/// +/// @param src2Pyr +/// Image Pyradmid of src2 (with stride) +/// \n\b WARNING: obtained by calling fcvPyramidCreateu8_v3 +/// +/// @param featureXY +/// Pointer to X,Y floating point, sub-pixel coordinates for features to +/// track. Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureXY_out +/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features +/// Stored as X,Y tuples. featureXY array storage must +/// be >= featureLen*2. +/// +/// @param featureXY_estimate +/// Pointer to X,Y floating point, sub-pixel coordinates for estimated features +/// on the new frame stored as X,Y tuples. featureXY array storage must +/// has the same length as featureXY +/// +/// @param featureStatus +/// Pointer to integer array for status of each feature defined in +/// featureXY. featureStatus array storage must +/// be >= featureLen. +/// +/// @param featureLen +/// Number of features in featuresXY and featureStatus array. +/// +/// @param windowWidth +/// Width of window for optical flow searching. Must be odd number. +/// \n\b NOTE: suggested value 5, 7 or 9 +/// +/// @param windowHeight +/// Height of window for optical flow searching. Must be odd number. +/// \n\b NOTE:: suggested value 5, 7 or 9 +/// +/// @param nPyramidLevels +/// Number of pyramid levels. +/// \n\b NOTE: suggested value 3 or 4 depending on size of image +/// +/// @param termCriteria +/// The enum parameter to specify termination criteria. See fcvTerminationCriteria for details +/// +/// @param maxIterations +/// Maximum number of LK iterations to perform per pyramid level if +/// FASTCV_TERM_CRITERIA_ITERATIONS is set as the termCriteria +/// \n\b NOTE: will be saturated to range [1, 100]; suggested value 5 or 7 +/// +/// @param maxEpsilon +/// Epsilon value in float32_t for error measure to determine the iteration +/// \n\b NOTE: the value should be within [0, 10]; suggested value 0.03*0.03 +/// +/// @param use_initial_estimate +/// The flag indicatiing if to use initial estimations stored in featureXY_estimate +/// to start the search. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvTrackLKOpticalFlowu8_v3 ( const uint8_t *__restrict src1, + const uint8_t *__restrict src2, + uint32_t width, + uint32_t height, + uint32_t stride, + const fcvPyramidLevel_v2 * __restrict src1Pyr, + const fcvPyramidLevel_v2 * __restrict src2Pyr, + const float32_t * __restrict featureXY, + const float32_t * __restrict featureXY_estimate, + float32_t * __restrict featureXY_out, + int32_t * __restrict featureStatus, + int32_t featureLen, + int32_t windowWidth, + int32_t windowHeight, + int32_t nPyramidLevels, + fcvTerminationCriteria termCriteria, + int32_t maxIterations, + float32_t maxEpsilon, + int32_t use_initial_estimate); + +//------------------------------------------------------------------------------ +/// @brief +/// Undistort a disparity image and optionally convert the undistorted disparity image into a +/// depth image. +/// +/// @param src +/// Pointer to the disparity input image +/// +/// @param srcWidth +/// Width of the disparity input image in pixel. The number of pixels in a row. +/// +/// @param srcHeight +/// Height of the disparity input image in pixel. +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) +/// \n\b NOTE: should be multiple of 8. +/// +/// @param mask +/// Pointer to the returned foreground mask image. +/// It's a 1-channel image, same width and height as src. +/// If an entry set to 1, there will be a valid undistorted dispartity or depth value. +/// If an entry set to 0, there will be no valid undistorted dispartity or depth value. +/// +/// @param maskStride +/// Stride of the foreground mask image. It's the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 MaskStride is default to srcWidth. +/// \n\b NOTE: should be multiple of 8. +/// +/// @param pixelDistortion +/// Pointer to the pixel distortion value for each pixel in the image. It has the same dimensions +/// as the input image src. +/// +/// @param pixelDistortionStride +/// Stride of pixel distortion value for each pixel in the image. +/// It's the number of bytes between column 0 of row 1 and column 0 of row 2 in data memory. +/// If left at 0 pixelDistortionStride is default to srcWidth*sizeof(float32_t). +/// \n\b WARNING: should be multiple of 8 +/// +/// @param convertDepth +/// This parameter is a flag to enable or disable the conversion of disparity to depth. +/// If set to 1, then the undistorted disparity values will be converted to depth +/// and returned in the dst buffer. +/// If set to 0, then the undistorted disparity will be returned in the dst buffer. +/// +/// @param imageDistortion +/// ImageDistortion contains two elements. The First part contains the spatial distortion pattern, +/// and the second part contains the decay of the distortion effect. +/// +/// @param depthParam +/// Parameters used to transform disparity to depth values. +/// The equation is +/// undistortedDepthValue = 1 / (undistortedDisparityValue * depthParam[0] + depthParam[1]) +/// +/// @param dst +/// Output matrix which has the same width, length and channel number as src. +/// The buffer contains undistorted disparity values if convertDepth is set to 0 and +/// contains the undistorted depth values if convertDepth is set to 1 +/// +/// @param dstStride +/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) +/// \n\b NOTE: should be multiple of 8. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvUndistortDisparityConvertDepthf32(const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const uint8_t* __restrict mask, + uint32_t maskStride, + const float32_t* __restrict pixelDistortion, + uint32_t pixelDistortionStride, + uint32_t convertDepth, + const float32_t* __restrict imageDistortion, + const float32_t* __restrict depthParam, + float32_t* __restrict dst, + uint32_t dstStride); + + +//------------------------------------------------------------------------------ +/// @brief +/// Registers an input Depth Image with an input Color Image +/// +/// @param src +/// Pointer to the input depth image +/// +/// @param srcWidth +/// The width of the input depth image. +/// +/// @param srcHeight +/// The height of the input depth image +/// +/// @param srcStride +/// Stride of image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). +/// \n\b NOTE: should be multiple of 8. +/// +/// @param Kdinv +/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix +/// arranged row wise. +/// +/// @param Kc +/// Kc is an array of 9 elements which represents the 3x3 color camera intrinsic parameters +/// arranged row wise +/// +/// @param Rd2c +/// Rd2c is an array of 9 element which represents the 3D Rotation (3x3) matrix from the Depth +/// Camera to the Color Camera arranged row wise +/// +/// @param Td2c +/// Td2c is an array of 3 element which represents the transform parameter from the Depth +/// Camera to the Color Camera. +/// +/// @param dst +/// Output matrix which has the same width, length and channel number as src +/// +/// @param dstStride +/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t) +/// \n\b NOTE: should be multiple of 8. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ + +FASTCV_API fcvStatus +fcvRegisterDepthImagef32(const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const float32_t* __restrict Kdinv, + const float32_t* __restrict Kc, + const float32_t* __restrict Rd2c, + const float32_t* __restrict Td2c, + float32_t* __restrict dst, + uint32_t dstStride); + +//------------------------------------------------------------------------------ +/// @brief +/// Convert depth image into 3D point Cloud +/// +/// @param src +/// Pointer to the depth image +/// +/// @param srcWidth +/// Width of the depth image in pixel. The number of pixels in a row. +/// +/// @param srcHeight +/// Height of the depth image in pixel +/// +/// @param srcStride +/// Stride of depth image is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*sizeof(float32_t). +/// \n\b NOTE: should be multiple of 8. +/// +/// @param Kdinv +/// Kdinv is an array of 9 elements representing the inverse of the 3x3 depth camera matrix +/// arranged row wise. +// +/// @param dst +/// Pointer to the 3D point cloud in an interleaved fashion x0,y0,z0,x1,y1,z1. +/// It has a width of 3*srcWidth and has the same height as the src buffer. +/// +/// @param dstStride +/// Stride for output image, i.e. the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 srcStride is default to 3*srcWidth*sizeof(float32_t) +/// \n\b NOTE: should be multiple of 8. +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup 3D_reconstruction +//------------------------------------------------------------------------------ +FASTCV_API fcvStatus +fcvConvertDepthImageToPointCloudf32(const float32_t* __restrict src, + uint32_t srcWidth, + uint32_t srcHeight, + uint32_t srcStride, + const float32_t* __restrict Kdinv, + float32_t* __restrict dst, + uint32_t dstStride); + +// ----------------------------------------------------------------------------- +/// @brief +/// Extract Histogram of Oriented Gradients (HOG) descriptor given an image's gradient strength +/// and orientation +/// +/// @param strength +/// The gradient strength at each pixel. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param width +/// Input window width. +/// +/// @param height +/// Input window height. +/// +/// @param strengthStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 strengthStride is default to width*2. +/// NOTE: should be a multiple of 8. +/// +/// @param orientation +/// Gradient orientation at each pixel. When normMethod is FASTCV_HOG_NORM_REGULAR or +/// FASTCV_HOG_NORM_RENORMALIZATION, orientation should be within range of [0, 179]; while +/// FASTCV_HOG_NORM_FHOG is used, orientation should be within [0, 359] to meet its contrast- +/// sensitive requirements. +/// \n\b WARNING: should be 128-bit aligned. +/// +/// @param orientationStride +/// Stride is the number of bytes between column 0 of row 1 and +/// column 0 of row 2 in data memory. If left at 0 orientationStride is default to width*2. +/// NOTE: should be a multiple of 8. +/// +/// @param cellSize +/// The size of one cell in pixels. The typical cell size is 4. +/// +/// @param blockSize +/// Block size in pixels. It must be a multiple of cellSize. +/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockSize is by default equal to cellSize +/// +/// @param blockStep +/// Block step in pixels when sliding the block over the image. If the blockStep +/// is a multiple of cellSize, faster approach would be taken when normMethod +/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. +/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize +/// +/// @param binSize +/// Number of bins in the gradient histogram. Typical binSize is 9. +/// +/// @param normMethod +/// The enum parameter to specify the normalization method for HOG descriptor construction. See +/// fcvHOGNormMethod for details. +/// +/// @param hogVector +/// The output descriptor vector in uint16_t. The length of the vector is obtained by fcvGetHOGVectorLengthu32 +/// +/// @return +/// FASTCV_SUCCESS upon success. +/// Other status codes upon failure. +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvExtractHOGu16(const uint16_t* __restrict strength, + uint32_t width, + uint32_t height, + uint32_t strengthStride, + const uint16_t* __restrict orientation, + uint32_t orientationStride, + uint32_t cellSize, + uint32_t blockSize, + uint32_t blockStep, + uint32_t binSize, + fcvHOGNormMethod normMethod, + uint16_t* __restrict hogVector, + uint32_t flen, + void* handle); + +// ----------------------------------------------------------------------------- +/// @brief +/// Calculate the length of the output vector for HOG extraction +/// +/// @param width +/// Input window width. +/// +/// @param height +/// Input window height. +/// +/// @param cellSize +/// The size of one cell in pixels. The typical cell size is 4. +/// +/// @param blockSize +/// Block size in pixels. It must be a multiple of cellSize. +/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize +/// +/// @param blockStep +/// Block step in pixels when sliding the block over the image. If the blockStep +/// is a multiple of cellSize, faster approach would be taken when normMethod +/// is FASTCV_HOG_NORM_REGULAR or FASTCV_HOG_NORM_RENORMALIZATION. +/// \n\b WARNING: When normMethod is FASTCV_HOG_NORM_FHOG, blockStep is by default equal to cellSize +/// +/// @param binSize +/// Number of bins in the gradient histogram. Typical binSize is 9. +/// +/// @param normMethod +/// The enum parameter to specify the normalization method for HOG descriptor construction. See +/// fcvHOGNormMethod for details. +/// +/// @param +/// The length of HOG vector in uint32_t +/// +/// @param hogHandle +/// Output. the hogHandle to be used in subsequent calls. +/// +/// @ingroup object_detection +// ----------------------------------------------------------------------------- + +FASTCV_API fcvStatus +fcvHOGInit(uint32_t width, + uint32_t height, + uint32_t cellSize, + uint32_t blockSize, + uint32_t blockStep, + uint32_t binSize, + fcvHOGNormMethod normMethod, + uint32_t *vecLength, + void **hogHandle + ); +//------------------------------------------------------------------------------ +/// @brief Function to release HOG resources. +/// @param hogHandle +/// Handle to be used to free up HOG resources. +/// @ingroup object_detection +//------------------------------------------------------------------------------ + +FASTCV_API void fcvHOGDeInit(void* hogHandle); + + + +#ifdef __cplusplus +}//extern "C" +#endif + +#endif diff --git a/phonelibs/fastcv/x64/include/fastcv.h b/phonelibs/fastcv/x64/include/fastcv.h deleted file mode 100755 index 0bffaba27..000000000 --- a/phonelibs/fastcv/x64/include/fastcv.h +++ /dev/null @@ -1,23220 +0,0 @@ -#ifndef FASTCV_H -#define FASTCV_H - -/**============================================================================= - -@file - fastcv.h - -@brief - Public API - - -Copyright (c) 2011-2013 Qualcomm Technologies Incorporated. -All Rights Reserved Qualcomm Technologies Proprietary - -Export of this technology or software is regulated by the U.S. -Government. Diversion contrary to U.S. law prohibited. - -All ideas, data and information contained in or disclosed by -this document are confidential and proprietary information of -Qualcomm Technologies Incorporated and all rights therein are expressly reserved. -By accepting this material the recipient agrees that this material -and the information contained therein are held in confidence and in -trust and will not be used, copied, reproduced in whole or in part, -nor its contents revealed in any manner to others without the express -written permission of Qualcomm Technologies Incorporated. - -=============================================================================**/ - -/**============================================================================= -@mainpage FastCV Public API Documentation - -@version 1.2.2 - -@section Overview Overview - -FastCV provides two main features to computer vision application developers: - - First, it provides a library of frequently used computer vision (CV) - functions, optimized to run efficiently on mobile devices. - - Second, it provides a clean processor-agnostic hardware acceleration API, - under which chipset vendors can hardware accelerate FastCV functions on - their hardware. - -This initial release (FastCV 1.0) only supports Android mobile developers; -however, we intend to support iOS and Windows devices as soon as possible. -FastCV 1.0 is available for download for free from developer.qualcomm.com. - -FastCV 1.0 is released as a unified binary, a single binary containing two -implementations of the library. - - The first implementation runs on ARM processor, and is referred to as - the "FastCV for ARM." - - The second implementation runs only on Qualcomm Snapdragon - chipsets, and is called "FastCV for Snapdragon." - -Releases are generally motivated for the following reasons: - - Changes to previously released APIs - - Addition of new functions - - Performance improvements and/or bug fixes - also known as implementation - modifications - - Each motivation has a varying degree of impact on the user of the library. - The general release numbering scheme captures this variety of motivations. - - Given release ID: A.B.C - - An increase in "A" indicates that a previously released API has changed, - so a developer may encounter compilation issues which require modification - of their code in order to adhear to the modified API. Qualcomm will make - every effort to minimize these changes. Additionally, new functions and - implementation modifications may be present. - - An increase in "B" indicates that new functions have been added to the - library, so additional functionality is available, however existing APIs - have not changed. Additionally, implementation modifications may be - present. - - An increase in "C" indicates that implementation modifications only have - been made. - -@defgroup math_vector Math / Vector Operations -@details Commonly used vector & math functions - -@defgroup image_processing Image processing -@details Image filtering, convolution and scaling operations - -@defgroup image_transform Image transformation -@details Warp perspective, affine transformations - -@defgroup feature_detection Feature detection -@details Fast corner detection, harris corner detection, canny edge detection, etc. - -@defgroup object_detection Object detection -@details Object detection functions such as NCC template match, etc. - -@defgroup 3D_reconstruction 3D reconstruction -@details Homography, pose evaluation functions - -@defgroup color_conversion Color conversion -@details Commonly used formats supported: e.g., YUV, RGB, YCrCb, etc. - -@defgroup clustering_and_search Clustering and search -@details K clusters best fitting of a set of input points - -@defgroup Motion_and_Object_Tracking Motion and object tracking -@details Supports and tracking functions - -@defgroup Structural_Analysis_and_Drawing Shape and drawing -@details Contour and polygon drawing functions - -@defgroup mem_management Memory Management -@details Functions to allocate and deallocate memory for use with fastCV. - -@defgroup misc Miscellaneous -@details Support functions - -**/ - -//============================================================================== -// Defines -//============================================================================== - -#define FASTCV_VERSION 122 - -#ifdef __GNUC__ - /// Macro to align memory at 4-bytes (32-bits) for GNU-based compilers. - #define FASTCV_ALIGN32( VAR ) (VAR) __attribute__ ((aligned(4))) - /// Macro to align memory at 8-bytes (64-bits) for GNU-based compilers. - #define FASTCV_ALIGN64( VAR ) (VAR) __attribute__ ((aligned(8))) - /// Macro to align memory at 16-bytes (128-bits) for GNU-based compilers. - #define FASTCV_ALIGN128( VAR ) (VAR) __attribute__ ((aligned(16))) - #ifdef BUILDING_SO - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __attribute__ ((visibility ("default"))) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#else - /// Macro to align memory at 4-bytes (32-bits) for MSVC compiler. - #define FASTCV_ALIGN32( VAR ) __declspec(align(4)) (VAR) - /// Macro to align memory at 8-bytes (64-bits) for MSVC compiler. - #define FASTCV_ALIGN64( VAR ) __declspec(align(8)) (VAR) - /// Macro to align memory at 16-bytes (128-bits) for MSVC compiler. - #define FASTCV_ALIGN128( VAR ) __declspec(align(16)) (VAR) - #ifdef BUILDING_DLL - /// MACRO enables function to be visible in shared-library case. - #define FASTCV_API __declspec(dllexport) - #else - /// MACRO empty for non-shared-library case. - #define FASTCV_API - #endif -#endif - -//============================================================================== -// Included modules -//============================================================================== - -#include - -#ifndef FASTCV_STDINT -#define FASTCV_STDINT - #ifdef _MSC_VER - - #if _MSC_VER <= 1500 - // stdint.h support for VS2008 and older - #include "stdint_.h" - #else - #include - #endif - - typedef float float32_t; - typedef double float64_t; - - #else - - #ifdef __ARM_NEON__ - #include - #else - #include - typedef float float32_t; - typedef double float64_t; - #endif - - #endif -#endif - -//============================================================================== -// Declarations -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines operational mode of interface to allow the end developer to -/// dictate how the target optimized implementation should behave. -//------------------------------------------------------------------------------ -typedef enum -{ - /// Target-optimized implementation uses lowest power consuming - /// implementation. - FASTCV_OP_LOW_POWER = 0, - - /// Target-optimized implementation uses higheset performance implementation. - FASTCV_OP_PERFORMANCE = 1, - - /// Target-optimized implementation offloads as much of the CPU as possible. - FASTCV_OP_CPU_OFFLOAD = 2, - - /// Values >= 0x80000000 are reserved - FASTCV_OP_RESERVED = 0x80000000 - -} fcvOperationMode; - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a structure to contain points correspondence data. -//------------------------------------------------------------------------------ -typedef struct -{ - /// Tuples of 3 values: xFrom,yFrom,zFrom. Float array which this points to - /// must be greater than or equal to 3 * numCorrespondences. - const float32_t* from; - /*~ FIELD fcvCorrespondences.from - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.fromStride ? fcvCorrespondences.fromStride : 3) ) */ - - /// Tuples of 2 values: xTo,yTo. Float array which this points to - /// must be greater than or equal to 2 * numCorrespondences. - const float32_t* to; - /*~ FIELD fcvCorrespondences.to - VARRAY LENGTH ( fcvCorrespondences.numCorrespondences * \ - (fcvCorrespondences.toStride ? fcvCorrespondences.toStride : 2) ) */ - - /// Distance in bytes between two coordinates in the from array. - /// If this parameter is set to 2 or 3, a dense array is assume (stride will - /// be sizeof(float) times 2 or 3). The minimum value of fromStride - /// should be 2. - uint32_t fromStride; - - /// Distance in bytes between two coordinates in the to array. - /// If this parameter is set to 2, a dense array is assume (stride will - /// be 2 * sizeof(float)). The minimum value of toStride - /// should be 2. - uint32_t toStride; - - /// Number of points in points correspondences. - uint32_t numCorrespondences; - - /// Array of inlier indices for corrs array. Processing will only occur on - /// the indices supplied in this array. Array which this points to must be - /// at least numIndices long. - const uint16_t* indices; - /*~ FIELD fcvCorrespondences.indices VARRAY LENGTH (fcvCorrespondences.numIndices) */ - - /// Length of indices array. - uint32_t numIndices; -} fcvCorrespondences; - - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure representing an image pyramid level -//------------------------------------------------------------------------------ - -typedef struct -{ - const void* ptr; - unsigned int width; - unsigned int height; -} fcvPyramidLevel ; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure describing node of a tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodef32 -{ - /// the split value at the node - float32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodef32; - -// ----------------------------------------------------------------------------- -/// @brief -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchf32 -{ - /// square of minimal distance from query for all nodes below - float32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchf32; - -// ----------------------------------------------------------------------------- -/// @brief -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8f32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const float32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indice of root nodes of trees - int32_t* trees; - - /// array of nodes of all trees - fcvKDTreeNodef32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchf32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8f32; - - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure describing node of tree; -/// Assumption is that nodes of all trees are stored in in a single array -/// and all indices refer to this array -/// @remark -/// if indices of both children are negative the node is a leaf -// ---------------------------------------------------------------------------- -typedef struct fcvKDTreeNodes32 -{ - /// the split value at the node - int32_t divVal; - - /// dimension at which the split is made; - /// if this is a leaf (both children equal to -1) then this is - /// the index of the dataset vector - int32_t divFeat; - - /// index of the child node with dataset items to the left - /// of the split value - int32_t childLeft; - - /// index of the child node with dataset items to the right - /// of the split value - int32_t childRight; - -} fcvKDTreeNodes32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// structure describing a branch (subtree) -/// @remark -/// branches are stored on the priority queue (heap) for backtracking -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeBranchs32 -{ - /// square of minimal distance from query for all nodes below - int32_t minDistSq; - - /// index of the top node of the branch - int32_t topNode; - -} fcvKDTreeBranchs32; - -// ----------------------------------------------------------------------------- -/// @brief -/// fixed point kdtrees -/// Structure with KDTrees data -// ----------------------------------------------------------------------------- -typedef struct fcvKDTreeDatas8s32 -{ - // info about the dataset for which KDTrees are constructed - /// the dataset of vectors - const int8_t *dataset; - - /// array with inverse lengths of dataset vectors - const int32_t* invLen; - - /// number of vectors in the dataset - int32_t numVectors; - - // info about trees - /// indices of root nodes of all trees - int32_t* trees; - - /// number of trees used - int32_t numTrees; - - /// array of nodes of all trees - fcvKDTreeNodes32* nodes; - - /// number of all nodes - int32_t numNodes; - - /// capacity of node array - int32_t maxNumNodes; - - // info used during lookups - /// priority queue - fcvKDTreeBranchs32* heap; - - /// number of branches on the priority queue - int32_t numBranches; - - /// capactiy of the priority queue - int32_t maxNumBranches; - - /// array of indices to vectors in the dataset; - /// during searches used to mark checkID; - /// should have numVectors capacity - int32_t* vind; - - /// unique ID for each lookup - int32_t checkID; - - /// number of nearest neighbors to find - int32_t numNNs; - -} fcvKDTreeDatas8s32; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of rectangle -//------------------------------------------------------------------------------ -typedef struct -{ - ///x-coordinate of the top-left corner - int32_t x; - ///y-coordinate of the top-left corner - int32_t y; - ///width of the rectangle - uint32_t width; - ///height of the rectangle - uint32_t height; -} fcvRectangleInt; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of termination criteria -//------------------------------------------------------------------------------ -typedef struct -{ - /// Maxmimum number of iteration - int32_t max_iter; - /// - float32_t epsilon; -}fcvTermCriteria; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of 2D box used for tracking -//------------------------------------------------------------------------------ -typedef struct -{ - // Center of the box - ///x-coordinate of the 2D point - int32_t x; - ///y-coordinate of the 2D point - int32_t y; - // The box size - int32_t columns; - int32_t rows; - // The orientation of the principal axis - int32_t orientation; -}fcvBox2D; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct of code word -//------------------------------------------------------------------------------ -typedef struct fcvBGCodeWord -{ - /// Pointer to next codebook element - struct fcvBGCodeWord* next; - - /// Last update time - int32_t tLastUpdate; - - /// Longest period of inactivity - int32_t stale; - /// Min value of pixel for each channel - uint8_t min0, min1, min2; - - /// Max value of pixel for each channel - uint8_t max0, max1, max2; - - /// Min value of learning boundary for each channel - uint8_t learnLow0, learnLow1, learnLow2; - - /// Max value of learning boundary for each channel - uint8_t learnHigh0, learnHigh1, learnHigh2; -} fcvBGCodeWord; - -//------------------------------------------------------------------------------ -/// @brief -/// Defines a struct for circle -//------------------------------------------------------------------------------ -typedef struct fcvCircle -{ - int32_t x; - int32_t y; - int32_t radius; -} fcvCircle; - -//============================================================================== -// UTILITY FUNCTIONS -//============================================================================== - -#ifdef __cplusplus -extern "C" -{ -#endif - -//------------------------------------------------------------------------------ -/// @brief -/// Retrieves version of FastCV library. -/// -/// @param version -/// Pointer to location to put string. -/// -/// @param versionLength -/// Length of storage for version string. -/// -/// @ingroup misc -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGetVersion( char* version, - unsigned int versionLength ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Selects HW units for all routines at run-time. Can be called anytime to -/// update choice. -/// -/// @param mode -/// See enum for details. -/// -/// @return -/// 0 if successful. -/// 999 if minmum HW requirement not met. -/// other #'s if unsuccessful. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvSetOperationMode( fcvOperationMode mode ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Clean up FastCV resources. Must be called before the program exits. -/// -/// @ingroup misc -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCleanUp( void ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Allocates memory for Pyramid -/// -/// @param pyr -/// Pointer to an array of qcvaPyramidLevel -/// -/// @param baseWidth -/// Width of the base level: the value assigned to pyr[0].width -/// -/// @param baseHeight -/// Height of the base level: the value assigned to pyr[0].height -/// -/// @param bytesPerPixel -/// Number of bytes per pixel: -/// \n e.g for uint8_t pyramid, bytesPerPixel = 1 -/// \n for int32_t pyramid, bytesPerPixel = 4 -/// -/// @param numLevels -/// number of levels in the pyramid -/// -/// @param allocateBase -/// \n if set to 1, memory will be allocated for the base level -/// \n if set to 0, memory for the base level is allocated by the callee -/// \n\b WARNING: How this parameter is set will impact how the memory is freed. -/// Please refer to fcvPyramidDelete for details. -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidAllocate( fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Deallocates an array of fcvPyramidLevel. Can be used for any -/// type(f32/s8/u8). -/// -/// @param pyr -/// pyramid to deallocate -/// -/// @param numLevels -/// Number of levels in the pyramid -/// -/// @param startLevel -/// Start level of the pyramid -/// \n\b WARNING: if pyr was allocated with allocateBase=0 which means baselevel memory -/// was allocated outside of fcvPyramidAllocate, then startLevel -/// for fcvPyramidDelete has to be set to 1 (or higher). -/// -/// @ingroup mem_management -//---------------------------------------------------------------------------- - -FASTCV_API void -fcvPyramidDelete( fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates aligned memory. -/// -/// @param nBytes -/// Number of bytes. -/// -/// @param byteAlignment -/// Alignment specified in bytes (e.g., 16 = 128-bit alignment). -/// \n\b WARNING: must be < 255 bytes -/// -/// @return -/// SUCCESS: pointer to aligned memory -/// FAILURE: 0 -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void* -fcvMemAlloc( unsigned int nBytes, - unsigned int byteAlignment ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Frees memory allocated by fcvMemAlloc(). -/// -/// @param ptr -/// Pointer to memory. -/// -/// @ingroup mem_management -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvMemFree( void* ptr ); - -#ifdef __cplusplus -}//extern "C" -#endif -//End - Utility functions - - -//============================================================================== -// FUNCTIONS -//============================================================================== - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterMedian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterMedian3x3u8_v2 will be renamed to fcvFilterMedian3x3u8 -/// and the signature of fcvFilterMedian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dstImg ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 median filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterMedian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterMedian3x3u8, -/// \a fcvFilterMedian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterMedian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterMedian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param srcImg -/// Input 8-bit image. Size of buffer is srcStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dstImg -/// Output 8-bit image. Size of buffer is dstStride*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian3x3u8_v2 will be renamed to fcvFilterGaussian3x3u8 -/// and the signature of fcvFilterGaussian3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight byte. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Destination buffer size is srcWidth*srcHeight. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 3x3 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian3x3u8, -/// \a fcvFilterGaussian3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 3x3 Gaussian kernel: -/// \n 1 2 1 -/// \n 2 4 2 -/// \n 1 2 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 1 pixel in the 3x3 -/// case). -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5u8_v2 will be renamed to fcvFilterGaussian5x5u8 -/// and the signature of fcvFilterGaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5u8, -/// \a fcvFilterGaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 2 pixel in the 5x5 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian11x11u8_v2(). In the 2.0.0 release, -/// fcvFilterGaussian11x11u8_v2 will be renamed to fcvFilterGaussian11x11u8 -/// and the signature of fcvFilterGaussian11x11u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int blurBorder ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Blurs an image with 11x11 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian11x11u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian11x11u8, -/// \a fcvFilterGaussian11x11u8_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian11x11u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian11x11u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 11x11 Gaussian kernel: -/// \n 1 10 45 120 210 252 210 120 45 10 1 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 252 2520 11340 30240 52920 63504 52920 30240 11340 2520 252 -/// \n 210 2100 9450 25200 44100 52920 44100 25200 9450 2100 210 -/// \n 120 1200 5400 14400 25200 30240 25200 14400 5400 1200 120 -/// \n 45 450 2025 5400 9450 11340 9450 5400 2025 450 45 -/// \n 10 100 450 1200 2100 2520 2100 1200 450 100 10 -/// \n 1 10 45 120 210 252 210 120 45 10 , 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 1, border is blurred by 0-padding adjacent values. If set to 0, -/// borders up to half-kernel width are ignored (e.g. 5 pixel in the 11x11 -/// case). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved) to RGB 8888. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorYCrCb420PseudoPlanarToRGB8888u8. In the 2.0.0 release, -/// the signature of fcvColorYUV420toRGB8888u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R is at LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCrCb) 4:2:0 PesudoPlanar (Interleaved CrCb) to RGB 888. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV picture. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CrCb plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cr0 Cb0 Cr1 Cb1 ... -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcYStride -/// Stride (in bytes) of input image Y component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2). -/// \n\b WARNING: Must be multiple of 8 (8 * 1-byte values). -/// -/// @param srcCStride -/// Stride (in bytes) of input image Chroma component (i.e., number of bytes between -/// column 0 of row 1 and column 0 of row 2) -/// \n\b WARNING: Must be multiple of 4 (4 * 1-byte values). -/// -/// @param dst -/// 32-bit image of output RGB 8888 values. R in LSB. -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output RGB image (i.e., number of bytes between column 0 of -/// row 1 and column 0 of row 2) -/// \n\b WARNING: Must be multiple of 32 (8 * 4-byte values). -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YUV (YCbCr) 4:2:0 PesudoPlanar (Interleaved CbCr) to RGB 565. -/// -/// \n\b ATTENTION: The name of this function will be changed when the 2.0.0 release -/// of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different name when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// 8-bit image of input YUV 4:2:0 values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// The input are one Y plane followed by one interleaved and 2D (both -/// horizontally and vertically) sub-sampled CbCr plane: -/// Y plane : Y00 Y01 Y02 Y03 ... -/// Y10 Y11 Y12 Y13 ... -/// Interleaved and 2D sub-sampled plane: Cb0 Cr0 Cb1 Cr1 ... -/// -/// @param dst -/// 16-bit image of output RGB 565 values. R in LSBs. -/// 2 pixels are packed into one 32-bit output -/// \n\b WARNING: size must match input yuv420. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 4 -/// -/// @param srcHeight -/// Image height. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYUV420toRGB565u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint32_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V1 (YCbCr 4:4:4 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit image of input values. Stored as YCbCr H1V1 planar format in 8x8 blocks for Y,Cb,Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V2 (YCbCr 4:2:0 planar) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H2V2 planar format in 16x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V2toRGB888u8( const uint8_t* __restrict ysrc, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H2V1 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H2V1 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param src -/// 8-bit input values. Stored as YCbCr H2V1 planar format in 16x8 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH2V1toRGB888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from YCbCr H1V2 to RGB 888. -/// -/// @details -/// Color conversion from YCbCr H1V2 (YCbCr 4:2:2) to RGB 888. -/// \n R = Y + 1.40200*(Cr-128) -/// \n G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128) -/// \n B = Y + 1.77200*(CB-128) -/// -/// @param ysrc -/// 8-bit input values. Stored as YCbCr H1V2 planar format in 8x16 blocks for Y, 8x8 blocks for Cb, Cr. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit image of output RGB 888 values. R in LSB. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorYCrCbH1V2toRGB888u8( const uint8_t* __restrict ysrc, - - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvColorRGB888toYCrCbu8_v2(). In the 2.0.0 release, -/// fcvColorRGB888toYCrCbu8_v2 will be renamed to fcvColorRGB888toYCrCbu8 -/// and the signature of fcvColorRGB888toYCrCbu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Color conversion from RGB 888 to YCrCb 4:4:4 (Full interleaved, similar to -/// 3-channel RGB). -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvColorRGB888toYCrCbu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvColorRGB888toYCrCbu8, -/// \a fcvColorRGB888toYCrCbu8_v2 will be removed, and the current signature -/// for \a fcvColorRGB888toYCrCbu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvColorRGB888toYCrCbu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Color conversion from RGB 888 to YCrCb 4:4:4 interleaved. -/// -/// @param src -/// 8-bit input values. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: Must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// @param dst -/// 8-bit output values. Stored as Y, Cr, Cb interleaved format. -/// \n\b WARNING: size must match input crcb. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b WARNING: Must be at least 3*srcWidth. -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvColorRGB888toYCrCbu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Create a 36-dimension gradient based descriptor on 17x17 patch. -/// -/// @details -/// -/// @param patch -/// Input luminance data for 17x17 patch to describe. -/// -/// @param descriptorChar -/// Output descriptor vector. 36 x 8-bit vector. Normalized and quantized to range [-127, 127] -/// -/// @param descriptorNormSq -/// Output squared norm (L2 norm) of the descriptor vector. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 8-bit vectors. -/// -/// @param a -/// Vector A. -/// -/// @param b -/// Vector B. -/// -/// @param abSize -/// Number of elements in A and B. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct36x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 36-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct36x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 36-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm36x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct64x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 64-byte vectors. -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// -/// @param b -/// Vector. -/// -/// @param c -/// Vector. -/// -/// @param d -/// Vector. -/// -/// @param e -/// Vector. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 64-byte vector against 4 others. -/// -/// @details -/// Dot product of 36-byte vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// -/// @param b1 -/// Vector. -/// -/// @param b2 -/// Vector. -/// -/// @param b3 -/// Vector. -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm64x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct128x4s8( const int8_t* __restrict a, - const int8_t* __restrict b, - const int8_t* __restrict c, - const int8_t* __restrict d, - const int8_t* __restrict e, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4s8( const int8_t* __restrict a, - float invLengthA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of two 128-byte vectors. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @return -/// Dot product . -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b,c,d,e):\n -/// , , , -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param c -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param d -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param e -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct128x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Normalized dot product of one 128-byte vector against 4 others. -/// -/// @details -/// Dot product of vector (a) against 4 others (b0,b1,b2,b3):\n -/// , , , -/// using their given inverse lengths for normalization. -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthA -/// Inverse of vector A. -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLengthsB -/// Pointer to an array of the inverse values of each B vector. -/// The pointer must point to 4 floating point values. -/// -/// @param dotProducts -/// Output of the 4 results { , , , }. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProductNorm128x4u8( const uint8_t* __restrict a, - float invLengthA, - const uint8_t* __restrict b0, - const uint8_t* __restrict b1, - const uint8_t* __restrict b2, - const uint8_t* __restrict b3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with several (n) 8x8 squares -/// along a line of pixels in an image. -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the source image. -/// -/// @param imgH -/// Height in pixels of the source image. -/// -/// @param nX -/// X location on image of starting search pixel. -/// -/// @param nY -/// Y location on image of starting search pixel. -/// -/// @param nNum -/// Number of pixels (in X direction) on image to sweep. -/// -/// @param dotProducts -/// Output dot product values of nNum pixels. -/// \n\b WARNING: array size must be a multiple of 4 (e.g., 4, 8, 12, ...) -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvDotProduct8x8u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int nX, - int nY, - unsigned int nNum, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dot product of 1 patch (8x8 byte square) with 8x8 squares in 11x12 -/// rectangle around the center search pixel (iX,iY). -/// -/// @param patchPixels -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param imagePixels -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// -/// @param imgW -/// Width in pixels of the image. -/// -/// @param imgH -/// Height in pixels of the image. -/// -/// @param iX -/// X location on image of the center of the search window. -/// -/// @param iY -/// Y location on image of the center of the search window. -/// -/// @param dotProducts -/// Output 11x12 dot product values. -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @ingroup math_vector -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvDotProduct11x12u8( const uint8_t* __restrict patchPixels, - const uint8_t* __restrict imagePixels, - unsigned short imgW, - unsigned short imgH, - int iX, - int iY, - int32_t* __restrict dotProducts ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterSobel3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterSobel3x3u8_v2 will be renamed to fcvFilterSobel3x3u8 -/// and the signature of fcvFilterSobel3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 Sobel edge filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterSobel3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterSobel3x3u8, -/// \a fcvFilterSobel3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterSobel3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterSobel3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// This function calculates an image derivative by convolving the image with an appropriate 3x3 kernel. -/// Border values are ignored. The 3x3 mask convolves with the image area -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: dst is saturated to 255 -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCanny3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterCanny3x3u8_v2 will be renamed to fcvFilterCanny3x3u8 -/// and the signature of fcvFilterCanny3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// is set to 3. This function will output the edge, since its working with a -/// 3x3 window, it leaves one row/col of pixels at the corners -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge). -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Canny edge filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCanny3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCanny3x3u8, -/// \a fcvFilterCanny3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterCanny3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCanny3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Canny edge detector applied to a 8 bit grayscale image. The Canny edge -/// detector uses min/max threshold to classify an edge. The min threshold -/// is set to 0 and the max threshold is set to 15. The aperture size used -/// in the Canny edge detector will be same as the filter footprint in the -/// Sobel edge detector and is set to 3. This function will output the edge -/// map stored as a binarized image (0x0 - not an edge, 0xFF - edge), since -/// it works with 3x3 windows, it leaves 1 row/col of pixels at the corners. -/// | a(1,1) , a12, ..., a(1,srcWidth-2) |\n -/// | ... , ..., ..., ... |\n -/// | a(srcHeight-2,1), ..., ..., a1(srcHeight-2,srcWidth-2) |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image containing the edge detection results. -/// Size of buffer is dstStride*srcHeight bytes. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// @param lowThresh -/// For all the intermediate pixels along the edge, the magnitude of the -/// gradient at the pixel locations should be greater than 'low' -/// (sqrt(gx^2 + gy^2) > low, where gx and gy are X and Y gradient) -/// -/// @param highThresh -/// For an edge starting point, i.e. either the first or last -/// pixel of the edge, the magnitude of the gradient at the pixel should be -/// greater than 'high' (sqrt(gx^2 + gy^2) > high, where gx and gy are X and -/// Y gradient). -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int lowThresh, - int highThresh ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageDiffu8_v2(). In the 2.0.0 release, -/// fcvImageDiffu8_v2 will be renamed to fcvImageDiffu8 -/// and the signature of fcvImageDiffu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Destination. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageDiffu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageDiffu8, -/// \a fcvImageDiffu8_v2 will be removed, and the current signature -/// for \a fcvImageDiffu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageDiffu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// dst[i,j] = (uint8_t) max( min((short)(src1[i,j]-src2[i,j]), 255), 0 ); -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//-------------------------------------------------------------------------- -/// @brief -/// Compute image difference src1-src2 -/// -/// @param src1 -/// Input image1 of int16 type. Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image2, must have same size as src1 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output image, saturated for int16 type. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -////------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image. Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Destination. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by promoting both src1 and src 2 to -/// floating point values and then subracting src2 from src1. dst=src1-src2. -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Destination image in float type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs image difference by subracting src2 from src1. -/// dst = ( src1 >> 1) - ( src2 >> 1). -/// -/// @details -/// -/// @param src1 -/// First source image -/// -/// @param src2 -/// Second source image, must be same size as src1. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of input image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Destination image in int8 type -/// \n\b NOTE: Must be same size as src1 and src2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleaveds16_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleaveds16_v2 will be renamed to fcvImageGradientInterleaveds16 -/// and the signature of fcvImageGradientInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientInterleaveds16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleaveds16, -/// \a fcvImageGradientInterleaveds16_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleaveds16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// -/// @param gradStride -/// Stride in bytes of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as 4*(srcWidth-2). -/// \n\b WARNING: must be multiple of 16 ( 8 * 2-byte values ), and at least as much as 4*(srcWidth-2) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to initialize MSER. To invoke MSER functionality, 3 functions have to be called: -/// fcvMserInit, fcvMseru8, fcvMserRelease. -/// -/// Heris the typical usage: -/// -/// void *mserHandle; -/// if (fcvMserInit (width,........,&mserHandle)) -/// { -/// fcvmseru8 (mserHandle,...); -/// fcvRelease(mserHandle); -/// } -/// -/// -/// @param width Width of the image for which MSER has to be done. -/// @param height Height of the image for which MSER has to be done. -/// @param delta Delta to be used in MSER algorithm (the difference in grayscale -/// values within which the region is stable ). -/// Typical value range [0.8 8], typical value 2 -/// @param minArea Minimum area (number of pixels) of a mser contour. -/// Typical value range [10 50], typical value 30 -/// @param maxArea Maximum area (number of pixels) of a mser contour. -/// Typical value 14400 or 0.25*width*height -/// @param maxVariation Maximum variation in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.15 -/// @param minDiversity Minimum diversity in grayscale between 2 levels allowed. -/// Typical value range [0.1 1.0], typical value 0.2 -/// @param mserHandle Return value: the mserHandle to be used in subsequent calls. -/// -/// @return int 1 if mserInit is successful, if 0, mserHandle is invalid. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle ); - -//--------------------------------------------------------------------------- -/// @brief -/// Function to release MSER resources. -/// -/// -/// -/// @param mserHandle Handle to be used to free up MSER resources. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserRelease(void *mserHandle); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER. -/// -/// \n\b ATTENTION: The signature of this function will be changed to reduce complexity -/// and memory usage when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// -/// @param mserHandle The MSER Handle returned by init. -/// @param srcPtr Pointer to an image array (unsigned char ) for which MSER has to be done. -/// @param srcWidth Width of the source image. -/// @param srcHeight Height of the source image. -/// @param srcStride Stride of the source image. -/// @param maxContours Maximum contours that will be returned. Must be set to 2x the maximum contours. -/// @param numContours Output, Number of MSER contours in the region. -/// @param numPointsInContour Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// @param pointsArraySize Size of the output points Array. -/// Typical size: (# of pixels in source image) * 30 -/// @param pointsArray Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region, -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int pointsArraySize, - unsigned int* __restrict pointsArray - ); - -///--------------------------------------------------------------------------- -/// @brief -/// Function to invoke MSER, with additional outputs for each contour. -/// -/// \n\b ATTENTION: The signature of this function will be changed to reduce complexity -/// and memory usage when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// @param mserHandle The MSER Handle returned by init. -/// @param srcPtr Pointer to an image array (unsigned char ) for which MSER has to be done. -/// @param srcWidth Width of the source image. -/// @param srcHeight Height of the source image. -/// @param srcStride Stride of the source image. -/// @param maxContours Maximum contours that will be returned. Need to be set to 2x the maximum contours. -/// Application dependent. OCR usually requires 100-1000 contours -/// Segmentation usually requires 50-100 -/// @param numContours Output, Number of MSER contours in the region. -/// @param numPointsInContour Output, Number of points in each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller. -/// @param pointsArraySize Size of the output points Array. -/// Typical size: (# of pixels in source image)*30 -/// @param pointsArray Output. This is the points in all the contours. This is a linear array, whose memory -/// has to be allocated by the caller. -/// Typical allocation size: pointArraySize -/// pointsArray[0...numPointsInContour[0]-1] defines the first MSER region; -/// pointsArray[numPointsInContour[0] .. numPointsInContour[1]-1] defines 2nd MSER region -/// and so on. -/// @param contourVariation Output, Variation for each contour from previous grey level. -/// This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// @param contourPolarity Output, Polarity for each contour. This value is 1 if this is a MSER+ region, -/// -1 if this is a MSER- region. . This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// @param contourNodeId Output, Node id for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours -/// @param contourNodeCounter Output, Node counter for each contour. This will have values filled up -/// for the first (*numContours) values. This memory has to be allocated by -/// the caller with size of maxContours. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientInterleavedf32_v2 will be renamed to fcvImageGradientInterleavedf32 -/// and the signature of fcvImageGradientInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientInterleavedf32, -/// \a fcvImageGradientInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store gradient. Must be 2*(width-1)*(height-1) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, srcStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: must be multiple of 32 ( 8 * 4-byte values ), and at least as much as 8 * srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanars16_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanars16_v2 will be renamed to fcvImageGradientPlanars16 -/// and the signature of fcvImageGradientPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientPlanars16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanars16, -/// \a fcvImageGradientPlanars16_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanars16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientPlanarf32_v2 will be renamed to fcvImageGradientPlanarf32 -/// and the signature of fcvImageGradientPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// Creates 2D gradient from source illuminance data. -/// This function considers only the left/right neighbors -/// for x-gradients and top/bottom neighbors for y-gradients. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientPlanarf32, -/// \a fcvImageGradientPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (srcWidth)*(srcHeight) in size. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride of Gradient values ('dx' and 'dy' arrays) measured in bytes. -/// \n\b NOTE: if 0, srcStride is set as 4*srcWidth. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value), and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-9 looks for continuous segments on the -/// pixel ring of 9 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be a multiple of 8. If left at 0 srcStride is default to srcWidth. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function tests the whole image -/// for corners (apart from the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to width. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n e.g. struct { int x, y; } xy; -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts FAST corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). FAST-10 looks for continuous segments on the -/// pixel ring of 10 pixels or more. -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be <= 2048. -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exists when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function tests the whole -/// image for corners (apart from the border). -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Response" of a pixel for it to be -/// regarded as a corner. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold ); - -//------------------------------------------------------------------------------ -/// @brief -/// Local Harris Max applies the Harris Corner algorithm on an 11x11 patch -/// within an image to determine if a corner is present. -/// -/// @param src -/// Pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If srcStride == 0, then will use srcWidth. -/// -/// @param posX -/// Center X coordinate of the search window -/// -/// @param posY -/// Center Y coordinate of the search window -/// -/// @param maxX -/// pointer to the X coordinate identified as a corner -/// -/// @param maxY -/// pointer to the Y coordinate identified as a corner -/// -/// @param maxScore -/// pointer to the Harris score associated with the corner -/// -/// @return -/// 0 if no corner is found (maxX, maxY, and maxScore are invalid) -/// or if posX and/or posY position the patch outside of the range of -/// the source image. -/// 1 if a corner is found (maxX, maxY, and maxScore are valid) -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API unsigned int -fcvLocalHarrisMaxu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore); - - -//------------------------------------------------------------------------------ -/// @brief -/// Extracts Harris corners from the image. This function takes a bit mask so -/// that only image areas masked with '0' are tested for corners (if these -/// areas are also not part of the border). -/// -/// @param src -/// pointer to grayscale image with one byte per pixel -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b WARNING: must be a multiple of 8. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array containing the interleaved x,y position of the -/// detected corners -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of corners -/// is exceeded -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param threshold -/// Minimum "Harris Score" or "Harris Corner Respose" of a pixel for it to be -/// regarded as a corner. -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @return -/// 0 if successful. -/// -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerHarrisInMasku8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - int threshold, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Computes affine trans. for a given set of corresponding features points -/// using a linear least square colver based on Cholkesky decomposition. -/// -/// @param corrs -/// Correspondence data struct containing coords of points in two frames -/// -/// @param affine -/// 3 x 3 affine matrix (computed best fit affine transformation) -/// -/// @ingroup 3D_reconstruction -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified affine transformation against provided points -/// correspondences. Checks which correspondence members have a projection -/// error that is smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param affine -/// Affine matrix representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky homography fitting on specified points correspondences. -/// -/// @details -/// Output precision is within 3e-3 -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// 3x3 floating point matrix formatted as @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Evaluates specified homography against provided points correspondences. -/// Check which correspondence members have a projection error that is -/// smaller than the given one (maxSquErr). -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param homography -/// Homography representing relationship between ptTo and ptFrom -/// correspondences stored as 3x3 floating point matrix formatted as -/// @todo r0h0, r0h1 -/// Pointer storage must be at least a 9-element floating point array. -/// -/// @param maxsqerr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numinliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Performs cholesky pose fitting on specified points correspondences. -/// Takes a pose and uses the correspondences to refine it using iterative -/// Gauss-Newton optimization. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param minIterations -/// Minimum number of iterations to refine. -/// -/// @param maxIterations -/// Maximum number of iterations to refine. -/// -/// @param stopCriteria -/// Improvement threshold, iterations stop if improvement is less than this -/// value. -/// -/// @param initpose -/// Pose representing initial pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param refinedpose -/// Pose representing refined pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// Final reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update and compute the differential pose based on the specified points correspondences -/// This function and fcvGeomPoseOptimizeGNf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing differential pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -//------------------------------------------------------------------------------ -/// @brief -/// Update the pose based on the specified points correspondences -/// using Gauss-Newton optimization. This function and fcvGeomPoseEvaluateErrorf32 -/// can be used iteratively to perform poseRefine GN. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @param numpts -/// Number of points -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseOptimizeGNf32( const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Calculate the reprojection error based on the input pose. -/// This function and fcvGeomPoseOptimizef32 can be used iteratively -/// to perform poseRefine (GN or LM).. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing updated pose -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param projected -/// 2D position after projection -/// -/// @param reprojErr -/// 2D reprojection error in camera coordinates (not in pixels!) -/// -/// @param invz -/// Inverse depth (z) -/// -/// @param reprojVariance -/// Reprojection variance in camera coordinates -/// -/// @return -/// Reprojection error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API float -fcvGeomPoseEvaluateErrorf32( const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Checks which members have a projection error that is smaller than the -/// given one. -/// -/// @param corrs -/// Pointer to correspondences structure. -/// -/// @param pose -/// Pose representing relationship between ptTo and ptFrom -/// correspondences stored as a -/// 3x4 transformation matrix in the form [R|t], where R is a 3x3 rotation -/// matrix and t is the translation vector. The matrix stored in pose is row -/// major ordering: \n -/// a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34 where the -/// matrix is: \n -/// | a11, a12, a13 , a14|\n -/// | a21, a22, a23, a24 |\n -/// | a31, a32, a33, a34 |\n -/// Pointer storage must be at least a 12-element floating point array. -/// -/// @param maxSquErr -/// Maximum error value squared. -/// -/// @param inliers -/// Output array for those indices that passed the test - the array MUST -/// be able to store numIndices items. -/// -/// @param numInliers -/// Output number of corrs that passed the test. -/// -/// @return -/// 0 that error is less than maximum error, -1 greater or equal to maximum -/// error. -/// -/// -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Estimates a 6DOF pose -/// \n\b NOTE: Given the coordinates of three 3D points (in world reference frame), -/// and their corresponding perspective projections in an image, -/// this algorithm determines the position and orientation of the camera in -/// the world reference frame. The function provides up to four solutions -/// that can be disambiguated using a fourth point. -/// When used in conjunction with RANSAC, this function can perform efficient outlier rejection. -/// Two degenerate cases should be avoided when using this function: -/// - Indeterminate configuration: -/// When the three points are collinear in space, there will be a family of poses mapping the -/// three points to the same image points. -/// - Unstable configuration: -/// The camera center is located on a circular cylinder passing through the three points and -/// the camera optical axis is perpendicular to the plane derived by the three points. -/// With this configuration, a small change in the position of the three points will -/// result in a large change of the estimated pose.. -/// -/// @param corrs -/// 2D-3D correspondence points -/// -/// @param pose -/// computed pose (numPoses * 12 data) -/// -/// @param numPoses (max = 4) -/// -/// @ingroup 3D_reconstruction -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorr3x3s8_v2(). In the 2.0.0 release, -/// fcvFilterCorr3x3s8_v2 will be renamed to fcvFilterCorr3x3s8 -/// and the signature of fcvFilterCorr3x3s8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param dst -/// Output convolution. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 3x3 correlation with non-separable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorr3x3s8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorr3x3s8, -/// \a fcvFilterCorr3x3s8_v2 will be removed, and the current signature -/// for \a fcvFilterCorr3x3s8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorr3x3s8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 2-D 3x3 kernel. -/// \n\b NOTE: Normalized to Q4.4 -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be an even number -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: must be an even number -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output convolution. Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. Border values are ignored in this function. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 9x9 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep9x9s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep9x9s16_v2 will be renamed to fcvFilterCorrSep9x9s16 -/// and the signature of fcvFilterCorrSep9x9s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel in Q15. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmp -/// Temporary image buffer used internally. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep9x9s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmp, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 9x9 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep9x9s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep9x9s16, -/// \a fcvFilterCorrSep9x9s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep9x9s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep9x9s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is dstStride*srcHeight bytes. -/// \n\b NOTE: Size = width * heigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 11x11 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep11x11s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep11x11s16_v2 will be renamed to fcvFilterCorrSep11x11s16 -/// and the signature of fcvFilterCorrSep11x11s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be >=12 elements with kernel[11]=0 -/// \n\b WARNING: must be 128-bit aligned. -/// \n\b NOTE: Normalized to Q1.15 -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep11x11s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 11x11 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep11x11s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep11x11s16, -/// \a fcvFilterCorrSep11x11s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep11x11s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep11x11s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 13x13 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep13x13s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep13x13s16_v2 will be renamed to fcvFilterCorrSep13x13s16 -/// and the signature of fcvFilterCorrSep13x13s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep13x13s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 13x13 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep13x13s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep13x13s16, -/// \a fcvFilterCorrSep13x13s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep13x13s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep13x13s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 15x15 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep15x15s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep15x15s16_v2 will be renamed to fcvFilterCorrSep15x15s16 -/// and the signature of fcvFilterCorrSep15x15s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dst -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b NOTE: data should be 128-bit aligned -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep15x15s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - -//--------------------------------------------------------------------------- -/// @brief -/// 15x15 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep15x15s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep15x15s16, -/// \a fcvFilterCorrSep15x15s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep15x15s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep15x15s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: array must be 16 elements with kernel[15]=0 -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// 17x17 correlation with separable kernel. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterCorrSep17x17s16_v2(). In the 2.0.0 release, -/// fcvFilterCorrSep17x17s16_v2 will be renamed to fcvFilterCorrSep17x17s16 -/// and the signature of fcvFilterCorrSep17x17s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: Normalized to Q1.15 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// \n\b WARNING: must be > 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dst -/// Output correlation.. Border values are ignored in this function. -/// \n\b NOTE: Must be same size as src -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterCorrSep17x17s16( const int16_t* __restrict kernel, - const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict tmpImg, - int16_t* __restrict dst ); - - - -//--------------------------------------------------------------------------- -/// @brief -/// 17x17 FIR filter (convolution) with seperable kernel. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterCorrSep17x17s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterCorrSep17x17s16, -/// \a fcvFilterCorrSep17x17s16_v2 will be removed, and the current signature -/// for \a fcvFilterCorrSep17x17s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterCorrSep17x17s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param kernel -/// 1-D kernel. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcImg -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param srcWidth -/// Image tile width. -/// -/// @param srcHeight -/// Image tile height. -/// -/// @param srcStride -/// source Image width -/// -/// @param tmpImg -/// Temporary image scratch space used internally. -/// \n\b NOTE: Size = width * ( height + knlSize - 1 ) -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstImg -/// Output correlation. Border values are ignored in this function. -/// \n\b NOTE: Size = dstStride * srcHeigth -/// \n\b NOTE: data should be 128-bit aligned -/// -/// @param dstStride -/// dst Image width -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- -FASTCV_API void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates the mean and variance of intensities of a rectangle in a -/// grayscale image. -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: must be multiple of 8. -/// -/// @param xBegin -/// x coordinate of of top left of rectangle -/// -/// @param yBegin -/// y coordinate of of top left of rectangle -/// -/// @param recWidth -/// width of rectangular region -/// -/// @param recHeight -/// height of rectangular region -/// -/// @param mean -/// output of mean of region -/// -/// @param variance -/// output of variance of region -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a histogram of intensities for a rectangular region of a grayscale -/// image. Bins each pixel into a histogram of size 256, depending on the -/// intensity of the pixel (in the range 0 to 255). -/// -/// @details -/// -/// @param src -/// pointer to 8-bit grayscale image -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of source image -/// \n\b WARNING: must be multiple of 8. -/// -/// @param xBegin -/// x coordinate of of top left of rectangle -/// -/// @param yBegin -/// y coordinate of of top left of rectangle -/// -/// @param recWidth -/// Width of rectangular region -/// -/// @param recHeight -/// Height of rectangular region -/// -/// @param histogram -/// Array of size 256 for storing the histogram -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit image and adds an -/// unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatchu8_v2(). In the 2.0.0 release, -/// fcvIntegratePatchu8_v2 will be renamed to fcvIntegratePatchu8 -/// and the signature of fcvIntegratePatchu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 8-bit patch values and their -/// squares and adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatchu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatchu8, -/// \a fcvIntegratePatchu8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatchu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatchu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (patchW+1)(patchH+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (patchW+1)(patchH+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch12x12u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch12x12u8_v2 will be renamed to fcvIntegratePatch12x12u8 -/// and the signature of fcvIntegratePatch12x12u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Builds an integral image of the incoming 12x12 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatch12x12u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch12x12u8, -/// \a fcvIntegratePatch12x12u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch12x12u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch12x12u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (12+1)(12+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (12+1)(12+1) -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvIntegratePatch18x18u8_v2(). In the 2.0.0 release, -/// fcvIntegratePatch18x18u8_v2 will be renamed to fcvIntegratePatch18x18u8 -/// and the signature of fcvIntegratePatch18x18u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Builds an integral image of the incoming 18x18 8-bit patch values and -/// their squares. It also adds an unfilled border on top and to the left. -/// \n NOTE: border usually zero filled elsewhere. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvIntegratePatch18x18u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvIntegratePatch18x18u8, -/// \a fcvIntegratePatch18x18u8_v2 will be removed, and the current signature -/// for \a fcvIntegratePatch18x18u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvIntegratePatch18x18u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// sum (X,Y) = sum_{x (18+1)(18+1) -/// -/// @param intgrlSqrdImgOut -/// Integral image of squared values. -/// \n\b NOTE: Memory must be > (18+1)(18+1) -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Integrates one line of an image or any portion of an image that is -/// contiguous in memory. -/// -/// @param src -/// Input image. Size of buffer is srcWidth bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Number of pixels. -/// \n NOTE: bit width enforces numPxls < 2^16 -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvIntegrateImageLineu8( const uint8_t* __restrict src, - uint16_t srcWidth, - uint32_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integrates 64 contiguous pixels of an image. -/// -/// @param src -/// Input image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param intgrl -/// Sum of values from specified pixels. -/// -/// @param intgrlSqrd -/// Sum of squared values from specified pixels. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvIntegrateImageLine64u8( const uint8_t* __restrict src, - uint16_t* intgrl, - uint32_t* intgrlSqrd ); - - -//------------------------------------------------------------------------------ -/// @brief -/// compute approximate mean and variance for the range of NFT4 float -/// descriptors where descriptor elements along dimension are treated -/// as random vars -/// -/// @param src -/// contiguous block of descriptors of dimension 36 -/// -/// @param first -/// index of the first descriptor in range array vind for computing mean and var -/// -/// @param last -/// index of the last descriptor in range array vind for computing mean and range -/// -/// @param vind -/// array of randomized indexes of descriptors -/// -/// @param means -/// buffer for approximate means, must be 36 long -/// -/// @param vars -/// buffer for approximate variances, must be 36 long -/// -/// @param temp -/// bufffer, must be 46 long -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @remark -/// If descriptor range is > 100 then only -/// 100 samples are drawn from the range to compute -/// approximate means and variances. -/// -/// Variances computed here do not have to be true variances because their -/// values do not matter in kdtrees. The only thing that matters is that -/// the ordering relation of variances is preserved -/// -/// -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvDescriptorSampledMeanAndVar36f32( const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnCircle8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnCircle8x8u8_v2 will be renamed to fcvNCCPatchOnCircle8x8u8 -/// and the signature of fcvNCCPatchOnCircle8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within radius around a center pixel for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvNCCPatchOnCircle8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnCircle8x8u8, -/// \a fcvNCCPatchOnCircle8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnCircle8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnCircle8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// X location of search center in pixels of the image. -/// -/// @param search_center_y -/// Y location of search center in pixels of the image. -/// -/// @param search_radius -/// Radius of search in pixels. Must be <=5. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// Largest value of the normalized cross-correlation found in the NCC search. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param findSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int findSubPixel, - float* subX, - float* subY ); - - - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvNCCPatchOnSquare8x8u8_v2(). In the 2.0.0 release, -/// fcvNCCPatchOnSquare8x8u8_v2 will be renamed to fcvNCCPatchOnSquare8x8u8 -/// and the signature of fcvNCCPatchOnSquare8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Searches a 8x8 patch within square region around a center pixel -/// for the max NCC. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvNCCPatchOnSquare8x8u8 with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvNCCPatchOnSquare8x8u8, -/// \a fcvNCCPatchOnSquare8x8u8_v2 will be removed, and the current signature -/// for \a fcvNCCPatchOnSquare8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvNCCPatchOnSquare8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param patch -/// Pointer to 8-bit patch pixel values linearly laid out in memory. -/// -/// @param src -/// Pointer to 8-bit image pixel values linearly laid out in memory. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width in pixels of the image. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height in pixels of the image. -/// -/// @param search_center_x -/// Center X coordinate of the search window -/// -/// @param search_center_y -/// Center Y coordinate of the search window -/// -/// @param search_w -/// Width of search square in pixels -/// \n\b WARNING: must be 11 or less. -/// -/// @param filterLowVariance -/// Minimum variance. Used to as threshold to compare against variance of -/// 8x8 block of src or patch. -/// -/// @param best_x -/// Center X location on the image of the best NCC match. The center X has -/// 4 pixels to the left and 3 to the right. -/// -/// @param best_y -/// Center Y location on the image of the best NCC match. The center Y has -/// 4 pixels above and 3 pixels below. -/// -/// @param bestNCC -/// NCC value of the best match block. -/// It's quantized to integer value in Q7 (between -128 and 128). -/// -/// @param doSubPixel (0 or 1) -/// Use parabolic interpolation of NCC values to find sub-pixel estimates. -/// -/// @param subX -/// Sub-pixel estimate for optimal NCC relative to best_x. -/// \n e.g., float x = (float)best_x + subX; -/// -/// @param subY -/// Sub-pixel estimate for optimal NCC relative to best_y. -/// -/// @return -/// 0 = OK \n -/// 1 = "search_radius" too large\n -/// 2 = invalid "search_center_x,y"\n -/// 3 = not found\n -/// 4 = Patch has too low variance\n -/// 5 = Image region has too low variance\n -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned short srcWidth, - unsigned short srcHeight, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvSumOfAbsoluteDiffs8x8u8_v2(). In the 2.0.0 release, -/// fcvSumOfAbsoluteDiffs8x8u8_v2 will be renamed to fcvSumOfAbsoluteDiffs8x8u8 -/// and the signature of fcvSumOfAbsoluteDiffs8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// The dst buffer shall be width X height bytes in length. -/// Output of SAD(A,B). dst[4][4] correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Sum of absolute differences of an image against an 8x8 template. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvSumOfAbsoluteDiffs8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvSumOfAbsoluteDiffs8x8u8, -/// \a fcvSumOfAbsoluteDiffs8x8u8_v2 will be removed, and the current signature -/// for \a fcvSumOfAbsoluteDiffs8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvSumOfAbsoluteDiffs8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// 8x8 sum of ||A-B||. The template patch is swept over the entire image and -/// the results are put in dst. -/// -/// @param patch -/// 8x8 template -/// -/// @param patchStride -/// Stride of the 8x8 template buffer -/// -/// @param dstStride -/// Stride of the patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param src -/// Reference Image. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of the src image. -/// -/// @param srcHeight -/// Height of the src image. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// @param dst -/// The dst buffer shall be at least ( width x height ) values in length. -/// Output of SAD(A,B). dst[4][4]correspondes to the 0,0 pixel of the template -/// aligned with the 0,0 pixel of src. The dst border values not covered by -/// entire 8x8 patch window will remain unmodified by the function. The caller -/// should either initialize these to 0 or ignore. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// -/// -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2u8_v2 will be renamed to fcvScaleDownBy2u8 -/// and the signature of fcvScaleDownBy2u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/4 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Down-scale the image to half width and height by averaging 2x2 pixels -/// into one. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy2u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2u8, -/// \a fcvScaleDownBy2u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A box filter downsampling the next pixel, the pixel below, and the next -/// pixel to the pixel below into one pixel.\n -/// | px00 px01 px02 px03 |\n -/// | px10 px11 px12 px13 |\n -/// to:\n -/// | (px00+px01+px10+px11)/4 (px02+px03+px12+px13)/4 |\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/2 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy2Gaussian5x5u8_v2 will be renamed to fcvScaleDownBy2Gaussian5x5u8 -/// and the signature of fcvScaleDownBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 2 -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy2Gaussian5x5u8, -/// \a fcvScaleDownBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Downsamples the image using a 5x5 Gaussian filter kernel. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit downscale image of size (width / 2) x (height / 2). -/// \n\b NOTE: border values have been taken cared w.r.t. the pixel coordinate. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownBy4u8_v2(). In the 2.0.0 release, -/// fcvScaleDownBy4u8_v2 will be renamed to fcvScaleDownBy4u8 -/// and the signature of fcvScaleDownBy4u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param dst -/// Output 8-bit image. Size of buffer is srcWidth*srcHeight/16 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to quarter width and height by averaging 4x4 pixels -/// into one.. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownBy4u8_v2() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownBy4u8_v2, -/// \a fcvScaleDownBy4u8_v2 will be removed, and the current signature -/// for \a fcvScaleDownBy4u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownBy4u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// A 4x4 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE:must be a multiple of 4 -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*srcHeight/4 bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth/4. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth/4 if not 0. -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Downscale the image to 2/3 width and height by averaging 3x3 pixels -/// into one.. -/// -/// @details -/// A 3x3 downsampling box filter across adjacent pixels is applied. -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcHeight -/// Image height. -/// \n\b NOTE: In case of non multiple of 3, it will crop to the closest multiple of 3 -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// Memory must be pre-allocated at least srcWidth * srcHeight * 2 / 3 -/// dstWidth = srcWidth/3*2 -/// dstHeight = srcHeight/3*2 -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return 0 if successful -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// @details -/// Uses Nearest Neighbor method -/// -/// @param src -/// Input 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, srcStride is set to srcWidth. -/// -/// @param dst -/// Output 8-bit image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). If 0 is passed, dstStride is set to dstWidth which is srcWidth *2/3. -/// -/// @return 0 if successful -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleDownu8_v2(). In the 2.0.0 release, -/// fcvScaleDownu8_v2 will be renamed to fcvScaleDownu8 -/// and the signature of fcvScaleDownu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension. -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Downsample Horizontaly and/or Vertically by an *integer* scale. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleDownu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleDownu8, -/// \a fcvScaleDownu8_v2 will be removed, and the current signature -/// for \a fcvScaleDownu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleDownu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Uses an box averaging filter of size MxN where M is the scale factor -/// in horizontal dimension and N is the scale factor in the vertical -/// dimension -/// \n \b NOTE: input dimensions should be multiple of output dimensions. -/// \n NOTE: On different processors, some output pixel values may be off by 1 -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Source Image height. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Destination Image width. -/// -/// @param dstHeight -/// Destination Image height. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvScaleUpBy2Gaussian5x5u8_v2(). In the 2.0.0 release, -/// fcvScaleUpBy2Gaussian5x5u8_v2 will be renamed to fcvScaleUpBy2Gaussian5x5u8 -/// and the signature of fcvScaleUpBy2Gaussian5x5u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*width) x (2*height). -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Upscale a grayscale image by a factor of two using a 5x5 Gaussian filter kernel -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvScaleUpBy2Gaussian5x5u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvScaleUpBy2Gaussian5x5u8, -/// \a fcvScaleUpBy2Gaussian5x5u8_v2 will be removed, and the current signature -/// for \a fcvScaleUpBy2Gaussian5x5u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvScaleUpBy2Gaussian5x5u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Upsamples the image using a 5x5 Gaussian filter kernel. -/// /n/b NOTE: border values have been taken care with Gaussion coefficients. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcStride -/// Image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit upsampled image of size (2*dstStride) x (2*srcHeight). -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth*2. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*2 if not 0. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Translate to float and normalize 36 8-bit elements -/// -/// @param src -/// Pointer to the first input vector -/// -/// @param invLen -/// Pointer to inverse length of the first input vector -/// located right after each 36 element vector -/// -/// @param numVecs -/// Number of vectors to translate -/// -/// @param reqNorm -/// Required norm -/// -/// @param srcStride -/// Step in bytes to data of the next vector -/// Each vector has 36 8-bit elements and 1 float invLen -/// -/// @param dst -/// Pointer to contiguous block for output vectors -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param stopBuild -/// Allows other threads to break this function in the middle of processing. -/// When set to 1, the function will exit on the next iteration. -/// -/// @return -/// 0 - success -/// EFAULT - invalid address -/// EINVAL - invalid argument -/// -/// @ingroup math_vector -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against 4 others. -/// -/// @details -/// SSD of one vector (a) against 4 others (b0,b1,b2,b3) using their given -/// inverse lengths for normalization. -/// \n\n SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b0 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b1 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b2 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param b3 -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenB -/// Inverse of vectors b0...b3 = 1/|b0|,... 1/|b3| -/// \n\b WARNING: array must be 128-bit aligned -/// -/// @param distances -/// Output of the 4 results { SSD(a,b0), SSD(a,b1), SSD(a,b2), SSD(a,b3) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: array must be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict a, - float invLenA, - const int8_t* __restrict b0, - const int8_t* __restrict b1, - const int8_t* __restrict b2, - const int8_t* __restrict b3, - const float* __restrict invLenB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sum of squared differences of one 36-byte vector against N others. -/// -/// @details -/// SSD of one vector (a) against N other 36-byte vectors -/// ( b[0], b[1], ..., b[n-1] ) -/// using their given inverse lengths for normalization. -/// \n\n SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) -/// -/// @param a -/// Vector. -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param invLenA -/// Inverse of vector A = 1/|A| -/// -/// @param b -/// Vectors b[0]...b[n-1]. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param invLenB -/// Inverse of vectors b[0]...b[n-1] = 1/|b[0]|,... 1/|b[n-1]| -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param numB -/// Number of B vectors. -/// -/// @param distances -/// Output of the N results { SSD(a,b[0]), SSD(a,b[1]), ..., SSD(a,b[n-1]) }. -/// \n ACCURACY: 1.0e-6 -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict a, - float invLenA, - const int8_t* const * __restrict b, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Sorting of 8 float numbers -/// -/// @details -/// Perform sorting of 8 scores in ascending order (output of SumOfSquaredDiffs) -/// -/// @param inScores -/// Input 8 element float array -/// \n\b NOTE: array should be 128-bit aligned -/// -/// @param outScores -/// Output is 8 element sorted float array -/// \n\b WARNING: array must be 128-bit aligned -/// -/// -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSort8Scoresf32( float* __restrict inScores, float* __restrict outScores ); - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterThresholdu8_v2(). In the 2.0.0 release, -/// fcvFilterThresholdu8_v2 will be renamed to fcvFilterThresholdu8 -/// and the signature of fcvFilterThresholdu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Binarizes a grayscale image based on a threshold value. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterThresholdu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterThresholdu8, -/// \a fcvFilterThresholdu8_v2 will be removed, and the current signature -/// for \a fcvFilterThresholdu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterThresholdu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Sets the pixel to max(255) if it's value is greater than the threshold; -/// else, set the pixel to min(0). -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit binarized image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Output stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param threshold -/// Threshold value for binarization. -/// \n\b WARNING: must be larger than 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterThresholdu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterDilate3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterDilate3x3u8_v2 will be renamed to fcvFilterDilate3x3u8 -/// and the signature of fcvFilterDilate3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Dilate a grayscale image by taking the local maxima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterDilate3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterDilate3x3u8, -/// \a fcvFilterDilate3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterDilate3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterDilate3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit dilated image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 neighborhood window. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterErode3x3u8_v2(). In the 2.0.0 release, -/// fcvFilterErode3x3u8_v2 will be renamed to fcvFilterErode3x3u8 -/// and the signature of fcvFilterErode3x3u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ); - -//------------------------------------------------------------------------------ -/// @brief -/// Erode a grayscale image by taking the local minima of 3x3 nbhd window. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterErode3x3u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterErode3x3u8, -/// \a fcvFilterErode3x3u8_v2 will be removed, and the current signature -/// for \a fcvFilterErode3x3u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterErode3x3u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output 8-bit eroded image. Size of buffer is dstStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of output image. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ); - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffine8x8u8_v2(). In the 2.0.0 release, -/// fcvTransformAffine8x8u8_v2 will be renamed to fcvTransformAffine8x8u8 -/// and the signature of fcvTransformAffine8x8u8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param nPatch -/// Transformed patch. -/// -/// -/// @returns 0 if the transformation is valid -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvTransformAffine8x8u8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffine8x8u8, -/// \a fcvTransformAffine8x8u8_v2 will be removed, and the current signature -/// for \a fcvTransformAffine8x8u8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffine8x8u8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param nPos[ 2 ] -/// Position in the image in 32 bit fixed point (Q16) -/// \n\b NOTE: if any 1 coordinates of the warped square are inside the image, return 1 and -/// \n leave function. Otherwise, return 0. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param nAffine[ 2 ][ 2 ] -/// Transformation matrix in 32 bit fixed point (Q16). The matrix stored -/// in nAffine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as 8. -/// \n\b WARNING: must be at least as much as 8 if not 0. -/// -/// -/// @returns 0 if the transformation is valid -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcvWarpPerspectiveu8_v2 will be renamed to fcvWarpPerspectiveu8 -/// and the signature of fcvWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data must be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Warps a grayscale image using the a perspective projection transformation -/// matrix (also known as a homography). This type of transformation is an -/// invertible transformation which maps straight lines to straight lines. -/// Bi-linear interpolation is used where applicable. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvWarpPerspectiveu8, -/// \a fcvWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcvWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Warps an image taking into consideration the perspective scaling. -/// -/// @param src -/// Input 8-bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Dst image width. -/// \n\b NOTE: data must be multiple of 8. -/// -/// @param dstHeight -/// Dst image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection matrix using -/// bilinear interpolation. -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcv3ChannelWarpPerspectiveu8_v2(). In the 2.0.0 release, -/// fcv3ChannelWarpPerspectiveu8_v2 will be renamed to fcv3ChannelWarpPerspectiveu8 -/// and the signature of fcv3ChannelWarpPerspectiveu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight*3 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b NOTE: must be multiple of 8 -/// -/// @param dst -/// Warped output image. Size of buffer is dstWidth*dstHeight*3 bytes. -/// \n\b NOTE: data must be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps a 3 color channel image based on a 3x3 perspective projection -/// matrix using bilinear interpolation. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcv3ChannelWarpPerspectiveu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcv3ChannelWarpPerspectiveu8, -/// \a fcv3ChannelWarpPerspectiveu8_v2 will be removed, and the current signature -/// for \a fcv3ChannelWarpPerspectiveu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcv3ChannelWarpPerspectiveu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b WARNING: data must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcHeight -/// Input image height. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param srcStride -/// Input image stride (in bytes). -/// \n\b NOTE: if 0, srcStride is set as srcWidth*3. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as srcWidth*3 if not 0. -/// -/// @param dst -/// Warped output image. Size of buffer is dstStride*dstHeight bytes. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstWidth -/// Output image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dstHeight -/// Output image height. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param dstStride -/// Output image stride (in bytes). -/// \n\b NOTE: if 0, dstStride is set as dstWidth*3. -/// \n\b WARNING: must be multiple of 8 (8 * 1-byte values), and at least as much as dstWidth*3 if not 0. -/// -/// @param projectionMatrix -/// 3x3 perspective transformation matrix (generally a homography). The -/// matrix stored in homography is row major ordering: \n -/// a11, a12, a13, a21, a22, a23, a31, a32, a33 where the matrix is: \n -/// | a11, a12, a13 |\n -/// | a21, a22, a23 |\n -/// | a31, a32, a33 |\n -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict projectionMatrix ); - - -//--------------------------------------------------------------------------- -/// @brief -/// General function for computing cluster centers and cluster bindings -/// for a set of points of dimension dim. -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// \n\b WARNING: must be > numPoints * dim. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, array must -/// be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// This is general clusterer. There are no assumptions on points other -/// than they belong to a vector space -/// -/// -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension dim. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * dim. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param dim -/// dimension, e.g. 36 -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surface of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Function for computing cluster centers and cluster bindings -/// for a set of normalized points of dimension 36. Cluster centers -/// are also normalized (see remark below) -/// -/// @param points -/// Array of all points. Array size must be greater than -/// numPoints * 36. -/// -/// @param numPoints -/// Number of points in points array. -/// -/// @param pointStride -/// Byte distance between adjacent points in array -/// -/// @param indices -/// Array of point indices in points array. Processing will only -/// occur on points whose indices are in this array. Each index in array -/// must be smaller numPoints. -/// -/// @param numIndices -/// Length of indices array. numIndieces must be <= numPoints. -/// -/// @param numClusters -/// Number of cluster centers -/// -/// @param clusterCenters -/// current cluster centers; -/// elements are distant by clusterCenterStride -/// -/// @param clusterCenterStride -/// byte distance between adjacent cluster centers in array -/// -/// @param newClusterCenters -/// array for new cluster centers; should be numClusterCenters long -/// -/// @param clusterMemberCounts -/// Element counts for each cluster; should be numClusterCenters long -/// -/// @param clusterBindings -/// Output indices of the clusters to which each vector belongs to, a -/// rray must be numIndices long. -/// -/// @param sumOfClusterDistances -/// Array for sum of distances of cluster elements to cluster centers; -/// Must be numClusters long -/// -/// @return -/// 0 if successfully clustered, otherwise error code -/// -/// @remark -/// this function assumes that points are normalized (e.g. NFT4 -/// descriptors). Cluster centers are also normalized. Normalized points -/// are on a surphace of unit sphere which is not a vector space but -/// curved manifold of dimension (dim-1) embeded in Euclidean vector space -/// of dimension dim -/// -/// @ingroup clustering_and_search -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s16_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s16_v2 will be renamed to fcvFilterGaussian5x5s16 -/// and the signature of fcvFilterGaussian5x5s16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// \n\b NOTE: Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int16_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5s16() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s16, -/// \a fcvFilterGaussian5x5s16_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s16 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s16 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*2 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, edstStrid is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian5x5s32_v2(). In the 2.0.0 release, -/// fcvFilterGaussian5x5s32_v2 will be renamed to fcvFilterGaussian5x5s32 -/// and the signature of fcvFilterGaussian5x5s32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param dst -/// Output int data. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int32_t* __restrict dst, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Blur with 5x5 Gaussian filter -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvFilterGaussian5x5s32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvFilterGaussian5x5s32, -/// \a fcvFilterGaussian5x5s32_v2 will be removed, and the current signature -/// for \a fcvFilterGaussian5x5s32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvFilterGaussian5x5s32 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// Convolution with 5x5 Gaussian kernel: -/// \n 1 4 6 4 1 -/// \n 4 16 24 16 4 -/// \n 6 24 36 24 6 -/// \n 4 16 24 16 4 -/// \n 1 4 6 4 1 -/// -/// @param src -/// Input int data (can be sq. of gradient, etc). -/// Size of buffer is srcStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Image stride. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dst -/// Output int data. Size of buffer is dstStride*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dstStride -/// Output stride. -/// \n\b NOTE: if 0, dstStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param blurBorder -/// If set to 0, border is ignored. -/// If set to 1, border is blurred by 0-padding adjacent values. -/// -/// @ingroup image_processing -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int blurBorder ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvTransformAffineu8_v2(). In the 2.0.0 release, -/// fcvTransformAffineu8_v2 will be renamed to fcvTransformAffineu8 -/// and the signature of fcvTransformAffineu8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @returns 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Warps the patch centered at nPos in the input image using the affine -/// transform in nAffine -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvTransformAffineu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvTransformAffineu8, -/// \a fcvTransformAffineu8_v2 will be removed, and the current signature -/// for \a fcvTransformAffineu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvTransformAffineu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image. Size of buffer is srcStride*srcHeight bytes. -/// -/// @param srcWidth -/// Image width. -/// -/// @param srcHeight -/// Image height. -/// -/// @param srcStride -/// Stride of image (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be at least as much as srcWidth if not 0. -/// -/// @param position[ 2 ] -/// Position in the image -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param affine[ 2 ][ 2 ] -/// Transformation matrix. The matrix stored -/// in affine is using row major ordering: \n -/// a11, a12, a21, a22 where the matrix is: \n -/// | a11, a12 |\n -/// | a21, a22 |\n -/// -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param patch -/// Transformed patch. -/// -/// @param patchWidth -/// Patch width. -/// -/// @param patchHeight -/// Patch height. -/// -/// @param patchStride -/// Stride of patch (in bytes) - i.e., how many bytes between column 0 of row N -/// and column 0 of row N+1. -/// \n\b NOTE: if 0, patchStride is set as patchWidth. -/// \n\b WARNING: must be at least as much as patchWidth if not 0. -/// -/// @returns 0 if the transformation is valid -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvTransformAffineu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const float* __restrict position, - const float* __restrict affine, - uint8_t* __restrict patch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts a 17x17 rotation corrected patch from a 25x25 image. -/// -/// @param src -/// 25x25 input image in continuous memory. -/// -/// @param dst -/// 17x17 output patch. -/// -/// @param orientation -/// Rotation angle of patch relative to src. -/// \n 10-bit fixed-point angle around unit circle. -/// \n NOTE: 0 = 0 degrees and 1024 = 360 degrees. -/// -/// @ingroup image_transform -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCopyRotated17x17u8( const uint8_t* __restrict src, - uint8_t* __restrict dst, - int orientation ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied vector. -/// -/// @param src -/// Pointer to vector to count bits that are 1. -/// -/// @param srcLength -/// Length of the vector to count bits. Assumed that the remainder of bits modulo 8 -/// will be set to 0 a priori. -/// -/// @returns total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu8( const uint8_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts "1" bits in supplied 32-byte vector. -/// -/// @param src -/// Pointer to 32-byte vector(s) to count bits that are 1. -/// -/// @returns total number of "1" bits in supplied vector -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to count bits. -/// -/// @param b -/// Pointer to 32-byte vector to count bits. -/// -/// @param c -/// Pointer to 32-byte vector to count bits. -/// -/// @param d -/// Pointer to 32-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount32x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 64-byte vector. -/// -/// @param src -/// Pointer to 64-byte vector(s) to count bits. -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied 4, 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to count bits. -/// -/// @param b -/// Pointer to 64-byte vector to count bits. -/// -/// @param c -/// Pointer to 64-byte vector to count bits. -/// -/// @param d -/// Pointer to 64-byte vector to count bits. -/// -/// @param bitCount -/// Array to store the four resultant bit counts. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitCount64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - uint32_t* __restrict bitCount ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Counts bits in supplied vector of unsigned intergers. -/// -/// @param src -/// Pointer to vector(s) to count bits. -/// -/// @param srcLength -/// Number of elements in vector -/// -/// @return -/// Bit count. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvBitCountu32( const uint32_t* __restrict src, - unsigned int srcLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied arbitrary length -/// vectors. -/// -/// @param a -/// Pointer to vector to compute distance. -/// -/// @param b -/// Pointer to vector to compute distance. -/// -/// @param abLength -/// Length in bits of each of the vectors. Assumed that the remainder of -/// bits modulo 8 will be set to 0 a priori. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abLength ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// -/// @param b -/// Pointer to 32-byte vector to compute distance. -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between the two supplied 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @return -/// Hamming distance between the two vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 32-byte vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte -/// vectors. -/// -/// @param a -/// Pointer to 32-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 32-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// \n\b WARNING: must be 128-bit aligned -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Computes the Hamming distance between A and each of B,C,D,E 64-byte vectors. -/// -/// @param a -/// Pointer to 64-byte vector to compute distance. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param b -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param c -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param d -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param e -/// Pointer to 64-byte vector to compute distance from A. -/// \n\b WARNING: must be 32-bit aligned -/// -/// @param hammingDistances -/// Array to store each Hamming distance between the vectors. -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvHammingDistance64x4u8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - const uint8_t* __restrict c, - const uint8_t* __restrict d, - const uint8_t* __restrict e, - uint32_t* __restrict hammingDistances ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// 8-bit image -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width -/// \n\b NOTE: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners ); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @param src -/// Grayscale image with one byte per pixel -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: must be a multiple of 8. -/// \n\b WARNING: must be <= 2048. -/// -/// @param srcHeight -/// image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Per-pixel mask for each pixel represented in input image. -/// If a bit set to 0, pixel will be a candidate for corner detection. -/// If a bit set to 1, pixel will be ignored. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight ); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvCornerFast9Scoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9Scoreu8, -/// \a fcvCornerFast9Scoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9Scoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9Scoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvCornerFast9InMaskScoreu8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvCornerFast9InMaskScoreu8, -/// \a fcvCornerFast9InMaskScoreu8_v2 will be removed, and the current signature -/// for \a fcvCornerFast9InMaskScoreu8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvCornerFast9InMaskScoreu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// Pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image -/// -/// @details -/// non-maximum suppression can be enabled to reduce the number of false corners. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: must be 128-bit aligned. -/// \n\b NOTE: size of buffer is @param nCornersMax -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @return -/// void. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -//--------------------------------------------------------------------------- -/// @brief -/// Extracts FAST corners and scores from the image based on the mask. The mask specifies pixels -/// to be ignored by the detector. -/// -/// @param src -/// 8-bit grayscale image where keypoints are detected -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// image width -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param barrier -/// FAST threshold. The threshold is used to compare difference between intensity value of -/// the central pixel and pixels on a circle surrounding this pixel. -/// -/// @param border -/// Number for pixels to ignore from top,bottom,right,left of the image -/// -/// @param xy -/// Pointer to the output array cointaining the interleaved x,y position of the -/// detected corners. -/// \n\b NOTE: Remember to allocate double the size of @param nCornersMax -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param scores -/// Pointer to the output array containing the scores of the detected corners. -/// The score is computed as the sum of the absolute difference between the pixels in the -/// contiguous arc and the centre pixel. A higher score value indicates a stronger corner feature. -/// For example, a corner of score 108 is stronger than a corner of score 50. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param nCornersMax -/// Maximum number of corners. The function exits when the maximum number of -/// corners is exceeded. This number should account for the number of key points before non-maximum suppression. -/// -/// @param nCorners -/// pointer to an integer storing the number of corners detected -/// -/// @param mask -/// Mask used to omit regions of the image. For allowed mask sizes refer to -/// @param maskWidth and @param maskHeight . The mask is so defined to work with multiple -/// scales if necessary. For any pixel set to '1' in the mask, the corresponding pixel in the image -/// will be ignored. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param maskWidth -/// Width of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param maskHeight -/// Height of the mask. Both width and height of the mask must be 'k' times image width and height, -/// where k = 1/2, 1/4 , 1/8 , 1, 2, 4 and 8. -/// -/// @param nmsEnabled -/// Enable non-maximum suppresion to prune weak key points (0=disabled, 1=enabled) -/// -/// @param tempBuf -/// Pointer to scratch buffer if nms is enabled, otherwise it can be NULL. -/// Size of buffer: (3*nCornersMax+srcHeight+1)*4 bytes -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @return -/// void. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. Bitwidth optimized implementation -/// -/// \n\b ATTENTION: The signature of this function will be changed to remove -/// unused parameters when the 2.0.0 release of this library is made. -/// Until 2.0.0, the developer should use this implementation with the expectation of -/// moving to a different signature when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -// ----------------------------------------------------------------------------- - -FASTCV_API void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int srcWidth, - int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Optical flow. -/// -/// \n\b ATTENTION: This function will be removed when the 2.0.0 release of this library -/// is made. Until 2.0.0, the developer should use this implementation with the expectation of -/// using \a fcvTrackLKOpticalFlowu8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src1 -/// Input image from frame #1. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param src2 -/// Input image from frame #2. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Input image width. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Input image height. -/// -/// @param src1Pyr -/// Image Pyradmid of src1 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param src2Pyr -/// Image Pyradmid of src2 -/// \n\b WARNING: obtained by calling fcvPyramidCreateu8 -/// -/// @param dx1Pyr -/// Horizontal Sobel gradient pyramid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param dy1Pyr -/// Vertical Sobel grading pyraid for src1 -/// \n\b NOTE: To be left NULL. In this case the function will -/// build the pyramid internally. -/// -/// @param featureXY -/// Pointer to X,Y floating point, sub-pixel coordinates for features to -/// track. Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureXY_out -/// Pointer to X,Y floating point, sub-pixel coordinates for tracked features -/// Stored as X,Y tuples. featureXY array storage must -/// be >= featureLen*2. -/// -/// @param featureStatus -/// Pointer to integer array for status of each feature defined in -/// featureXY. featureStatus array storage must -/// be >= featureLen. -/// \n\b NOTE: Possible status are : -/// \n TRACKED 1 -/// \n NOT_FOUND -1 -/// \n SMALL_DET -2 -/// \n MAX_ITERATIONS -3 -/// \n OUT_OF_BOUNDS -4 -/// \n LARGE_RESIDUE -5 -/// \n SMALL_EIGVAL -6 -/// \n INVALID -99 -/// -/// @param featureLen -/// Number of features in featuresXY and featureStatus array. -/// -/// @param windowWidth -/// Width of window for optical flow searching. -/// \n\b NOTE: suggested value 5, 7 or 9 -/// -/// @param windowHeight -/// Height of window for optical flow searching. -/// \n\b NOTE:: suggested value 5, 7 or 9 -/// -/// @param maxIterations -/// Maximum number of LK iterations to perform per pyramid level. -/// \n\b NOTE: suggested value 5 or 7 -/// -/// @param nPyramidLevels -/// Number of pyramid levels. -/// \n\b NOTE: suggested value 3 or 4 depending on size of image -/// -/// @param maxResidue -/// Maximum feature residue above which feature is declared lost. -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minDisplacement -/// Minimum displacement solved below which iterations are stopped. -/// \n\b NOTE : Suggest that be set to between 0.1 and 0.2, say 0.15 -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param minEigenvalue -/// Threshold for feature goodness. If it is set it to 0, the check is disabled. -/// \n\b NOTE: If good features are passed to the function, then it is suggested -/// that you set it to 0 to have faster function time -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @param lightingNormalized -/// if 1 Enable lightning normalization -/// \n if 0 Disable lightning normalization -/// \n\b NOTE: obsolete parameters, set to 0 -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - const fcvPyramidLevel* src1Pyr, - const fcvPyramidLevel* src2Pyr, - const fcvPyramidLevel* dx1Pyr, - const fcvPyramidLevel* dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of float32 arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight*4 bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param srcHeight -/// Height of base image -/// \n\b WARNING: must be a multiple of 2^numLevels -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreatef32( const float* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Builds an image pyramid of uint8_t arising from a single -/// original image - that are successively downscaled w.r.t. the -/// pre-set levels. -/// \n\b NOTE: Memory should be deallocated using fcvPyramidDelete -/// -/// @param src -/// Base image. Size of buffer is srcWidth*srcHeight bytes. -/// -/// @param srcWidth -/// Width of base image -/// \n\b WARNING: must be a multiple of 2^(numLevels-1) -/// -/// @param srcHeight -/// height of base image -/// \n\b NOTE: must be a multiple of 2^(numLevels-1) -/// -/// @param numLevels -/// Number of levels of the pyramid -/// -/// @param pyramid -/// Output pyramid of numLevels+1 images of the same type as src . -/// pyramid[0] will be the same as src . pyramid[1] is the next -/// pyramid layer, a smoothed and down-sized src , and so on. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidCreateu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of int16_t from an image pyramid of uint8_t -/// -/// @param imgPyr -/// Input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of float32 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatef32( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a gradient pyramid of integer8 from an image pyramid of uint8_t -/// -/// @param imgPyr -/// input Image Pyramid -/// -/// @param dxPyr -/// Horizontal Sobel gradient pyramid -/// -/// @param dyPyr -/// Verical Sobel gradient pyramid -/// -/// @param numLevels -/// Number of levels in the pyramids -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- - -FASTCV_API int -fcvPyramidSobelGradientCreatei8( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, - unsigned int numLevels ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanars16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars16_v3 will be renamed to fcvImageGradientSobelPlanars16 -/// and the signature of fcvImageGradientSobelPlanars16_v2 and -/// fcvImageGradientSobelPlanars16_v3 as it appears now, will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as (srcWidth*sizeof(int16_t)). -/// \n\b WARNING: must be multiple of 16 (8 * 2-bytes per gradient value), and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data without normalization. -/// This function computes central differences on 3x3 neighborhood and then convolves -/// the result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanars16_v2() with a change in behavior: no normalization -/// at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars16, -/// \a fcvImageGradientSobelPlanars16_v2 and fcvImageGradientSobelPlanars16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelPlanars16 -/// and fcvImageGradientSobelPlanars16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars16 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be multiple of 8. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays, is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the gradient arrays dx or dy. If left at 0 gradStride is default to 2 * srcWidth. -/// \n\b NOTE: must be multiple of 8. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleaveds16_v3(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleaveds16_v3 will be renamed to fcvImageGradientSobelInterleaveds16 -/// and the signature of fcvImageGradientSobelInterleaveds16 and -/// fcvImageGradientSobelInterleaveds16_v2 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(int16_t). -/// \n\b WARNING: must be multiple of 8, and at least as much as 4*srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -// ----------------------------------------------------------------------------- -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// \n Compared to the original and v2 functions, this v3 functions does not normalize -/// \n the gradients (divide by 8). It just returns the actual dx, dy values. -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelInterleaveds16_v2() with a change in behavior: no -/// normalization at the end of the calculation. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleaveds16, -/// \a fcvImageGradientSobelInterleaveds16_v2 and fcvImageGradientSobelInterleaveds16_v3 -/// will be removed, and the current signature for \a fcvImageGradientSobelInterleaveds16 -/// and fcvImageGradientSobelInterleaveds16_v3 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleaveds16 when transitioning to 2.0.0. -/// \n\n -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. The number of pixels in a row. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in the interleaved gradients array. If left at 0 gradStride is default to 4 * (srcWidth-2). -/// \n\b WARNING: must be multiple of 8. -/// -/// @ingroup image_processing -// ----------------------------------------------------------------------------- -FASTCV_API void -fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelInterleavedf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelInterleavedf32_v2 will be renamed to fcvImageGradientSobelInterleavedf32 -/// and the signature of fcvImageGradientSobelInterleavedf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// (width-2)*(height-2) *2 floats in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel. The output is in interleaved format (i.e.) [dx][dy][dx][dy].... -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelInterleavedf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelInterleavedf32, -/// \a fcvImageGradientSobelInterleavedf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelInterleavedf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelInterleavedf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param gradients -/// Buffer to store horizontal and vertical gradient. Must be -/// gradStride*(height-2) *2 bytes in size. -/// Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param gradStride -/// Stride (in bytes) of the interleaved gradients array. -/// \n\b NOTE: if 0, gradStride is set as (srcWidth-2)*2*sizeof(float). -/// \n\b WARNING: must be multiple of 8, and at least as much as (srcWidth-2)*2*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvFilterGaussian3x3u8_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanars8_v2 will be renamed to fcvImageGradientSobelPlanars8 -/// and the signature of fcvImageGradientSobelPlanars8 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function -/// computes central differences on 3x3 neighborhood and then convolves the -/// result with Sobel kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanars8() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanars8, -/// \a fcvImageGradientSobelPlanars8_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanars8 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanars8 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32_v2 will be renamed to fcvImageGradientSobelPlanarf32 -/// and the signature of fcvImageGradientSobelPlanarf32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8 -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanarf32() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32, -/// \a fcvImageGradientSobelPlanarf32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// \n\b WARNING: must be multiple of 8, and at least as much as srcWidth if not 0. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b NOTE: if 0, dxyStride is set as 4*srcWidth. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value),and at least as much as srcWidth*sizeof(float) if not 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function's signature will become \b OBSOLETE in a future -/// release of this library (2.0.0). The new interface is specified in the -/// function: fcvImageGradientSobelPlanarf32f32_v2(). In the 2.0.0 release, -/// fcvImageGradientSobelPlanarf32f32_v2 will be renamed to fcvImageGradientSobelPlanarf32f32 -/// and the signature of fcvImageGradientSobelPlanarf32f32 as it appears now, -/// will be removed. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels (not bytes) between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b NOTE: if 0, srcStride is set as srcWidth. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (width)*(height) floats in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy); - - -//------------------------------------------------------------------------------ -/// @brief -/// Creates a 2D gradient image from source luminance data. This function computes -/// central differences on 3x3 neighborhood and then convolves the result with Sobel -/// kernel -/// \n -/// \n [ -1 0 +1 ] [ -1 -2 -1 ] -/// \n dx = [ -2 0 +2 ] * src dy = [ 0 0 0 ] * src -/// \n [ -1 0 +1 ] [ +1 +2 +1 ] -/// -/// \n\b ATTENTION: This function is a duplication of of -/// fcvImageGradientSobelPlanarf32f32()() with the addition of extra parameters. -/// This function has been added to allow for backward compatibility -/// with the original function. When the 2.0.0 release of this library -/// is made, this function will be renamed to: \a fcvImageGradientSobelPlanarf32f32(), -/// \a fcvImageGradientSobelPlanarf32f32_v2 will be removed, and the current signature -/// for \a fcvImageGradientSobelPlanarf32f32 will be removed. Until 2.0.0, the -/// developer should use this implementation with the expectation of -/// renaming it to \a fcvImageGradientSobelPlanarf32f32 when transitioning to 2.0.0. -/// \n\n -/// -/// @param src -/// Input image/patch. Size of buffer is srcStride*srcHeight floats. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param srcWidth -/// Width of src data to create gradient. -/// \n\b WARNING: must be multiple of 8. -/// -/// @param srcHeight -/// Height of src data to create gradient. -/// -/// @param srcStride -/// Stride (in bytes) of image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, srcStride is set as srcWidth*4. -/// -/// @param dx -/// Buffer to store horizontal gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dy -/// Buffer to store vertical gradient. Must be (dxyStride)*(height) bytes in size. -/// \n\b NOTE: a border of 1 pixel in size on top, bottom, left, and right -/// contains undefined values. Gradient output is scaled by 1/8. -/// \n\b NOTE: data should be 128-bit aligned. -/// -/// @param dxyStride -/// Stride (in bytes) of 'dx' and 'dy' gradient arrays. -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes per gradient value). -/// \n\b WARNING: must be multiple of 32 (8 * 4-bytes), and at least as much as srcWidth*sizeof(float) if not 0. -/// \n\b NOTE: if 0, dxyStride is set as srcWidth*4. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Block Optical Flow 16x16 - Tracks all 16x16 blocks in the Region of Interest -/// (ROI) from Source-1 to Source-2. Generates Motion Vectors for blocks where -/// motion is detected. -/// -/// @details -/// -/// @param[in] src1 -/// Pointer to source image where the original blocks are present. -/// \n Dimensions should be same as \a src2, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: must be 128-bit aligned. Buffer size is srcStride*srcHeight bytes. -/// -/// @param[in] src2 -/// Pointer to second source image where motion vectors for blocks in \a img1 -/// are to be located. -/// \n Dimensions should be same as \a src1, and equal to \a srcWidth, -/// \a srcHeight, \a srcStride. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param[in] srcWidth -/// Width of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcHeight -/// Height of source images pointed by \a src1 and \a src2. -/// -/// @param[in] srcStride -/// Stride of source images pointed by \a src1 and \a src2. -/// -/// @param[in] roiLeft -/// Left co-ordinate (x0) of Region-of-Interest (ROI). -/// -/// @param[in] roiTop -/// Top co-orgdinate (y0) of Region-of-Interest (ROI). -/// -/// @param[in] roiRight -/// Right co-ordinate (x1) of Region-of-Interest (ROI). -/// -/// @param[in] roiBottom -/// Bottom co-ordinate (y1) of Region-of-Interest (ROI). -/// -/// @param[in] shiftSize -/// Distance in number of pixels (both horizontally and vertically) between -/// consecutive blocks for which motion vector is searched. -/// \n\b NOTE: Larger the value, less number of blocks will be tracked, and -/// hence the function will run faster. -/// -/// @param[in] searchWidth -/// Numbers of pixels horizontally on left and right of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchHeight -/// Numbers of pixels vertically on top and bottom of the source block (src2) where a -/// match is searched for. For example, if searchWidth is 8 and searchHeight -/// is 8, then the search area for any given block will be 32x32 around -/// the location of that block. -/// -/// @param[in] searchStep -/// Distance in number of pixels between consecutive search targets within -/// the above search window. -/// \n\b NOTE: Larger the value, more coarse the search will be and thus -/// will make the fucntion run faster. Smaller the value, more dense the -/// search will be, making the funciton run slower. -/// -/// @param[in] usePrevious -/// Indicates if the function should use the existing motion vectors in -/// locX and locY as the starting point for motion vector search. -/// \n\b NOTE: This parameter is redundant at the moment. -/// -/// @param[out] numMv -/// Pointer to variable that will store the count of Motion Vectors -/// generated by the function. -/// \n\b WARNING: This pointer should be Non-NULL. -/// -/// @param[out] locX -/// Pointer to an array which will store the X co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] locY -/// Pointer to an array which will store the Y co-ordinates of the -/// original Block for which a Motion Vector is generated. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvX -/// Pointer to an array which will store the X co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvX[i]-\a locX[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @param[out] mvY -/// Pointer to an array which will store the Y co-ordinates of the block in \a src2 -/// corresponding block in \a src1. (\a mvY[i]-\a locY[i]) will give the motion -/// vector for the block in \a src1. -/// \n\b NOTE: The array will contain \a numMv valid entries. -/// \n\b WARNING: This pointer should be Non-NULL, and the array size should -/// be >= number of 16x16 blocks in ROI. -/// -/// @return -/// 0 - Success, Failure otherwise. -/// -/// @ingroup object_detection -//------------------------------------------------------------------------------ -FASTCV_API int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 8-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 8-bit source image 1. -/// -/// @param src2 -/// Pointer to the 8-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOru8(const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride ); - -//------------------------------------------------------------------------------ -/// @brief -/// Performs per-element bitwise-OR operation on two 32-bit single channel images. -/// Two images should have the same size. dst(I)=src1(I) V src2(I) if mask(I) is not zero. -/// -/// @param src1 -/// Pointer to the 32-bit source image 1. -/// -/// @param src2 -/// Pointer to the 32-bit source image 2. -/// -/// @param srcWidth -/// Width of source images pointed by src1 and src2. -/// -/// @param srcHeight -/// Height of source images pointed by src1 and src2. -/// -/// @param srcStride -/// Stride of source images (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param dst -/// Pointer to the 8-bit destination image. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param mask -/// Pointer to the 8-bit single channel mask. It specifies elements of the destination array to be changed. -/// The mask is optional. If there is no mask, the value is NULL. -/// -/// @param maskStride -/// Stride of the mask (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If there is no mask, the value is 0. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvBitwiseOrs32(const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Converts an image from RGB space to grayscale -/// -/// @details -/// -/// @param src -/// Source 8-bit image, BGR888 format (R is lowest byte for the pixel) -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param srcWidth -/// Source image width. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Source image height. -/// -/// @param srcStride -/// Stride of source image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, srcStride=srcWidth as default -/// -/// @param dst -/// Destination 8-bit gray-scale image. -/// \n\b WARNING: must be 128-bit aligned. -/// -/// @param dstStride -/// Stride of destination image (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). -/// If set to 0, dstStride=srcStride as default -/// -/// -/// -/// @ingroup color_conversion -//------------------------------------------------------------------------------ -FASTCV_API void -fcvColorRGB888ToGrayu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride); - - -//------------------------------------------------------------------------------ -/// @brief -/// Integral of the image tilted by 45 degrees -/// -/// @details -/// Calculates the tilted integral image of an input image -/// and adds an zero-filled border on top. Left border not zero. -/// dst[i,j]=sum (src[m,n]), where n according to -/// descDBTargetId. -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param descDBOldIdx -/// A pointer to uint32_t [numDescDB], -/// which stores the old index of the desc before sorting -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API int -fcvLinearSearchPrepare8x36s8( uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict descDBOldIdx, - uint32_t numDescDB ); - -//--------------------------------------------------------------------------- -/// @brief -/// Perform linear search of descriptor in a database -/// -/// @param dbLUT -/// A pointer to uint32_t [numDBLUT][2], -/// which stores the starting index of descDB and -/// the number of descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param numDBLUT -/// The size of dbLUT -/// -/// @param descDB -/// A pointer to int8_t [numDescDB][36], -/// which stores descriptors -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param descDBInvLenQ38 -/// A pointer to uint32_t [numDescDB], -/// which stores the inverse length of descDB. -/// The value is in Q38 format. -/// -/// @param descDBTargetId -/// A pointer to uint16_t [numDescDB], -/// which stores the target id. -/// -/// @param numDescDB -/// Number of descriptor in the database. -/// -/// @param srcDesc -/// A pointer to int8_t [numSrcDesc][36], -/// which stores descriptors. -/// \n\b WARNING: must be 64-bit aligned. -/// -/// @param srcDescInvLenQ38 -/// A pointer to uint32_t [numSrcDec], -/// which stores the inverse length of srcDesc. -/// The value is in Q38 format. -/// -/// @param srcDescIdx -/// A pointer to the dbLUT data -/// -/// @param numSrcDesc -/// Number of source descriptor -/// -/// @param targetsToIgnore -/// A list of target IDs to be ignored -/// -/// @param numTargetsToIgnore -/// Number of targets to be ignored -/// -/// @param maxDistanceQ31 -/// Maximum distance for correspondences. -/// In Q31 format. -/// -/// @param correspondenceDBIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of featuresDB -/// as a part of correspondences. -/// -/// @param correspondenceSrcDescIdx -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output indices of descriptors -/// as a part of correspondences. -/// -/// @param correspondenceDistanceQ31 -/// A pointer to uint32_t [maxNumCorrespondences], -/// which will be used by this function to output the distances -/// as a part of correspondences. -/// In Q31 format. -/// -/// @param maxNumCorrespondences -/// Maximum number of correspondences allowed -/// -/// @param numCorrespondences -/// Number of correspondences returned by this function -/// -/// @ingroup feature_detection -//--------------------------------------------------------------------------- - -FASTCV_API void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondenceSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds only extreme outer contours in a binary image. There is no nesting -/// relationship between contours. It sets hierarchy[i][2]=hierarchy[i][3]=-1 -/// for all the contours. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image without any hierarchical relationships. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and organizes them into a two-level -/// hierarchy. At the top level, there are external boundaries of the -/// components. At the second level, there are boundaries of the holes. -/// If there is another contour inside a hole of a connected component, -/// it is still put at the top level. -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Finds contours in a binary image and reconstructs a full hierarchy of -/// nested contours -/// -/// @param src -/// Grayscale image with one byte per pixel. Non-zero pixels are treated as -/// 1's. Zero pixels remain 0's, so the image is treated as binary. -/// -/// @param srcWidth -/// Image width -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @param numContours -/// Number of actually found contours -/// -/// @param maxNumContours -/// Maximum number of contours can be found (<= 126) -/// -/// @param holeFlag -/// Hole flag for each found contour to indicate whether it is a hole or not -/// -/// @param numContourPoints -/// Number of points in each found contour -/// -/// @param contourStartPoints -/// Pointers to the start point of each found contour -/// -/// @param pointBuffer -/// Pointer to point buffer for contour points' coordinates. It should -/// be allocated before calling this function. -/// -/// @param pointBufferSize -/// Size of point buffer in terms of uint32_t -/// -/// @param hierarchy -/// Information about the image topology. It has numContours elements. -/// For each contour i, the elements hierarchy[i][0], hiearchy[i][1], -/// hiearchy[i][2], and hiearchy[i][3] are set to 0-based indices of the -/// next and previous contours at the same hierarchical level, the first -/// child contour and the parent contour, respectively. If for a contour i -/// there are no next, previous, parent, or nested contours, the corresponding -/// elements of hierarchy[i] will be negative. -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data. It should be allocated by -/// fcvFindContoursAllocate() and deallocated by fcvFindContoursDelete(). -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Allocates assistant and intermediate data for contour -/// -/// @param srcStride -/// Stride of image (i.e., how many pixels between column 0 of row 1 and -/// column 0 of row 2). -/// -/// @return -/// Pointer to allocated data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void* -fcvFindContoursAllocate( uint32_t srcStride ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Deallocates assistant and intermediate data for contour -/// -/// @param contourHandle -/// Pointer to assistant and intermediate data -/// -/// @ingroup feature_detection -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindContoursDelete( void* contourHandle ); - -//------------------------------------------------------------------------------ -/// @brief -/// Solve linear equation system -/// Ax = b -/// -/// @details -/// -/// -/// @param A -/// The matrix contains coefficients of the linear equation system -/// -/// @param numRows -/// The number of rows for the matrix A -/// -/// @param numCols -/// The number of columns for the matrix A -/// -/// @param b -/// The right side value -/// -/// @param x -/// The solution vector -/// -/// -/// @return -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x); - -//------------------------------------------------------------------------------ -/// @brief -/// Calculates a perspective transform from four pairs of the corresponding -/// points. -/// NOTE: in order to guarantee a valid output transform, any three points -/// in src1 or src2 cannot be collinear. -/// -/// @param src1 -/// Coordinates of quadrangle vertices in the source image -/// -/// @param src2 -/// Coordinates of the corresponding quadrangle vertices in the destination -/// image -/// -/// @param transformCoefficient -/// 3x3 matrix of a perspective transform -/// -/// @ingroup image_transform -//------------------------------------------------------------------------------ -FASTCV_API void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input uint8_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for the mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ - -FASTCV_API void -fcvSetElementsu8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input int32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementss32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t single channel array to a given value. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value -/// the input float32_t value -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsf32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param value4 -/// Fourth uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param value4 -/// Fourth int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 4-channel array to a given 4-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param value4 -/// Fourth float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc4f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a uint8_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First uint8_t value of the Scalar -/// -/// @param value2 -/// Second uint8_t value of the Scalar -/// -/// @param value3 -/// Third uint8_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3u8( uint8_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of an int32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First int32_t value of the Scalar -/// -/// @param value2 -/// Second int32_t value of the Scalar -/// -/// @param value3 -/// Third int32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed. -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3s32( int32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -//------------------------------------------------------------------------------ -/// @brief -/// Sets every element of a float32_t 3-channel array to a given 3-element scalar. -/// -/// @details -/// A non-zero element of the mask array indicates the corresponding element -/// of the destination array to be changed. The mask itself equals to zero means that -/// all elements of the dst array need to be changed. The mask is assumed to -/// have the same width and height( in terms of pixels) as the destination array. -/// -/// @param dst -/// The destination matrix -/// -/// @param dstWidth -/// Destination matrix width -/// -/// @param dstHeight -/// Destination matrix height -/// -/// @param dstStride -/// Stride for the destination matrix, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @param value1 -/// First float32_t value of the Scalar -/// -/// @param value2 -/// Second float32_t value of the Scalar -/// -/// @param value3 -/// Third float32_t value of the Scalar -/// -/// @param mask -/// Operation mask, 8-bit single channel array; specifies elements of the src -/// array to be changed -/// -/// @param maskStride -/// Stride for input mask, i.e. the gap (in terms of bytes) between the first element of a row and that of the successive row -/// -/// @return -/// No return value -/// -/// @ingroup math_vector -//------------------------------------------------------------------------------ -FASTCV_API void -fcvSetElementsc3f32( float32_t * __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -//------------------------------------------------------------------------------ -/// @brief -/// Defines an enumeration to list threshold types used in fcvAdaptiveThreshold -//------------------------------------------------------------------------------ - -typedef enum { - FCV_THRESH_BINARY = 0, // value = value > threshold ? max_value : 0 - FCV_THRESH_BINARY_INV // value = value > threshold ? 0 : max_value -} fcvThreshType; - - -//--------------------------------------------------------------------------- -/// @brief -/// Binarizes a grayscale image based on an adaptive threshold value calculated from 3x3 Gaussian kernel. -/// -/// @details -/// For each pixel, the threshold is computed adaptively based on cross-correlation with a -/// 3x3 Gaussian kernel minus value (parameter). The standard deviation is used for Gaussian kernel. -/// For FCV_THRESH_BINARY threshold type, the pixel is set as maxValue if it's value is greater than the threshold; -/// else, it is set as zero. For FCV_THRESH_BINARY_INV threshold type, the pixel is set as zero if it's value is greater than the threshold; -/// else, it is set as maxValue. -/// -/// @param src -/// Pointer to the 8-bit input image. -/// -/// @param srcWidth -/// Width of source images pointed by src. -/// -/// @param srcHeight -/// Height of source images pointed by src. -/// -/// @param srcStride -/// Stride of source image (i.e., number of bytes between column 0 -/// of row 0 and column 0 of row 1). -/// -/// @param maxValue -/// The maximum integer value to be used. 0>1+8) *sizeof(uint32_t) -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param integralCrStride -/// The stride of integralCr. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 integralCrStride is default to (srcWidth>>1+8) *sizeof(uint32_t) -/// \n\b NOTE: must be a multiple of 8. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function finds the foreground. -/// -/// @details -/// This function tries to find a forgound in the current image (represented by: fgIntegralY, -/// fgIntegralCb, fgIntegralCr) based on the current background model (represented by: bgIntegralY, -/// bgIntegralCb, bgIntegralCr). For example, the tuple (bgIntegralY, bgIntegralCb, bgIntegralCr) may be -/// from a picture shooting a wall. Then the tuple (fgIntegralY, fgIntegralCb, fgIntegralCr) may be -/// the wall with a paint on it. Note that all the first six parameters are indicating integral images -/// that's computed from a YUV420 image, which maybe computed from the function: -/// fcvIntegrateImageYCbCr420PseudoPlanaru8. Generally the size of fgIntegralY and bgIntegralY are -/// (srcWidth+1)*(srcHeight+1). And the size of fgIntegralU, fgIntegralV, bgIntegralU and bgIntegralV -/// are (srcWidth/2+1)*(srcHeight/2+1). The value of the outputWidth and outputHeight are usually indicating -/// the desired block size. For example, if the user wants a 20x15 blocks on a 800x480 image. Then -/// outputWidth=800/20 and outputHeight=480/15. After return, if the value in the outputMask image is -/// 255, then a moving block is indicated, otherwise a non-moving block is indicated. -/// -/// @param bgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the background image. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param bgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the background image. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param bgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the background image. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralY -/// The input image/patch that's indicating the Y channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcYStride*srcHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralCb -/// The input image/patch that's indicating the Cb channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCbStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param fgIntegralCr -/// The input image/patch that's indicating the Cr channel of the integral image of the image -/// on which we want to find the foreground. -/// Size of buffer is srcCrStride*srcHeight/2 bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row. See the details. -/// \n\b NOTE: must be a multiple of 16. -/// -/// @param srcHeight -/// The height of the source image. See the details. -/// \n\b NOTE: must be a multiple of 2. -/// -/// @param srcYStride -/// The stride of the input source image's Y channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcCbStride -/// The stride of the input source image's Cb channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcCrStride -/// The stride of the input source image's Cr channel. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 srcStride is default to (srcWidth>>1+8)*sizeof(uint32_t). -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param outputMask -/// The output mask image. Each pixel represent the motion condition for a block in the original image. -/// Size of buffer is outputMaskStride*outputHeight bytes -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param outputWidth -/// The width of the output mask image. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param outputHeight -/// The height of the output mask image. -/// -/// @param outputMaskStride -/// The stride of the output mask image. (i.e., how many bytes between column 0 of row 1 and -/// column 0 of row 2). If left at 0 outputMaskStride is default to outputWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param threshold -/// The threshold that's used to decide if a block is moving or not. (recommend the value of 20). -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t * __restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ); - - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// The input image/patch. Must be 32 bit image. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - -//--------------------------------------------------------------------------- -/// @brief -/// This function calculates the average value of an image. -/// -/// @details -/// This function sums all the pixel value in an image and divide the result by the number of pixels in the image. -/// -/// @param src -/// 8-bit image where keypoints are detected. Size of buffer is srcStride*srcHeight bytes. -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// Image width, the number of pixels in a row -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// Image height -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// \n\b NOTE: must be a multiple of 8. -/// -/// @param avgValue -/// The output average value. -/// -/// @return -/// No return value. -/// -/// @ingroup image_processing -//------------------------------------------------------------------------------ -FASTCV_API void -fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8 bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// The actually number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShifts32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the meanshift procedure and obtains the final converged position -/// -/// @details -/// This function applies the meanshift procedure to an original image (usually a probability image) and obtains the final converged position. -/// The converged position search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the MeanShift which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvMeanShiftf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be 8bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracku8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be int 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTracks32(const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - - -//------------------------------------------------------------------------------ -/// @brief -/// Applies the ConAdaTrack procedure and find the object center, size and orientation -/// -/// @details -/// This function applies the ConAdaTrack procedure to an original image (usually a probability image) and obtains the final converged object. -/// The optimal object search will stop either it has reached the required accuracy or the maximum number of iterations. -/// -/// @param src -/// Pointer to the original image which is usually a probability image computed based on object histogram. Must be float 32bit grayscale image. -/// Size of buffer is srcStride*srcHeight bytes. -/// NOTE: must be 128-bit aligned. -/// -/// @param srcWidth -/// The width of the input source image. -/// NOTE: must be a multiple of 8. -/// -/// @param srcHeight -/// The height of the input source image. -/// -/// @param srcStride -/// Stride of image is the number of bytes between column 0 of row 1 and -/// column 0 of row 2 in data memory. If left at 0 srcStride is default to srcWidth*4. -/// NOTE: must be a multiple of 8. -/// -/// @param window -/// Pointer to the initial search window position which also returns the final converged window position. -/// -/// @param criteria -/// The criteria used to finish the object search which consists of two termination criteria: -/// 1) epsilon: required accuracy; 2) max_iter: maximum number of iterations -/// -/// @param circuBox -/// The circumscribed box around the object -/// -/// @return -/// Number of iterations -/// -/// @ingroup Motion_and_Object_Tracking -//------------------------------------------------------------------------------ -FASTCV_API uint32_t -fcvConAdaTrackf32(const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D* circuBox); - -//------------------------------------------------------------------------------ -/// @brief -/// Compute a singular value decomposition of a matrix of a float type -/// A = U*diag[w]*Vt; -/// It is used for solving problems like least-squares, under-determined linear systems, matrix -/// inversion and so forth. The algorithm used here does not compute the full U and V matrices -/// however it computes a condensed version of U and V described below which is sufficient to solve -/// most problems which use SVD. -/// -/// @details -/// -/// -/// @param A -/// The input matrix of dimensions m x n -/// \n\b NOTE: must be 128-bit aligned. -/// -/// @param m -/// The number of rows of matrix A -/// -/// @param n -/// The number of columns of matrix A -/// -/// @param w -/// The pointer to the buffer that holds n singular values. When m>n it -/// contains n singular values while when m -#include - -//============================================================================== -// Defines -//============================================================================== - -#define FASTCV_INL_VERSION 122 - -#ifdef ANDROID - #include - #define FASTCV_ERROR( FMT, ... ) \ - __android_log_print( ANDROID_LOG_ERROR, "", FMT, __VA_ARGS__ ); -#else - #define FASTCV_ERROR( FMT, ... ) \ - fprintf( stderr, FMT, __VA_ARGS__ ); -#endif - -#ifndef fcvAssertHook - #define fcvAssertHook( FASTCV_ASSERT_HOOK_IN, \ - FASTCV_ASSERT_HOOK_FILE, \ - FASTCV_ASSERT_HOOK_LINE ) \ - FASTCV_ERROR( "%s@%d: %s\n", \ - FASTCV_ASSERT_HOOK_FILE, \ - FASTCV_ASSERT_HOOK_LINE, \ - #FASTCV_ASSERT_HOOK_IN ) -#endif - -#ifndef NDEBUG - #define fcvAssert( FASTCV_ASSERT_IN ) \ - if( !(FASTCV_ASSERT_IN) ) \ - fcvAssertHook( FASTCV_ASSERT_IN, __FILE__, __LINE__ ); -#else - #define fcvAssert( FASTCV_ASSERT_IN ) ((void)0) -#endif - - -//============================================================================== -// Declarations -//============================================================================== - -#ifdef _MSC_VER - #pragma warning(disable:4311) -#endif - -#if FASTCV_VERSION != FASTCV_INL_VERSION - #error "Version mismatch: fastcv.h and fastcv.inl is not from the same version." -#endif - -extern void -(**ppfcvFilterMedian3x3u8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterGaussian3x3u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int border -); - -extern void -(**ppfcvFilterGaussian5x5u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvFilterGaussian11x11u8_v2) -( - const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvColorYUV420toRGB565u8) -( - const uint8_t* __restrict yuv420, - unsigned int width, - unsigned int height, - uint32_t* __restrict rgb565 -); - -extern void -(**ppfcvColorYCrCbH1V1toRGB888u8) -( - const uint8_t* __restrict crcb, - unsigned int width, - unsigned int height, - uint8_t* __restrict rgb888 -); - -extern void -(**ppfcvColorYCrCbH2V2toRGB888u8) -( - const uint8_t* __restrict y_src, - unsigned int width, - unsigned int height, - uint8_t* __restrict rgb888 -); - -extern void -(**ppfcvColorYCrCbH2V1toRGB888u8) -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvColorYCrCbH1V2toRGB888u8) -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvColorRGB888toYCrCbu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvDescriptor17x17u8To36s8) -( - const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq -); - -extern int -(**ppfcvDescriptorSampledMeanAndVar36f32) -( - const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp -); - -extern int32_t -(**ppfcvDotProducts8) -( - const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize -); - -extern int32_t -(**ppfcvDotProductu8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize -); - -extern int32_t -(**ppfcvDotProduct36x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct36x4s8)( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] ); - -extern void -(**ppfcvDotProductNorm36x4s8)( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); -extern int32_t -(**ppfcvDotProduct36x1u8)( const uint8_t* __restrict a, - const uint8_t* __restrict b ); - -extern void -(**ppfcvDotProduct36x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm36x4u8)( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern int32_t -(**ppfcvDotProduct64x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct64x4s8) -( - const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm64x4s8)( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern uint32_t -(**ppfcvDotProduct64x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvDotProduct64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm64x4u8)( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - -extern int32_t -(**ppfcvDotProduct128x1s8)( const int8_t* __restrict a, - const int8_t* __restrict b ); - -extern void -(**ppfcvDotProduct128x4s8)( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t dotProducts[4] ); - -extern void -(**ppfcvDotProductNorm128x4s8) -( - const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts -); - -extern uint32_t -(**ppfcvDotProduct128x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvDotProduct128x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t dotProducts[4] -); - -extern void -(**ppfcvDotProductNorm128x4u8)(const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ); - - -extern void -(**ppfcvDotProduct8x8u8)( const uint8_t* ptch, const uint8_t* img, - unsigned short imgW, unsigned short imgH, int nX, - int nY, unsigned int nNum, int32_t* nProducts ); - -extern void -(**ppfcvDotProduct11x12u8)( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, int iX, - int iY, int32_t* __restrict dotProducts ); - -extern void -(**ppfcvFilterSobel3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCanny3x3u8_v2) -( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstStride, - int low, - int high -); - -extern void -(**ppfcvImageDiffu8_v2) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDiffs16_v2) -( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDifff32_v2) -( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageDiffu8f32_v3) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStrde -); - - -extern void -(**ppfcvImageDiffu8s8_v2) -( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageGradientInterleaveds16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientInterleavedf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientPlanars16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientPlanarf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelInterleaveds16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride -); - -extern void - (**ppfcvImageGradientSobelInterleaveds16_v3) - ( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride - ); - -extern void -(**ppfcvImageGradientSobelInterleavedf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride -); - -extern void -(**ppfcvImageGradientSobelPlanars16_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void - (**ppfcvImageGradientSobelPlanars16_v3) - ( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelPlanarf32_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride -); - -extern void -(**ppfcvImageGradientSobelPlanarf32f32_v2) -( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride -); - -extern int -(**ppfcvClusterEuclideanf32)( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - - -extern int -(**ppfcvClusterEuclideanNormedf32)( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) ; - - -extern int -(**ppfcvClusterEuclideanNormed36f32)( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ); - -extern void -(**ppfcvImageGradientSobelPlanars8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride -); - -extern void -(**ppfcvCornerFast9u8_v2) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - unsigned int maxnumcorners, - uint32_t* numcorners -); - -extern void -(**ppfcvCornerFast9InMasku8_v2) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight -); - -extern void -(**ppfcvCornerFast10u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners); - -extern void -(**ppfcvCornerFast10InMasku8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ); - -extern void -(**ppfcvCornerHarrisu8) -( - const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold -); - -extern unsigned int -(**ppfcvLocalHarrisMaxu8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore -); - -extern void -(**ppfcvCornerHarrisInMasku8) -( - const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold, - const uint8_t* __restrict bitMask, - int maskWidth, - int maskHeight -); - -extern void -(**ppfcvGeomAffineFitf32)( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ); - -extern int -(**ppfcvGeomAffineEvaluatef32)( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -extern void -(**ppfcvGeomHomographyFitf32)( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ); - -extern int -(**ppfcvGeomHomographyEvaluatef32)( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ); - -extern float -(**ppfcvGeomPoseRefineGNf32) ( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ); - -extern int -(**ppfcvGeomPoseUpdatef32) ( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -extern int -(**ppfcvGeomPoseOptimizeGNf32) ( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ); - -extern float -(**ppfcvGeomPoseEvaluateErrorf32) ( - const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ); - -extern int -(**ppfcvGeomPoseEvaluatef32) ( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ); - -extern void -(**ppfcvGeom3PointPoseEstimatef32) ( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ); - -extern void -(**ppfcvFilterCorr3x3s8_v2) -( -const int8_t* __restrict mask, -const uint8_t* __restrict srcImg, -unsigned int srcWidth, -unsigned int srcHeight, -unsigned int srcStride, -uint8_t* __restrict dstImg, -unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep9x9s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep13x13s16) -( - const int16_t* __restrict knl, - const int16_t* __restrict srcimg, unsigned int w, unsigned int h, - int16_t* __restrict tmpimg, - int16_t* __restrict dstimg -); - - -extern void -(**ppfcvFilterCorrSep11x11s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep13x13s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep15x15s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern void -(**ppfcvFilterCorrSep17x17s16_v3) -( - const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDownBy2u8_v2) -( const uint8_t* __restrict imgSrc, - unsigned int width, - unsigned int height, - unsigned int srcStride, - uint8_t* __restrict imgDst, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDownBy4u8_v2) -( const uint8_t* __restrict imgSrc, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict imgDst, - unsigned int dstStride -); - -extern int -( **ppfcvScaleDown3To2u8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvScaleDownu8_v2) -( const uint8_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dstImg, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride -); - -extern int -(**ppfcvScaleDownNNu8) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride -); - -extern void -(**ppfcvScaleUpBy2Gaussian5x5u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvScaleDownBy2Gaussian5x5u8) -( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -); - -extern void -(**ppfcvScaleDownBy2Gaussian5x5u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvImageIntensityStats) ( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ); - -extern void -(**ppfcvImageIntensityHistogram)( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ); - -extern void -(**ppfcvIntegrateImageu8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - uint32_t* __restrict integralImageOut, - unsigned int integralImageStride -); - -extern void -(**ppfcvIntegratePatchu8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegratePatch12x12u8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegratePatch18x18u8_v2) -( const uint8_t* __restrict imageIn, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut -); - -extern void -(**ppfcvIntegrateImageLineu8) -( - const uint8_t* __restrict imageIn, - unsigned short numPxls, - uint32_t* intgrl, - uint32_t* intgrlSqrd -); - -extern void -(**ppfcvIntegrateImageLine64u8) -( - const uint8_t* __restrict imageIn, - uint16_t* intgrl, - uint32_t* intgrlSqrd -); - -extern int -(**ppfcvNCCPatchOnCircle8x8u8_v2) -( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - - -extern int -(**ppfcvNCCPatchOnSquare8x8u8_v2) -( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* best_x, - uint16_t* best_y, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ); - -extern void -(**ppfcvSumOfAbsoluteDiffs8x8u8_v2) -( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvVecNormalize36s8f32)( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ); - -extern void -(**ppfcvSumOfSquaredDiffs36x4s8)( const int8_t* __restrict A, - float invLenA, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - const float invLenB[4], - float distances[4] ); - -extern void -(**ppfcvSumOfSquaredDiffs36xNs8)( const int8_t* __restrict A, - float invLenA, - const int8_t* const * __restrict B, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ); - -extern void -(**ppfcvSort8Scoresf32)( float* __restrict inScores, - float* __restrict outScores ); - -extern void -(**ppfcvFilterThresholdu8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold -); - -extern void -(**ppfcvFilterDilate3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern void -(**ppfcvFilterErode3x3u8_v2) -( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -); - -extern int -(**ppfcvTransformAffine8x8u8_v2) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride -); - -extern void -(**ppfcvWarpPerspectiveu8) -( - const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict kernel -); - -extern void -(**ppfcvWarpPerspectiveu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict kernel -); - -extern void -(**ppfcv3ChannelWarpPerspectiveu8) -( - const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict kernel -); - -extern void -(**ppfcv3ChannelWarpPerspectiveu8_v2) -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict kernel -); - -extern void -(**ppfcvFilterGaussian5x5s16_v2) -( - const int16_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern void -(**ppfcvFilterGaussian5x5s32_v2) -( - const int32_t* __restrict srcImg, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dstImg, - unsigned int dstStride, - int blurBorder -); - -extern int -(**ppfcvTransformAffineu8) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - const float nPos[ 2 ], - const float nAffine[ 4 ], - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight -); - -extern int -(**ppfcvTransformAffineu8_v2) -( - const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const float nPos[ 2 ], - const float nAffine[ 4 ], - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride -); - -extern void -(**ppfcvCopyRotated17x17u8) -( - const uint8_t*region, - uint8_t*patch, - int nOri - ); - -extern void -(**ppfcvCornerFast9Scoreu8_v3) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* numcorners -); - -extern void -(**ppfcvCornerFast9InMaskScoreu8_v3) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight -); - -extern void -(**ppfcvCornerFast9Scoreu8_v4) -( - const uint8_t*im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* numcorners, - uint32_t nmsEnabled, - void* __restrict tempBuf -); - -extern void -(**ppfcvCornerFast9InMaskScoreu8_v4) -( - const uint8_t* __restrict im, - unsigned int xsize, - unsigned int ysize, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf -); - -extern void -(**ppfcvCornerFast10Scoreu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -extern void -(**ppfcvCornerFast10InMaskScoreu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf); - -extern void -(**ppfcvTrackLKOpticalFlowu8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized -); - -extern void -(**ppfcvTrackLKOpticalFlowf32) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized -); - -extern int -(**ppfcvPyramidCreatef32) -( - const float* __restrict base, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, - fcvPyramidLevel* pyramid -); - -extern int -(**ppfcvPyramidCreateu8) -( - const uint8_t* __restrict base, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, - fcvPyramidLevel * pyramid -); - -extern int -(**ppfcvPyramidAllocate) -( - fcvPyramidLevel* pyr, - unsigned int baseWidth, - unsigned int baseHeight, - unsigned int bytesPerPixel, - unsigned int numLevels, - int allocateBase -); - -extern void -(**ppfcvPyramidDelete) -( - fcvPyramidLevel* pyr, - unsigned int numLevels, - unsigned int startLevel -); - -extern int -(**ppfcvPyramidSobelGradientCreatei16) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, - unsigned int numLevels -); - -extern int -(**ppfcvPyramidSobelGradientCreatei8) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, unsigned int numLevels -); - -extern int -(**ppfcvPyramidSobelGradientCreatef32) -( - const fcvPyramidLevel * imgPyr, - fcvPyramidLevel * dxPyr, - fcvPyramidLevel * dyPyr, - unsigned int numLevels -); - -extern uint32_t -(**ppfcvBitCountu8) -( - const uint8_t* __restrict src, - unsigned int len -); - -extern uint32_t -(**ppfcvBitCount32x1u8) -( - const uint8_t* __restrict src -); - -extern void -(**ppfcvBitCount32x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - uint32_t* __restrict count -); - -extern uint32_t -(**ppfcvBitCount64x1u8) -( - const uint8_t* __restrict src -); - -extern void -(**ppfcvBitCount64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - uint32_t count[4] -); - -extern uint32_t -(**ppfcvBitCountu32) -( - const uint32_t* __restrict src, - unsigned int len -); - -extern uint32_t -(**ppfcvHammingDistanceu8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int len -); - -extern uint32_t -(**ppfcvHammingDistance32x1u8a4) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance64x1u8a4) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance32x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern uint32_t -(**ppfcvHammingDistance64x1u8) -( - const uint8_t* __restrict a, - const uint8_t* __restrict b -); - -extern void -(**ppfcvHammingDistance32x4u8a4) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern void -(**ppfcvHammingDistance64x4u8a4) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern void -(**ppfcvHammingDistance64x4u8) -( - const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t HamminDistances[4] -); - -extern int -(**ppfcvTrackBMOpticalFlow16x16u8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY -); - -extern int -(**ppfcvMserInit) -( - const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle -); - -extern void -(**ppfcvMserRelease) (void *mserHandle); - -extern void -(**ppfcvMseru8) -( - void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour, -unsigned int pointsArraySize, -unsigned int* __restrict pointsArray -); - -extern void -(**ppfcvMserExtu8)( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ); - - -extern void -(**ppfcvBoundingRectangle) -( -const uint32_t * __restrict xy, uint32_t numPoints, - uint32_t * rectTopLeftX, uint32_t * rectTopLeftY, - uint32_t * rectWidth, uint32_t *rectHeight -); - -extern void -(**ppfcvUpsampleVerticalu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleHorizontalu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsample2Du8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleVerticalInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsampleHorizontalInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvUpsample2DInterleavedu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr444Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr422Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr420Planaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB888ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr444PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr422PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGBA8888ToYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorRGB565ToRGB888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToRGBA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB565ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToRGB565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToRGBA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGB888ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToRGB565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToRGB888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGR565u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGR888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToBGRA8888u8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorRGBA8888ToLABu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8) -( - const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr444PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr422PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGB565u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGB888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvColorYCbCr420PseudoPlanarToRGBA8888u8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvEdgeWeightings16) -( - int16_t* __restrict edgeMap, - const uint32_t edgeMapWidth, - const uint32_t edgeMapHeight, - const uint32_t edgeMapStride, - const uint32_t weight, - const uint32_t edge_limit, - const uint32_t hl_threshold, - const uint32_t hh_threshold, - const uint32_t edge_denoise_factor -); - -extern void -(**ppfcvDeinterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst0, - uint32_t dst0Stride, - uint8_t* __restrict dst1, - uint32_t dst1Stride -); - -extern void -(**ppfcvInterleaveu8) -( - const uint8_t* __restrict src0, - const uint8_t* __restrict src1, - uint32_t imageWidth, - uint32_t imageHeight, - uint32_t src0Stride, - uint32_t src1Stride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWTHaarTransposeu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWT53TabTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWT53TabTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWTHaarTransposes16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWTHaaru8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDWT53Tabs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWT53Tabs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDWTHaars16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvDCTu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvIDCTs16) -( - const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvScaleUpPolyu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleUpPolyInterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleDownMNu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvScaleDownMNInterleaveu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern uint32_t -(**ppfcvKMeansTreeSearch36x10s8) -( - const int8_t* __restrict nodeChildrenCenter, - const uint32_t* __restrict nodeChildrenInvLenQ32, - const uint32_t* __restrict nodeChildrenIndex, - const uint8_t* __restrict nodeNumChildren, - uint32_t numNodes, - const int8_t* __restrict key -); - -extern void -(**ppfcvLinearSearch8x36s8) -( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondencSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences -); - -extern int -(**ppfcvLinearSearchPrepare8x36s8_v2) -( - uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict idxLUT, - uint32_t numDescDB -); - -extern void -(**ppfcvFindContoursExternalu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void -(**ppfcvFindContoursListu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ); - -extern void -(**ppfcvFindContoursCcompu8)( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void -(**ppfcvFindContoursTreeu8) ( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ); - -extern void * -(**ppfcvFindContoursAllocate) ( uint32_t srcStride ); - -extern void -(**ppfcvFindContoursDelete) ( void* contourHandle ); - -extern void -(**ppfcvSolvef32) (const float32_t * __restrict A, - int32_t numRows, - int32_t numCols, - const float32_t * __restrict b, - float32_t * __restrict x); - -extern void -(**ppfcvGetPerspectiveTransformf32)( const float32_t* __restrict src, - const float32_t* __restrict dst, - float32_t* __restrict transformCoefficient ); - - -extern void -(**ppfcvSetElementsu8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementss32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsf32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4u8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4s32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc4f32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ); -extern void -(**ppfcvSetElementsc3u8)( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc3s32)( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - -extern void -(**ppfcvSetElementsc3f32)( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ); - - -extern void -(**ppfcvAdaptiveThresholdGaussian3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); -extern void -(**ppfcvAdaptiveThresholdGaussian5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdGaussian11x11u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdMean3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAdaptiveThresholdMean5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAdaptiveThresholdMean11x11u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvBoxFilter3x3u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - - -extern void -(**ppfcvBoxFilter5x5u8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - -extern void -(**ppfcvBoxFilter11x11u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - -extern void -(**ppfcvBilateralFilter5x5u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - - -extern void -(**ppfcvBilateralFilter7x7u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - - -extern void -(**ppfcvBilateralFilter9x9u8)(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ); - -extern void -(**ppfcvSegmentFGMasku8)(uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t Polygonal, - uint32_t perimScale); - - -extern void -(**ppfcvAbsDiffu8)(const uint8_t * __restrict src1, - const uint8_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - - -extern void -(**ppfcvAbsDiffs32)(const int32_t * __restrict src1, - const int32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - - - -extern void -(**ppfcvAbsDifff32)(const float32_t * __restrict src1, - const float32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVu8)(const uint8_t * __restrict src, - uint8_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVs32)(const int32_t * __restrict src, - int32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVf32)(const float32_t * __restrict src, - float32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVc4u8)(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - - -extern void -(**ppfcvAbsDiffVc4s32)(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc4f32)(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride); - -extern void -(**ppfcvAbsDiffVc3u8)(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc3s32)(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ); - -extern void -(**ppfcvAbsDiffVc3f32)(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride); - -extern -int (**ppfcvKDTreeCreate36s8f32) -( const int8_t* __restrict vectors, - const float32_t* __restrict invLengths, - int numVectors, - fcvKDTreeDatas8f32** kdtrees -); - -extern -int (**ppfcvKDTreeDestroy36s8f32) -( fcvKDTreeDatas8f32* kdtrees -); - -extern -int (**ppfcvKDTreeQuery36s8f32) -( fcvKDTreeDatas8f32* kdtrees, - const int8_t* __restrict query, - float32_t queryInvLen, - int maxNNs, - float32_t maxDist, - int maxChecks, - const uint8_t* __restrict mask, - int32_t* numNNsFound, - int32_t* __restrict NNInds, - float32_t* __restrict NNDists -); - -extern void (**ppfcvBitwiseOru8) -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -); - -extern void -(**ppfcvBitwiseOrs32) -( - const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -); - -extern void -(**ppfcvColorRGB888ToGrayu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvTiltedIntegralu8s32) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvConvValids16) -( - const int16_t* __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int16_t* __restrict src2, - uint32_t src2Width, - uint32_t src2Height, - uint32_t src2Stride, - int32_t* __restrict dst, - uint32_t dstStride -); - -extern void -(**ppfcvFloodfillSimpleu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - uint32_t xBegin, - uint32_t yBegin, - uint8_t newVal, //new Val can't be zero. zero is background. - fcvConnectedComponent *cc, - uint8_t connectivity, - void* lineBuffer); - -extern void -(**ppfcvUpdateMotionHistoryu8s32) -( - const uint8_t* __restrict src, - uint32_t srcWidth, uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride, - int32_t timeStamp, - int32_t maxHistory); - -extern void -(**ppfcvIntegrateImageYCbCr420PseudoPlanaru8) -( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride -); - -extern void -(**ppfcvFindForegroundIntegrateImageYCbCr420u32) -( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t *__restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold -); - -extern void -(**ppfcvAverages32) -( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue -); - -extern void -(**ppfcvAverageu8) -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue -); - -extern uint32_t - (**ppfcvMeanShiftu8) - (const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvMeanShifts32) - (const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvMeanShiftf32) - (const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria); - - -extern uint32_t - (**ppfcvConAdaTracku8) - (const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern uint32_t - (**ppfcvConAdaTracks32) - (const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern uint32_t - (**ppfcvConAdaTrackf32) - (const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox); - -extern void -(**ppfcvSVDf32) -( - const float32_t * __restrict A, - uint32_t m, - uint32_t n, - float32_t * __restrict w, - float32_t * __restrict U, - float32_t * __restrict Vt, - float32_t * __restrict tmpU, - float32_t * __restrict tmpV -); - -extern void -(**ppfcvFillConvexPolyu8) -( - uint32_t nPts, - const uint32_t* __restrict polygon, - uint32_t nChannel, - const uint8_t* __restrict color, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride -); - -extern void -(**ppfcvPointPolygonTest) -( - uint32_t nPts, - const uint32_t* __restrict polygonContour, - uint32_t px, - uint32_t py, - float32_t* distance, - int16_t* resultFlag -); - -extern void -(**ppfcvFindConvexHull) -( - uint32_t* __restrict polygonContour, - uint32_t nPtsContour, - uint32_t* __restrict convexHull, - uint32_t* nPtsHull, - uint32_t* __restrict tmpBuff -); - -extern int32_t -(**ppfcvSolveCholeskyf32) -( - float32_t* __restrict A, - const float32_t* __restrict b, - float32_t* __restrict diag, - uint32_t N, - float32_t* __restrict x -); - -extern void - (**ppfcvGeomDistortPoint2x1f32) - (const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice); - -extern void -(**ppfcvGeomDistortPoint2xNf32)(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyDevice, - uint32_t dstStride); - -extern void - (**ppfcvGeomUndistortPoint2x1f32) - (const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - float32_t* __restrict xyCamera); - -extern void -(**ppfcvGeomUndistortPoint2xNf32)(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyCamera, - uint32_t dstStride); - -extern int32_t -(**ppfcvGeomProjectPoint3x1f32) -(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice); - -extern void -(**ppfcvGeomProjectPoint3xNf32)(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - uint32_t srcStride, - uint32_t xyzSize, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice, - uint32_t dstStride, - uint32_t* inFront); - -extern void -(**ppfcvRemapRGBA8888NNu8) -( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride -); - -extern void -(**ppfcvRemapRGBA8888BLu8) -( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t* __restrict mapX, - const float32_t* __restrict mapY, - uint32_t mapStride -); - -extern void -(**ppfcvJacobianSE2f32) -( const uint8_t *__restrict warpedImage, - const uint16_t *__restrict warpedBorder, - const uint8_t *__restrict targetImage, - const int16_t *__restrict targetDX, - const int16_t *__restrict targetDY, - uint32_t width, - uint32_t height, - uint32_t stride, - float32_t *__restrict sumJTJ, - float32_t *__restrict sumJTE, - float32_t *__restrict sumError, - uint32_t * __restrict numPixels -); - -extern void -(**ppfcvTransformAffineClippedu8) -( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t *__restrict affineMatrix, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint32_t *__restrict dstBorder -); - -extern fcvBGCodeWord** - (**ppfcvCreateBGCodeBookModel) - ( - uint32_t srcWidth, - uint32_t srcHeight, - void** __restrict cbmodel - ); - -extern void - (**ppfcvReleaseBGCodeBookModel) - ( - void** cbmodel - ); - -extern void - (**ppfcvBGCodeBookUpdateu8) - ( - void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict updateTime - ); - -extern void - (**ppfcvBGCodeBookDiffu8) - ( - void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict numFgMask - ); - - -extern void - (**ppfcvBGCodeBookClearStaleu8) - ( - void* __restrict cbmodel, - int32_t staleThresh, - const uint8_t* __restrict fgMask, - uint32_t fgMaskWidth, - uint32_t fgMaskHeight, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap - ); - -extern void -(**ppfcvHoughCircleu8)( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvCircle *circles, - uint32_t* numCircle, - uint32_t maxCircle, - uint32_t minDist, - uint32_t cannyThreshold, - uint32_t accThreshold, - uint32_t minRadius, - uint32_t maxRadius, - void *data); - -extern void -(**ppfcvDrawContouru8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t color, - uint8_t hole_color); - -extern void -(**ppfcvDrawContourInterleavedu8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB); - -extern void -(**ppfcvDrawContourPlanaru8)(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB); - -//============================================================================== -// Function Definitions -//============================================================================== - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterMedian3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterMedian3x3u8_v2)( src, width, height, width, dst, width ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterMedian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterMedian3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( ((width - 2)/6)*6 <= (width - 2) && - ((width - 2)/6)*6 >= ((width - 2) - 5) ); - - return (**ppfcvFilterGaussian3x3u8_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - fcvAssert( ((srcWidth - 2)/6)*6 <= (srcWidth - 2) && - ((srcWidth - 2)/6)*6 >= ((srcWidth - 2) - 5) ); - - return (**ppfcvFilterGaussian3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian5x5u8_v2)( src, width, height, width, dst, width, - border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian11x11u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int blurBorder ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian11x11u8_v2)( src, width, height, width, dst, - width, blurBorder ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian11x11u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int blurBorder ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvFilterGaussian11x11u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, blurBorder ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYUV420toRGB8888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint32_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8)( src, width, height, width, width, dst, width * sizeof(uint32_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCrCb420PseudoPlanarToRGB8888u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcYStride, - unsigned int srcCStride, - uint32_t* __restrict dst, - unsigned int dstStride ) -{ - srcYStride = (srcYStride==0 ? srcWidth : srcYStride); - srcCStride = (srcCStride==0 ? srcWidth : srcCStride); - dstStride = (dstStride==0 ? srcWidth*4 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 4 - fcvAssert( (dstStride & 31) == 0 ); // multiple of 32 - fcvAssert( (srcYStride >= srcWidth) ); // Y-stride is at least as much as srcWidth - fcvAssert( (srcCStride >= srcWidth) ); // Y-stride is at least as much as srcWidth/2 - fcvAssert( (dstStride >= srcWidth*4) ); // Dst-stride is at least as much as srcWidth*3 -#endif - - return (**ppfcvColorYCrCb420PseudoPlanarToRGB8888u8)( src, srcWidth, srcHeight, - srcYStride, srcCStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYUV420toRGB565u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint32_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x3) == 0 ); // multiple of 4 -#endif - - return (**ppfcvColorYUV420toRGB565u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH1V1toRGB888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH1V1toRGB888u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH2V2toRGB888u8 -( - const uint8_t* __restrict y_src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)y_src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH2V2toRGB888u8)( y_src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorRGB888toYCrCbu8_v2 -( - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride -) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - dstStride = (dstStride==0 ? srcWidth*3 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*3) ); // multiple of 8 - fcvAssert( (dstStride >= srcWidth*3) ); // multiple of 8 -#endif - - return (**ppfcvColorRGB888toYCrCbu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorRGB888toYCrCbu8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorRGB888toYCrCbu8_v2)( src, width, height, width*3, dst, width*3 ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH2V1toRGB888u8 -( - const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH2V1toRGB888u8)( src, width, height, dst ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvColorYCrCbH1V2toRGB888u8 -( - const uint8_t* __restrict ysrc, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst -) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - - fcvAssert( ((int)(size_t)ysrc & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvColorYCrCbH1V2toRGB888u8)( ysrc, width, height, dst ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvDescriptor17x17u8To36s8( const uint8_t* __restrict patch, - int8_t* __restrict descriptorChar, - int32_t* __restrict descriptorNormSq ) -{ - return (**ppfcvDescriptor17x17u8To36s8)(patch, descriptorChar, descriptorNormSq); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvDescriptorSampledMeanAndVar36f32( - const float* __restrict src, - int first, - int last, - int32_t* vind, - float* __restrict means, - float* __restrict vars, - float* __restrict temp ) -{ - return (**ppfcvDescriptorSampledMeanAndVar36f32)(src, first, last, vind, means, vars, temp); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProducts8( const int8_t* __restrict a, - const int8_t* __restrict b, - unsigned int abSize ) -{ - return (**ppfcvDotProducts8)( a, b, abSize ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProductu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, - unsigned int abSize ) -{ - return (**ppfcvDotProductu8)( a, b, abSize ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct36x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct36x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct36x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct36x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm36x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm36x4s8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct36x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct36x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct36x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct36x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm36x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm36x4u8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct64x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct64x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct64x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct64x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm64x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm64x4s8)( A, invLengthA, - vB0, - vB1, - vB2, - vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct64x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct64x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct64x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm64x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm64x4u8)( A, invLengthA, - vB0, - vB1, - vB2, - vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvDotProduct128x1s8( const int8_t* __restrict a, - const int8_t* __restrict b ) -{ - return (**ppfcvDotProduct128x1s8)( a, b ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct128x4s8( const int8_t* __restrict A, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct128x4s8)( A, B, C, D, E, dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm128x4s8( const int8_t* __restrict A, - float invLengthA, - const int8_t* __restrict vB0, - const int8_t* __restrict vB1, - const int8_t* __restrict vB2, - const int8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm128x4s8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline uint32_t -fcvDotProduct128x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ - return (**ppfcvDotProduct128x1u8)( a, b ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct128x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct128x4u8)( A, B, C, D, E, dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProductNorm128x4u8( const uint8_t* __restrict A, - float invLengthA, - const uint8_t* __restrict vB0, - const uint8_t* __restrict vB1, - const uint8_t* __restrict vB2, - const uint8_t* __restrict vB3, - float* __restrict invLengthsB, - float* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLengthsB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment - fcvAssert( sizeof(*invLengthsB) == 4 ); - fcvAssert( sizeof(*dotProducts) == 4 ); -#endif - - (**ppfcvDotProductNorm128x4u8)( A, invLengthA, vB0, vB1, vB2, vB3, invLengthsB, - dotProducts ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct8x8u8( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, - int nX, int nY, unsigned int nNum, int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct8x8u8)( ptch, img, imgW, imgH, nX, nY, nNum, dotProducts ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDotProduct11x12u8( const uint8_t* __restrict ptch, - const uint8_t* __restrict img, - unsigned short imgW, unsigned short imgH, - int iX, int iY, - int32_t* __restrict dotProducts ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)dotProducts & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDotProduct11x12u8)( ptch, img, imgW, imgH, iX, iY, dotProducts ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterSobel3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterSobel3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterSobel3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterSobel3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCanny3x3u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - int low, - int high ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( (low >=0 ) && (low <= 255) ); - fcvAssert( (high >=0 ) && (high <= 255) ); - fcvAssert( low <= high ); - - return (**ppfcvFilterCanny3x3u8_v2)( src, width, height, width, dst, width, low, high ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCanny3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - int low, - int high ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - fcvAssert( (low >=0 ) && (low <= 255) ); - fcvAssert( (high >=0 ) && (high <= 255) ); - fcvAssert( low <= high ); - - return (**ppfcvFilterCanny3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, low, high ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageDiffu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageDiffu8_v2)( src1, src2, srcWidth, srcHeight, srcWidth, dst, - srcWidth ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageDiffu8_v2( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvImageDiffu8_v2)( src1, src2, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -inline void -fcvImageDiffs16( const int16_t* __restrict src1, - const int16_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? (srcWidth * sizeof (int16_t)) : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (int16_t)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return(**ppfcvImageDiffs16_v2)( src1, src2, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDifff32( const float* __restrict src1, - const float* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? (srcWidth * sizeof (float)) : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (float)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDifff32_v2)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDiffu8f32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dst, - unsigned int dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? (srcWidth * sizeof (float)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDiffu8f32_v3)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvImageDiffu8s8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dst, - unsigned int dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageDiffu8s8_v2)( src1, src2, srcWidth, srcHeight, srcStride, - dst, dstStride ); - -} - - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients - ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); //4*(width-2) because 2 grad values, 2 bytes each. - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*(width-2) -#endif - - return(**ppfcvImageGradientInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*gradients) == 4 ); -#endif - - return(**ppfcvImageGradientInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(float) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(float))) ); // at least as much as 8*width -#endif - - return(**ppfcvImageGradientInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth<<1) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0xF) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // srcStride should be at least as much as srcWidth - fcvAssert( (dxyStride >= (srcWidth<<1)) ); // dxyStride should be at least twice as much as srcWidth -#endif - - return(**ppfcvImageGradientPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*dx) == 4 ); - fcvAssert( sizeof(*dy) == 4 ); -#endif - - return(**ppfcvImageGradientPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict dx, - float* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? srcStride*4 : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 31) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( srcStride >= srcWidth ); // at least as much as width - fcvAssert( dxyStride >= srcWidth*4 ); // at least as much as 4*width -#endif - - return(**ppfcvImageGradientPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleaveds16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleaveds16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*(width -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvImageGradientSobelInterleaveds16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(int16_t) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(int16_t))) ); // at least as much as 4*width -#endif - - return(**ppfcvImageGradientSobelInterleaveds16_v3)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleavedf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*gradients) == 4 ); -#endif - - return (**ppfcvImageGradientSobelInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,(srcWidth-2)*2*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelInterleavedf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* __restrict gradients, - unsigned int gradStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - gradStride = (gradStride==0 ? (srcWidth-2)*2*sizeof(float) : gradStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)gradients & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 7) == 0 ); // multiple of 8 - fcvAssert( (gradStride & 7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (gradStride >= ((srcWidth-2)*2*sizeof(float))) ); // at least as much as 8*width -#endif - - return (**ppfcvImageGradientSobelInterleavedf32_v2)(src,srcWidth,srcHeight,srcStride,gradients,gradStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars16( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(int16_t)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars16_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(int16_t)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 15 ) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(int16_t))) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageGradientSobelPlanars16_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvImageGradientSobelPlanars16_v3( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dx, - int16_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(int16_t)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(int16_t))) ); // Stride is at least as much as Width*2 -#endif - - return (**ppfcvImageGradientSobelPlanars16_v3)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanars8_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanars8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int8_t* __restrict dx, - int8_t* __restrict dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? srcWidth : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvImageGradientSobelPlanars8_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvImageGradientSobelPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(float)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dxyStride & 31 ) == 0 ); // multiple of 16 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dxyStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. -#endif - - return (**ppfcvImageGradientSobelPlanarf32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32f32( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*dx) == 4 ); - fcvAssert( sizeof(*dy) == 4 ); -#endif - - return (**ppfcvImageGradientSobelPlanarf32f32_v2)(src,srcWidth,srcHeight,srcStride*sizeof(float),dx,dy,srcWidth*sizeof(float)); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvImageGradientSobelPlanarf32f32_v2( const float * __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - float* dx, - float* dy, - unsigned int dxyStride ) -{ - srcStride = (srcStride==0 ? (srcWidth*sizeof(float)) : srcStride); - dxyStride = (dxyStride==0 ? (srcWidth*sizeof(float)) : dxyStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dx & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 31) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( (dxyStride & 31 ) == 0 ); // multiple of (8 * 4 bytes) - fcvAssert( (srcStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. - fcvAssert( (dxyStride >= (srcWidth*sizeof(float))) ); // Stride is at least as much as Width*sizeof each value. -#endif - - return (**ppfcvImageGradientSobelPlanarf32f32_v2)(src,srcWidth,srcHeight,srcStride,dx,dy,dxyStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanNormed36f32( const float* __restrict points, - int numPoints, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanNormed36f32)(points,numPoints,pointStride,indices,numIndices,numClusters,clusterCenters, - clusterCenterStride,newClusterCenters,clusterMemberCounts, - clusterBindings,sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanf32( const float* __restrict points, - int numPoints, // actually not used but helpful - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanf32)(points,numPoints,dim,pointStride,indices,numIndices,numClusters, - clusterCenters,clusterCenterStride, - newClusterCenters,clusterMemberCounts,clusterBindings, - sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvClusterEuclideanNormedf32( const float* __restrict points, - int numPoints, - int dim, - int pointStride, - const size_t* __restrict indices, - int numIndices, - int numClusters, - float* __restrict clusterCenters, - int clusterCenterStride, - float* __restrict newClusterCenters, - size_t* __restrict clusterMemberCounts, - size_t* __restrict clusterBindings, - float* sumOfClusterDistances ) -{ - return (**ppfcvClusterEuclideanNormedf32)(points,numPoints,dim,pointStride,indices,numIndices,numClusters,clusterCenters, - clusterCenterStride,newClusterCenters,clusterMemberCounts, - clusterBindings,sumOfClusterDistances); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9u8_v2)( src, width, height, stride, barrier, border, xy, - maxnumcorners, numcorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMasku8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9InMasku8_v2)( src, width, height, stride, barrier, border, xy, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( srcWidth <= 2048 ); - - (**ppfcvCornerFast10u8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, - nCornersMax, nCorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10InMasku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( srcWidth <= 2048 ); - - (**ppfcvCornerFast10InMasku8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, - nCornersMax, nCorners, - mask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvCornerHarrisu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvCornerHarrisu8)( src, width, height, stride, border, xy, - maxnumcorners, numcorners, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline unsigned int -fcvLocalHarrisMaxu8 (const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - unsigned int posX, - unsigned int posY, - unsigned int *maxX, - unsigned int *maxY, - int *maxScore ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvLocalHarrisMaxu8) - ( src, srcWidth, srcHeight, srcStride, posX, - posY, maxX, maxY, maxScore); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvCornerHarrisInMasku8( const uint8_t* __restrict srcImg, - unsigned int width, - unsigned int height, - unsigned int stride, - unsigned int border, - uint32_t* __restrict xy, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - int threshold, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvCornerHarrisInMasku8)( srcImg, width, height, stride, border, xy, maxnumcorners, - numcorners, threshold, bitMask, maskWidth, - maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomAffineFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*affine) == 4 ); -#endif - - (**ppfcvGeomAffineFitf32)( corrs, affine ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomAffineEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict affine, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*affine) == 4 ); -#endif - - return (**ppfcvGeomAffineEvaluatef32)( corrs, affine, maxsqerr, inliers, - numinliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomHomographyFitf32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*homography) == 4 ); -#endif - - (**ppfcvGeomHomographyFitf32)( corrs, homography ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomHomographyEvaluatef32( const fcvCorrespondences* __restrict corrs, - float* __restrict homography, - float maxsqerr, - uint16_t* __restrict inliers, - int32_t* numinliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*homography) == 4 ); -#endif - - return (**ppfcvGeomHomographyEvaluatef32)( corrs, homography, maxsqerr, inliers, - numinliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline float -fcvGeomPoseRefineGNf32( const fcvCorrespondences* __restrict corrs, - short minIterations, - short maxIterations, - float stopCriteria, - float* initpose, - float* refinedpose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*initpose) == 4 ); - fcvAssert( sizeof(*refinedpose) == 4 ); -#endif - - return (**ppfcvGeomPoseRefineGNf32)( corrs, minIterations, maxIterations, stopCriteria, - initpose, refinedpose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseUpdatef32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseUpdatef32)( projected, reprojErr, invz, - reprojVariance, numpts, pose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseOptimizeGNf32( - const float* __restrict projected, - const float* __restrict reprojErr, - const float* __restrict invz, - const float* __restrict reprojVariance, - unsigned int numpts, - float* __restrict pose ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseOptimizeGNf32)( projected, reprojErr, invz, - reprojVariance, numpts, pose ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline float -fcvGeomPoseEvaluateErrorf32( - const fcvCorrespondences* __restrict corrs, - const float* __restrict pose, - float* __restrict projected, - float* __restrict reprojErr, - float* __restrict invz, - float* __restrict reprojVariance ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseEvaluateErrorf32)( corrs, pose, projected, reprojErr, - invz, reprojVariance ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvGeomPoseEvaluatef32( const fcvCorrespondences* __restrict corrs, - const float* pose, - float maxSquErr, - uint16_t* __restrict inliers, - uint32_t* numInliers ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeomPoseEvaluatef32)( corrs, pose, maxSquErr, inliers, numInliers ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeom3PointPoseEstimatef32( const fcvCorrespondences* __restrict corrs, - float* pose, - int32_t* numPoses ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*pose) == 4 ); -#endif - - return (**ppfcvGeom3PointPoseEstimatef32)( corrs, pose, numPoses ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorr3x3s8( const int8_t* __restrict kernel, - const uint8_t* __restrict src, unsigned int w, unsigned int h, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x1) == 0 ); // even - fcvAssert( (h & 0x1) == 0 ); // even -#endif - - (**ppfcvFilterCorr3x3s8_v2)( kernel, src, w, h, w, dst, w ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorr3x3s8_v2( const int8_t* __restrict kernel, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x1) == 0 ); // even - fcvAssert( (srcHeight & 0x1) == 0 ); // even - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvFilterCorr3x3s8_v2)( kernel, src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep9x9s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep9x9s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep11x11s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep11x11s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep13x13s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep13x13s16)( knl, src, w, h, tmp, dst ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep15x15s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep15x15s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep17x17s16( const int16_t* __restrict knl, - const int16_t* __restrict src, unsigned int w, unsigned int h, - int16_t* __restrict tmp, - int16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)knl & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmp & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - (**ppfcvFilterCorrSep17x17s16_v3)( knl, src, w, h, w*sizeof(int16_t), tmp, dst, w*sizeof(int16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep9x9s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep9x9s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep11x11s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep11x11s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep13x13s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep13x13s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep15x15s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep15x15s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterCorrSep17x17s16_v2( const int16_t* __restrict kernel, - const int16_t* __restrict srcImg, - unsigned int w, unsigned int h, unsigned int srcStride, - int16_t* __restrict tmpImg, - int16_t* __restrict dstImg, unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)kernel & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpImg & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (w & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( w >= 8 ); - - return (**ppfcvFilterCorrSep17x17s16_v3) (kernel, srcImg, w, h, srcStride, tmpImg, dstImg, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -inline void -fcvImageIntensityStats( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - float* mean, - float* variance ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( sizeof(*mean) == 4 ); - fcvAssert( sizeof(*variance) == 4 ); -#endif - fcvAssert( (recHeight * recWidth ) > 1 ); - - (**ppfcvImageIntensityStats)( src, srcWidth, xBegin, yBegin, recWidth, recHeight, mean, - variance ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -inline void -fcvImageIntensityHistogram( const uint8_t* __restrict src, - unsigned int srcWidth, - int xBegin, - int yBegin, - unsigned int recWidth, - unsigned int recHeight, - int32_t* histogram ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)histogram & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvImageIntensityHistogram)( src, srcWidth, xBegin, yBegin, recWidth, recHeight, - histogram ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegrateImageu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint32_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( height < 2048 ); -#endif - - (**ppfcvIntegrateImageu8_v2)( src, width, height, width, dst, (width+1)*sizeof(uint32_t) ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegrateImageu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint32_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? ((srcWidth+1)*sizeof(uint32_t)) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= ((srcWidth+1)*sizeof(uint32_t))) ); // Stride is at least as much as Width*4 (in bytes) - fcvAssert( (srcHeight) < 2048 ); -#endif - - (**ppfcvIntegrateImageu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatchu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, int patchX, int patchY, - unsigned int patchW, unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (patchW*patchH) < 66051 ); // to avoid overflow -#endif - fcvAssert( height < 2048 ); - - (**ppfcvIntegratePatchu8_v2)( src, width, height, width, patchX, patchY, patchW, patchH, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatchu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - unsigned int patchW, - unsigned int patchH, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (patchW*patchH) < 66051 ); // to avoid overflow -#endif - fcvAssert( srcHeight < 2048 ); - - (**ppfcvIntegratePatchu8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - patchW, patchH, intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch12x12u8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIntegratePatch12x12u8_v2)( src, srcWidth, srcHeight, srcWidth, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch12x12u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvIntegratePatch12x12u8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch18x18u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, int patchX, int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIntegratePatch18x18u8_v2)( src, width, height, width, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvIntegratePatch18x18u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int patchX, - int patchY, - uint32_t* __restrict intgrlImgOut, - uint32_t* __restrict intgrlSqrdImgOut ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - (**ppfcvIntegratePatch18x18u8_v2)( src, srcWidth, srcHeight, srcStride, patchX, patchY, - intgrlImgOut, intgrlSqrdImgOut ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageLineu8( const uint8_t* __restrict imageIn, - unsigned short numPxls, - uint32_t* intgrl, - uint32_t* intgrlSqrd ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)imageIn & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIntegrateImageLineu8)( imageIn, numPxls, intgrl, intgrlSqrd ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageLine64u8( const uint8_t* __restrict imageIn, - uint16_t* intgrl, - uint32_t* intgrlSqrd ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)imageIn & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIntegrateImageLine64u8)( imageIn, intgrl, intgrlSqrd ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvNCCPatchOnCircle8x8u8( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_radius <= 5 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - const int defaultLowVariance = 0; - - return (**ppfcvNCCPatchOnCircle8x8u8_v2) - ( patch_pixels, image_pixels, - image_w, image_h, search_center_x, search_center_y, - search_radius, defaultLowVariance, bestX, bestY, bestNCC, - doSubPixel, subX, subY ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvNCCPatchOnSquare8x8u8( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_w <= 11 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - const int defaultLowVariance = 0; - - return (**ppfcvNCCPatchOnSquare8x8u8_v2) - ( patch_pixels, image_pixels, image_w, image_h, - search_center_x, search_center_y, search_w, defaultLowVariance, - bestX, bestY, bestNCC, doSubPixel, subX, subY ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvNCCPatchOnCircle8x8u8_v2( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_radius, - int filterLowVariance, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_radius <= 5 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - - return (**ppfcvNCCPatchOnCircle8x8u8_v2) - ( patch_pixels, image_pixels, - image_w, image_h, search_center_x, search_center_y, - search_radius, filterLowVariance, bestX, bestY, bestNCC, - doSubPixel, subX, subY ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvNCCPatchOnSquare8x8u8_v2( const uint8_t* __restrict patch_pixels, - const uint8_t* __restrict image_pixels, - unsigned short image_w, - unsigned short image_h, - unsigned short search_center_x, - unsigned short search_center_y, - unsigned short search_w, - int filterLowVariance, - uint16_t* bestX, - uint16_t* bestY, - uint32_t* bestNCC, - int doSubPixel, - float* subX, - float* subY ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)image_pixels & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (image_w & 0x7) == 0 ); // multiple of 8 - fcvAssert( patch_pixels != 0 ); - fcvAssert( image_pixels != 0 ); - fcvAssert( search_w <= 11 ); - fcvAssert( bestX != 0 ); - fcvAssert( bestY != 0 ); - fcvAssert( bestNCC != 0 ); - fcvAssert( (doSubPixel == 0) || - ( (subX != 0) && (subY != 0) ) ); -#endif - - return (**ppfcvNCCPatchOnSquare8x8u8_v2) - ( patch_pixels, image_pixels, image_w, image_h, - search_center_x, search_center_y, search_w, filterLowVariance, - bestX, bestY, bestNCC, doSubPixel, subX, subY ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfAbsoluteDiffs8x8u8( const uint8_t* __restrict patch, - const uint8_t* __restrict src, - unsigned int width, unsigned int height, - unsigned int pitch, - uint16_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (patch != NULL) ); - fcvAssert( (src != NULL) ); - fcvAssert( (dst != NULL) ); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvSumOfAbsoluteDiffs8x8u8_v2)( patch, 8, src, width, height, pitch, dst, width*sizeof(uint16_t) ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfAbsoluteDiffs8x8u8_v2( const uint8_t* __restrict patch, - unsigned int patchStride, - const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint16_t* __restrict dst, - unsigned int dstStride ) -{ - patchStride = (patchStride==0 ? 8 : patchStride); - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth*2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (patch != NULL) ); - fcvAssert( (src != NULL) ); - fcvAssert( (dst != NULL) ); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (patchStride >= 8) ); // Stride is at least as much as width - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth*2)) ); // Stride is at least as much as 2*width -#endif - - return (**ppfcvSumOfAbsoluteDiffs8x8u8_v2)( patch, patchStride, src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy2u8( const uint8_t* __restrict src, unsigned int width, unsigned int height, - uint8_t* __restrict dst) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownBy2u8_v2)( src, width, height, width, dst, width/2 ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy2u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth/2)) ); // Stride is at least as much as width/2 -#endif - - return (**ppfcvScaleDownBy2u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy4u8( const uint8_t* __restrict src, unsigned int width, unsigned int height, - uint8_t* __restrict dst) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownBy4u8_v2)( src, width, height, width, dst, width/4 ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownBy4u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/4 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth/4)) ); // Stride is at least as much as (width/4) -#endif - - return (**ppfcvScaleDownBy4u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDown3To2u8( const uint8_t* __restrict src, - unsigned srcWidth, - unsigned srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDown3To2u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvScaleDownNNu8( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvScaleDownNNu8)( src, srcWidth, srcHeight, srcStride, dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownu8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst, - unsigned int dstWidth, unsigned int dstHeight) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( ( width % dstWidth ) == 0 && ( height % dstHeight ) == 0 ); - - return (**ppfcvScaleDownu8_v2)( src, width, height, width, dst, dstWidth, dstHeight, dstWidth ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // Stride is at least as much as width -#endif - fcvAssert( ( srcWidth % dstWidth ) == 0 && ( srcHeight % dstHeight ) == 0 ); - - return (**ppfcvScaleDownu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpBy2Gaussian5x5u8_v2)( src, width, height, width, dst, width*2 ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth*2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (dstStride >= (srcWidth*2)) ); // Stride is at least as much as 2*width -#endif - - (**ppfcvScaleUpBy2Gaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownBy2Gaussian5x5u8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( (width&1)==0 && (height&1)==0 ); - - (**ppfcvScaleDownBy2Gaussian5x5u8)( src, width, height, dst ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownBy2Gaussian5x5u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth/2 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 1) == 0 ); // Height is multiple of 2 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= (srcWidth/2)) ); // Stride is at least as much as Width/2 -#endif - - (**ppfcvScaleDownBy2Gaussian5x5u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvVecNormalize36s8f32( const int8_t* __restrict src, - unsigned int srcStride, - const float* __restrict invLen, - unsigned int numVecs, - float reqNorm, - float* __restrict dst, - int32_t* stopBuild ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvVecNormalize36s8f32)( src, srcStride, invLen, numVecs, reqNorm, - dst, stopBuild ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvSumOfSquaredDiffs36x4s8( const int8_t* __restrict A, - float invLenA, - const int8_t* __restrict B, - const int8_t* __restrict C, - const int8_t* __restrict D, - const int8_t* __restrict E, - const float* __restrict invLenB, - float* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)invLenB & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvSumOfSquaredDiffs36x4s8)( A, invLenA, B, C, D, E, invLenB, - distances ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSumOfSquaredDiffs36xNs8( const int8_t* __restrict A, - float invLenA, - const int8_t* const * __restrict B, - const float* __restrict invLenB, - unsigned int numB, - float* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*invLenB) == 4 ); - fcvAssert( sizeof(*distances) == 4 ); -#endif - - return (**ppfcvSumOfSquaredDiffs36xNs8)( A, invLenA, B, invLenB, numB, - distances ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSort8Scoresf32( float* __restrict inScores, - float* __restrict outScores ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*inScores) == 4 ); - fcvAssert( sizeof(*outScores) == 4 ); -#endif - - return (**ppfcvSort8Scoresf32)( inScores, outScores ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterThresholdu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - uint8_t* __restrict dst, - unsigned int threshold ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterThresholdu8_v2)( src, width, height, width, dst, width, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterThresholdu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride, - unsigned int threshold ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterThresholdu8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, threshold ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterDilate3x3u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterDilate3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterDilate3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterDilate3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterErode3x3u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - uint8_t* __restrict dst ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterErode3x3u8_v2)( src, width, height, width, dst, width ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFilterErode3x3u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( ( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || ( srcStride & 0x7 ) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterErode3x3u8_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffine8x8u8( const uint8_t* __restrict src, - unsigned int width, unsigned int height, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict nPatch ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvTransformAffine8x8u8_v2)( src, width, height, width, nPos, nAffine, nPatch, 8 ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffine8x8u8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - const int32_t* __restrict nPos, - const int32_t* __restrict nAffine, - uint8_t* __restrict patch, - unsigned int patchStride ) - -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - patchStride = (patchStride==0 ? 8 : patchStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment - - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as width - fcvAssert( (patchStride >= 8) ); // Stride is at least as much as 8 (patchWidth) -#endif - - return (**ppfcvTransformAffine8x8u8_v2)( src, srcWidth, srcHeight, srcStride, - nPos, nAffine, patch, patchStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict proj ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvWarpPerspectiveu8)( src, srcwidth, srcheight, dst, - dstwidth, dstheight, proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict proj ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // at least as much as width -#endif - - return (**ppfcvWarpPerspectiveu8_v2)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride, - proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcv3ChannelWarpPerspectiveu8( const uint8_t* __restrict src, - unsigned int srcwidth, - unsigned int srcheight, - uint8_t* __restrict dst, - unsigned int dstwidth, - unsigned int dstheight, - float* __restrict proj ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstwidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstheight & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcv3ChannelWarpPerspectiveu8)( src, srcwidth, srcheight, dst, - dstwidth, dstheight, proj ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcv3ChannelWarpPerspectiveu8_v2( const uint8_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - uint8_t* __restrict dst, - unsigned int dstWidth, - unsigned int dstHeight, - unsigned int dstStride, - float* __restrict proj ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - dstStride = (dstStride==0 ? dstWidth*3 : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstHeight & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( ((int)(size_t)proj & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= (srcWidth*3)) ); // at least as much as 3*width (3-channel) - fcvAssert( (dstStride >= (dstWidth*3)) ); // at least as much as 3*width (3-channel) -#endif - - return (**ppfcv3ChannelWarpPerspectiveu8_v2)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride, - proj ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s16( const int16_t* __restrict src, - unsigned int width, - unsigned int height, - int16_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvFilterGaussian5x5s16_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s16_v2( const int16_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int16_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5s16_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s32( const int32_t* __restrict src, - unsigned int width, - unsigned int height, - int32_t* __restrict dst, - int border ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - - return (**ppfcvFilterGaussian5x5s32_v2)( src, width, height, width, dst, - width, border ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFilterGaussian5x5s32_v2( const int32_t* __restrict src, - unsigned int srcWidth, - unsigned int srcHeight, - unsigned int srcStride, - int32_t* __restrict dst, - unsigned int dstStride, - int border ) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? srcWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( (srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // Stride is at least as much as Width - fcvAssert( (dstStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvFilterGaussian5x5s32_v2)( src, srcWidth, srcHeight, srcStride, dst, dstStride, border ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffineu8( const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - const float* __restrict nPos, - const float* __restrict nAffine, - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight ) - -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvTransformAffineu8_v2)( nImage,imageWidth,imageHeight,imageWidth, - nPos, nAffine, - nPatch, patchWidth, patchHeight, patchWidth ); -} - - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvTransformAffineu8_v2( const uint8_t* __restrict nImage, - unsigned int imageWidth, - unsigned int imageHeight, - unsigned int imageStride, - const float* __restrict nPos, - const float* __restrict nAffine, - uint8_t* __restrict nPatch, - unsigned int patchWidth, - unsigned int patchHeight, - unsigned int patchStride ) - -{ - imageStride = (imageStride==0 ? imageWidth : imageStride); - patchStride = (patchStride==0 ? patchWidth : patchStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)nPos & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)nAffine & 0xF) == 0 ); // 128-bit alignment - - fcvAssert( (imageStride >= imageWidth) ); // Stride is at least as much as width - fcvAssert( (patchStride >= patchWidth) ); // Stride is at least as much as width -#endif - - return (**ppfcvTransformAffineu8_v2)( nImage, imageWidth, imageHeight, imageStride, - nPos, nAffine, - nPatch, patchWidth, patchHeight, patchStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvCopyRotated17x17u8( const uint8_t* __restrict region, - uint8_t* __restrict patch, - int nOri ) -{ - (**ppfcvCopyRotated17x17u8)( region, patch, nOri ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9Scoreu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9Scoreu8_v3)( src, width, height, stride, barrier,border, xy, scores, - maxnumcorners, numcorners ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMaskScoreu8( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 );// 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 -#endif - fcvAssert( width <= 2048 ); - - (**ppfcvCornerFast9InMaskScoreu8_v3)( src, width, height, stride, barrier, border, xy, scores, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9Scoreu8_v2( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - stride = (stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL)); - fcvAssert( stride >= width ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast9Scoreu8_v4)( src, width, height, stride, barrier,border, xy, scores, - maxnumcorners, numcorners, nmsEnabled, tempBuf ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast9InMaskScoreu8_v2( const uint8_t* __restrict src, - unsigned int width, - unsigned int height, - unsigned int stride, - int barrier, - unsigned int border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - unsigned int maxnumcorners, - uint32_t* __restrict numcorners, - const uint8_t* __restrict bitMask, - unsigned int maskWidth, - unsigned int maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - stride = (stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL) && (bitMask != NULL)); - fcvAssert( stride >= width ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bitMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (width & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast9InMaskScoreu8_v4)( src, width, height, stride, barrier, border, xy, scores, - maxnumcorners, numcorners, - bitMask, maskWidth, maskHeight, nmsEnabled, tempBuf ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10Scoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL)); - fcvAssert( srcStride >= srcWidth ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - (**ppfcvCornerFast10Scoreu8)( src, srcWidth, srcHeight, srcStride, barrier,border, xy, scores, - nCornersMax, nCorners, nmsEnabled, tempBuf ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvCornerFast10InMaskScoreu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t barrier, - uint32_t border, - uint32_t* __restrict xy, - uint32_t* __restrict scores, - uint32_t nCornersMax, - uint32_t* __restrict nCorners, - const uint8_t* __restrict mask, - uint32_t maskWidth, - uint32_t maskHeight, - uint32_t nmsEnabled, - void* __restrict tempBuf) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (xy != NULL) && (scores != NULL) && (mask != NULL) ); - fcvAssert( srcStride >= srcWidth ); - fcvAssert( (nmsEnabled==0) || (tempBuf != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xy & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)scores & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert ((nmsEnabled==0) || (((int)(size_t)tempBuf & 0xF) == 0) ); // 128-bit alignment -#endif - - (**ppfcvCornerFast10InMaskScoreu8)( src, srcWidth, srcHeight, srcStride, barrier, border, xy, scores, - nCornersMax, nCorners, - mask, maskWidth, maskHeight, nmsEnabled, tempBuf ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvTrackLKOpticalFlowu8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - int width, - int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *scr2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*featureXY) == 4 ); - fcvAssert( sizeof(*featureXY_out) == 4 ); - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY_out & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureStatus & 0xF) == 0 ); // 128-bit alignment - #ifndef NDEBUG - int div = (1 << (nPyramidLevels - 1)) - 1; - fcvAssert( ( (width & div) == 0 ) & ( (height & div) == 0 ) ); //width and height multiples of 2^(nPyramidLevels-1) - #endif -#endif - - (**ppfcvTrackLKOpticalFlowu8)( src1, src2, width, height, - src1Pyr, scr2Pyr, - dx1Pyr, dy1Pyr, - featureXY, featureXY_out, - featureStatus, featureLen, - windowWidth, windowHeight, - maxIterations, nPyramidLevels, - maxResidue, minDisplacement, - minEigenvalue, lightingNormalized); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvTrackLKOpticalFlowf32( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - unsigned int width, - unsigned int height, - const fcvPyramidLevel *src1Pyr, - const fcvPyramidLevel *src2Pyr, - const fcvPyramidLevel *dx1Pyr, - const fcvPyramidLevel *dy1Pyr, - const float* featureXY, - float* featureXY_out, - int32_t* featureStatus, - int featureLen, - int windowWidth, - int windowHeight, - int maxIterations, - int nPyramidLevels, - float maxResidue, - float minDisplacement, - float minEigenvalue, - int lightingNormalized ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( sizeof(*featureXY) == 4 ); - fcvAssert( sizeof(*featureXY_out) == 4 ); - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src2 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureXY_out & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)featureStatus & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvTrackLKOpticalFlowf32)( src1, src2, width, height, - src1Pyr, src2Pyr, - dx1Pyr,dy1Pyr, - featureXY, featureXY_out, - featureStatus, featureLen, windowWidth, windowHeight, - maxIterations, nPyramidLevels, maxResidue, - minDisplacement, minEigenvalue, - lightingNormalized ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidCreatef32( const float* __restrict base, unsigned int baseWidth, - unsigned int baseHeight, - unsigned int numLevels, fcvPyramidLevel* pyramid ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)base & 0xF) == 0 ); // 128-bit alignment - #ifndef NDEBUG - int div = (1 << (numLevels - 1)) - 1; - #endif - fcvAssert( sizeof(*base) == 4 ); - fcvAssert( ( (baseWidth & div) == 0 ) & ( (baseHeight & div) == 0 ) ); -#endif - - return (**ppfcvPyramidCreatef32)( base, baseWidth, baseHeight,numLevels, pyramid ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidCreateu8( const uint8_t* __restrict base, unsigned int baseWidth, unsigned int baseHeight, - unsigned int numLevels, fcvPyramidLevel * pyramid ) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - #ifndef NDEBUG - int div = (1 << (numLevels - 1)) - 1; - #endif - fcvAssert( ( (baseWidth & div) == 0 ) & ( (baseHeight & div) == 0 ) ); -#endif - return (**ppfcvPyramidCreateu8)( base, baseWidth, baseHeight,numLevels, pyramid ); - -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int -fcvPyramidAllocate( fcvPyramidLevel* pyr, unsigned int baseWidth, - unsigned int baseHeight, unsigned int bytesPerPixel, - unsigned int numLevels, int allocateBase ) -{ - - return (**ppfcvPyramidAllocate)(pyr,baseWidth,baseHeight,bytesPerPixel,numLevels,allocateBase); - -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvPyramidDelete( fcvPyramidLevel * pyr, unsigned int numLevels, unsigned int startLevel ) -{ - - (**ppfcvPyramidDelete)(pyr,numLevels,startLevel); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatei16( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatei16)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatei8 ( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatei8)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvPyramidSobelGradientCreatef32 ( const fcvPyramidLevel* imgPyr, - fcvPyramidLevel* dxPyr, - fcvPyramidLevel* dyPyr, unsigned int numLevels ) -{ - return (**ppfcvPyramidSobelGradientCreatef32)( imgPyr,dxPyr, dyPyr, numLevels ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCountu8( const uint8_t* __restrict src, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvBitCountu8)( src, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCount32x1u8( const uint8_t* __restrict src ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 128-bit alignment -#endif - - return (**ppfcvBitCount32x1u8)( src ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvBitCount32x4u8( const uint8_t* __restrict A, const uint8_t* __restrict B, - const uint8_t* __restrict C, const uint8_t* __restrict D, - uint32_t* __restrict count ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)count & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvBitCount32x4u8)( A, B, C, D, count ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCount64x1u8( const uint8_t* __restrict src ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvBitCount64x1u8)( src ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvBitCount64x4u8( const uint8_t* __restrict A, const uint8_t* __restrict B, - const uint8_t* __restrict C, const uint8_t* __restrict D, - uint32_t* __restrict count ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)count & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvBitCount64x4u8)( A, B, C, D, count ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvBitCountu32( const uint32_t* __restrict src, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvBitCountu32)( src, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistanceu8( const uint8_t* __restrict a, - const uint8_t* __restrict b, unsigned int len ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistanceu8)( a, b, len ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance32x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistance32x1u8a4)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance64x1u8a4( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)b & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvHammingDistance64x1u8a4)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance32x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)b & 0x3) == 0 ); // 32-bit alignment -#endif - - return (**ppfcvHammingDistance32x1u8)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline uint32_t -fcvHammingDistance64x1u8( const uint8_t* __restrict a, - const uint8_t* __restrict b ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)a & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)b & 0x7) == 0 ); // 64-bit alignment -#endif - - return (**ppfcvHammingDistance64x1u8)( a, b ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance32x4u8a4( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)B & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)C & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)D & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)E & 0x3) == 0 ); // 32-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance32x4u8a4)( A, B, C, D, E, distances ); -} - - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance64x4u8a4( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)E & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance64x4u8a4)( A, B, C, D, E, distances ); -} - - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -inline void -fcvHammingDistance64x4u8( const uint8_t* __restrict A, - const uint8_t* __restrict B, - const uint8_t* __restrict C, - const uint8_t* __restrict D, - const uint8_t* __restrict E, - uint32_t* __restrict distances ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)B & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)C & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)D & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)E & 0x7) == 0 ); // 64-bit alignment - fcvAssert( ((int)(size_t)distances & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvHammingDistance64x4u8)( A, B, C, D, E, distances ); -} - -inline void fcvMseru8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int pointsArraySize, - unsigned int* __restrict pointsArray - ) - -{ - (**ppfcvMseru8)(mserHandle,srcPtr,srcWidth,srcHeight,srcStride - ,maxContours,numContours,numPointsInContour,pointsArraySize,pointsArray); -} - -inline void -fcvMserExtu8( void *mserHandle, - const uint8_t* __restrict srcPtr,unsigned int srcWidth, - unsigned int srcHeight, unsigned int srcStride, - unsigned int maxContours, - unsigned int * __restrict numContours, unsigned int * __restrict numPointsInContour , - unsigned int* __restrict pointsArray, unsigned int pointsArraySize, - unsigned int * __restrict contourVariation, - int * __restrict contourPolarity, - unsigned int * __restrict contourNodeId, - unsigned int * __restrict contourNodeCounter - ) -{ - (**ppfcvMserExtu8)(mserHandle,srcPtr,srcWidth,srcHeight,srcStride,maxContours, numContours, numPointsInContour, - pointsArray,pointsArraySize,contourVariation,contourPolarity,contourNodeId, contourNodeCounter); -} - -inline int fcvMserInit(const unsigned int width, - const unsigned int height, - unsigned int delta, - unsigned int minArea , - unsigned int maxArea , - float maxVariation , - float minDiversity , void ** mserHandle ) -{ - return (*ppfcvMserInit)(width,height,delta,minArea,maxArea,maxVariation, minDiversity, mserHandle); -} - -inline void fcvMserRelease(void *mserHandle) -{ - (**ppfcvMserRelease)(mserHandle); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int -fcvTrackBMOpticalFlow16x16u8( const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t roiLeft, - uint32_t roiTop, - uint32_t roiRight, - uint32_t roiBottom, - uint32_t shiftSize, - uint32_t searchWidth, - uint32_t searchHeight, - uint32_t searchStep, - uint32_t usePrevious, - uint32_t * numMv, - uint32_t * locX, - uint32_t * locY, - uint32_t * mvX, - uint32_t * mvY) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((static_cast(reinterpret_cast(src1))) & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((static_cast(reinterpret_cast(src1))) & 0xF) == 0 ); // 128-bit alignment - fcvAssert( numMv != NULL ); // NULL Check - fcvAssert( locX != NULL ); // NULL Check - fcvAssert( locY != NULL ); // NULL Check - fcvAssert( mvX != NULL ); // NULL Check - fcvAssert( mvY != NULL ); // NULL Check -#endif - - return (**ppfcvTrackBMOpticalFlow16x16u8)( src1, src2, srcWidth, srcHeight, srcStride, - roiLeft, roiTop, roiRight, roiBottom, shiftSize, - searchWidth, searchHeight, searchStep, usePrevious, - numMv, locX, locY, mvX, mvY ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void fcvBoundingRectangle (const uint32_t * __restrict xy, uint32_t numPoints, - uint32_t * rectTopLeftX, uint32_t * rectTopLeftY, - uint32_t * rectWidth, uint32_t *rectHeight) -{ - (**ppfcvBoundingRectangle)(xy,numPoints,rectTopLeftX, rectTopLeftY, rectWidth, rectHeight); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleVerticalu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleVerticalu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleHorizontalu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleHorizontalu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsample2Du8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsample2Du8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleVerticalInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleVerticalInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsampleHorizontalInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsampleHorizontalInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpsample2DInterleavedu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvUpsample2DInterleavedu8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr444Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr444Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr422Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr422Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr420Planaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr420Planaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr444PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr444PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr422PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr422PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToYCbCr420PseudoPlanaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToYCbCr420PseudoPlanaru8)( src, srcWidth, srcHeight, srcStride, dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToRGB888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToRGB888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToRGBA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToRGBA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB565ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB565ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToRGB565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToRGB565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToRGBA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToRGBA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGB888ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGB888ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToRGB565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToRGB565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToRGB888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToRGB888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGR565u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGR565u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGR888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGR888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToBGRA8888u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToBGRA8888u8)( src, srcWidth, srcHeight, srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorRGBA8888ToLABu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorRGBA8888ToLABu8)(src, srcWidth, srcHeight, srcStride, dst, dstStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr422Planaru8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr420Planaru8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr444Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr420Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr444Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr422Planaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr444PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr422PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToYCbCr420PseudoPlanaru8)( srcY, srcCb, srcCr, srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr422PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr420PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr444PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr420PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr444PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstC, - uint32_t dstYStride, - uint32_t dstCStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr422PseudoPlanaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstC, dstYStride, dstCStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr444Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr422Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8( const uint8_t* srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* dstY, - uint8_t* __restrict dstCb, - uint8_t* __restrict dstCr, - uint32_t dstYStride, - uint32_t dstCbStride, - uint32_t dstCrStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstCrStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToYCbCr420Planaru8)( srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - dstY, dstCb, dstCr, dstYStride, dstCbStride, dstCrStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGB565u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGB888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcCb, - const uint8_t* __restrict srcCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PlanarToRGBA8888u8)( srcY, srcCb, srcCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr444PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr444PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr422PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr422PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGB565u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGB565u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGB888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGB888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvColorYCbCr420PseudoPlanarToRGBA8888u8( const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)srcC & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvColorYCbCr420PseudoPlanarToRGBA8888u8)( srcY, srcC, - srcWidth, srcHeight, srcYStride, srcCStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvEdgeWeightings16( int16_t* __restrict edgeMap, - const uint32_t edgeMapWidth, - const uint32_t edgeMapHeight, - const uint32_t edgeMapStride, - const uint32_t weight, - const uint32_t edge_limit, - const uint32_t hl_threshold, - const uint32_t hh_threshold, - const uint32_t edge_denoise_factor ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)edgeMap & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( edgeMapStride == 0 && (edgeMapWidth & 0x7) == 0 ) || (edgeMapStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvEdgeWeightings16)( edgeMap, edgeMapWidth, edgeMapHeight, edgeMapStride, - weight, edge_limit, hl_threshold, hh_threshold, edge_denoise_factor ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDeinterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst0, - uint32_t dst0Stride, - uint8_t* __restrict dst1, - uint32_t dst1Stride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst0 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dst0Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dst1Stride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDeinterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst0, dst0Stride, dst1, dst1Stride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvInterleaveu8( const uint8_t* __restrict src0, - const uint8_t* __restrict src1, - uint32_t imageWidth, - uint32_t imageHeight, - uint32_t src0Stride, - uint32_t src1Stride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src0 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)src1 & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (imageWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (src0Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (src1Stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvInterleaveu8)( src0, src1, imageWidth, imageHeight, - src0Stride, src1Stride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHarrTransposeu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvDWTHaarTransposeu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHaarTransposeu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWTHaarTransposeu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWT53TabTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWT53TabTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWT53TabTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWT53TabTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHarrTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvIDWTHaarTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHaarTransposes16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWTHaarTransposes16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWTHaaru8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWTHaaru8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDWT53Tabs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDWT53Tabs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWT53Tabs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWT53Tabs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDWTHaars16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDWTHaars16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDCTu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int16_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDCTu8)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIDCTs16( const int16_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcWidth == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvIDCTs16)( src, srcWidth, srcHeight, srcStride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpPolyu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpPolyu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleUpPolyInterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleUpPolyInterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownMNu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleDownMNu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvScaleDownMNInterleaveu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvScaleDownMNInterleaveu8)( src, srcWidth, srcHeight, srcStride, - dst, dstWidth, dstHeight, dstStride ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline uint32_t -fcvKMeansTreeSearch36x10s8( const int8_t* __restrict nodeChildrenCenter, - const uint32_t* __restrict nodeChildrenInvLenQ32, - const uint32_t* __restrict nodeChildrenIndex, - const uint8_t* __restrict nodeNumChildren, - uint32_t numNodes, - const int8_t* __restrict key ) -{ - return (**ppfcvKMeansTreeSearch36x10s8)( nodeChildrenCenter, - nodeChildrenInvLenQ32, - nodeChildrenIndex, - nodeNumChildren, - numNodes, - key ); - -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline void -fcvLinearSearch8x36s8( - const uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - const int8_t * __restrict descDB, - const uint32_t * __restrict descDBInvLenQ38, - const uint16_t * __restrict descDBTargetId, - uint32_t numDescDB, - const int8_t * __restrict srcDesc, - const uint32_t * __restrict srcDescInvLenQ38, - const uint32_t * __restrict srcDescIdx, - uint32_t numSrcDesc, - const uint16_t * __restrict targetsToIgnore, - uint32_t numTargetsToIgnore, - uint32_t maxDistanceQ31, - uint32_t * __restrict correspondenceDBIdx, - uint32_t * __restrict correspondencSrcDescIdx, - uint32_t * __restrict correspondenceDistanceQ31, - uint32_t maxNumCorrespondences, - uint32_t * __restrict numCorrespondences ) -{ - return (**ppfcvLinearSearch8x36s8)( dbLUT, - numDBLUT, - descDB, - descDBInvLenQ38, - descDBTargetId, - numDescDB, - srcDesc, - srcDescInvLenQ38, - srcDescIdx, - numSrcDesc, - targetsToIgnore, - numTargetsToIgnore, - maxDistanceQ31, - correspondenceDBIdx, - correspondencSrcDescIdx, - correspondenceDistanceQ31, - maxNumCorrespondences, - numCorrespondences ); -} - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - -inline int -fcvLinearSearchPrepare8x36s8( - uint32_t * __restrict dbLUT, - uint32_t numDBLUT, - int8_t * __restrict descDB, - uint32_t * __restrict descDBInvLenQ38, - uint16_t * __restrict descDBTargetId, - uint32_t * __restrict idxLUT, - uint32_t numDescDB ) -{ - return (**ppfcvLinearSearchPrepare8x36s8_v2)( dbLUT, - numDBLUT, - descDB, - descDBInvLenQ38, - descDBTargetId, - idxLUT, - numDescDB ); -} - - -inline void -fcvFindContoursExternalu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursExternalu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void -fcvFindContoursListu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - void* contourHandle ) -{ - return(**ppfcvFindContoursListu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours, - numContourPoints,contourStartPoints,pointBuffer,pointBufferSize,contourHandle); -} - -inline void -fcvFindContoursCcompu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t*__restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursCcompu8) (src,srcWidth,srcHeight,srcStride,maxNumContours,numContours, - holeFlag,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void -fcvFindContoursTreeu8( uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t maxNumContours, - uint32_t* __restrict numContours, - uint32_t* __restrict holeFlag, - uint32_t* __restrict numContourPoints, - uint32_t** __restrict contourStartPoints, - uint32_t* __restrict pointBuffer, - uint32_t pointBufferSize, - int32_t hierarchy[][4], - void* contourHandle ) -{ - return(**ppfcvFindContoursTreeu8)(src,srcWidth,srcHeight,srcStride,maxNumContours,numContours,holeFlag,numContourPoints, - contourStartPoints,pointBuffer,pointBufferSize,hierarchy,contourHandle); -} - -inline void* -fcvFindContoursAllocate( uint32_t srcStride ) -{ - return(**ppfcvFindContoursAllocate) (srcStride); -} - -inline void -fcvFindContoursDelete( void* contourHandle ) -{ - (**ppfcvFindContoursDelete) ( contourHandle ); -} - - -inline void -fcvSolvef32(const float32_t * __restrict A, - int32_t numCols, - int32_t numRows, - const float32_t * __restrict b, - float32_t * __restrict x) -{ - return(**ppfcvSolvef32)(A,numCols,numRows,b,x); - -} - -inline void -fcvGetPerspectiveTransformf32( const float32_t src1[8], - const float32_t src2[8], - float32_t transformCoefficient[9] ) - -{ - (**ppfcvGetPerspectiveTransformf32)(src1,src2,transformCoefficient); - -} -inline void -fcvSetElementsu8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsu8)( src, srcWidth, srcHeight, srcStride, value, mask, maskStride ); -} - -inline void -fcvSetElementss32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value, - const uint8_t * __restrict mask , - uint32_t maskStride - ) -{ - (**ppfcvSetElementss32)( src, srcWidth, srcHeight, srcStride, value, mask , maskStride); - -} - -inline void -fcvSetElementsf32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsf32)( src, srcWidth, srcHeight, srcStride, value, mask, maskStride); - -} - -inline void -fcvSetElementsc4u8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4u8)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); - -} - -inline void -fcvSetElementsc4s32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4s32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); -} - -inline void -fcvSetElementsc4f32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc4f32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, value4, mask, maskStride ); -} - -inline void -fcvSetElementsc3u8( uint8_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t value1, - uint8_t value2, - uint8_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - return (**ppfcvSetElementsc3u8)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); - -} - -inline void -fcvSetElementsc3s32( int32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t value1, - int32_t value2, - int32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc3s32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); -} - -inline void -fcvSetElementsc3f32( float32_t * __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t value1, - float32_t value2, - float32_t value3, - const uint8_t * __restrict mask, - uint32_t maskStride - ) -{ - (**ppfcvSetElementsc3f32)( src, srcWidth, srcHeight, srcStride, value1, value2, value3, mask, maskStride ); -} - - - - -inline void -fcvAdaptiveThresholdGaussian3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian3x3u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} -inline void -fcvAdaptiveThresholdGaussian5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian5x5u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdGaussian11x11u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdGaussian11x11u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdMean3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean3x3u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); - -} - -inline void -fcvAdaptiveThresholdMean5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean5x5u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvAdaptiveThresholdMean11x11u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t maxValue, - fcvThreshType thresholdType, - int32_t value, - uint8_t* __restrict dst, - uint32_t dstStride ) -{ - (**ppfcvAdaptiveThresholdMean11x11u8)( src,srcWidth, srcHeight, srcStride, - maxValue,thresholdType, value, dst,dstStride ); -} - -inline void -fcvBoxFilter3x3u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (*ppfcvBoxFilter3x3u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); - -} - - -inline void -fcvBoxFilter5x5u8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (*ppfcvBoxFilter5x5u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); - -} - - -inline void -fcvBoxFilter11x11u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBoxFilter11x11u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvBilateralFilter5x5u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBilateralFilter5x5u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvBilateralFilter7x7u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - - (**ppfcvBilateralFilter7x7u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvBilateralFilter9x9u8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride - ) -{ - (**ppfcvBilateralFilter9x9u8)(src,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvSegmentFGMasku8(uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t Polygonal, - uint32_t perimScale) -{ - (**ppfcvSegmentFGMasku8)(src,srcWidth,srcHeight,srcStride,Polygonal,perimScale); -} - - -inline void -fcvAbsDiffu8(const uint8_t * __restrict src1, - const uint8_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (uint8_t) : dstStride); - - - (*ppfcvAbsDiffu8)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvAbsDiffs32(const int32_t * __restrict src1, - const int32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (int32_t) : dstStride); - - (*ppfcvAbsDiffs32)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - - -inline void -fcvAbsDifff32(const float32_t * __restrict src1, - const float32_t * __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (float32_t) : dstStride); - - (*ppfcvAbsDifff32)(src1,src2,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVu8(const uint8_t * __restrict src, - uint8_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (uint8_t) : dstStride); - - (**ppfcvAbsDiffVu8)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVs32(const int32_t * __restrict src, - int32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (int32_t) : dstStride); - - (**ppfcvAbsDiffVs32)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVf32(const float32_t * __restrict src, - float32_t value, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*sizeof (float32_t) : dstStride); - - (**ppfcvAbsDiffVf32)(src,value,srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVc4u8(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint8_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*4*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (uint8_t) : dstStride); - - (*ppfcvAbsDiffVc4u8)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - - -inline void -fcvAbsDiffVc4s32(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - int32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - - srcStride = (srcStride==0 ? srcWidth*4*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (int32_t) : dstStride); - - (*ppfcvAbsDiffVc4s32)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc4f32(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - float32_t value4, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride) -{ - - srcStride = (srcStride==0 ? srcWidth*4*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*4*sizeof (float32_t) : dstStride); - - (*ppfcvAbsDiffVc4f32)(src,value1,value2,value3,value4, - srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3u8(const uint8_t * __restrict src, - uint8_t value1, - uint8_t value2, - uint8_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (uint8_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (uint8_t) : dstStride); - - (**ppfcvAbsDiffVc3u8)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3s32(const int32_t * __restrict src, - int32_t value1, - int32_t value2, - int32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride ) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (int32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (int32_t) : dstStride); - - (**ppfcvAbsDiffVc3s32)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -inline void -fcvAbsDiffVc3f32(const float32_t * __restrict src, - float32_t value1, - float32_t value2, - float32_t value3, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t * __restrict dst, - uint32_t dstStride) -{ - srcStride = (srcStride==0 ? srcWidth*3*sizeof (float32_t) : srcStride); - dstStride = (dstStride==0 ? srcWidth*3*sizeof (float32_t) : dstStride); - - (**ppfcvAbsDiffVc3f32)(src,value1,value2,value3,srcWidth,srcHeight,srcStride,dst,dstStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeCreate36s8f32( const int8_t* __restrict vectors, - const float32_t* __restrict invLengths, - int numVectors, - fcvKDTreeDatas8f32** kdtrees ) -{ - return (**ppfcvKDTreeCreate36s8f32)(vectors, invLengths, numVectors, kdtrees ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeDestroy36s8f32( fcvKDTreeDatas8f32* kdtrees ) -{ - return (**ppfcvKDTreeDestroy36s8f32) ( kdtrees ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -int fcvKDTreeQuery36s8f32( fcvKDTreeDatas8f32* kdtrees, - const int8_t* __restrict query, - float32_t queryInvLen, - int maxNNs, - float32_t maxDist, - int maxChecks, - const uint8_t* __restrict mask, - int32_t* numNNsFound, - int32_t* __restrict NNInds, - float32_t* __restrict NNDists ) -{ - return (**ppfcvKDTreeQuery36s8f32) ( kdtrees, query, queryInvLen, maxNNs, - maxDist, maxChecks, mask, numNNsFound, - NNInds, NNDists ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvBitwiseOru8 -( - const uint8_t* __restrict src1, - const uint8_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -) -{ - return (**ppfcvBitwiseOru8) ( src1, src2, srcWidth, srcHeight, - srcStride, dst, dstStride, mask, - maskStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvBitwiseOrs32 -( - const int32_t* __restrict src1, - const int32_t* __restrict src2, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t * __restrict dst, - uint32_t dstStride, - uint8_t * __restrict mask, - uint32_t maskStride -) -{ - return (**ppfcvBitwiseOrs32) ( src1, src2, srcWidth, srcHeight, - srcStride, dst, dstStride, mask, - maskStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvColorRGB888ToGrayu8 -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvColorRGB888ToGrayu8) ( src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvTiltedIntegralu8s32 -( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvTiltedIntegralu8s32) ( src, srcWidth, srcHeight, - srcStride, dst, dstStride ); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline -void fcvConvValids16 -( - const int16_t* __restrict src1, - uint32_t src1Width, - uint32_t src1Height, - uint32_t src1Stride, - const int16_t* __restrict src2, - uint32_t src2Width, - uint32_t src2Height, - uint32_t src2Stride, - int32_t* __restrict dst, - uint32_t dstStride -) -{ - return (**ppfcvConvValids16) ( src1, src1Width, src1Height, src1Stride, - src2, src2Width, src2Height, src2Stride, - dst, dstStride ); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvIntegrateImageYCbCr420PseudoPlanaru8( - const uint8_t* __restrict srcY, - const uint8_t* __restrict srcC, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCStride, - uint32_t* __restrict integralY, - uint32_t* __restrict integralCb, - uint32_t* __restrict integralCr, - uint32_t integralYStride, - uint32_t integralCbStride, - uint32_t integralCrStride) -{ - srcYStride=(srcYStride==0 ? srcWidth : srcYStride); - srcCStride=(srcCStride==0 ? srcWidth : srcCStride); - integralYStride=(integralYStride==0 ? (srcWidth+8)*sizeof(uint32_t) : integralYStride); - integralCbStride=(integralCbStride==0 ? ((srcWidth>>1)+8) *sizeof(uint32_t) : integralCbStride); - integralCrStride=(integralCrStride==0 ? ((srcWidth>>1)+8) *sizeof(uint32_t) : integralCrStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)srcY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)integralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0xF) == 0 ); // multiple of 16 - fcvAssert( (srcYStride & 0xF) == 0 ); // multiple of 8 - fcvAssert( (srcCStride & 0xF) == 0 ); // multiple of 8 - fcvAssert( (integralYStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (integralCbStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (integralCrStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (srcYStride >= srcWidth) ); // at least as much as width - fcvAssert( (srcCStride >= srcWidth>>1) ); // at least as much as width - fcvAssert( (integralYStride >= srcWidth*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) - fcvAssert( (integralCbStride >= srcWidth>>1*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) - fcvAssert( (integralCrStride >= srcWidth>>1*sizeof(uint32_t))); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvIntegrateImageYCbCr420PseudoPlanaru8)(srcY, srcC, srcWidth, srcHeight, srcYStride, srcCStride, - integralY, integralCb, integralCr, integralYStride, integralCbStride, integralCrStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFindForegroundIntegrateImageYCbCr420u32( - const uint32_t * __restrict bgIntegralY, - const uint32_t * __restrict bgIntegralCb, - const uint32_t * __restrict bgIntegralCr, - const uint32_t * __restrict fgIntegralY, - const uint32_t * __restrict fgIntegralCb, - const uint32_t * __restrict fgIntegralCr, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcYStride, - uint32_t srcCbStride, - uint32_t srcCrStride, - uint8_t *__restrict outputMask, - uint32_t outputWidth, - uint32_t outputHeight, - uint32_t outputMaskStride, - float32_t threshold ) -{ - srcYStride=(srcYStride==0 ? (srcWidth+8)*sizeof(uint32_t) : srcYStride); - srcCbStride=(srcCbStride==0 ? ((srcWidth>>1)+8)*sizeof(uint32_t) : srcCbStride); - srcCrStride=(srcCrStride==0 ? ((srcWidth>>1)+8)*sizeof(uint32_t) : srcCrStride); - outputMaskStride=(outputMaskStride==0 ? outputWidth : outputMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)outputMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)bgIntegralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralCb & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgIntegralCr & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0xF) == 0 ); // multiple of 8 - fcvAssert( (srcYStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (srcCbStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (srcCrStride & 0x7) == 0 ); // multiple of 32 - fcvAssert( (outputMaskStride & 0x7) == 0 ); // multiple of 8 (8 values) - fcvAssert( (srcYStride >= srcWidth*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (srcCbStride >= srcWidth>>1*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (srcCrStride >= srcWidth>>1*sizeof(uint32_t)) ); // at least as much as width - fcvAssert( (outputMaskStride >= (uint32_t)outputWidth)); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvFindForegroundIntegrateImageYCbCr420u32)(bgIntegralY, bgIntegralCb, bgIntegralCr, fgIntegralY, fgIntegralCb, fgIntegralCr, - srcWidth, srcHeight, srcYStride, srcCbStride, srcCrStride, - outputMask, outputWidth, outputHeight, outputMaskStride, threshold); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvFloodfillSimpleu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict dst, - uint32_t dstStride, - uint32_t xBegin, - uint32_t yBegin, - uint8_t newVal, //new Val can't be zero. zero is background. - fcvConnectedComponent *cc, - uint8_t connectivity, - void* lineBuffer) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - dstStride=(dstStride==0 ? srcWidth : dstStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)lineBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0xF) == 0 ); // multiple of 16 (8 values) - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= srcWidth) ); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvFloodfillSimpleu8)(src, srcWidth, srcHeight, srcStride, dst, dstStride, xBegin, yBegin, newVal, cc, connectivity, lineBuffer); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvUpdateMotionHistoryu8s32( - const uint8_t* __restrict src, - uint32_t srcWidth, uint32_t srcHeight, - uint32_t srcStride, - int32_t* __restrict dst, - uint32_t dstStride, - int32_t timeStamp, - int32_t maxHistory) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - dstStride=(dstStride==0 ? srcWidth*sizeof(int32_t) : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 32 (8 values) - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= srcWidth*sizeof(int32_t))); // at least as much as 2*width values (or 4*width bytes) -#endif - (**ppfcvUpdateMotionHistoryu8s32)(src, srcWidth, srcHeight, srcStride, dst, dstStride, timeStamp, maxHistory); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvAverages32( - const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue) -{ - srcStride=(srcStride==0 ? srcWidth*sizeof(uint32_t) : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*sizeof(uint32_t)) ); // at least as much as width -#endif - (**ppfcvAverages32)(src, srcWidth, srcHeight, srcStride, avgValue); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void - fcvAverageu8( - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - float32_t* __restrict avgValue) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ( srcStride == 0 && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - (**ppfcvAverageu8)(src, srcWidth, srcHeight, srcStride, avgValue); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShiftu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - return (**ppfcvMeanShiftu8)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShifts32( const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvMeanShifts32)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvMeanShiftf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvMeanShiftf32)( src, srcWidth, srcHeight, srcStride, window, criteria); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTracku8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - return (**ppfcvConAdaTracku8)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTracks32( const int32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvConAdaTracks32)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline uint32_t - fcvConAdaTrackf32( const float32_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvRectangleInt* window, - fcvTermCriteria criteria, - fcvBox2D *circuBox) -{ - srcStride=(srcStride==0 ? srcWidth*4 : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (window != NULL) && (src != NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (( srcStride == 0 ) && (srcWidth & 0x7) == 0 ) || (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4 -#endif - - return (**ppfcvConAdaTrackf32)( src, srcWidth, srcHeight, srcStride, window, criteria, circuBox); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvSVDf32(const float32_t * __restrict A, - uint32_t m, - uint32_t n, - float32_t * __restrict w, - float32_t * __restrict U, - float32_t * __restrict Vt, - float32_t * tmpU, - float32_t * tmpV) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)A & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)w & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)U & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)Vt & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpU & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpV & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvSVDf32)(A,m,n,w,U,Vt,tmpU,tmpV); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvFillConvexPolyu8( uint32_t nPts, - const uint32_t* __restrict polygon, - uint32_t nChannel, - const uint8_t* __restrict color, - uint8_t* __restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride) -{ - - dstStride = (dstStride==0 ? dstWidth * nChannel : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygon != NULL) && (dst != NULL) && (color != NULL)); - fcvAssert( ((int)(size_t)polygon & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - -#endif - (**ppfcvFillConvexPolyu8)(nPts, polygon, nChannel, color, dst, dstWidth, dstHeight, dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvPointPolygonTest(uint32_t nPts, - const uint32_t* __restrict polygonContour, - uint32_t px, - uint32_t py, - float32_t* distance, - int16_t* resultFlag) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygonContour != NULL) && (nPts >= 2) ); - fcvAssert( ((int)(size_t)polygonContour & 0xF) == 0 ); // 128-bit alignment -#endif - - (**ppfcvPointPolygonTest)(nPts, polygonContour, px, py, distance, resultFlag); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void fcvFindConvexHull( uint32_t* __restrict polygonContour, - uint32_t nPtsContour, - uint32_t* __restrict convexHull, - uint32_t* nPtsHull, - uint32_t* __restrict tmpBuff) -{ - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (polygonContour != NULL) && (convexHull != NULL) && (tmpBuff != NULL)); - fcvAssert( ((int)(size_t)polygonContour & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)convexHull & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)tmpBuff & 0xF) == 0 ); // 128-bit alignment - fcvAssert( nPtsContour>0 ); // non negative number of input points -#endif - - (**ppfcvFindConvexHull)(polygonContour,nPtsContour,convexHull,nPtsHull,tmpBuff); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline int32_t -fcvSolveCholeskyf32( float32_t *__restrict A, - const float32_t *__restrict b, - float32_t *__restrict diag, - uint32_t N, - float32_t *__restrict x) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (A != NULL) && (b != NULL) ); - fcvAssert( (diag != NULL) && (x != NULL) ); - fcvAssert( ((int)(size_t)A & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)b & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)diag & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)x & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvSolveCholeskyf32)(A, b, diag, N, x); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void - fcvGeomUndistortPoint2x1f32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - float32_t* __restrict xyCamera) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvGeomUndistortPoint2x1f32)(cameraCalibration, - xyDevice, - xyCamera); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomUndistortPoint2xNf32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyDevice, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyCamera, - uint32_t dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - (**ppfcvGeomUndistortPoint2xNf32)(cameraCalibration,xyDevice,srcStride,xySize,xyCamera,dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void - fcvGeomDistortPoint2x1f32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment -#endif - (**ppfcvGeomDistortPoint2x1f32)(cameraCalibration, - xyCamera, - xyDevice); -} - -inline void -fcvGeomDistortPoint2xNf32(const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyCamera, - uint32_t srcStride, - uint32_t xySize, - float32_t* __restrict xyDevice, - uint32_t dstStride) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - (**ppfcvGeomDistortPoint2xNf32)(cameraCalibration,xyCamera,srcStride,xySize,xyDevice,dstStride); - -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline int32_t - fcvGeomProjectPoint3x1f32(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (pose != NULL) && (xyz != NULL) ); - fcvAssert( (cameraCalibration != NULL) && (xyCamera != NULL) && (xyDevice != NULL) ); - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment -#endif - return (**ppfcvGeomProjectPoint3x1f32)(pose, cameraCalibration, xyz, xyCamera, xyDevice); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvGeomProjectPoint3xNf32(const float32_t* __restrict pose, - const float32_t* __restrict cameraCalibration, - const float32_t* __restrict xyz, - uint32_t srcStride, - uint32_t xyzSize, - float32_t* __restrict xyCamera, - float32_t* __restrict xyDevice, - uint32_t dstStride, - uint32_t* inFront) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (pose != NULL) && (cameraCalibration != NULL)); - fcvAssert( (xyz != NULL) && (xyCamera != NULL) && (xyDevice != NULL) && (inFront != NULL)); - fcvAssert( ((int)(size_t)pose & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)cameraCalibration & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyz & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyCamera & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)xyDevice & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvGeomProjectPoint3xNf32)(pose,cameraCalibration,xyz,srcStride,xyzSize,xyCamera,xyDevice,dstStride,inFront); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvRemapRGBA8888NNu8(const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t *__restrict mapX, - const float32_t *__restrict mapY, - uint32_t mapStride) -{ - srcStride = (srcStride==0 ? srcWidth*4 : srcStride); - dstStride = (dstStride==0 ? dstWidth*4 : dstStride); - mapStride = (mapStride==0 ? dstWidth*sizeof(float32_t) : mapStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (dst!=NULL) && (mapX!=NULL) && (mapY!=NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (mapStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width*4(4 channels) - fcvAssert( (dstStride >= dstWidth*4) ); // at least as much as width*4(4 channels) - fcvAssert( (mapStride >= (dstWidth*sizeof(float32_t))) ); //at least as much as dstWidth*4 (float) -#endif - - return (**ppfcvRemapRGBA8888NNu8)(src, srcWidth, srcHeight, srcStride, dst, - dstWidth, dstHeight, dstStride, mapX, mapY, mapStride); -} - -//---------------------------------------------------------------------------------------- -//---------------------------------------------------------------------------------------- -inline void -fcvRemapRGBA8888BLu8 ( const uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - const float32_t *__restrict mapX, - const float32_t *__restrict mapY, - uint32_t mapStride ) -{ - srcStride = (srcStride==0 ? srcWidth*4 : srcStride); - dstStride = (dstStride==0 ? dstWidth*4 : dstStride); - mapStride = (mapStride==0 ? dstWidth*sizeof(float32_t) : mapStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (src != NULL) && (dst!=NULL) && (mapX!=NULL) && (mapY!=NULL)); - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)mapY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (mapStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth*4) ); // at least as much as width *4 ( 4 channels) - fcvAssert( (dstStride >= dstWidth*4) ); // at least as much as width *4 (4 channels) - fcvAssert( (mapStride >= (dstWidth*sizeof(float32_t))) ); //at least as much as dstWidth *4 (float ) -#endif - - return (**ppfcvRemapRGBA8888BLu8)(src, srcWidth, srcHeight, srcStride, dst, - dstWidth, dstHeight, dstStride, mapX, mapY, mapStride); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -inline void -fcvJacobianSE2f32(const uint8_t* __restrict warpedImage, - const uint16_t *__restrict warpedBorder, - const uint8_t *__restrict targetImage, - const int16_t *__restrict targetDX, - const int16_t *__restrict targetDY, - uint32_t width, - uint32_t height, - uint32_t stride, - float32_t *__restrict sumJTJ, - float32_t *__restrict sumJTE, - float32_t *__restrict sumError, - uint32_t *__restrict numPixels) -{ - stride=(stride==0 ? width : stride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)warpedImage & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetImage & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)warpedBorder & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetDX & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)targetDY & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)sumJTJ & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (stride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (stride >= width) ); // at least as much as width -#endif - - (**ppfcvJacobianSE2f32)(warpedImage, warpedBorder, targetImage, targetDX, - targetDY, width, height, stride, sumJTJ, sumJTE, - sumError, numPixels); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvTransformAffineClippedu8(const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const float32_t *__restrict affineMatrix, - uint8_t *__restrict dst, - uint32_t dstWidth, - uint32_t dstHeight, - uint32_t dstStride, - uint32_t *__restrict dstBorder) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - dstStride = (dstStride==0 ? dstWidth : dstStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dst & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)affineMatrix & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)dstBorder & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (dstStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( (dstStride >= dstWidth) ); // at least as much as width -#endif - - (**ppfcvTransformAffineClippedu8)(src, srcWidth, srcHeight, srcStride, - affineMatrix, dst, dstWidth, dstHeight, - dstStride, dstBorder); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline fcvBGCodeWord** - fcvCreateBGCodeBookModel( uint32_t srcWidth, - uint32_t srcHeight, - void** __restrict cbmodel ) -{ -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 -#endif - return (**ppfcvCreateBGCodeBookModel) ( srcWidth, srcHeight, cbmodel ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvReleaseBGCodeBookModel( void** cbmodel ) -{ - return (**ppfcvReleaseBGCodeBookModel) ( cbmodel ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookUpdateu8( void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - const uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict updateTime ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - fgMaskStride = (fgMaskStride==0 ? srcWidth : fgMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= 3*srcWidth) ); // Stride is at least 3 times of Width. Input image must have 3 channels. - fcvAssert( (fgMaskStride >= srcWidth) ); // Stride is at least as much as Width -#endif - return (**ppfcvBGCodeBookUpdateu8) ( cbmodel, src, srcWidth, srcHeight, srcStride, fgMask, fgMaskStride, cbMap, updateTime ); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookDiffu8( void* __restrict cbmodel, - const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint8_t* __restrict fgMask, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap, - int32_t* __restrict numFgMask ) -{ - srcStride = (srcStride==0 ? srcWidth*3 : srcStride); - fgMaskStride = (fgMaskStride==0 ? srcWidth : fgMaskStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= 3*srcWidth) ); // Stride is at least 3 times of Width. Input image must have 3 channels. - fcvAssert( (fgMaskStride >= srcWidth) ); // Stride is at least as much as Width -#endif - - return (**ppfcvBGCodeBookDiffu8) ( cbmodel, src, srcWidth, srcHeight, srcStride, fgMask, fgMaskStride, cbMap, numFgMask); -} - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -inline void - fcvBGCodeBookClearStaleu8( void* __restrict cbmodel, - int32_t staleThresh, - const uint8_t* __restrict fgMask, - uint32_t fgMaskWidth, - uint32_t fgMaskHeight, - uint32_t fgMaskStride, - fcvBGCodeWord** __restrict cbMap ) -{ - fgMaskStride = (fgMaskStride==0 ? fgMaskWidth : fgMaskStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)fgMask & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (fgMaskWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (fgMaskStride >= fgMaskWidth) ); // Stride is at least as much as Width -#endif - return (**ppfcvBGCodeBookClearStaleu8) ( cbmodel, staleThresh, fgMask, fgMaskWidth, fgMaskHeight, fgMaskStride, cbMap); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvHoughCircleu8( const uint8_t* __restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - fcvCircle *circles, - uint32_t* numCircle, - uint32_t maxCircle, - uint32_t minDist, - uint32_t cannyThreshold, - uint32_t accThreshold, - uint32_t minRadius, - uint32_t maxRadius, - void *data) -{ - srcStride = (srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( ((int)(size_t)data & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcWidth & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width -#endif - - (**ppfcvHoughCircleu8)(src, srcWidth, srcHeight, srcStride, circles, numCircle, maxCircle, minDist, cannyThreshold, accThreshold, minRadius, maxRadius, data); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContouru8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t color, - uint8_t hole_color) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContouru8) (src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, color, hole_color); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContourInterleavedu8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContourInterleavedu8)( src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, colorR, colorG, colorB, hole_colorR, hole_colorG, hole_colorB); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -inline void -fcvDrawContourPlanaru8(uint8_t *__restrict src, - uint32_t srcWidth, - uint32_t srcHeight, - uint32_t srcStride, - uint32_t nContours, - const uint32_t *__restrict holeFlag, - const uint32_t *__restrict numContourPoints, - const uint32_t **__restrict contourStartPoints, - uint32_t pointBufferSize, - const uint32_t *__restrict pointBuffer, - int32_t hierarchy[][4], - uint32_t max_level, - int32_t thickness, - uint8_t colorR, - uint8_t colorG, - uint8_t colorB, - uint8_t hole_colorR, - uint8_t hole_colorG, - uint8_t hole_colorB) -{ - srcStride=(srcStride==0 ? srcWidth : srcStride); - -#ifndef FASTCV_DISABLE_API_ENFORCEMENT - fcvAssert( ((int)(size_t)src & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride >= srcWidth) ); // at least as much as width - fcvAssert( ((int)(size_t) pointBuffer & 0xF) == 0 ); // 128-bit alignment - fcvAssert( (srcStride & 0x7) == 0 ); // multiple of 8 -#endif - - (**ppfcvDrawContourPlanaru8)( src, srcWidth, srcHeight, srcStride, nContours, holeFlag, numContourPoints, contourStartPoints, pointBufferSize, pointBuffer, hierarchy, max_level, thickness, colorR, colorG, colorB, hole_colorR, hole_colorG, hole_colorB); -} diff --git a/phonelibs/fastcv/x64/include/stdint_.h b/phonelibs/fastcv/x64/include/stdint_.h deleted file mode 100755 index d02608a59..000000000 --- a/phonelibs/fastcv/x64/include/stdint_.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/phonelibs/fastcv/x64/lib/libfastcv.a b/phonelibs/fastcv/x64/lib/libfastcv.a deleted file mode 100755 index 6d33d734e..000000000 Binary files a/phonelibs/fastcv/x64/lib/libfastcv.a and /dev/null differ diff --git a/phonelibs/install_capnp.sh b/phonelibs/install_capnp.sh deleted file mode 100755 index b1ea7602f..000000000 --- a/phonelibs/install_capnp.sh +++ /dev/null @@ -1,42 +0,0 @@ -set -e -echo "Installing capnp" - -cd /tmp -VERSION=0.6.1 -wget https://capnproto.org/capnproto-c++-${VERSION}.tar.gz -tar xvf capnproto-c++-${VERSION}.tar.gz -cd capnproto-c++-${VERSION} -CXXFLAGS="-fPIC" ./configure - -make -j4 -make install - -# manually build binaries statically -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnp src/capnp/compiler/module-loader.o src/capnp/compiler/capnp.o ./.libs/libcapnpc.a ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-c++ src/capnp/compiler/capnpc-c++.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -g++ -std=gnu++11 -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -pthread -O2 -DNDEBUG -pthread -pthread -o .libs/capnpc-capnp src/capnp/compiler/capnpc-capnp.o ./.libs/libcapnp.a ./.libs/libkj.a -lpthread -pthread - -cp .libs/capnp /usr/local/bin/ -rm /usr/local/bin/capnpc -ln -s /usr/local/bin/capnp /usr/local/bin/capnpc -cp .libs/capnpc-c++ /usr/local/bin/ -cp .libs/capnpc-capnp /usr/local/bin/ -cp .libs/*.a /usr/local/lib - -cd /tmp -echo "Installing c-capnp" -git clone https://github.com/commaai/c-capnproto.git -cd c-capnproto -git submodule update --init --recursive -autoreconf -f -i -s -CXXFLAGS="-fPIC" ./configure -make -j4 -make install - -# manually build binaries statically -gcc -fPIC -o .libs/capnpc-c compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o ./.libs/libcapnp_c.a - -cp .libs/capnpc-c /usr/local/bin/ -cp .libs/*.a /usr/local/lib diff --git a/phonelibs/libyuv/LICENSE b/phonelibs/libyuv/LICENSE deleted file mode 100644 index c911747a6..000000000 --- a/phonelibs/libyuv/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Copyright 2011 The LibYuv Project Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Google nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/phonelibs/libyuv/LICENSE.libyuv b/phonelibs/libyuv/LICENSE.libyuv deleted file mode 100644 index c911747a6..000000000 --- a/phonelibs/libyuv/LICENSE.libyuv +++ /dev/null @@ -1,29 +0,0 @@ -Copyright 2011 The LibYuv Project Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of Google nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/phonelibs/libyuv/build.txt b/phonelibs/libyuv/build.txt deleted file mode 100644 index 376e981ec..000000000 --- a/phonelibs/libyuv/build.txt +++ /dev/null @@ -1,4 +0,0 @@ -git clone https://chromium.googlesource.com/libyuv/libyuv -cd libyuv -git reset --hard 4a14cb2e81235ecd656e799aecaaf139db8ce4a2 -cmake . diff --git a/phonelibs/libyuv/mac/lib/libyuv.a b/phonelibs/libyuv/mac/lib/libyuv.a deleted file mode 100644 index 4a1609ca7..000000000 Binary files a/phonelibs/libyuv/mac/lib/libyuv.a and /dev/null differ diff --git a/phonelibs/libyuv/tx2/libyuv.a b/phonelibs/libyuv/tx2/libyuv.a deleted file mode 100644 index bfe5b5b37..000000000 Binary files a/phonelibs/libyuv/tx2/libyuv.a and /dev/null differ diff --git a/phonelibs/libyuv/x64/include b/phonelibs/libyuv/x64/include deleted file mode 120000 index f5030fe88..000000000 --- a/phonelibs/libyuv/x64/include +++ /dev/null @@ -1 +0,0 @@ -../include \ No newline at end of file diff --git a/phonelibs/libyuv/x64/lib/libyuv.a b/phonelibs/libyuv/x64/lib/libyuv.a deleted file mode 100644 index c6afc5643..000000000 Binary files a/phonelibs/libyuv/x64/lib/libyuv.a and /dev/null differ diff --git a/phonelibs/qpoases/INCLUDE/Bounds.hpp b/phonelibs/qpoases/INCLUDE/Bounds.hpp index 1fbd28ab3..7260756da 100644 --- a/phonelibs/qpoases/INCLUDE/Bounds.hpp +++ b/phonelibs/qpoases/INCLUDE/Bounds.hpp @@ -1,189 +1,189 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Bounds.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the Bounds class designed to manage working sets of - * bounds within a QProblem. - */ - - -#ifndef QPOASES_BOUNDS_HPP -#define QPOASES_BOUNDS_HPP - - -#include - - - -/** This class manages working sets of bounds by storing - * index sets and other status information. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class Bounds : public SubjectTo -{ - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - Bounds( ); - - /** Copy constructor (deep copy). */ - Bounds( const Bounds& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~Bounds( ); - - /** Assignment operator (deep copy). */ - Bounds& operator=( const Bounds& rhs /**< Rhs object. */ - ); - - - /** Pseudo-constructor takes the number of bounds. - * \return SUCCESSFUL_RETURN */ - returnValue init( int n /**< Number of bounds. */ - ); - - - /** Initially adds number of a new (i.e. not yet in the list) bound to - * given index set. - * \return SUCCESSFUL_RETURN \n - RET_SETUP_BOUND_FAILED \n - RET_INDEX_OUT_OF_BOUNDS \n - RET_INVALID_ARGUMENTS */ - returnValue setupBound( int _number, /**< Number of new bound. */ - SubjectToStatus _status /**< Status of new bound. */ - ); - - /** Initially adds all numbers of new (i.e. not yet in the list) bounds to - * to the index set of free bounds; the order depends on the SujectToType - * of each index. - * \return SUCCESSFUL_RETURN \n - RET_SETUP_BOUND_FAILED */ - returnValue setupAllFree( ); - - - /** Moves index of a bound from index list of fixed to that of free bounds. - * \return SUCCESSFUL_RETURN \n - RET_MOVING_BOUND_FAILED \n - RET_INDEX_OUT_OF_BOUNDS */ - returnValue moveFixedToFree( int _number /**< Number of bound to be freed. */ - ); - - /** Moves index of a bound from index list of free to that of fixed bounds. - * \return SUCCESSFUL_RETURN \n - RET_MOVING_BOUND_FAILED \n - RET_INDEX_OUT_OF_BOUNDS */ - returnValue moveFreeToFixed( int _number, /**< Number of bound to be fixed. */ - SubjectToStatus _status /**< Status of bound to be fixed. */ - ); - - /** Swaps the indices of two free bounds within the index set. - * \return SUCCESSFUL_RETURN \n - RET_SWAPINDEX_FAILED */ - returnValue swapFree( int number1, /**< Number of first constraint or bound. */ - int number2 /**< Number of second constraint or bound. */ - ); - - - /** Returns number of variables. - * \return Number of variables. */ - inline int getNV( ) const; - - /** Returns number of implicitly fixed variables. - * \return Number of implicitly fixed variables. */ - inline int getNFV( ) const; - - /** Returns number of bounded (but possibly free) variables. - * \return Number of bounded (but possibly free) variables. */ - inline int getNBV( ) const; - - /** Returns number of unbounded variables. - * \return Number of unbounded variables. */ - inline int getNUV( ) const; - - - /** Sets number of implicitly fixed variables. - * \return SUCCESSFUL_RETURN */ - inline returnValue setNFV( int n /**< Number of implicitly fixed variables. */ - ); - - /** Sets number of bounded (but possibly free) variables. - * \return SUCCESSFUL_RETURN */ - inline returnValue setNBV( int n /**< Number of bounded (but possibly free) variables. */ - ); - - /** Sets number of unbounded variables. - * \return SUCCESSFUL_RETURN */ - inline returnValue setNUV( int n /**< Number of unbounded variables */ - ); - - - /** Returns number of free variables. - * \return Number of free variables. */ - inline int getNFR( ); - - /** Returns number of fixed variables. - * \return Number of fixed variables. */ - inline int getNFX( ); - - - /** Returns a pointer to free variables index list. - * \return Pointer to free variables index list. */ - inline Indexlist* getFree( ); - - /** Returns a pointer to fixed variables index list. - * \return Pointer to fixed variables index list. */ - inline Indexlist* getFixed( ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - int nV; /**< Number of variables (nV = nFV + nBV + nUV). */ - int nFV; /**< Number of implicitly fixed variables. */ - int nBV; /**< Number of bounded (but possibly free) variables. */ - int nUV; /**< Number of unbounded variables. */ - - Indexlist free; /**< Index list of free variables. */ - Indexlist fixed; /**< Index list of fixed variables. */ -}; - -#include - -#endif /* QPOASES_BOUNDS_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Bounds.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the Bounds class designed to manage working sets of + * bounds within a QProblem. + */ + + +#ifndef QPOASES_BOUNDS_HPP +#define QPOASES_BOUNDS_HPP + + +#include + + + +/** This class manages working sets of bounds by storing + * index sets and other status information. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class Bounds : public SubjectTo +{ + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + Bounds( ); + + /** Copy constructor (deep copy). */ + Bounds( const Bounds& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~Bounds( ); + + /** Assignment operator (deep copy). */ + Bounds& operator=( const Bounds& rhs /**< Rhs object. */ + ); + + + /** Pseudo-constructor takes the number of bounds. + * \return SUCCESSFUL_RETURN */ + returnValue init( int n /**< Number of bounds. */ + ); + + + /** Initially adds number of a new (i.e. not yet in the list) bound to + * given index set. + * \return SUCCESSFUL_RETURN \n + RET_SETUP_BOUND_FAILED \n + RET_INDEX_OUT_OF_BOUNDS \n + RET_INVALID_ARGUMENTS */ + returnValue setupBound( int _number, /**< Number of new bound. */ + SubjectToStatus _status /**< Status of new bound. */ + ); + + /** Initially adds all numbers of new (i.e. not yet in the list) bounds to + * to the index set of free bounds; the order depends on the SujectToType + * of each index. + * \return SUCCESSFUL_RETURN \n + RET_SETUP_BOUND_FAILED */ + returnValue setupAllFree( ); + + + /** Moves index of a bound from index list of fixed to that of free bounds. + * \return SUCCESSFUL_RETURN \n + RET_MOVING_BOUND_FAILED \n + RET_INDEX_OUT_OF_BOUNDS */ + returnValue moveFixedToFree( int _number /**< Number of bound to be freed. */ + ); + + /** Moves index of a bound from index list of free to that of fixed bounds. + * \return SUCCESSFUL_RETURN \n + RET_MOVING_BOUND_FAILED \n + RET_INDEX_OUT_OF_BOUNDS */ + returnValue moveFreeToFixed( int _number, /**< Number of bound to be fixed. */ + SubjectToStatus _status /**< Status of bound to be fixed. */ + ); + + /** Swaps the indices of two free bounds within the index set. + * \return SUCCESSFUL_RETURN \n + RET_SWAPINDEX_FAILED */ + returnValue swapFree( int number1, /**< Number of first constraint or bound. */ + int number2 /**< Number of second constraint or bound. */ + ); + + + /** Returns number of variables. + * \return Number of variables. */ + inline int getNV( ) const; + + /** Returns number of implicitly fixed variables. + * \return Number of implicitly fixed variables. */ + inline int getNFV( ) const; + + /** Returns number of bounded (but possibly free) variables. + * \return Number of bounded (but possibly free) variables. */ + inline int getNBV( ) const; + + /** Returns number of unbounded variables. + * \return Number of unbounded variables. */ + inline int getNUV( ) const; + + + /** Sets number of implicitly fixed variables. + * \return SUCCESSFUL_RETURN */ + inline returnValue setNFV( int n /**< Number of implicitly fixed variables. */ + ); + + /** Sets number of bounded (but possibly free) variables. + * \return SUCCESSFUL_RETURN */ + inline returnValue setNBV( int n /**< Number of bounded (but possibly free) variables. */ + ); + + /** Sets number of unbounded variables. + * \return SUCCESSFUL_RETURN */ + inline returnValue setNUV( int n /**< Number of unbounded variables */ + ); + + + /** Returns number of free variables. + * \return Number of free variables. */ + inline int getNFR( ); + + /** Returns number of fixed variables. + * \return Number of fixed variables. */ + inline int getNFX( ); + + + /** Returns a pointer to free variables index list. + * \return Pointer to free variables index list. */ + inline Indexlist* getFree( ); + + /** Returns a pointer to fixed variables index list. + * \return Pointer to fixed variables index list. */ + inline Indexlist* getFixed( ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + int nV; /**< Number of variables (nV = nFV + nBV + nUV). */ + int nFV; /**< Number of implicitly fixed variables. */ + int nBV; /**< Number of bounded (but possibly free) variables. */ + int nUV; /**< Number of unbounded variables. */ + + Indexlist free; /**< Index list of free variables. */ + Indexlist fixed; /**< Index list of fixed variables. */ +}; + +#include + +#endif /* QPOASES_BOUNDS_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/Constants.hpp b/phonelibs/qpoases/INCLUDE/Constants.hpp index 8293fa514..92ee81229 100644 --- a/phonelibs/qpoases/INCLUDE/Constants.hpp +++ b/phonelibs/qpoases/INCLUDE/Constants.hpp @@ -1,108 +1,108 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Constants.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2008 - * - * Definition of all global constants. - */ - - -#ifndef QPOASES_CONSTANTS_HPP -#define QPOASES_CONSTANTS_HPP - -#ifndef QPOASES_CUSTOM_INTERFACE -#include "acado_qpoases_interface.hpp" -#else - #define XSTR(x) #x - #define STR(x) XSTR(x) - #include STR(QPOASES_CUSTOM_INTERFACE) -#endif - -/** Maximum number of variables within a QP formulation. - Note: this value has to be positive! */ -const int NVMAX = QPOASES_NVMAX; - -/** Maximum number of constraints within a QP formulation. - Note: this value has to be positive! */ -const int NCMAX = QPOASES_NCMAX; - -/** Redefinition of NCMAX used for memory allocation, to avoid zero sized arrays - and compiler errors. */ -const int NCMAX_ALLOC = (NCMAX == 0) ? 1 : NCMAX; - -/**< Maximum number of working set recalculations. - Note: this value has to be positive! */ -const int NWSRMAX = QPOASES_NWSRMAX; - -/** Desired KKT tolerance of QP solution; a warning RET_INACCURATE_SOLUTION is - * issued if this tolerance is not met. - * Note: this value has to be positive! */ -const real_t DESIREDACCURACY = (real_t) 1.0e-3; - -/** Critical KKT tolerance of QP solution; an error is issued if this - * tolerance is not met. - * Note: this value has to be positive! */ -const real_t CRITICALACCURACY = (real_t) 1.0e-2; - - - -/** Numerical value of machine precision (min eps, s.t. 1+eps > 1). - Note: this value has to be positive! */ -const real_t EPS = (real_t) QPOASES_EPS; - -/** Numerical value of zero (for situations in which it would be - * unreasonable to compare with 0.0). - * Note: this value has to be positive! */ -const real_t ZERO = (real_t) 1.0e-50; - -/** Numerical value of infinity (e.g. for non-existing bounds). - * Note: this value has to be positive! */ -const real_t INFTY = (real_t) 1.0e12; - - -/** Lower/upper (constraints') bound tolerance (an inequality constraint - * whose lower and upper bound differ by less than BOUNDTOL is regarded - * to be an equality constraint). - * Note: this value has to be positive! */ -const real_t BOUNDTOL = (real_t) 1.0e-10; - -/** Offset for relaxing (constraints') bounds at beginning of an initial homotopy. - * Note: this value has to be positive! */ -const real_t BOUNDRELAXATION = (real_t) 1.0e3; - - -/** Factor that determines physical lengths of index lists. - * Note: this value has to be greater than 1! */ -const int INDEXLISTFACTOR = 5; - - -#endif /* QPOASES_CONSTANTS_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Constants.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2008 + * + * Definition of all global constants. + */ + + +#ifndef QPOASES_CONSTANTS_HPP +#define QPOASES_CONSTANTS_HPP + +#ifndef QPOASES_CUSTOM_INTERFACE +#include "acado_qpoases_interface.hpp" +#else + #define XSTR(x) #x + #define STR(x) XSTR(x) + #include STR(QPOASES_CUSTOM_INTERFACE) +#endif + +/** Maximum number of variables within a QP formulation. + Note: this value has to be positive! */ +const int NVMAX = QPOASES_NVMAX; + +/** Maximum number of constraints within a QP formulation. + Note: this value has to be positive! */ +const int NCMAX = QPOASES_NCMAX; + +/** Redefinition of NCMAX used for memory allocation, to avoid zero sized arrays + and compiler errors. */ +const int NCMAX_ALLOC = (NCMAX == 0) ? 1 : NCMAX; + +/**< Maximum number of working set recalculations. + Note: this value has to be positive! */ +const int NWSRMAX = QPOASES_NWSRMAX; + +/** Desired KKT tolerance of QP solution; a warning RET_INACCURATE_SOLUTION is + * issued if this tolerance is not met. + * Note: this value has to be positive! */ +const real_t DESIREDACCURACY = (real_t) 1.0e-3; + +/** Critical KKT tolerance of QP solution; an error is issued if this + * tolerance is not met. + * Note: this value has to be positive! */ +const real_t CRITICALACCURACY = (real_t) 1.0e-2; + + + +/** Numerical value of machine precision (min eps, s.t. 1+eps > 1). + Note: this value has to be positive! */ +const real_t EPS = (real_t) QPOASES_EPS; + +/** Numerical value of zero (for situations in which it would be + * unreasonable to compare with 0.0). + * Note: this value has to be positive! */ +const real_t ZERO = (real_t) 1.0e-50; + +/** Numerical value of infinity (e.g. for non-existing bounds). + * Note: this value has to be positive! */ +const real_t INFTY = (real_t) 1.0e12; + + +/** Lower/upper (constraints') bound tolerance (an inequality constraint + * whose lower and upper bound differ by less than BOUNDTOL is regarded + * to be an equality constraint). + * Note: this value has to be positive! */ +const real_t BOUNDTOL = (real_t) 1.0e-10; + +/** Offset for relaxing (constraints') bounds at beginning of an initial homotopy. + * Note: this value has to be positive! */ +const real_t BOUNDRELAXATION = (real_t) 1.0e3; + + +/** Factor that determines physical lengths of index lists. + * Note: this value has to be greater than 1! */ +const int INDEXLISTFACTOR = 5; + + +#endif /* QPOASES_CONSTANTS_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/Constraints.hpp b/phonelibs/qpoases/INCLUDE/Constraints.hpp index 0b78747e2..899167942 100644 --- a/phonelibs/qpoases/INCLUDE/Constraints.hpp +++ b/phonelibs/qpoases/INCLUDE/Constraints.hpp @@ -1,181 +1,181 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Constraints.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the Constraints class designed to manage working sets of - * constraints within a QProblem. - */ - - -#ifndef QPOASES_CONSTRAINTS_HPP -#define QPOASES_CONSTRAINTS_HPP - - -#include - - - -/** This class manages working sets of constraints by storing - * index sets and other status information. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class Constraints : public SubjectTo -{ - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - Constraints( ); - - /** Copy constructor (deep copy). */ - Constraints( const Constraints& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~Constraints( ); - - /** Assignment operator (deep copy). */ - Constraints& operator=( const Constraints& rhs /**< Rhs object. */ - ); - - - /** Pseudo-constructor takes the number of constraints. - * \return SUCCESSFUL_RETURN */ - returnValue init( int n /**< Number of constraints. */ - ); - - - /** Initially adds number of a new (i.e. not yet in the list) constraint to - * a given index set. - * \return SUCCESSFUL_RETURN \n - RET_SETUP_CONSTRAINT_FAILED \n - RET_INDEX_OUT_OF_BOUNDS \n - RET_INVALID_ARGUMENTS */ - returnValue setupConstraint( int _number, /**< Number of new constraint. */ - SubjectToStatus _status /**< Status of new constraint. */ - ); - - /** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to - * to the index set of inactive constraints; the order depends on the SujectToType - * of each index. Only disabled constraints are added to index set of disabled constraints! - * \return SUCCESSFUL_RETURN \n - RET_SETUP_CONSTRAINT_FAILED */ - returnValue setupAllInactive( ); - - - /** Moves index of a constraint from index list of active to that of inactive constraints. - * \return SUCCESSFUL_RETURN \n - RET_MOVING_CONSTRAINT_FAILED */ - returnValue moveActiveToInactive( int _number /**< Number of constraint to become inactive. */ - ); - - /** Moves index of a constraint from index list of inactive to that of active constraints. - * \return SUCCESSFUL_RETURN \n - RET_MOVING_CONSTRAINT_FAILED */ - returnValue moveInactiveToActive( int _number, /**< Number of constraint to become active. */ - SubjectToStatus _status /**< Status of constraint to become active. */ - ); - - - /** Returns the number of constraints. - * \return Number of constraints. */ - inline int getNC( ) const; - - /** Returns the number of implicit equality constraints. - * \return Number of implicit equality constraints. */ - inline int getNEC( ) const; - - /** Returns the number of "real" inequality constraints. - * \return Number of "real" inequality constraints. */ - inline int getNIC( ) const; - - /** Returns the number of unbounded constraints (i.e. without any bounds). - * \return Number of unbounded constraints (i.e. without any bounds). */ - inline int getNUC( ) const; - - - /** Sets number of implicit equality constraints. - * \return SUCCESSFUL_RETURN */ - inline returnValue setNEC( int n /**< Number of implicit equality constraints. */ - ); - - /** Sets number of "real" inequality constraints. - * \return SUCCESSFUL_RETURN */ - inline returnValue setNIC( int n /**< Number of "real" inequality constraints. */ - ); - - /** Sets number of unbounded constraints (i.e. without any bounds). - * \return SUCCESSFUL_RETURN */ - inline returnValue setNUC( int n /**< Number of unbounded constraints (i.e. without any bounds). */ - ); - - - /** Returns the number of active constraints. - * \return Number of constraints. */ - inline int getNAC( ); - - /** Returns the number of inactive constraints. - * \return Number of constraints. */ - inline int getNIAC( ); - - - /** Returns a pointer to active constraints index list. - * \return Pointer to active constraints index list. */ - inline Indexlist* getActive( ); - - /** Returns a pointer to inactive constraints index list. - * \return Pointer to inactive constraints index list. */ - inline Indexlist* getInactive( ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - int nC; /**< Number of constraints (nC = nEC + nIC + nUC). */ - int nEC; /**< Number of implicit equality constraints. */ - int nIC; /**< Number of "real" inequality constraints. */ - int nUC; /**< Number of unbounded constraints (i.e. without any bounds). */ - - Indexlist active; /**< Index list of active constraints. */ - Indexlist inactive; /**< Index list of inactive constraints. */ -}; - - -#include - -#endif /* QPOASES_CONSTRAINTS_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Constraints.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the Constraints class designed to manage working sets of + * constraints within a QProblem. + */ + + +#ifndef QPOASES_CONSTRAINTS_HPP +#define QPOASES_CONSTRAINTS_HPP + + +#include + + + +/** This class manages working sets of constraints by storing + * index sets and other status information. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class Constraints : public SubjectTo +{ + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + Constraints( ); + + /** Copy constructor (deep copy). */ + Constraints( const Constraints& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~Constraints( ); + + /** Assignment operator (deep copy). */ + Constraints& operator=( const Constraints& rhs /**< Rhs object. */ + ); + + + /** Pseudo-constructor takes the number of constraints. + * \return SUCCESSFUL_RETURN */ + returnValue init( int n /**< Number of constraints. */ + ); + + + /** Initially adds number of a new (i.e. not yet in the list) constraint to + * a given index set. + * \return SUCCESSFUL_RETURN \n + RET_SETUP_CONSTRAINT_FAILED \n + RET_INDEX_OUT_OF_BOUNDS \n + RET_INVALID_ARGUMENTS */ + returnValue setupConstraint( int _number, /**< Number of new constraint. */ + SubjectToStatus _status /**< Status of new constraint. */ + ); + + /** Initially adds all enabled numbers of new (i.e. not yet in the list) constraints to + * to the index set of inactive constraints; the order depends on the SujectToType + * of each index. Only disabled constraints are added to index set of disabled constraints! + * \return SUCCESSFUL_RETURN \n + RET_SETUP_CONSTRAINT_FAILED */ + returnValue setupAllInactive( ); + + + /** Moves index of a constraint from index list of active to that of inactive constraints. + * \return SUCCESSFUL_RETURN \n + RET_MOVING_CONSTRAINT_FAILED */ + returnValue moveActiveToInactive( int _number /**< Number of constraint to become inactive. */ + ); + + /** Moves index of a constraint from index list of inactive to that of active constraints. + * \return SUCCESSFUL_RETURN \n + RET_MOVING_CONSTRAINT_FAILED */ + returnValue moveInactiveToActive( int _number, /**< Number of constraint to become active. */ + SubjectToStatus _status /**< Status of constraint to become active. */ + ); + + + /** Returns the number of constraints. + * \return Number of constraints. */ + inline int getNC( ) const; + + /** Returns the number of implicit equality constraints. + * \return Number of implicit equality constraints. */ + inline int getNEC( ) const; + + /** Returns the number of "real" inequality constraints. + * \return Number of "real" inequality constraints. */ + inline int getNIC( ) const; + + /** Returns the number of unbounded constraints (i.e. without any bounds). + * \return Number of unbounded constraints (i.e. without any bounds). */ + inline int getNUC( ) const; + + + /** Sets number of implicit equality constraints. + * \return SUCCESSFUL_RETURN */ + inline returnValue setNEC( int n /**< Number of implicit equality constraints. */ + ); + + /** Sets number of "real" inequality constraints. + * \return SUCCESSFUL_RETURN */ + inline returnValue setNIC( int n /**< Number of "real" inequality constraints. */ + ); + + /** Sets number of unbounded constraints (i.e. without any bounds). + * \return SUCCESSFUL_RETURN */ + inline returnValue setNUC( int n /**< Number of unbounded constraints (i.e. without any bounds). */ + ); + + + /** Returns the number of active constraints. + * \return Number of constraints. */ + inline int getNAC( ); + + /** Returns the number of inactive constraints. + * \return Number of constraints. */ + inline int getNIAC( ); + + + /** Returns a pointer to active constraints index list. + * \return Pointer to active constraints index list. */ + inline Indexlist* getActive( ); + + /** Returns a pointer to inactive constraints index list. + * \return Pointer to inactive constraints index list. */ + inline Indexlist* getInactive( ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + int nC; /**< Number of constraints (nC = nEC + nIC + nUC). */ + int nEC; /**< Number of implicit equality constraints. */ + int nIC; /**< Number of "real" inequality constraints. */ + int nUC; /**< Number of unbounded constraints (i.e. without any bounds). */ + + Indexlist active; /**< Index list of active constraints. */ + Indexlist inactive; /**< Index list of inactive constraints. */ +}; + + +#include + +#endif /* QPOASES_CONSTRAINTS_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/CyclingManager.hpp b/phonelibs/qpoases/INCLUDE/CyclingManager.hpp index 9b5c064a0..b4410b106 100644 --- a/phonelibs/qpoases/INCLUDE/CyclingManager.hpp +++ b/phonelibs/qpoases/INCLUDE/CyclingManager.hpp @@ -1,126 +1,126 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/CyclingManager.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the CyclingManager class designed to detect - * and handle possible cycling during QP iterations. - */ - - -#ifndef QPOASES_CYCLINGMANAGER_HPP -#define QPOASES_CYCLINGMANAGER_HPP - - -#include - - - -/** This class is intended to detect and handle possible cycling during QP iterations. - * As cycling seems to occur quite rarely, this class is NOT FULLY IMPLEMENTED YET! - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class CyclingManager -{ - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - CyclingManager( ); - - /** Copy constructor (deep copy). */ - CyclingManager( const CyclingManager& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~CyclingManager( ); - - /** Copy asingment operator (deep copy). */ - CyclingManager& operator=( const CyclingManager& rhs /**< Rhs object. */ - ); - - - /** Pseudo-constructor which takes the number of bounds/constraints. - * \return SUCCESSFUL_RETURN */ - returnValue init( int _nV, /**< Number of bounds to be managed. */ - int _nC /**< Number of constraints to be managed. */ - ); - - - /** Stores index of a bound/constraint that might cause cycling. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - returnValue setCyclingStatus( int number, /**< Number of bound/constraint. */ - BooleanType isBound, /**< Flag that indicates if given number corresponds to a - * bound (BT_TRUE) or a constraint (BT_FALSE). */ - CyclingStatus _status /**< Cycling status of bound/constraint. */ - ); - - /** Returns if bound/constraint might cause cycling. - * \return BT_TRUE: bound/constraint might cause cycling \n - BT_FALSE: otherwise */ - CyclingStatus getCyclingStatus( int number, /**< Number of bound/constraint. */ - BooleanType isBound /**< Flag that indicates if given number corresponds to - * a bound (BT_TRUE) or a constraint (BT_FALSE). */ - ) const; - - - /** Clears all previous cycling information. - * \return SUCCESSFUL_RETURN */ - returnValue clearCyclingData( ); - - - /** Returns if cycling was detected. - * \return BT_TRUE iff cycling was detected. */ - inline BooleanType isCyclingDetected( ) const; - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - int nV; /**< Number of managed bounds. */ - int nC; /**< Number of managed constraints. */ - - CyclingStatus status[NVMAX+NCMAX]; /**< Array to store cycling status of all bounds/constraints. */ - - BooleanType cyclingDetected; /**< Flag if cycling was detected. */ -}; - - -#include - -#endif /* QPOASES_CYCLINGMANAGER_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/CyclingManager.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the CyclingManager class designed to detect + * and handle possible cycling during QP iterations. + */ + + +#ifndef QPOASES_CYCLINGMANAGER_HPP +#define QPOASES_CYCLINGMANAGER_HPP + + +#include + + + +/** This class is intended to detect and handle possible cycling during QP iterations. + * As cycling seems to occur quite rarely, this class is NOT FULLY IMPLEMENTED YET! + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class CyclingManager +{ + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + CyclingManager( ); + + /** Copy constructor (deep copy). */ + CyclingManager( const CyclingManager& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~CyclingManager( ); + + /** Copy asingment operator (deep copy). */ + CyclingManager& operator=( const CyclingManager& rhs /**< Rhs object. */ + ); + + + /** Pseudo-constructor which takes the number of bounds/constraints. + * \return SUCCESSFUL_RETURN */ + returnValue init( int _nV, /**< Number of bounds to be managed. */ + int _nC /**< Number of constraints to be managed. */ + ); + + + /** Stores index of a bound/constraint that might cause cycling. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + returnValue setCyclingStatus( int number, /**< Number of bound/constraint. */ + BooleanType isBound, /**< Flag that indicates if given number corresponds to a + * bound (BT_TRUE) or a constraint (BT_FALSE). */ + CyclingStatus _status /**< Cycling status of bound/constraint. */ + ); + + /** Returns if bound/constraint might cause cycling. + * \return BT_TRUE: bound/constraint might cause cycling \n + BT_FALSE: otherwise */ + CyclingStatus getCyclingStatus( int number, /**< Number of bound/constraint. */ + BooleanType isBound /**< Flag that indicates if given number corresponds to + * a bound (BT_TRUE) or a constraint (BT_FALSE). */ + ) const; + + + /** Clears all previous cycling information. + * \return SUCCESSFUL_RETURN */ + returnValue clearCyclingData( ); + + + /** Returns if cycling was detected. + * \return BT_TRUE iff cycling was detected. */ + inline BooleanType isCyclingDetected( ) const; + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + int nV; /**< Number of managed bounds. */ + int nC; /**< Number of managed constraints. */ + + CyclingStatus status[NVMAX+NCMAX]; /**< Array to store cycling status of all bounds/constraints. */ + + BooleanType cyclingDetected; /**< Flag if cycling was detected. */ +}; + + +#include + +#endif /* QPOASES_CYCLINGMANAGER_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/Indexlist.hpp b/phonelibs/qpoases/INCLUDE/Indexlist.hpp index 18e3494e3..21c31ddb9 100644 --- a/phonelibs/qpoases/INCLUDE/Indexlist.hpp +++ b/phonelibs/qpoases/INCLUDE/Indexlist.hpp @@ -1,154 +1,154 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Indexlist.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the Indexlist class designed to manage index lists of - * constraints and bounds within a SubjectTo object. - */ - - -#ifndef QPOASES_INDEXLIST_HPP -#define QPOASES_INDEXLIST_HPP - - -#include - - -/** This class manages index lists. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class Indexlist -{ - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - Indexlist( ); - - /** Copy constructor (deep copy). */ - Indexlist( const Indexlist& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~Indexlist( ); - - /** Assingment operator (deep copy). */ - Indexlist& operator=( const Indexlist& rhs /**< Rhs object. */ - ); - - /** Pseudo-constructor. - * \return SUCCESSFUL_RETURN */ - returnValue init( ); - - - /** Creates an array of all numbers within the index set in correct order. - * \return SUCCESSFUL_RETURN \n - RET_INDEXLIST_CORRUPTED */ - returnValue getNumberArray( int* const numberarray /**< Output: Array of numbers (NULL on error). */ - ) const; - - - /** Determines the index within the index list at with a given number is stored. - * \return >= 0: Index of given number. \n - -1: Number not found. */ - int getIndex( int givennumber /**< Number whose index shall be determined. */ - ) const; - - /** Determines the physical index within the index list at with a given number is stored. - * \return >= 0: Index of given number. \n - -1: Number not found. */ - int getPhysicalIndex( int givennumber /**< Number whose physical index shall be determined. */ - ) const; - - /** Returns the number stored at a given physical index. - * \return >= 0: Number stored at given physical index. \n - -RET_INDEXLIST_OUTOFBOUNDS */ - int getNumber( int physicalindex /**< Physical index of the number to be returned. */ - ) const; - - - /** Returns the current length of the index list. - * \return Current length of the index list. */ - inline int getLength( ); - - /** Returns last number within the index list. - * \return Last number within the index list. */ - inline int getLastNumber( ) const; - - - /** Adds number to index list. - * \return SUCCESSFUL_RETURN \n - RET_INDEXLIST_MUST_BE_REORDERD \n - RET_INDEXLIST_EXCEEDS_MAX_LENGTH */ - returnValue addNumber( int addnumber /**< Number to be added. */ - ); - - /** Removes number from index list. - * \return SUCCESSFUL_RETURN */ - returnValue removeNumber( int removenumber /**< Number to be removed. */ - ); - - /** Swaps two numbers within index list. - * \return SUCCESSFUL_RETURN */ - returnValue swapNumbers( int number1,/**< First number for swapping. */ - int number2 /**< Second number for swapping. */ - ); - - /** Determines if a given number is contained in the index set. - * \return BT_TRUE iff number is contain in the index set */ - inline BooleanType isMember( int _number /**< Number to be tested for membership. */ - ) const; - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - int number[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store numbers of constraints or bounds. */ - int next[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of successor. */ - int previous[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of predecossor. */ - int length; /**< Length of index list. */ - int first; /**< Physical index of first element. */ - int last; /**< Physical index of last element. */ - int lastusedindex; /**< Physical index of last entry in index list. */ - int physicallength; /**< Physical length of index list. */ -}; - - -#include - -#endif /* QPOASES_INDEXLIST_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Indexlist.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the Indexlist class designed to manage index lists of + * constraints and bounds within a SubjectTo object. + */ + + +#ifndef QPOASES_INDEXLIST_HPP +#define QPOASES_INDEXLIST_HPP + + +#include + + +/** This class manages index lists. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class Indexlist +{ + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + Indexlist( ); + + /** Copy constructor (deep copy). */ + Indexlist( const Indexlist& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~Indexlist( ); + + /** Assingment operator (deep copy). */ + Indexlist& operator=( const Indexlist& rhs /**< Rhs object. */ + ); + + /** Pseudo-constructor. + * \return SUCCESSFUL_RETURN */ + returnValue init( ); + + + /** Creates an array of all numbers within the index set in correct order. + * \return SUCCESSFUL_RETURN \n + RET_INDEXLIST_CORRUPTED */ + returnValue getNumberArray( int* const numberarray /**< Output: Array of numbers (NULL on error). */ + ) const; + + + /** Determines the index within the index list at with a given number is stored. + * \return >= 0: Index of given number. \n + -1: Number not found. */ + int getIndex( int givennumber /**< Number whose index shall be determined. */ + ) const; + + /** Determines the physical index within the index list at with a given number is stored. + * \return >= 0: Index of given number. \n + -1: Number not found. */ + int getPhysicalIndex( int givennumber /**< Number whose physical index shall be determined. */ + ) const; + + /** Returns the number stored at a given physical index. + * \return >= 0: Number stored at given physical index. \n + -RET_INDEXLIST_OUTOFBOUNDS */ + int getNumber( int physicalindex /**< Physical index of the number to be returned. */ + ) const; + + + /** Returns the current length of the index list. + * \return Current length of the index list. */ + inline int getLength( ); + + /** Returns last number within the index list. + * \return Last number within the index list. */ + inline int getLastNumber( ) const; + + + /** Adds number to index list. + * \return SUCCESSFUL_RETURN \n + RET_INDEXLIST_MUST_BE_REORDERD \n + RET_INDEXLIST_EXCEEDS_MAX_LENGTH */ + returnValue addNumber( int addnumber /**< Number to be added. */ + ); + + /** Removes number from index list. + * \return SUCCESSFUL_RETURN */ + returnValue removeNumber( int removenumber /**< Number to be removed. */ + ); + + /** Swaps two numbers within index list. + * \return SUCCESSFUL_RETURN */ + returnValue swapNumbers( int number1,/**< First number for swapping. */ + int number2 /**< Second number for swapping. */ + ); + + /** Determines if a given number is contained in the index set. + * \return BT_TRUE iff number is contain in the index set */ + inline BooleanType isMember( int _number /**< Number to be tested for membership. */ + ) const; + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + int number[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store numbers of constraints or bounds. */ + int next[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of successor. */ + int previous[INDEXLISTFACTOR*(NVMAX+NCMAX)]; /**< Array to store physical index of predecossor. */ + int length; /**< Length of index list. */ + int first; /**< Physical index of first element. */ + int last; /**< Physical index of last element. */ + int lastusedindex; /**< Physical index of last entry in index list. */ + int physicallength; /**< Physical length of index list. */ +}; + + +#include + +#endif /* QPOASES_INDEXLIST_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/MessageHandling.hpp b/phonelibs/qpoases/INCLUDE/MessageHandling.hpp index f0b0c79a4..3d17498ad 100644 --- a/phonelibs/qpoases/INCLUDE/MessageHandling.hpp +++ b/phonelibs/qpoases/INCLUDE/MessageHandling.hpp @@ -1,415 +1,415 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/MessageHandling.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the MessageHandling class including global return values. - */ - - -#ifndef QPOASES_MESSAGEHANDLING_HPP -#define QPOASES_MESSAGEHANDLING_HPP - -// #define PC_DEBUG - -#ifdef PC_DEBUG - #include - - /** Defines an alias for FILE from stdio.h. */ - #define myFILE FILE - /** Defines an alias for stderr from stdio.h. */ - #define myStderr stderr - /** Defines an alias for stdout from stdio.h. */ - #define myStdout stdout -#else - /** Defines an alias for FILE from stdio.h. */ - #define myFILE int - /** Defines an alias for stderr from stdio.h. */ - #define myStderr 0 - /** Defines an alias for stdout from stdio.h. */ - #define myStdout 0 -#endif - - -#include -#include - - -/** Defines symbols for global return values. \n - * Important: All return values are assumed to be nonnegative! */ -enum returnValue -{ -TERMINAL_LIST_ELEMENT = -1, /**< Terminal list element, internal usage only! */ -/* miscellaneous */ -SUCCESSFUL_RETURN = 0, /**< Successful return. */ -RET_DIV_BY_ZERO, /**< Division by zero. */ -RET_INDEX_OUT_OF_BOUNDS, /**< Index out of bounds. */ -RET_INVALID_ARGUMENTS, /**< At least one of the arguments is invalid. */ -RET_ERROR_UNDEFINED, /**< Error number undefined. */ -RET_WARNING_UNDEFINED, /**< Warning number undefined. */ -RET_INFO_UNDEFINED, /**< Info number undefined. */ -RET_EWI_UNDEFINED, /**< Error/warning/info number undefined. */ -RET_AVAILABLE_WITH_LINUX_ONLY, /**< This function is available under Linux only. */ -RET_UNKNOWN_BUG, /**< The error occured is not yet known. */ -RET_PRINTLEVEL_CHANGED, /**< 10 Print level changed. */ -RET_NOT_YET_IMPLEMENTED, /**< Requested function is not yet implemented in this version of qpOASES. */ -/* Indexlist */ -RET_INDEXLIST_MUST_BE_REORDERD, /**< Index list has to be reordered. */ -RET_INDEXLIST_EXCEEDS_MAX_LENGTH, /**< Index list exceeds its maximal physical length. */ -RET_INDEXLIST_CORRUPTED, /**< Index list corrupted. */ -RET_INDEXLIST_OUTOFBOUNDS, /**< Physical index is out of bounds. */ -RET_INDEXLIST_ADD_FAILED, /**< Adding indices from another index set failed. */ -RET_INDEXLIST_INTERSECT_FAILED, /**< Intersection with another index set failed. */ -/* SubjectTo / Bounds / Constraints */ -RET_INDEX_ALREADY_OF_DESIRED_STATUS, /**< Index is already of desired status. */ -RET_ADDINDEX_FAILED, /**< Cannot swap between different indexsets. */ -RET_SWAPINDEX_FAILED, /**< 20 Adding index to index set failed. */ -RET_NOTHING_TO_DO, /**< Nothing to do. */ -RET_SETUP_BOUND_FAILED, /**< Setting up bound index failed. */ -RET_SETUP_CONSTRAINT_FAILED, /**< Setting up constraint index failed. */ -RET_MOVING_BOUND_FAILED, /**< Moving bound between index sets failed. */ -RET_MOVING_CONSTRAINT_FAILED, /**< Moving constraint between index sets failed. */ -/* QProblem */ -RET_QP_ALREADY_INITIALISED, /**< QProblem has already been initialised. */ -RET_NO_INIT_WITH_STANDARD_SOLVER, /**< Initialisation via extern QP solver is not yet implemented. */ -RET_RESET_FAILED, /**< Reset failed. */ -RET_INIT_FAILED, /**< Initialisation failed. */ -RET_INIT_FAILED_TQ, /**< 30 Initialisation failed due to TQ factorisation. */ -RET_INIT_FAILED_CHOLESKY, /**< Initialisation failed due to Cholesky decomposition. */ -RET_INIT_FAILED_HOTSTART, /**< Initialisation failed! QP could not be solved! */ -RET_INIT_FAILED_INFEASIBILITY, /**< Initial QP could not be solved due to infeasibility! */ -RET_INIT_FAILED_UNBOUNDEDNESS, /**< Initial QP could not be solved due to unboundedness! */ -RET_INIT_SUCCESSFUL, /**< Initialisation done. */ -RET_OBTAINING_WORKINGSET_FAILED, /**< Failed to obtain working set for auxiliary QP. */ -RET_SETUP_WORKINGSET_FAILED, /**< Failed to setup working set for auxiliary QP. */ -RET_SETUP_AUXILIARYQP_FAILED, /**< Failed to setup auxiliary QP for initialised homotopy. */ -RET_NO_EXTERN_SOLVER, /**< No extern QP solver available. */ -RET_QP_UNBOUNDED, /**< 40 QP is unbounded. */ -RET_QP_INFEASIBLE, /**< QP is infeasible. */ -RET_QP_NOT_SOLVED, /**< Problems occured while solving QP with standard solver. */ -RET_QP_SOLVED, /**< QP successfully solved. */ -RET_UNABLE_TO_SOLVE_QP, /**< Problems occured while solving QP. */ -RET_INITIALISATION_STARTED, /**< Starting problem initialisation. */ -RET_HOTSTART_FAILED, /**< Unable to perform homotopy due to internal error. */ -RET_HOTSTART_FAILED_TO_INIT, /**< Unable to initialise problem. */ -RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, /**< Unable to perform homotopy as previous QP is not solved. */ -RET_ITERATION_STARTED, /**< Iteration... */ -RET_SHIFT_DETERMINATION_FAILED, /**< 50 Determination of shift of the QP data failed. */ -RET_STEPDIRECTION_DETERMINATION_FAILED, /**< Determination of step direction failed. */ -RET_STEPLENGTH_DETERMINATION_FAILED, /**< Determination of step direction failed. */ -RET_OPTIMAL_SOLUTION_FOUND, /**< Optimal solution of neighbouring QP found. */ -RET_HOMOTOPY_STEP_FAILED, /**< Unable to perform homotopy step. */ -RET_HOTSTART_STOPPED_INFEASIBILITY, /**< Premature homotopy termination because QP is infeasible. */ -RET_HOTSTART_STOPPED_UNBOUNDEDNESS, /**< Premature homotopy termination because QP is unbounded. */ -RET_WORKINGSET_UPDATE_FAILED, /**< Unable to update working sets according to initial guesses. */ -RET_MAX_NWSR_REACHED, /**< Maximum number of working set recalculations performed. */ -RET_CONSTRAINTS_NOT_SPECIFIED, /**< Problem does comprise constraints! You also have to specify new constraints' bounds. */ -RET_INVALID_FACTORISATION_FLAG, /**< 60 Invalid factorisation flag. */ -RET_UNABLE_TO_SAVE_QPDATA, /**< Unable to save QP data. */ -RET_STEPDIRECTION_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */ -RET_STEPDIRECTION_FAILED_CHOLESKY, /**< Abnormal termination due to Cholesky factorisation. */ -RET_CYCLING_DETECTED, /**< Cycling detected. */ -RET_CYCLING_NOT_RESOLVED, /**< Cycling cannot be resolved, QP probably infeasible. */ -RET_CYCLING_RESOLVED, /**< Cycling probably resolved. */ -RET_STEPSIZE, /**< For displaying performed stepsize. */ -RET_STEPSIZE_NONPOSITIVE, /**< For displaying non-positive stepsize. */ -RET_SETUPSUBJECTTOTYPE_FAILED, /**< Setup of SubjectToTypes failed. */ -RET_ADDCONSTRAINT_FAILED, /**< 70 Addition of constraint to working set failed. */ -RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, /**< Addition of constraint to working set failed (due to QP infeasibility). */ -RET_ADDBOUND_FAILED, /**< Addition of bound to working set failed. */ -RET_ADDBOUND_FAILED_INFEASIBILITY, /**< Addition of bound to working set failed (due to QP infeasibility). */ -RET_REMOVECONSTRAINT_FAILED, /**< Removal of constraint from working set failed. */ -RET_REMOVEBOUND_FAILED, /**< Removal of bound from working set failed. */ -RET_REMOVE_FROM_ACTIVESET, /**< Removing from active set... */ -RET_ADD_TO_ACTIVESET, /**< Adding to active set... */ -RET_REMOVE_FROM_ACTIVESET_FAILED, /**< Removing from active set failed. */ -RET_ADD_TO_ACTIVESET_FAILED, /**< Adding to active set failed. */ -RET_CONSTRAINT_ALREADY_ACTIVE, /**< 80 Constraint is already active. */ -RET_ALL_CONSTRAINTS_ACTIVE, /**< All constraints are active, no further constraint can be added. */ -RET_LINEARLY_DEPENDENT, /**< New bound/constraint is linearly dependent. */ -RET_LINEARLY_INDEPENDENT, /**< New bound/constraint is linearly independent. */ -RET_LI_RESOLVED, /**< Linear independence of active contraint matrix successfully resolved. */ -RET_ENSURELI_FAILED, /**< Failed to ensure linear indepence of active contraint matrix. */ -RET_ENSURELI_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */ -RET_ENSURELI_FAILED_NOINDEX, /**< No index found, QP probably infeasible. */ -RET_ENSURELI_FAILED_CYCLING, /**< Cycling detected, QP probably infeasible. */ -RET_BOUND_ALREADY_ACTIVE, /**< Bound is already active. */ -RET_ALL_BOUNDS_ACTIVE, /**< 90 All bounds are active, no further bound can be added. */ -RET_CONSTRAINT_NOT_ACTIVE, /**< Constraint is not active. */ -RET_BOUND_NOT_ACTIVE, /**< Bound is not active. */ -RET_HESSIAN_NOT_SPD, /**< Projected Hessian matrix not positive definite. */ -RET_MATRIX_SHIFT_FAILED, /**< Unable to update matrices or to transform vectors. */ -RET_MATRIX_FACTORISATION_FAILED, /**< Unable to calculate new matrix factorisations. */ -RET_PRINT_ITERATION_FAILED, /**< Unable to print information on current iteration. */ -RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, /**< No global message output file initialised. */ -/* Utils */ -RET_UNABLE_TO_OPEN_FILE, /**< Unable to open file. */ -RET_UNABLE_TO_WRITE_FILE, /**< Unable to write into file. */ -RET_UNABLE_TO_READ_FILE, /**< 100 Unable to read from file. */ -RET_FILEDATA_INCONSISTENT, /**< File contains inconsistent data. */ -/* SolutionAnalysis */ -RET_NO_SOLUTION, /**< QP solution does not satisfy KKT optimality conditions. */ -RET_INACCURATE_SOLUTION /**< KKT optimality conditions not satisfied to sufficient accuracy. */ -}; - - - -/** This class handles all kinds of messages (errors, warnings, infos) initiated - * by qpOASES modules and stores the correspoding global preferences. - * - * \author Hans Joachim Ferreau (special thanks to Leonard Wirsching) - * \version 1.3embedded - * \date 2007-2008 - */ -class MessageHandling -{ - /* - * INTERNAL DATA STRUCTURES - */ - public: - /** Data structure for entries in global message list. */ - typedef struct { - returnValue key; /**< Global return value. */ - const char* data; /**< Corresponding message. */ - VisibilityStatus globalVisibilityStatus; /**< Determines if message can be printed. - * If this value is set to VS_HIDDEN, no message is printed! */ - } ReturnValueList; - - - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - MessageHandling( ); - - /** Constructor which takes the desired output file. */ - MessageHandling( myFILE* _outputFile /**< Output file. */ - ); - - /** Constructor which takes the desired visibility states. */ - MessageHandling( VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */ - VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */ - VisibilityStatus _infoVisibility /**< Visibility status for info messages. */ - ); - - /** Constructor which takes the desired output file and desired visibility states. */ - MessageHandling( myFILE* _outputFile, /**< Output file. */ - VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */ - VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */ - VisibilityStatus _infoVisibility /**< Visibility status for info messages. */ - ); - - /** Copy constructor (deep copy). */ - MessageHandling( const MessageHandling& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~MessageHandling( ); - - /** Assignment operator (deep copy). */ - MessageHandling& operator=( const MessageHandling& rhs /**< Rhs object. */ - ); - - - /** Prints an error message(a simplified macro THROWERROR is also provided). \n - * Errors are definied as abnormal events which cause an immediate termination of the current (sub) function. - * Errors of a sub function should be commented by the calling function by means of a warning message - * (if this error does not cause an error of the calling function, either)! - * \return Error number returned by sub function call - */ - returnValue throwError( - returnValue Enumber, /**< Error number returned by sub function call. */ - const char* additionaltext, /**< Additional error text (0, if none). */ - const char* functionname, /**< Name of function which caused the error. */ - const char* filename, /**< Name of file which caused the error. */ - const unsigned long linenumber, /**< Number of line which caused the error.incompatible binary file */ - VisibilityStatus localVisibilityStatus /**< Determines (locally) if error message can be printed to myStderr. - * If GLOBAL visibility status of the message is set to VS_HIDDEN, - * no message is printed, anyway! */ - ); - - /** Prints a warning message (a simplified macro THROWWARNING is also provided). - * Warnings are definied as abnormal events which does NOT cause an immediate termination of the current (sub) function. - * \return Warning number returned by sub function call - */ - returnValue throwWarning( - returnValue Wnumber, /**< Warning number returned by sub function call. */ - const char* additionaltext, /**< Additional warning text (0, if none). */ - const char* functionname, /**< Name of function which caused the warning. */ - const char* filename, /**< Name of file which caused the warning. */ - const unsigned long linenumber, /**< Number of line which caused the warning. */ - VisibilityStatus localVisibilityStatus /**< Determines (locally) if warning message can be printed to myStderr. - * If GLOBAL visibility status of the message is set to VS_HIDDEN, - * no message is printed, anyway! */ - ); - - /** Prints a info message (a simplified macro THROWINFO is also provided). - * \return Info number returned by sub function call - */ - returnValue throwInfo( - returnValue Inumber, /**< Info number returned by sub function call. */ - const char* additionaltext, /**< Additional warning text (0, if none). */ - const char* functionname, /**< Name of function which submitted the info. */ - const char* filename, /**< Name of file which submitted the info. */ - const unsigned long linenumber, /**< Number of line which submitted the info. */ - VisibilityStatus localVisibilityStatus /**< Determines (locally) if info message can be printed to myStderr. - * If GLOBAL visibility status of the message is set to VS_HIDDEN, - * no message is printed, anyway! */ - ); - - - /** Resets all preferences to default values. - * \return SUCCESSFUL_RETURN */ - returnValue reset( ); - - - /** Prints a complete list of all messages to output file. - * \return SUCCESSFUL_RETURN */ - returnValue listAllMessages( ); - - - /** Returns visibility status for error messages. - * \return Visibility status for error messages. */ - inline VisibilityStatus getErrorVisibilityStatus( ) const; - - /** Returns visibility status for warning messages. - * \return Visibility status for warning messages. */ - inline VisibilityStatus getWarningVisibilityStatus( ) const; - - /** Returns visibility status for info messages. - * \return Visibility status for info messages. */ - inline VisibilityStatus getInfoVisibilityStatus( ) const; - - /** Returns pointer to output file. - * \return Pointer to output file. */ - inline myFILE* getOutputFile( ) const; - - /** Returns error count value. - * \return Error count value. */ - inline int getErrorCount( ) const; - - - /** Changes visibility status for error messages. */ - inline void setErrorVisibilityStatus( VisibilityStatus _errorVisibility /**< New visibility status for error messages. */ - ); - - /** Changes visibility status for warning messages. */ - inline void setWarningVisibilityStatus( VisibilityStatus _warningVisibility /**< New visibility status for warning messages. */ - ); - - /** Changes visibility status for info messages. */ - inline void setInfoVisibilityStatus( VisibilityStatus _infoVisibility /**< New visibility status for info messages. */ - ); - - /** Changes output file for messages. */ - inline void setOutputFile( myFILE* _outputFile /**< New output file for messages. */ - ); - - /** Changes error count. - * \return SUCCESSFUL_RETURN \n - * RET_INVALID_ARGUMENT */ - inline returnValue setErrorCount( int _errorCount /**< New error count value. */ - ); - - /** Return the error code string. */ - static const char* getErrorString(int error); - - /* - * PROTECTED MEMBER FUNCTIONS - */ - protected: - /** Prints a info message to myStderr (auxiliary function). - * \return Error/warning/info number returned by sub function call - */ - returnValue throwMessage( - returnValue RETnumber, /**< Error/warning/info number returned by sub function call. */ - const char* additionaltext, /**< Additional warning text (0, if none). */ - const char* functionname, /**< Name of function which caused the error/warning/info. */ - const char* filename, /**< Name of file which caused the error/warning/info. */ - const unsigned long linenumber, /**< Number of line which caused the error/warning/info. */ - VisibilityStatus localVisibilityStatus, /**< Determines (locally) if info message can be printed to myStderr. - * If GLOBAL visibility status of the message is set to VS_HIDDEN, - * no message is printed, anyway! */ - const char* RETstring /**< Leading string of error/warning/info message. */ - ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - VisibilityStatus errorVisibility; /**< Error messages visible? */ - VisibilityStatus warningVisibility; /**< Warning messages visible? */ - VisibilityStatus infoVisibility; /**< Info messages visible? */ - - myFILE* outputFile; /**< Output file for messages. */ - - int errorCount; /**< Counts number of errors (for nicer output only). */ -}; - - -#ifndef __FUNCTION__ - /** Ensures that __FUNCTION__ macro is defined. */ - #define __FUNCTION__ 0 -#endif - -#ifndef __FILE__ - /** Ensures that __FILE__ macro is defined. */ - #define __FILE__ 0 -#endif - -#ifndef __LINE__ - /** Ensures that __LINE__ macro is defined. */ - #define __LINE__ 0 -#endif - - -/** Short version of throwError with default values, only returnValue is needed */ -#define THROWERROR(retval) ( getGlobalMessageHandler( )->throwError((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) - -/** Short version of throwWarning with default values, only returnValue is needed */ -#define THROWWARNING(retval) ( getGlobalMessageHandler( )->throwWarning((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) - -/** Short version of throwInfo with default values, only returnValue is needed */ -#define THROWINFO(retval) ( getGlobalMessageHandler( )->throwInfo((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) - - -/** Returns a pointer to global message handler. - * \return Pointer to global message handler. - */ -MessageHandling* getGlobalMessageHandler( ); - - -#include - -#endif /* QPOASES_MESSAGEHANDLING_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/MessageHandling.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the MessageHandling class including global return values. + */ + + +#ifndef QPOASES_MESSAGEHANDLING_HPP +#define QPOASES_MESSAGEHANDLING_HPP + +// #define PC_DEBUG + +#ifdef PC_DEBUG + #include + + /** Defines an alias for FILE from stdio.h. */ + #define myFILE FILE + /** Defines an alias for stderr from stdio.h. */ + #define myStderr stderr + /** Defines an alias for stdout from stdio.h. */ + #define myStdout stdout +#else + /** Defines an alias for FILE from stdio.h. */ + #define myFILE int + /** Defines an alias for stderr from stdio.h. */ + #define myStderr 0 + /** Defines an alias for stdout from stdio.h. */ + #define myStdout 0 +#endif + + +#include +#include + + +/** Defines symbols for global return values. \n + * Important: All return values are assumed to be nonnegative! */ +enum returnValue +{ +TERMINAL_LIST_ELEMENT = -1, /**< Terminal list element, internal usage only! */ +/* miscellaneous */ +SUCCESSFUL_RETURN = 0, /**< Successful return. */ +RET_DIV_BY_ZERO, /**< Division by zero. */ +RET_INDEX_OUT_OF_BOUNDS, /**< Index out of bounds. */ +RET_INVALID_ARGUMENTS, /**< At least one of the arguments is invalid. */ +RET_ERROR_UNDEFINED, /**< Error number undefined. */ +RET_WARNING_UNDEFINED, /**< Warning number undefined. */ +RET_INFO_UNDEFINED, /**< Info number undefined. */ +RET_EWI_UNDEFINED, /**< Error/warning/info number undefined. */ +RET_AVAILABLE_WITH_LINUX_ONLY, /**< This function is available under Linux only. */ +RET_UNKNOWN_BUG, /**< The error occured is not yet known. */ +RET_PRINTLEVEL_CHANGED, /**< 10 Print level changed. */ +RET_NOT_YET_IMPLEMENTED, /**< Requested function is not yet implemented in this version of qpOASES. */ +/* Indexlist */ +RET_INDEXLIST_MUST_BE_REORDERD, /**< Index list has to be reordered. */ +RET_INDEXLIST_EXCEEDS_MAX_LENGTH, /**< Index list exceeds its maximal physical length. */ +RET_INDEXLIST_CORRUPTED, /**< Index list corrupted. */ +RET_INDEXLIST_OUTOFBOUNDS, /**< Physical index is out of bounds. */ +RET_INDEXLIST_ADD_FAILED, /**< Adding indices from another index set failed. */ +RET_INDEXLIST_INTERSECT_FAILED, /**< Intersection with another index set failed. */ +/* SubjectTo / Bounds / Constraints */ +RET_INDEX_ALREADY_OF_DESIRED_STATUS, /**< Index is already of desired status. */ +RET_ADDINDEX_FAILED, /**< Cannot swap between different indexsets. */ +RET_SWAPINDEX_FAILED, /**< 20 Adding index to index set failed. */ +RET_NOTHING_TO_DO, /**< Nothing to do. */ +RET_SETUP_BOUND_FAILED, /**< Setting up bound index failed. */ +RET_SETUP_CONSTRAINT_FAILED, /**< Setting up constraint index failed. */ +RET_MOVING_BOUND_FAILED, /**< Moving bound between index sets failed. */ +RET_MOVING_CONSTRAINT_FAILED, /**< Moving constraint between index sets failed. */ +/* QProblem */ +RET_QP_ALREADY_INITIALISED, /**< QProblem has already been initialised. */ +RET_NO_INIT_WITH_STANDARD_SOLVER, /**< Initialisation via extern QP solver is not yet implemented. */ +RET_RESET_FAILED, /**< Reset failed. */ +RET_INIT_FAILED, /**< Initialisation failed. */ +RET_INIT_FAILED_TQ, /**< 30 Initialisation failed due to TQ factorisation. */ +RET_INIT_FAILED_CHOLESKY, /**< Initialisation failed due to Cholesky decomposition. */ +RET_INIT_FAILED_HOTSTART, /**< Initialisation failed! QP could not be solved! */ +RET_INIT_FAILED_INFEASIBILITY, /**< Initial QP could not be solved due to infeasibility! */ +RET_INIT_FAILED_UNBOUNDEDNESS, /**< Initial QP could not be solved due to unboundedness! */ +RET_INIT_SUCCESSFUL, /**< Initialisation done. */ +RET_OBTAINING_WORKINGSET_FAILED, /**< Failed to obtain working set for auxiliary QP. */ +RET_SETUP_WORKINGSET_FAILED, /**< Failed to setup working set for auxiliary QP. */ +RET_SETUP_AUXILIARYQP_FAILED, /**< Failed to setup auxiliary QP for initialised homotopy. */ +RET_NO_EXTERN_SOLVER, /**< No extern QP solver available. */ +RET_QP_UNBOUNDED, /**< 40 QP is unbounded. */ +RET_QP_INFEASIBLE, /**< QP is infeasible. */ +RET_QP_NOT_SOLVED, /**< Problems occured while solving QP with standard solver. */ +RET_QP_SOLVED, /**< QP successfully solved. */ +RET_UNABLE_TO_SOLVE_QP, /**< Problems occured while solving QP. */ +RET_INITIALISATION_STARTED, /**< Starting problem initialisation. */ +RET_HOTSTART_FAILED, /**< Unable to perform homotopy due to internal error. */ +RET_HOTSTART_FAILED_TO_INIT, /**< Unable to initialise problem. */ +RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, /**< Unable to perform homotopy as previous QP is not solved. */ +RET_ITERATION_STARTED, /**< Iteration... */ +RET_SHIFT_DETERMINATION_FAILED, /**< 50 Determination of shift of the QP data failed. */ +RET_STEPDIRECTION_DETERMINATION_FAILED, /**< Determination of step direction failed. */ +RET_STEPLENGTH_DETERMINATION_FAILED, /**< Determination of step direction failed. */ +RET_OPTIMAL_SOLUTION_FOUND, /**< Optimal solution of neighbouring QP found. */ +RET_HOMOTOPY_STEP_FAILED, /**< Unable to perform homotopy step. */ +RET_HOTSTART_STOPPED_INFEASIBILITY, /**< Premature homotopy termination because QP is infeasible. */ +RET_HOTSTART_STOPPED_UNBOUNDEDNESS, /**< Premature homotopy termination because QP is unbounded. */ +RET_WORKINGSET_UPDATE_FAILED, /**< Unable to update working sets according to initial guesses. */ +RET_MAX_NWSR_REACHED, /**< Maximum number of working set recalculations performed. */ +RET_CONSTRAINTS_NOT_SPECIFIED, /**< Problem does comprise constraints! You also have to specify new constraints' bounds. */ +RET_INVALID_FACTORISATION_FLAG, /**< 60 Invalid factorisation flag. */ +RET_UNABLE_TO_SAVE_QPDATA, /**< Unable to save QP data. */ +RET_STEPDIRECTION_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */ +RET_STEPDIRECTION_FAILED_CHOLESKY, /**< Abnormal termination due to Cholesky factorisation. */ +RET_CYCLING_DETECTED, /**< Cycling detected. */ +RET_CYCLING_NOT_RESOLVED, /**< Cycling cannot be resolved, QP probably infeasible. */ +RET_CYCLING_RESOLVED, /**< Cycling probably resolved. */ +RET_STEPSIZE, /**< For displaying performed stepsize. */ +RET_STEPSIZE_NONPOSITIVE, /**< For displaying non-positive stepsize. */ +RET_SETUPSUBJECTTOTYPE_FAILED, /**< Setup of SubjectToTypes failed. */ +RET_ADDCONSTRAINT_FAILED, /**< 70 Addition of constraint to working set failed. */ +RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, /**< Addition of constraint to working set failed (due to QP infeasibility). */ +RET_ADDBOUND_FAILED, /**< Addition of bound to working set failed. */ +RET_ADDBOUND_FAILED_INFEASIBILITY, /**< Addition of bound to working set failed (due to QP infeasibility). */ +RET_REMOVECONSTRAINT_FAILED, /**< Removal of constraint from working set failed. */ +RET_REMOVEBOUND_FAILED, /**< Removal of bound from working set failed. */ +RET_REMOVE_FROM_ACTIVESET, /**< Removing from active set... */ +RET_ADD_TO_ACTIVESET, /**< Adding to active set... */ +RET_REMOVE_FROM_ACTIVESET_FAILED, /**< Removing from active set failed. */ +RET_ADD_TO_ACTIVESET_FAILED, /**< Adding to active set failed. */ +RET_CONSTRAINT_ALREADY_ACTIVE, /**< 80 Constraint is already active. */ +RET_ALL_CONSTRAINTS_ACTIVE, /**< All constraints are active, no further constraint can be added. */ +RET_LINEARLY_DEPENDENT, /**< New bound/constraint is linearly dependent. */ +RET_LINEARLY_INDEPENDENT, /**< New bound/constraint is linearly independent. */ +RET_LI_RESOLVED, /**< Linear independence of active contraint matrix successfully resolved. */ +RET_ENSURELI_FAILED, /**< Failed to ensure linear indepence of active contraint matrix. */ +RET_ENSURELI_FAILED_TQ, /**< Abnormal termination due to TQ factorisation. */ +RET_ENSURELI_FAILED_NOINDEX, /**< No index found, QP probably infeasible. */ +RET_ENSURELI_FAILED_CYCLING, /**< Cycling detected, QP probably infeasible. */ +RET_BOUND_ALREADY_ACTIVE, /**< Bound is already active. */ +RET_ALL_BOUNDS_ACTIVE, /**< 90 All bounds are active, no further bound can be added. */ +RET_CONSTRAINT_NOT_ACTIVE, /**< Constraint is not active. */ +RET_BOUND_NOT_ACTIVE, /**< Bound is not active. */ +RET_HESSIAN_NOT_SPD, /**< Projected Hessian matrix not positive definite. */ +RET_MATRIX_SHIFT_FAILED, /**< Unable to update matrices or to transform vectors. */ +RET_MATRIX_FACTORISATION_FAILED, /**< Unable to calculate new matrix factorisations. */ +RET_PRINT_ITERATION_FAILED, /**< Unable to print information on current iteration. */ +RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, /**< No global message output file initialised. */ +/* Utils */ +RET_UNABLE_TO_OPEN_FILE, /**< Unable to open file. */ +RET_UNABLE_TO_WRITE_FILE, /**< Unable to write into file. */ +RET_UNABLE_TO_READ_FILE, /**< 100 Unable to read from file. */ +RET_FILEDATA_INCONSISTENT, /**< File contains inconsistent data. */ +/* SolutionAnalysis */ +RET_NO_SOLUTION, /**< QP solution does not satisfy KKT optimality conditions. */ +RET_INACCURATE_SOLUTION /**< KKT optimality conditions not satisfied to sufficient accuracy. */ +}; + + + +/** This class handles all kinds of messages (errors, warnings, infos) initiated + * by qpOASES modules and stores the correspoding global preferences. + * + * \author Hans Joachim Ferreau (special thanks to Leonard Wirsching) + * \version 1.3embedded + * \date 2007-2008 + */ +class MessageHandling +{ + /* + * INTERNAL DATA STRUCTURES + */ + public: + /** Data structure for entries in global message list. */ + typedef struct { + returnValue key; /**< Global return value. */ + const char* data; /**< Corresponding message. */ + VisibilityStatus globalVisibilityStatus; /**< Determines if message can be printed. + * If this value is set to VS_HIDDEN, no message is printed! */ + } ReturnValueList; + + + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + MessageHandling( ); + + /** Constructor which takes the desired output file. */ + MessageHandling( myFILE* _outputFile /**< Output file. */ + ); + + /** Constructor which takes the desired visibility states. */ + MessageHandling( VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */ + VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */ + VisibilityStatus _infoVisibility /**< Visibility status for info messages. */ + ); + + /** Constructor which takes the desired output file and desired visibility states. */ + MessageHandling( myFILE* _outputFile, /**< Output file. */ + VisibilityStatus _errorVisibility, /**< Visibility status for error messages. */ + VisibilityStatus _warningVisibility,/**< Visibility status for warning messages. */ + VisibilityStatus _infoVisibility /**< Visibility status for info messages. */ + ); + + /** Copy constructor (deep copy). */ + MessageHandling( const MessageHandling& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~MessageHandling( ); + + /** Assignment operator (deep copy). */ + MessageHandling& operator=( const MessageHandling& rhs /**< Rhs object. */ + ); + + + /** Prints an error message(a simplified macro THROWERROR is also provided). \n + * Errors are definied as abnormal events which cause an immediate termination of the current (sub) function. + * Errors of a sub function should be commented by the calling function by means of a warning message + * (if this error does not cause an error of the calling function, either)! + * \return Error number returned by sub function call + */ + returnValue throwError( + returnValue Enumber, /**< Error number returned by sub function call. */ + const char* additionaltext, /**< Additional error text (0, if none). */ + const char* functionname, /**< Name of function which caused the error. */ + const char* filename, /**< Name of file which caused the error. */ + const unsigned long linenumber, /**< Number of line which caused the error.incompatible binary file */ + VisibilityStatus localVisibilityStatus /**< Determines (locally) if error message can be printed to myStderr. + * If GLOBAL visibility status of the message is set to VS_HIDDEN, + * no message is printed, anyway! */ + ); + + /** Prints a warning message (a simplified macro THROWWARNING is also provided). + * Warnings are definied as abnormal events which does NOT cause an immediate termination of the current (sub) function. + * \return Warning number returned by sub function call + */ + returnValue throwWarning( + returnValue Wnumber, /**< Warning number returned by sub function call. */ + const char* additionaltext, /**< Additional warning text (0, if none). */ + const char* functionname, /**< Name of function which caused the warning. */ + const char* filename, /**< Name of file which caused the warning. */ + const unsigned long linenumber, /**< Number of line which caused the warning. */ + VisibilityStatus localVisibilityStatus /**< Determines (locally) if warning message can be printed to myStderr. + * If GLOBAL visibility status of the message is set to VS_HIDDEN, + * no message is printed, anyway! */ + ); + + /** Prints a info message (a simplified macro THROWINFO is also provided). + * \return Info number returned by sub function call + */ + returnValue throwInfo( + returnValue Inumber, /**< Info number returned by sub function call. */ + const char* additionaltext, /**< Additional warning text (0, if none). */ + const char* functionname, /**< Name of function which submitted the info. */ + const char* filename, /**< Name of file which submitted the info. */ + const unsigned long linenumber, /**< Number of line which submitted the info. */ + VisibilityStatus localVisibilityStatus /**< Determines (locally) if info message can be printed to myStderr. + * If GLOBAL visibility status of the message is set to VS_HIDDEN, + * no message is printed, anyway! */ + ); + + + /** Resets all preferences to default values. + * \return SUCCESSFUL_RETURN */ + returnValue reset( ); + + + /** Prints a complete list of all messages to output file. + * \return SUCCESSFUL_RETURN */ + returnValue listAllMessages( ); + + + /** Returns visibility status for error messages. + * \return Visibility status for error messages. */ + inline VisibilityStatus getErrorVisibilityStatus( ) const; + + /** Returns visibility status for warning messages. + * \return Visibility status for warning messages. */ + inline VisibilityStatus getWarningVisibilityStatus( ) const; + + /** Returns visibility status for info messages. + * \return Visibility status for info messages. */ + inline VisibilityStatus getInfoVisibilityStatus( ) const; + + /** Returns pointer to output file. + * \return Pointer to output file. */ + inline myFILE* getOutputFile( ) const; + + /** Returns error count value. + * \return Error count value. */ + inline int getErrorCount( ) const; + + + /** Changes visibility status for error messages. */ + inline void setErrorVisibilityStatus( VisibilityStatus _errorVisibility /**< New visibility status for error messages. */ + ); + + /** Changes visibility status for warning messages. */ + inline void setWarningVisibilityStatus( VisibilityStatus _warningVisibility /**< New visibility status for warning messages. */ + ); + + /** Changes visibility status for info messages. */ + inline void setInfoVisibilityStatus( VisibilityStatus _infoVisibility /**< New visibility status for info messages. */ + ); + + /** Changes output file for messages. */ + inline void setOutputFile( myFILE* _outputFile /**< New output file for messages. */ + ); + + /** Changes error count. + * \return SUCCESSFUL_RETURN \n + * RET_INVALID_ARGUMENT */ + inline returnValue setErrorCount( int _errorCount /**< New error count value. */ + ); + + /** Return the error code string. */ + static const char* getErrorString(int error); + + /* + * PROTECTED MEMBER FUNCTIONS + */ + protected: + /** Prints a info message to myStderr (auxiliary function). + * \return Error/warning/info number returned by sub function call + */ + returnValue throwMessage( + returnValue RETnumber, /**< Error/warning/info number returned by sub function call. */ + const char* additionaltext, /**< Additional warning text (0, if none). */ + const char* functionname, /**< Name of function which caused the error/warning/info. */ + const char* filename, /**< Name of file which caused the error/warning/info. */ + const unsigned long linenumber, /**< Number of line which caused the error/warning/info. */ + VisibilityStatus localVisibilityStatus, /**< Determines (locally) if info message can be printed to myStderr. + * If GLOBAL visibility status of the message is set to VS_HIDDEN, + * no message is printed, anyway! */ + const char* RETstring /**< Leading string of error/warning/info message. */ + ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + VisibilityStatus errorVisibility; /**< Error messages visible? */ + VisibilityStatus warningVisibility; /**< Warning messages visible? */ + VisibilityStatus infoVisibility; /**< Info messages visible? */ + + myFILE* outputFile; /**< Output file for messages. */ + + int errorCount; /**< Counts number of errors (for nicer output only). */ +}; + + +#ifndef __FUNCTION__ + /** Ensures that __FUNCTION__ macro is defined. */ + #define __FUNCTION__ 0 +#endif + +#ifndef __FILE__ + /** Ensures that __FILE__ macro is defined. */ + #define __FILE__ 0 +#endif + +#ifndef __LINE__ + /** Ensures that __LINE__ macro is defined. */ + #define __LINE__ 0 +#endif + + +/** Short version of throwError with default values, only returnValue is needed */ +#define THROWERROR(retval) ( getGlobalMessageHandler( )->throwError((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) + +/** Short version of throwWarning with default values, only returnValue is needed */ +#define THROWWARNING(retval) ( getGlobalMessageHandler( )->throwWarning((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) + +/** Short version of throwInfo with default values, only returnValue is needed */ +#define THROWINFO(retval) ( getGlobalMessageHandler( )->throwInfo((retval),0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE) ) + + +/** Returns a pointer to global message handler. + * \return Pointer to global message handler. + */ +MessageHandling* getGlobalMessageHandler( ); + + +#include + +#endif /* QPOASES_MESSAGEHANDLING_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/QProblem.hpp b/phonelibs/qpoases/INCLUDE/QProblem.hpp index 68fc1af9c..91dc43417 100644 --- a/phonelibs/qpoases/INCLUDE/QProblem.hpp +++ b/phonelibs/qpoases/INCLUDE/QProblem.hpp @@ -1,666 +1,666 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/QProblem.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the QProblem class which is able to use the newly - * developed online active set strategy for parametric quadratic programming. - */ - - - -#ifndef QPOASES_QPROBLEM_HPP -#define QPOASES_QPROBLEM_HPP - - -#include -#include -#include - - -/** A class for setting up and solving quadratic programs. The main feature is - * the possibily to use the newly developed online active set strategy for - * parametric quadratic programming. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class QProblem : public QProblemB -{ - /* allow SolutionAnalysis class to access private members */ - friend class SolutionAnalysis; - - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - QProblem( ); - - /** Constructor which takes the QP dimensions only. */ - QProblem( int _nV, /**< Number of variables. */ - int _nC /**< Number of constraints. */ - ); - - /** Copy constructor (deep copy). */ - QProblem( const QProblem& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~QProblem( ); - - /** Assignment operator (deep copy). */ - QProblem& operator=( const QProblem& rhs /**< Rhs object. */ - ); - - - /** Clears all data structures of QProblemB except for QP data. - * \return SUCCESSFUL_RETURN \n - RET_RESET_FAILED */ - returnValue reset( ); - - - /** Initialises a QProblem with given QP data and solves it - * using an initial homotopy with empty working set (at most nWSR iterations). - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_TQ \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED \n - RET_INVALID_ARGUMENTS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue init( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _A, /**< Constraint matrix. */ - const real_t* const _lb, /**< Lower bound vector (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub, /**< Upper bound vector (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - const real_t* const _lbA, /**< Lower constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - const real_t* const _ubA, /**< Upper constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. - Output: Number of performed working set recalculations. */ - const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ - real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ - ); - - - /** Initialises a QProblem with given QP data and solves it - * using an initial homotopy with empty working set (at most nWSR iterations). - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_TQ \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED \n - RET_INVALID_ARGUMENTS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue init( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _A, /**< Constraint matrix. */ - const real_t* const _lb, /**< Lower bound vector (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub, /**< Upper bound vector (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - const real_t* const _lbA, /**< Lower constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - const real_t* const _ubA, /**< Upper constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. - Output: Number of performed working set recalculations. */ - const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ - real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ - ); - - - /** Solves QProblem using online active set strategy. - * \return SUCCESSFUL_RETURN \n - RET_MAX_NWSR_REACHED \n - RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED \n - RET_HOTSTART_FAILED \n - RET_SHIFT_DETERMINATION_FAILED \n - RET_STEPDIRECTION_DETERMINATION_FAILED \n - RET_STEPLENGTH_DETERMINATION_FAILED \n - RET_HOMOTOPY_STEP_FAILED \n - RET_HOTSTART_STOPPED_INFEASIBILITY \n - RET_HOTSTART_STOPPED_UNBOUNDEDNESS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue hotstart( const real_t* const g_new, /**< Gradient of neighbouring QP to be solved. */ - const real_t* const lb_new, /**< Lower bounds of neighbouring QP to be solved. \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const ub_new, /**< Upper bounds of neighbouring QP to be solved. \n - If no upper bounds exist, a NULL pointer can be passed. */ - const real_t* const lbA_new, /**< Lower constraints' bounds of neighbouring QP to be solved. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - const real_t* const ubA_new, /**< Upper constraints' bounds of neighbouring QP to be solved. \n - If no upper constraints' bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations; \n - Output: Number of performed working set recalculations. */ - real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ - ); - - - /** Returns constraint matrix of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getA( real_t* const _A /**< Array of appropriate dimension for copying constraint matrix.*/ - ) const; - - /** Returns a single row of constraint matrix of the QP (deep copy). - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue getA( int number, /**< Number of entry to be returned. */ - real_t* const row /**< Array of appropriate dimension for copying (number)th constraint. */ - ) const; - - /** Returns lower constraints' bound vector of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getLBA( real_t* const _lbA /**< Array of appropriate dimension for copying lower constraints' bound vector.*/ - ) const; - - /** Returns single entry of lower constraints' bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue getLBA( int number, /**< Number of entry to be returned. */ - real_t& value /**< Output: lbA[number].*/ - ) const; - - /** Returns upper constraints' bound vector of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getUBA( real_t* const _ubA /**< Array of appropriate dimension for copying upper constraints' bound vector.*/ - ) const; - - /** Returns single entry of upper constraints' bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue getUBA( int number, /**< Number of entry to be returned. */ - real_t& value /**< Output: ubA[number].*/ - ) const; - - - /** Returns current constraints object of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getConstraints( Constraints* const _constraints /** Output: Constraints object. */ - ) const; - - - /** Returns the number of constraints. - * \return Number of constraints. */ - inline int getNC( ) const; - - /** Returns the number of (implicitly defined) equality constraints. - * \return Number of (implicitly defined) equality constraints. */ - inline int getNEC( ) const; - - /** Returns the number of active constraints. - * \return Number of active constraints. */ - inline int getNAC( ); - - /** Returns the number of inactive constraints. - * \return Number of inactive constraints. */ - inline int getNIAC( ); - - /** Returns the dimension of null space. - * \return Dimension of null space. */ - int getNZ( ); - - - /** Returns the dual solution vector (deep copy). - * \return SUCCESSFUL_RETURN \n - RET_QP_NOT_SOLVED */ - returnValue getDualSolution( real_t* const yOpt /**< Output: Dual solution vector (if QP has been solved). */ - ) const; - - - /* - * PROTECTED MEMBER FUNCTIONS - */ - protected: - /** Determines type of constraints and bounds (i.e. implicitly fixed, unbounded etc.). - * \return SUCCESSFUL_RETURN \n - RET_SETUPSUBJECTTOTYPE_FAILED */ - returnValue setupSubjectToType( ); - - /** Computes the Cholesky decomposition R of the projected Hessian (i.e. R^T*R = Z^T*H*Z). - * \return SUCCESSFUL_RETURN \n - * RET_INDEXLIST_CORRUPTED */ - returnValue setupCholeskyDecompositionProjected( ); - - /** Initialises TQ factorisation of A (i.e. A*Q = [0 T]) if NO constraint is active. - * \return SUCCESSFUL_RETURN \n - RET_INDEXLIST_CORRUPTED */ - returnValue setupTQfactorisation( ); - - - /** Solves a QProblem whose QP data is assumed to be stored in the member variables. - * A guess for its primal/dual optimal solution vectors and the corresponding - * working sets of bounds and constraints can be provided. - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_TQ \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED */ - returnValue solveInitialQP( const real_t* const xOpt, /**< Optimal primal solution vector. - * A NULL pointer can be passed. */ - const real_t* const yOpt, /**< Optimal dual solution vector. - * A NULL pointer can be passed. */ - const Bounds* const guessedBounds, /**< Guessed working set of bounds for solution (xOpt,yOpt). - * A NULL pointer can be passed. */ - const Constraints* const guessedConstraints, /**< Optimal working set of constraints for solution (xOpt,yOpt). - * A NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations; \n - * Output: Number of performed working set recalculations. */ - real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ - ); - - /** Obtains the desired working set for the auxiliary initial QP in - * accordance with the user specifications - * (assumes that member AX has already been initialised!) - * \return SUCCESSFUL_RETURN \n - RET_OBTAINING_WORKINGSET_FAILED \n - RET_INVALID_ARGUMENTS */ - returnValue obtainAuxiliaryWorkingSet( const real_t* const xOpt, /**< Optimal primal solution vector. - * If a NULL pointer is passed, all entries are assumed to be zero. */ - const real_t* const yOpt, /**< Optimal dual solution vector. - * If a NULL pointer is passed, all entries are assumed to be zero. */ - const Bounds* const guessedBounds, /**< Guessed working set of bounds for solution (xOpt,yOpt). */ - const Constraints* const guessedConstraints, /**< Guessed working set for solution (xOpt,yOpt). */ - Bounds* auxiliaryBounds, /**< Input: Allocated bound object. \n - * Ouput: Working set of constraints for auxiliary QP. */ - Constraints* auxiliaryConstraints /**< Input: Allocated bound object. \n - * Ouput: Working set for auxiliary QP. */ - ) const; - - /** Setups bound and constraints data structures according to auxiliaryBounds/Constraints. - * (If the working set shall be setup afresh, make sure that - * bounds and constraints data structure have been resetted - * and the TQ factorisation has been initialised!) - * \return SUCCESSFUL_RETURN \n - RET_SETUP_WORKINGSET_FAILED \n - RET_INVALID_ARGUMENTS \n - RET_UNKNOWN BUG */ - returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, /**< Working set of bounds for auxiliary QP. */ - const Constraints* const auxiliaryConstraints, /**< Working set of constraints for auxiliary QP. */ - BooleanType setupAfresh /**< Flag indicating if given working set shall be - * setup afresh or by updating the current one. */ - ); - - /** Setups the optimal primal/dual solution of the auxiliary initial QP. - * \return SUCCESSFUL_RETURN */ - returnValue setupAuxiliaryQPsolution( const real_t* const xOpt, /**< Optimal primal solution vector. - * If a NULL pointer is passed, all entries are set to zero. */ - const real_t* const yOpt /**< Optimal dual solution vector. - * If a NULL pointer is passed, all entries are set to zero. */ - ); - - /** Setups gradient of the auxiliary initial QP for given - * optimal primal/dual solution and given initial working set - * (assumes that members X, Y and BOUNDS, CONSTRAINTS have already been initialised!). - * \return SUCCESSFUL_RETURN */ - returnValue setupAuxiliaryQPgradient( ); - - /** Setups (constraints') bounds of the auxiliary initial QP for given - * optimal primal/dual solution and given initial working set - * (assumes that members X, Y and BOUNDS, CONSTRAINTS have already been initialised!). - * \return SUCCESSFUL_RETURN \n - RET_UNKNOWN BUG */ - returnValue setupAuxiliaryQPbounds( const Bounds* const auxiliaryBounds, /**< Working set of bounds for auxiliary QP. */ - const Constraints* const auxiliaryConstraints, /**< Working set of constraints for auxiliary QP. */ - BooleanType useRelaxation /**< Flag indicating if inactive (constraints') bounds shall be relaxed. */ - ); - - - /** Adds a constraint to active set. - * \return SUCCESSFUL_RETURN \n - RET_ADDCONSTRAINT_FAILED \n - RET_ADDCONSTRAINT_FAILED_INFEASIBILITY \n - RET_ENSURELI_FAILED */ - returnValue addConstraint( int number, /**< Number of constraint to be added to active set. */ - SubjectToStatus C_status, /**< Status of new active constraint. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - /** Checks if new active constraint to be added is linearly dependent from - * from row of the active constraints matrix. - * \return RET_LINEARLY_DEPENDENT \n - RET_LINEARLY_INDEPENDENT \n - RET_INDEXLIST_CORRUPTED */ - returnValue addConstraint_checkLI( int number /**< Number of constraint to be added to active set. */ - ); - - /** Ensures linear independence of constraint matrix when a new constraint is added. - * To this end a bound or constraint is removed simultaneously if necessary. - * \return SUCCESSFUL_RETURN \n - RET_LI_RESOLVED \n - RET_ENSURELI_FAILED \n - RET_ENSURELI_FAILED_TQ \n - RET_ENSURELI_FAILED_NOINDEX \n - RET_REMOVE_FROM_ACTIVESET */ - returnValue addConstraint_ensureLI( int number, /**< Number of constraint to be added to active set. */ - SubjectToStatus C_status /**< Status of new active bound. */ - ); - - /** Adds a bound to active set. - * \return SUCCESSFUL_RETURN \n - RET_ADDBOUND_FAILED \n - RET_ADDBOUND_FAILED_INFEASIBILITY \n - RET_ENSURELI_FAILED */ - returnValue addBound( int number, /**< Number of bound to be added to active set. */ - SubjectToStatus B_status, /**< Status of new active bound. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - /** Checks if new active bound to be added is linearly dependent from - * from row of the active constraints matrix. - * \return RET_LINEARLY_DEPENDENT \n - RET_LINEARLY_INDEPENDENT */ - returnValue addBound_checkLI( int number /**< Number of bound to be added to active set. */ - ); - - /** Ensures linear independence of constraint matrix when a new bound is added. - * To this end a bound or constraint is removed simultaneously if necessary. - * \return SUCCESSFUL_RETURN \n - RET_LI_RESOLVED \n - RET_ENSURELI_FAILED \n - RET_ENSURELI_FAILED_TQ \n - RET_ENSURELI_FAILED_NOINDEX \n - RET_REMOVE_FROM_ACTIVESET */ - returnValue addBound_ensureLI( int number, /**< Number of bound to be added to active set. */ - SubjectToStatus B_status /**< Status of new active bound. */ - ); - - /** Removes a constraint from active set. - * \return SUCCESSFUL_RETURN \n - RET_CONSTRAINT_NOT_ACTIVE \n - RET_REMOVECONSTRAINT_FAILED \n - RET_HESSIAN_NOT_SPD */ - returnValue removeConstraint( int number, /**< Number of constraint to be removed from active set. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - /** Removes a bounds from active set. - * \return SUCCESSFUL_RETURN \n - RET_BOUND_NOT_ACTIVE \n - RET_HESSIAN_NOT_SPD \n - RET_REMOVEBOUND_FAILED */ - returnValue removeBound( int number, /**< Number of bound to be removed from active set. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - - /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. - * \return SUCCESSFUL_RETURN \n - RET_DIV_BY_ZERO */ - returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ - BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ - real_t* const a /**< Output: Solution vector */ - ); - - /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. \n - * Special variant for the case that this function is called from within "removeBound()". - * \return SUCCESSFUL_RETURN \n - RET_DIV_BY_ZERO */ - returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ - BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ - BooleanType removingBound, /**< Indicates if function is called from "removeBound()". */ - real_t* const a /**< Output: Solution vector */ - ); - - - /** Solves the system Ta = b or T^Ta = b where T is a reverse upper triangular matrix. - * \return SUCCESSFUL_RETURN \n - RET_DIV_BY_ZERO */ - returnValue backsolveT( const real_t* const b, /**< Right hand side vector. */ - BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ - real_t* const a /**< Output: Solution vector */ - ); - - - /** Determines step direction of the shift of the QP data. - * \return SUCCESSFUL_RETURN */ - returnValue hotstart_determineDataShift(const int* const FX_idx, /**< Index array of fixed variables. */ - const int* const AC_idx, /**< Index array of active constraints. */ - const real_t* const g_new, /**< New gradient vector. */ - const real_t* const lbA_new,/**< New lower constraints' bounds. */ - const real_t* const ubA_new,/**< New upper constraints' bounds. */ - const real_t* const lb_new, /**< New lower bounds. */ - const real_t* const ub_new, /**< New upper bounds. */ - real_t* const delta_g, /**< Output: Step direction of gradient vector. */ - real_t* const delta_lbA, /**< Output: Step direction of lower constraints' bounds. */ - real_t* const delta_ubA, /**< Output: Step direction of upper constraints' bounds. */ - real_t* const delta_lb, /**< Output: Step direction of lower bounds. */ - real_t* const delta_ub, /**< Output: Step direction of upper bounds. */ - BooleanType& Delta_bC_isZero,/**< Output: Indicates if active constraints' bounds are to be shifted. */ - BooleanType& Delta_bB_isZero/**< Output: Indicates if active bounds are to be shifted. */ - ); - - /** Determines step direction of the homotopy path. - * \return SUCCESSFUL_RETURN \n - RET_STEPDIRECTION_FAILED_TQ \n - RET_STEPDIRECTION_FAILED_CHOLESKY */ - returnValue hotstart_determineStepDirection(const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const int* const AC_idx, /**< Index array of active constraints. */ - const real_t* const delta_g, /**< Step direction of gradient vector. */ - const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ - const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - BooleanType Delta_bC_isZero, /**< Indicates if active constraints' bounds are to be shifted. */ - BooleanType Delta_bB_isZero, /**< Indicates if active bounds are to be shifted. */ - real_t* const delta_xFX, /**< Output: Primal homotopy step direction of fixed variables. */ - real_t* const delta_xFR, /**< Output: Primal homotopy step direction of free variables. */ - real_t* const delta_yAC, /**< Output: Dual homotopy step direction of active constraints' multiplier. */ - real_t* const delta_yFX /**< Output: Dual homotopy step direction of fixed variables' multiplier. */ - ); - - /** Determines the maximum possible step length along the homotopy path. - * \return SUCCESSFUL_RETURN */ - returnValue hotstart_determineStepLength( const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const int* const AC_idx, /**< Index array of active constraints. */ - const int* const IAC_idx, /**< Index array of inactive constraints. */ - const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ - const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ - const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ - const real_t* const delta_yAC, /**< Dual homotopy step direction of active constraints' multiplier. */ - const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ - real_t* const delta_Ax, /**< Output: Step in vector Ax. */ - int& BC_idx, /**< Output: Index of blocking constraint. */ - SubjectToStatus& BC_status, /**< Output: Status of blocking constraint. */ - BooleanType& BC_isBound /**< Output: Indicates if blocking constraint is a bound. */ - ); - - /** Performs a step along the homotopy path (and updates active set). - * \return SUCCESSFUL_RETURN \n - RET_OPTIMAL_SOLUTION_FOUND \n - RET_REMOVE_FROM_ACTIVESET_FAILED \n - RET_ADD_TO_ACTIVESET_FAILED \n - RET_QP_INFEASIBLE */ - returnValue hotstart_performStep( const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const int* const AC_idx, /**< Index array of active constraints. */ - const int* const IAC_idx, /**< Index array of inactive constraints. */ - const real_t* const delta_g, /**< Step direction of gradient vector. */ - const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ - const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ - const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ - const real_t* const delta_yAC, /**< Dual homotopy step direction of active constraints' multiplier. */ - const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ - const real_t* const delta_Ax, /**< Step in vector Ax. */ - int BC_idx, /**< Index of blocking constraint. */ - SubjectToStatus BC_status, /**< Status of blocking constraint. */ - BooleanType BC_isBound /**< Indicates if blocking constraint is a bound. */ - ); - - - /** Checks if lower/upper (constraints') bounds remain consistent - * (i.e. if lb <= ub and lbA <= ubA ) during the current step. - * \return BT_TRUE iff (constraints") bounds remain consistent - */ - BooleanType areBoundsConsistent( const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ - const real_t* const delta_ubA /**< Step direction of upper constraints' bounds. */ - ) const; - - - /** Setups internal QP data. - * \return SUCCESSFUL_RETURN \n - RET_INVALID_ARGUMENTS */ - returnValue setupQPdata( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _A, /**< Constraint matrix. */ - const real_t* const _lb, /**< Lower bound vector (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub, /**< Upper bound vector (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - const real_t* const _lbA, /**< Lower constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - const real_t* const _ubA /**< Upper constraints' bound vector. \n - If no lower constraints' bounds exist, a NULL pointer can be passed. */ - ); - - - #ifdef PC_DEBUG /* Define print functions only for debugging! */ - - /** Prints concise information on the current iteration. - * \return SUCCESSFUL_RETURN \n */ - returnValue printIteration( int iteration, /**< Number of current iteration. */ - int BC_idx, /**< Index of blocking constraint. */ - SubjectToStatus BC_status, /**< Status of blocking constraint. */ - BooleanType BC_isBound /**< Indicates if blocking constraint is a bound. */ - ); - - /** Prints concise information on the current iteration. - * NOTE: ONLY DEFINED FOR SUPPRESSING A COMPILER WARNING!! - * \return SUCCESSFUL_RETURN \n */ - returnValue printIteration( int iteration, /**< Number of current iteration. */ - int BC_idx, /**< Index of blocking bound. */ - SubjectToStatus BC_status /**< Status of blocking bound. */ - ); - - #endif /* PC_DEBUG */ - - - /** Determines the maximum violation of the KKT optimality conditions - * of the current iterate within the QProblem object. - * \return SUCCESSFUL_RETURN \n - * RET_INACCURATE_SOLUTION \n - * RET_NO_SOLUTION */ - returnValue checkKKTconditions( ); - - - /** Sets constraint matrix of the QP. \n - (Remark: Also internal vector Ax is recomputed!) - * \return SUCCESSFUL_RETURN */ - inline returnValue setA( const real_t* const A_new /**< New constraint matrix (with correct dimension!). */ - ); - - /** Changes single row of constraint matrix of the QP. \n - (Remark: Also correponding component of internal vector Ax is recomputed!) - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setA( int number, /**< Number of row to be changed. */ - const real_t* const value /**< New (number)th constraint (with correct dimension!). */ - ); - - - /** Sets constraints' lower bound vector of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setLBA( const real_t* const lbA_new /**< New constraints' lower bound vector (with correct dimension!). */ - ); - - /** Changes single entry of lower constraints' bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setLBA( int number, /**< Number of entry to be changed. */ - real_t value /**< New value for entry of lower constraints' bound vector (with correct dimension!). */ - ); - - /** Sets constraints' upper bound vector of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setUBA( const real_t* const ubA_new /**< New constraints' upper bound vector (with correct dimension!). */ - ); - - /** Changes single entry of upper constraints' bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setUBA( int number, /**< Number of entry to be changed. */ - real_t value /**< New value for entry of upper constraints' bound vector (with correct dimension!). */ - ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - real_t A[NCMAX_ALLOC*NVMAX]; /**< Constraint matrix. */ - real_t lbA[NCMAX_ALLOC]; /**< Lower constraints' bound vector. */ - real_t ubA[NCMAX_ALLOC]; /**< Upper constraints' bound vector. */ - - Constraints constraints; /**< Data structure for problem's constraints. */ - - real_t T[NVMAX*NVMAX]; /**< Reverse triangular matrix, A = [0 T]*Q'. */ - real_t Q[NVMAX*NVMAX]; /**< Orthonormal quadratic matrix, A = [0 T]*Q'. */ - int sizeT; /**< Matrix T is stored in a (sizeT x sizeT) array. */ - - real_t Ax[NCMAX_ALLOC]; /**< Stores the current product A*x (for increased efficiency only). */ - - CyclingManager cyclingManager; /**< Data structure for storing (possible) cycling information (NOT YET IMPLEMENTED!). */ -}; - - -#include - -#endif /* QPOASES_QPROBLEM_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/QProblem.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the QProblem class which is able to use the newly + * developed online active set strategy for parametric quadratic programming. + */ + + + +#ifndef QPOASES_QPROBLEM_HPP +#define QPOASES_QPROBLEM_HPP + + +#include +#include +#include + + +/** A class for setting up and solving quadratic programs. The main feature is + * the possibily to use the newly developed online active set strategy for + * parametric quadratic programming. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class QProblem : public QProblemB +{ + /* allow SolutionAnalysis class to access private members */ + friend class SolutionAnalysis; + + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + QProblem( ); + + /** Constructor which takes the QP dimensions only. */ + QProblem( int _nV, /**< Number of variables. */ + int _nC /**< Number of constraints. */ + ); + + /** Copy constructor (deep copy). */ + QProblem( const QProblem& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~QProblem( ); + + /** Assignment operator (deep copy). */ + QProblem& operator=( const QProblem& rhs /**< Rhs object. */ + ); + + + /** Clears all data structures of QProblemB except for QP data. + * \return SUCCESSFUL_RETURN \n + RET_RESET_FAILED */ + returnValue reset( ); + + + /** Initialises a QProblem with given QP data and solves it + * using an initial homotopy with empty working set (at most nWSR iterations). + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_TQ \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED \n + RET_INVALID_ARGUMENTS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue init( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _A, /**< Constraint matrix. */ + const real_t* const _lb, /**< Lower bound vector (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub, /**< Upper bound vector (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + const real_t* const _lbA, /**< Lower constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + const real_t* const _ubA, /**< Upper constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. + Output: Number of performed working set recalculations. */ + const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ + real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ + ); + + + /** Initialises a QProblem with given QP data and solves it + * using an initial homotopy with empty working set (at most nWSR iterations). + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_TQ \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED \n + RET_INVALID_ARGUMENTS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue init( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _A, /**< Constraint matrix. */ + const real_t* const _lb, /**< Lower bound vector (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub, /**< Upper bound vector (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + const real_t* const _lbA, /**< Lower constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + const real_t* const _ubA, /**< Upper constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. + Output: Number of performed working set recalculations. */ + const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ + real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ + ); + + + /** Solves QProblem using online active set strategy. + * \return SUCCESSFUL_RETURN \n + RET_MAX_NWSR_REACHED \n + RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED \n + RET_HOTSTART_FAILED \n + RET_SHIFT_DETERMINATION_FAILED \n + RET_STEPDIRECTION_DETERMINATION_FAILED \n + RET_STEPLENGTH_DETERMINATION_FAILED \n + RET_HOMOTOPY_STEP_FAILED \n + RET_HOTSTART_STOPPED_INFEASIBILITY \n + RET_HOTSTART_STOPPED_UNBOUNDEDNESS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue hotstart( const real_t* const g_new, /**< Gradient of neighbouring QP to be solved. */ + const real_t* const lb_new, /**< Lower bounds of neighbouring QP to be solved. \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const ub_new, /**< Upper bounds of neighbouring QP to be solved. \n + If no upper bounds exist, a NULL pointer can be passed. */ + const real_t* const lbA_new, /**< Lower constraints' bounds of neighbouring QP to be solved. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + const real_t* const ubA_new, /**< Upper constraints' bounds of neighbouring QP to be solved. \n + If no upper constraints' bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations; \n + Output: Number of performed working set recalculations. */ + real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ + ); + + + /** Returns constraint matrix of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getA( real_t* const _A /**< Array of appropriate dimension for copying constraint matrix.*/ + ) const; + + /** Returns a single row of constraint matrix of the QP (deep copy). + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue getA( int number, /**< Number of entry to be returned. */ + real_t* const row /**< Array of appropriate dimension for copying (number)th constraint. */ + ) const; + + /** Returns lower constraints' bound vector of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getLBA( real_t* const _lbA /**< Array of appropriate dimension for copying lower constraints' bound vector.*/ + ) const; + + /** Returns single entry of lower constraints' bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue getLBA( int number, /**< Number of entry to be returned. */ + real_t& value /**< Output: lbA[number].*/ + ) const; + + /** Returns upper constraints' bound vector of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getUBA( real_t* const _ubA /**< Array of appropriate dimension for copying upper constraints' bound vector.*/ + ) const; + + /** Returns single entry of upper constraints' bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue getUBA( int number, /**< Number of entry to be returned. */ + real_t& value /**< Output: ubA[number].*/ + ) const; + + + /** Returns current constraints object of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getConstraints( Constraints* const _constraints /** Output: Constraints object. */ + ) const; + + + /** Returns the number of constraints. + * \return Number of constraints. */ + inline int getNC( ) const; + + /** Returns the number of (implicitly defined) equality constraints. + * \return Number of (implicitly defined) equality constraints. */ + inline int getNEC( ) const; + + /** Returns the number of active constraints. + * \return Number of active constraints. */ + inline int getNAC( ); + + /** Returns the number of inactive constraints. + * \return Number of inactive constraints. */ + inline int getNIAC( ); + + /** Returns the dimension of null space. + * \return Dimension of null space. */ + int getNZ( ); + + + /** Returns the dual solution vector (deep copy). + * \return SUCCESSFUL_RETURN \n + RET_QP_NOT_SOLVED */ + returnValue getDualSolution( real_t* const yOpt /**< Output: Dual solution vector (if QP has been solved). */ + ) const; + + + /* + * PROTECTED MEMBER FUNCTIONS + */ + protected: + /** Determines type of constraints and bounds (i.e. implicitly fixed, unbounded etc.). + * \return SUCCESSFUL_RETURN \n + RET_SETUPSUBJECTTOTYPE_FAILED */ + returnValue setupSubjectToType( ); + + /** Computes the Cholesky decomposition R of the projected Hessian (i.e. R^T*R = Z^T*H*Z). + * \return SUCCESSFUL_RETURN \n + * RET_INDEXLIST_CORRUPTED */ + returnValue setupCholeskyDecompositionProjected( ); + + /** Initialises TQ factorisation of A (i.e. A*Q = [0 T]) if NO constraint is active. + * \return SUCCESSFUL_RETURN \n + RET_INDEXLIST_CORRUPTED */ + returnValue setupTQfactorisation( ); + + + /** Solves a QProblem whose QP data is assumed to be stored in the member variables. + * A guess for its primal/dual optimal solution vectors and the corresponding + * working sets of bounds and constraints can be provided. + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_TQ \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED */ + returnValue solveInitialQP( const real_t* const xOpt, /**< Optimal primal solution vector. + * A NULL pointer can be passed. */ + const real_t* const yOpt, /**< Optimal dual solution vector. + * A NULL pointer can be passed. */ + const Bounds* const guessedBounds, /**< Guessed working set of bounds for solution (xOpt,yOpt). + * A NULL pointer can be passed. */ + const Constraints* const guessedConstraints, /**< Optimal working set of constraints for solution (xOpt,yOpt). + * A NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations; \n + * Output: Number of performed working set recalculations. */ + real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ + ); + + /** Obtains the desired working set for the auxiliary initial QP in + * accordance with the user specifications + * (assumes that member AX has already been initialised!) + * \return SUCCESSFUL_RETURN \n + RET_OBTAINING_WORKINGSET_FAILED \n + RET_INVALID_ARGUMENTS */ + returnValue obtainAuxiliaryWorkingSet( const real_t* const xOpt, /**< Optimal primal solution vector. + * If a NULL pointer is passed, all entries are assumed to be zero. */ + const real_t* const yOpt, /**< Optimal dual solution vector. + * If a NULL pointer is passed, all entries are assumed to be zero. */ + const Bounds* const guessedBounds, /**< Guessed working set of bounds for solution (xOpt,yOpt). */ + const Constraints* const guessedConstraints, /**< Guessed working set for solution (xOpt,yOpt). */ + Bounds* auxiliaryBounds, /**< Input: Allocated bound object. \n + * Ouput: Working set of constraints for auxiliary QP. */ + Constraints* auxiliaryConstraints /**< Input: Allocated bound object. \n + * Ouput: Working set for auxiliary QP. */ + ) const; + + /** Setups bound and constraints data structures according to auxiliaryBounds/Constraints. + * (If the working set shall be setup afresh, make sure that + * bounds and constraints data structure have been resetted + * and the TQ factorisation has been initialised!) + * \return SUCCESSFUL_RETURN \n + RET_SETUP_WORKINGSET_FAILED \n + RET_INVALID_ARGUMENTS \n + RET_UNKNOWN BUG */ + returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, /**< Working set of bounds for auxiliary QP. */ + const Constraints* const auxiliaryConstraints, /**< Working set of constraints for auxiliary QP. */ + BooleanType setupAfresh /**< Flag indicating if given working set shall be + * setup afresh or by updating the current one. */ + ); + + /** Setups the optimal primal/dual solution of the auxiliary initial QP. + * \return SUCCESSFUL_RETURN */ + returnValue setupAuxiliaryQPsolution( const real_t* const xOpt, /**< Optimal primal solution vector. + * If a NULL pointer is passed, all entries are set to zero. */ + const real_t* const yOpt /**< Optimal dual solution vector. + * If a NULL pointer is passed, all entries are set to zero. */ + ); + + /** Setups gradient of the auxiliary initial QP for given + * optimal primal/dual solution and given initial working set + * (assumes that members X, Y and BOUNDS, CONSTRAINTS have already been initialised!). + * \return SUCCESSFUL_RETURN */ + returnValue setupAuxiliaryQPgradient( ); + + /** Setups (constraints') bounds of the auxiliary initial QP for given + * optimal primal/dual solution and given initial working set + * (assumes that members X, Y and BOUNDS, CONSTRAINTS have already been initialised!). + * \return SUCCESSFUL_RETURN \n + RET_UNKNOWN BUG */ + returnValue setupAuxiliaryQPbounds( const Bounds* const auxiliaryBounds, /**< Working set of bounds for auxiliary QP. */ + const Constraints* const auxiliaryConstraints, /**< Working set of constraints for auxiliary QP. */ + BooleanType useRelaxation /**< Flag indicating if inactive (constraints') bounds shall be relaxed. */ + ); + + + /** Adds a constraint to active set. + * \return SUCCESSFUL_RETURN \n + RET_ADDCONSTRAINT_FAILED \n + RET_ADDCONSTRAINT_FAILED_INFEASIBILITY \n + RET_ENSURELI_FAILED */ + returnValue addConstraint( int number, /**< Number of constraint to be added to active set. */ + SubjectToStatus C_status, /**< Status of new active constraint. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + /** Checks if new active constraint to be added is linearly dependent from + * from row of the active constraints matrix. + * \return RET_LINEARLY_DEPENDENT \n + RET_LINEARLY_INDEPENDENT \n + RET_INDEXLIST_CORRUPTED */ + returnValue addConstraint_checkLI( int number /**< Number of constraint to be added to active set. */ + ); + + /** Ensures linear independence of constraint matrix when a new constraint is added. + * To this end a bound or constraint is removed simultaneously if necessary. + * \return SUCCESSFUL_RETURN \n + RET_LI_RESOLVED \n + RET_ENSURELI_FAILED \n + RET_ENSURELI_FAILED_TQ \n + RET_ENSURELI_FAILED_NOINDEX \n + RET_REMOVE_FROM_ACTIVESET */ + returnValue addConstraint_ensureLI( int number, /**< Number of constraint to be added to active set. */ + SubjectToStatus C_status /**< Status of new active bound. */ + ); + + /** Adds a bound to active set. + * \return SUCCESSFUL_RETURN \n + RET_ADDBOUND_FAILED \n + RET_ADDBOUND_FAILED_INFEASIBILITY \n + RET_ENSURELI_FAILED */ + returnValue addBound( int number, /**< Number of bound to be added to active set. */ + SubjectToStatus B_status, /**< Status of new active bound. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + /** Checks if new active bound to be added is linearly dependent from + * from row of the active constraints matrix. + * \return RET_LINEARLY_DEPENDENT \n + RET_LINEARLY_INDEPENDENT */ + returnValue addBound_checkLI( int number /**< Number of bound to be added to active set. */ + ); + + /** Ensures linear independence of constraint matrix when a new bound is added. + * To this end a bound or constraint is removed simultaneously if necessary. + * \return SUCCESSFUL_RETURN \n + RET_LI_RESOLVED \n + RET_ENSURELI_FAILED \n + RET_ENSURELI_FAILED_TQ \n + RET_ENSURELI_FAILED_NOINDEX \n + RET_REMOVE_FROM_ACTIVESET */ + returnValue addBound_ensureLI( int number, /**< Number of bound to be added to active set. */ + SubjectToStatus B_status /**< Status of new active bound. */ + ); + + /** Removes a constraint from active set. + * \return SUCCESSFUL_RETURN \n + RET_CONSTRAINT_NOT_ACTIVE \n + RET_REMOVECONSTRAINT_FAILED \n + RET_HESSIAN_NOT_SPD */ + returnValue removeConstraint( int number, /**< Number of constraint to be removed from active set. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + /** Removes a bounds from active set. + * \return SUCCESSFUL_RETURN \n + RET_BOUND_NOT_ACTIVE \n + RET_HESSIAN_NOT_SPD \n + RET_REMOVEBOUND_FAILED */ + returnValue removeBound( int number, /**< Number of bound to be removed from active set. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + + /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. + * \return SUCCESSFUL_RETURN \n + RET_DIV_BY_ZERO */ + returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ + BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ + real_t* const a /**< Output: Solution vector */ + ); + + /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. \n + * Special variant for the case that this function is called from within "removeBound()". + * \return SUCCESSFUL_RETURN \n + RET_DIV_BY_ZERO */ + returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ + BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ + BooleanType removingBound, /**< Indicates if function is called from "removeBound()". */ + real_t* const a /**< Output: Solution vector */ + ); + + + /** Solves the system Ta = b or T^Ta = b where T is a reverse upper triangular matrix. + * \return SUCCESSFUL_RETURN \n + RET_DIV_BY_ZERO */ + returnValue backsolveT( const real_t* const b, /**< Right hand side vector. */ + BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ + real_t* const a /**< Output: Solution vector */ + ); + + + /** Determines step direction of the shift of the QP data. + * \return SUCCESSFUL_RETURN */ + returnValue hotstart_determineDataShift(const int* const FX_idx, /**< Index array of fixed variables. */ + const int* const AC_idx, /**< Index array of active constraints. */ + const real_t* const g_new, /**< New gradient vector. */ + const real_t* const lbA_new,/**< New lower constraints' bounds. */ + const real_t* const ubA_new,/**< New upper constraints' bounds. */ + const real_t* const lb_new, /**< New lower bounds. */ + const real_t* const ub_new, /**< New upper bounds. */ + real_t* const delta_g, /**< Output: Step direction of gradient vector. */ + real_t* const delta_lbA, /**< Output: Step direction of lower constraints' bounds. */ + real_t* const delta_ubA, /**< Output: Step direction of upper constraints' bounds. */ + real_t* const delta_lb, /**< Output: Step direction of lower bounds. */ + real_t* const delta_ub, /**< Output: Step direction of upper bounds. */ + BooleanType& Delta_bC_isZero,/**< Output: Indicates if active constraints' bounds are to be shifted. */ + BooleanType& Delta_bB_isZero/**< Output: Indicates if active bounds are to be shifted. */ + ); + + /** Determines step direction of the homotopy path. + * \return SUCCESSFUL_RETURN \n + RET_STEPDIRECTION_FAILED_TQ \n + RET_STEPDIRECTION_FAILED_CHOLESKY */ + returnValue hotstart_determineStepDirection(const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const int* const AC_idx, /**< Index array of active constraints. */ + const real_t* const delta_g, /**< Step direction of gradient vector. */ + const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ + const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + BooleanType Delta_bC_isZero, /**< Indicates if active constraints' bounds are to be shifted. */ + BooleanType Delta_bB_isZero, /**< Indicates if active bounds are to be shifted. */ + real_t* const delta_xFX, /**< Output: Primal homotopy step direction of fixed variables. */ + real_t* const delta_xFR, /**< Output: Primal homotopy step direction of free variables. */ + real_t* const delta_yAC, /**< Output: Dual homotopy step direction of active constraints' multiplier. */ + real_t* const delta_yFX /**< Output: Dual homotopy step direction of fixed variables' multiplier. */ + ); + + /** Determines the maximum possible step length along the homotopy path. + * \return SUCCESSFUL_RETURN */ + returnValue hotstart_determineStepLength( const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const int* const AC_idx, /**< Index array of active constraints. */ + const int* const IAC_idx, /**< Index array of inactive constraints. */ + const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ + const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ + const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ + const real_t* const delta_yAC, /**< Dual homotopy step direction of active constraints' multiplier. */ + const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ + real_t* const delta_Ax, /**< Output: Step in vector Ax. */ + int& BC_idx, /**< Output: Index of blocking constraint. */ + SubjectToStatus& BC_status, /**< Output: Status of blocking constraint. */ + BooleanType& BC_isBound /**< Output: Indicates if blocking constraint is a bound. */ + ); + + /** Performs a step along the homotopy path (and updates active set). + * \return SUCCESSFUL_RETURN \n + RET_OPTIMAL_SOLUTION_FOUND \n + RET_REMOVE_FROM_ACTIVESET_FAILED \n + RET_ADD_TO_ACTIVESET_FAILED \n + RET_QP_INFEASIBLE */ + returnValue hotstart_performStep( const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const int* const AC_idx, /**< Index array of active constraints. */ + const int* const IAC_idx, /**< Index array of inactive constraints. */ + const real_t* const delta_g, /**< Step direction of gradient vector. */ + const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ + const real_t* const delta_ubA, /**< Step direction of upper constraints' bounds. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ + const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ + const real_t* const delta_yAC, /**< Dual homotopy step direction of active constraints' multiplier. */ + const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ + const real_t* const delta_Ax, /**< Step in vector Ax. */ + int BC_idx, /**< Index of blocking constraint. */ + SubjectToStatus BC_status, /**< Status of blocking constraint. */ + BooleanType BC_isBound /**< Indicates if blocking constraint is a bound. */ + ); + + + /** Checks if lower/upper (constraints') bounds remain consistent + * (i.e. if lb <= ub and lbA <= ubA ) during the current step. + * \return BT_TRUE iff (constraints") bounds remain consistent + */ + BooleanType areBoundsConsistent( const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + const real_t* const delta_lbA, /**< Step direction of lower constraints' bounds. */ + const real_t* const delta_ubA /**< Step direction of upper constraints' bounds. */ + ) const; + + + /** Setups internal QP data. + * \return SUCCESSFUL_RETURN \n + RET_INVALID_ARGUMENTS */ + returnValue setupQPdata( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _A, /**< Constraint matrix. */ + const real_t* const _lb, /**< Lower bound vector (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub, /**< Upper bound vector (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + const real_t* const _lbA, /**< Lower constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + const real_t* const _ubA /**< Upper constraints' bound vector. \n + If no lower constraints' bounds exist, a NULL pointer can be passed. */ + ); + + + #ifdef PC_DEBUG /* Define print functions only for debugging! */ + + /** Prints concise information on the current iteration. + * \return SUCCESSFUL_RETURN \n */ + returnValue printIteration( int iteration, /**< Number of current iteration. */ + int BC_idx, /**< Index of blocking constraint. */ + SubjectToStatus BC_status, /**< Status of blocking constraint. */ + BooleanType BC_isBound /**< Indicates if blocking constraint is a bound. */ + ); + + /** Prints concise information on the current iteration. + * NOTE: ONLY DEFINED FOR SUPPRESSING A COMPILER WARNING!! + * \return SUCCESSFUL_RETURN \n */ + returnValue printIteration( int iteration, /**< Number of current iteration. */ + int BC_idx, /**< Index of blocking bound. */ + SubjectToStatus BC_status /**< Status of blocking bound. */ + ); + + #endif /* PC_DEBUG */ + + + /** Determines the maximum violation of the KKT optimality conditions + * of the current iterate within the QProblem object. + * \return SUCCESSFUL_RETURN \n + * RET_INACCURATE_SOLUTION \n + * RET_NO_SOLUTION */ + returnValue checkKKTconditions( ); + + + /** Sets constraint matrix of the QP. \n + (Remark: Also internal vector Ax is recomputed!) + * \return SUCCESSFUL_RETURN */ + inline returnValue setA( const real_t* const A_new /**< New constraint matrix (with correct dimension!). */ + ); + + /** Changes single row of constraint matrix of the QP. \n + (Remark: Also correponding component of internal vector Ax is recomputed!) + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setA( int number, /**< Number of row to be changed. */ + const real_t* const value /**< New (number)th constraint (with correct dimension!). */ + ); + + + /** Sets constraints' lower bound vector of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setLBA( const real_t* const lbA_new /**< New constraints' lower bound vector (with correct dimension!). */ + ); + + /** Changes single entry of lower constraints' bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setLBA( int number, /**< Number of entry to be changed. */ + real_t value /**< New value for entry of lower constraints' bound vector (with correct dimension!). */ + ); + + /** Sets constraints' upper bound vector of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setUBA( const real_t* const ubA_new /**< New constraints' upper bound vector (with correct dimension!). */ + ); + + /** Changes single entry of upper constraints' bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setUBA( int number, /**< Number of entry to be changed. */ + real_t value /**< New value for entry of upper constraints' bound vector (with correct dimension!). */ + ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + real_t A[NCMAX_ALLOC*NVMAX]; /**< Constraint matrix. */ + real_t lbA[NCMAX_ALLOC]; /**< Lower constraints' bound vector. */ + real_t ubA[NCMAX_ALLOC]; /**< Upper constraints' bound vector. */ + + Constraints constraints; /**< Data structure for problem's constraints. */ + + real_t T[NVMAX*NVMAX]; /**< Reverse triangular matrix, A = [0 T]*Q'. */ + real_t Q[NVMAX*NVMAX]; /**< Orthonormal quadratic matrix, A = [0 T]*Q'. */ + int sizeT; /**< Matrix T is stored in a (sizeT x sizeT) array. */ + + real_t Ax[NCMAX_ALLOC]; /**< Stores the current product A*x (for increased efficiency only). */ + + CyclingManager cyclingManager; /**< Data structure for storing (possible) cycling information (NOT YET IMPLEMENTED!). */ +}; + + +#include + +#endif /* QPOASES_QPROBLEM_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/QProblemB.hpp b/phonelibs/qpoases/INCLUDE/QProblemB.hpp index 8b3acb82b..49ace9ef9 100644 --- a/phonelibs/qpoases/INCLUDE/QProblemB.hpp +++ b/phonelibs/qpoases/INCLUDE/QProblemB.hpp @@ -1,628 +1,628 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/QProblemB.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the QProblemB class which is able to use the newly - * developed online active set strategy for parametric quadratic programming - * for problems with (simple) bounds only. - */ - - - -#ifndef QPOASES_QPROBLEMB_HPP -#define QPOASES_QPROBLEMB_HPP - - -#include - - - -class SolutionAnalysis; - -/** Class for setting up and solving quadratic programs with (simple) bounds only. - * The main feature is the possibily to use the newly developed online active set strategy - * for parametric quadratic programming. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class QProblemB -{ - /* allow SolutionAnalysis class to access private members */ - friend class SolutionAnalysis; - - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - QProblemB( ); - - /** Constructor which takes the QP dimension only. */ - QProblemB( int _nV /**< Number of variables. */ - ); - - /** Copy constructor (deep copy). */ - QProblemB( const QProblemB& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~QProblemB( ); - - /** Assignment operator (deep copy). */ - QProblemB& operator=( const QProblemB& rhs /**< Rhs object. */ - ); - - - /** Clears all data structures of QProblemB except for QP data. - * \return SUCCESSFUL_RETURN \n - RET_RESET_FAILED */ - returnValue reset( ); - - - /** Initialises a QProblemB with given QP data and solves it - * using an initial homotopy with empty working set (at most nWSR iterations). - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED \n - RET_INVALID_ARGUMENTS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue init( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _lb, /**< Lower bounds (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub, /**< Upper bounds (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. \n - Output: Number of performed working set recalculations. */ - const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ - real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ - ); - - - /** Initialises a QProblemB with given QP data and solves it - * using an initial homotopy with empty working set (at most nWSR iterations). - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED \n - RET_INVALID_ARGUMENTS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue init( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _lb, /**< Lower bounds (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub, /**< Upper bounds (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. \n - Output: Number of performed working set recalculations. */ - const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ - real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ - ); - - - /** Solves an initialised QProblemB using online active set strategy. - * \return SUCCESSFUL_RETURN \n - RET_MAX_NWSR_REACHED \n - RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED \n - RET_HOTSTART_FAILED \n - RET_SHIFT_DETERMINATION_FAILED \n - RET_STEPDIRECTION_DETERMINATION_FAILED \n - RET_STEPLENGTH_DETERMINATION_FAILED \n - RET_HOMOTOPY_STEP_FAILED \n - RET_HOTSTART_STOPPED_INFEASIBILITY \n - RET_HOTSTART_STOPPED_UNBOUNDEDNESS \n - RET_INACCURATE_SOLUTION \n - RET_NO_SOLUTION */ - returnValue hotstart( const real_t* const g_new, /**< Gradient of neighbouring QP to be solved. */ - const real_t* const lb_new, /**< Lower bounds of neighbouring QP to be solved. \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const ub_new, /**< Upper bounds of neighbouring QP to be solved. \n - If no upper bounds exist, a NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations; \n - Output: Number of performed working set recalculations. */ - real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ - ); - - - /** Returns Hessian matrix of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getH( real_t* const _H /**< Array of appropriate dimension for copying Hessian matrix.*/ - ) const; - - /** Returns gradient vector of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getG( real_t* const _g /**< Array of appropriate dimension for copying gradient vector.*/ - ) const; - - /** Returns lower bound vector of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getLB( real_t* const _lb /**< Array of appropriate dimension for copying lower bound vector.*/ - ) const; - - /** Returns single entry of lower bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue getLB( int number, /**< Number of entry to be returned. */ - real_t& value /**< Output: lb[number].*/ - ) const; - - /** Returns upper bound vector of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getUB( real_t* const _ub /**< Array of appropriate dimension for copying upper bound vector.*/ - ) const; - - /** Returns single entry of upper bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue getUB( int number, /**< Number of entry to be returned. */ - real_t& value /**< Output: ub[number].*/ - ) const; - - - /** Returns current bounds object of the QP (deep copy). - * \return SUCCESSFUL_RETURN */ - inline returnValue getBounds( Bounds* const _bounds /** Output: Bounds object. */ - ) const; - - - /** Returns the number of variables. - * \return Number of variables. */ - inline int getNV( ) const; - - /** Returns the number of free variables. - * \return Number of free variables. */ - inline int getNFR( ); - - /** Returns the number of fixed variables. - * \return Number of fixed variables. */ - inline int getNFX( ); - - /** Returns the number of implicitly fixed variables. - * \return Number of implicitly fixed variables. */ - inline int getNFV( ) const; - - /** Returns the dimension of null space. - * \return Dimension of null space. */ - int getNZ( ); - - - /** Returns the optimal objective function value. - * \return finite value: Optimal objective function value (QP was solved) \n - +infinity: QP was not yet solved */ - real_t getObjVal( ) const; - - /** Returns the objective function value at an arbitrary point x. - * \return Objective function value at point x */ - real_t getObjVal( const real_t* const _x /**< Point at which the objective function shall be evaluated. */ - ) const; - - /** Returns the primal solution vector. - * \return SUCCESSFUL_RETURN \n - RET_QP_NOT_SOLVED */ - returnValue getPrimalSolution( real_t* const xOpt /**< Output: Primal solution vector (if QP has been solved). */ - ) const; - - /** Returns the dual solution vector. - * \return SUCCESSFUL_RETURN \n - RET_QP_NOT_SOLVED */ - returnValue getDualSolution( real_t* const yOpt /**< Output: Dual solution vector (if QP has been solved). */ - ) const; - - - /** Returns status of the solution process. - * \return Status of solution process. */ - inline QProblemStatus getStatus( ) const; - - - /** Returns if the QProblem object is initialised. - * \return BT_TRUE: QProblemB initialised \n - BT_FALSE: QProblemB not initialised */ - inline BooleanType isInitialised( ) const; - - /** Returns if the QP has been solved. - * \return BT_TRUE: QProblemB solved \n - BT_FALSE: QProblemB not solved */ - inline BooleanType isSolved( ) const; - - /** Returns if the QP is infeasible. - * \return BT_TRUE: QP infeasible \n - BT_FALSE: QP feasible (or not known to be infeasible!) */ - inline BooleanType isInfeasible( ) const; - - /** Returns if the QP is unbounded. - * \return BT_TRUE: QP unbounded \n - BT_FALSE: QP unbounded (or not known to be unbounded!) */ - inline BooleanType isUnbounded( ) const; - - - /** Returns the print level. - * \return Print level. */ - inline PrintLevel getPrintLevel( ) const; - - /** Changes the print level. - * \return SUCCESSFUL_RETURN */ - returnValue setPrintLevel( PrintLevel _printlevel /**< New print level. */ - ); - - - /** Returns Hessian type flag (type is not determined due to this call!). - * \return Hessian type. */ - inline HessianType getHessianType( ) const; - - /** Changes the print level. - * \return SUCCESSFUL_RETURN */ - inline returnValue setHessianType( HessianType _hessianType /**< New Hessian type. */ - ); - - - /* - * PROTECTED MEMBER FUNCTIONS - */ - protected: - /** Checks if Hessian happens to be the identity matrix, - * and sets corresponding status flag (otherwise the flag remains unaltered!). - * \return SUCCESSFUL_RETURN */ - returnValue checkForIdentityHessian( ); - - /** Determines type of constraints and bounds (i.e. implicitly fixed, unbounded etc.). - * \return SUCCESSFUL_RETURN \n - RET_SETUPSUBJECTTOTYPE_FAILED */ - returnValue setupSubjectToType( ); - - /** Computes the Cholesky decomposition R of the (simply projected) Hessian (i.e. R^T*R = Z^T*H*Z). - * It only works in the case where Z is a simple projection matrix! - * \return SUCCESSFUL_RETURN \n - * RET_INDEXLIST_CORRUPTED */ - returnValue setupCholeskyDecomposition( ); - - - /** Solves a QProblemB whose QP data is assumed to be stored in the member variables. - * A guess for its primal/dual optimal solution vectors and the corresponding - * optimal working set can be provided. - * \return SUCCESSFUL_RETURN \n - RET_INIT_FAILED \n - RET_INIT_FAILED_CHOLESKY \n - RET_INIT_FAILED_HOTSTART \n - RET_INIT_FAILED_INFEASIBILITY \n - RET_INIT_FAILED_UNBOUNDEDNESS \n - RET_MAX_NWSR_REACHED */ - returnValue solveInitialQP( const real_t* const xOpt, /**< Optimal primal solution vector. - * A NULL pointer can be passed. */ - const real_t* const yOpt, /**< Optimal dual solution vector. - * A NULL pointer can be passed. */ - const Bounds* const guessedBounds, /**< Guessed working set for solution (xOpt,yOpt). - * A NULL pointer can be passed. */ - int& nWSR, /**< Input: Maximum number of working set recalculations; \n - * Output: Number of performed working set recalculations. */ - real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ - ); - - - /** Obtains the desired working set for the auxiliary initial QP in - * accordance with the user specifications - * \return SUCCESSFUL_RETURN \n - RET_OBTAINING_WORKINGSET_FAILED \n - RET_INVALID_ARGUMENTS */ - returnValue obtainAuxiliaryWorkingSet( const real_t* const xOpt, /**< Optimal primal solution vector. - * If a NULL pointer is passed, all entries are assumed to be zero. */ - const real_t* const yOpt, /**< Optimal dual solution vector. - * If a NULL pointer is passed, all entries are assumed to be zero. */ - const Bounds* const guessedBounds, /**< Guessed working set for solution (xOpt,yOpt). */ - Bounds* auxiliaryBounds /**< Input: Allocated bound object. \n - * Ouput: Working set for auxiliary QP. */ - ) const; - - /** Setups bound data structure according to auxiliaryBounds. - * (If the working set shall be setup afresh, make sure that - * bounds data structure has been resetted!) - * \return SUCCESSFUL_RETURN \n - RET_SETUP_WORKINGSET_FAILED \n - RET_INVALID_ARGUMENTS \n - RET_UNKNOWN BUG */ - returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, /**< Working set for auxiliary QP. */ - BooleanType setupAfresh /**< Flag indicating if given working set shall be - * setup afresh or by updating the current one. */ - ); - - /** Setups the optimal primal/dual solution of the auxiliary initial QP. - * \return SUCCESSFUL_RETURN */ - returnValue setupAuxiliaryQPsolution( const real_t* const xOpt, /**< Optimal primal solution vector. - * If a NULL pointer is passed, all entries are set to zero. */ - const real_t* const yOpt /**< Optimal dual solution vector. - * If a NULL pointer is passed, all entries are set to zero. */ - ); - - /** Setups gradient of the auxiliary initial QP for given - * optimal primal/dual solution and given initial working set - * (assumes that members X, Y and BOUNDS have already been initialised!). - * \return SUCCESSFUL_RETURN */ - returnValue setupAuxiliaryQPgradient( ); - - /** Setups bounds of the auxiliary initial QP for given - * optimal primal/dual solution and given initial working set - * (assumes that members X, Y and BOUNDS have already been initialised!). - * \return SUCCESSFUL_RETURN \n - RET_UNKNOWN BUG */ - returnValue setupAuxiliaryQPbounds( BooleanType useRelaxation /**< Flag indicating if inactive bounds shall be relaxed. */ - ); - - - /** Adds a bound to active set (specialised version for the case where no constraints exist). - * \return SUCCESSFUL_RETURN \n - RET_ADDBOUND_FAILED */ - returnValue addBound( int number, /**< Number of bound to be added to active set. */ - SubjectToStatus B_status, /**< Status of new active bound. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - /** Removes a bounds from active set (specialised version for the case where no constraints exist). - * \return SUCCESSFUL_RETURN \n - RET_HESSIAN_NOT_SPD \n - RET_REMOVEBOUND_FAILED */ - returnValue removeBound( int number, /**< Number of bound to be removed from active set. */ - BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ - ); - - - /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. - * \return SUCCESSFUL_RETURN \n - RET_DIV_BY_ZERO */ - returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ - BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ - real_t* const a /**< Output: Solution vector */ - ); - - /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. \n - * Special variant for the case that this function is called from within "removeBound()". - * \return SUCCESSFUL_RETURN \n - RET_DIV_BY_ZERO */ - returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ - BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ - BooleanType removingBound, /**< Indicates if function is called from "removeBound()". */ - real_t* const a /**< Output: Solution vector */ - ); - - - /** Determines step direction of the shift of the QP data. - * \return SUCCESSFUL_RETURN */ - returnValue hotstart_determineDataShift(const int* const FX_idx, /**< Index array of fixed variables. */ - const real_t* const g_new, /**< New gradient vector. */ - const real_t* const lb_new, /**< New lower bounds. */ - const real_t* const ub_new, /**< New upper bounds. */ - real_t* const delta_g, /**< Output: Step direction of gradient vector. */ - real_t* const delta_lb, /**< Output: Step direction of lower bounds. */ - real_t* const delta_ub, /**< Output: Step direction of upper bounds. */ - BooleanType& Delta_bB_isZero/**< Output: Indicates if active bounds are to be shifted. */ - ); - - - /** Checks if lower/upper bounds remain consistent - * (i.e. if lb <= ub) during the current step. - * \return BT_TRUE iff bounds remain consistent - */ - BooleanType areBoundsConsistent( const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub /**< Step direction of upper bounds. */ - ) const; - - - /** Setups internal QP data. - * \return SUCCESSFUL_RETURN \n - RET_INVALID_ARGUMENTS */ - returnValue setupQPdata( const real_t* const _H, /**< Hessian matrix. */ - const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ - const real_t* const _g, /**< Gradient vector. */ - const real_t* const _lb, /**< Lower bounds (on variables). \n - If no lower bounds exist, a NULL pointer can be passed. */ - const real_t* const _ub /**< Upper bounds (on variables). \n - If no upper bounds exist, a NULL pointer can be passed. */ - ); - - - /** Sets Hessian matrix of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setH( const real_t* const H_new /**< New Hessian matrix (with correct dimension!). */ - ); - - /** Changes gradient vector of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setG( const real_t* const g_new /**< New gradient vector (with correct dimension!). */ - ); - - /** Changes lower bound vector of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setLB( const real_t* const lb_new /**< New lower bound vector (with correct dimension!). */ - ); - - /** Changes single entry of lower bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setLB( int number, /**< Number of entry to be changed. */ - real_t value /**< New value for entry of lower bound vector. */ - ); - - /** Changes upper bound vector of the QP. - * \return SUCCESSFUL_RETURN */ - inline returnValue setUB( const real_t* const ub_new /**< New upper bound vector (with correct dimension!). */ - ); - - /** Changes single entry of upper bound vector of the QP. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setUB( int number, /**< Number of entry to be changed. */ - real_t value /**< New value for entry of upper bound vector. */ - ); - - - /** Computes parameters for the Givens matrix G for which [x,y]*G = [z,0] - * \return SUCCESSFUL_RETURN */ - inline void computeGivens( real_t xold, /**< Matrix entry to be normalised. */ - real_t yold, /**< Matrix entry to be annihilated. */ - real_t& xnew, /**< Output: Normalised matrix entry. */ - real_t& ynew, /**< Output: Annihilated matrix entry. */ - real_t& c, /**< Output: Cosine entry of Givens matrix. */ - real_t& s /**< Output: Sine entry of Givens matrix. */ - ) const; - - /** Applies Givens matrix determined by c and s (cf. computeGivens). - * \return SUCCESSFUL_RETURN */ - inline void applyGivens( real_t c, /**< Cosine entry of Givens matrix. */ - real_t s, /**< Sine entry of Givens matrix. */ - real_t xold, /**< Matrix entry to be transformed corresponding to - * the normalised entry of the original matrix. */ - real_t yold, /**< Matrix entry to be transformed corresponding to - * the annihilated entry of the original matrix. */ - real_t& xnew, /**< Output: Transformed matrix entry corresponding to - * the normalised entry of the original matrix. */ - real_t& ynew /**< Output: Transformed matrix entry corresponding to - * the annihilated entry of the original matrix. */ - ) const; - - - /* - * PRIVATE MEMBER FUNCTIONS - */ - private: - /** Determines step direction of the homotopy path. - * \return SUCCESSFUL_RETURN \n - RET_STEPDIRECTION_FAILED_CHOLESKY */ - returnValue hotstart_determineStepDirection(const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const real_t* const delta_g, /**< Step direction of gradient vector. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - BooleanType Delta_bB_isZero, /**< Indicates if active bounds are to be shifted. */ - real_t* const delta_xFX, /**< Output: Primal homotopy step direction of fixed variables. */ - real_t* const delta_xFR, /**< Output: Primal homotopy step direction of free variables. */ - real_t* const delta_yFX /**< Output: Dual homotopy step direction of fixed variables' multiplier. */ - ); - - /** Determines the maximum possible step length along the homotopy path. - * \return SUCCESSFUL_RETURN */ - returnValue hotstart_determineStepLength( const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ - const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ - int& BC_idx, /**< Output: Index of blocking constraint. */ - SubjectToStatus& BC_status /**< Output: Status of blocking constraint. */ - ); - - /** Performs a step along the homotopy path (and updates active set). - * \return SUCCESSFUL_RETURN \n - RET_OPTIMAL_SOLUTION_FOUND \n - RET_REMOVE_FROM_ACTIVESET_FAILED \n - RET_ADD_TO_ACTIVESET_FAILED \n - RET_QP_INFEASIBLE */ - returnValue hotstart_performStep( const int* const FR_idx, /**< Index array of free variables. */ - const int* const FX_idx, /**< Index array of fixed variables. */ - const real_t* const delta_g, /**< Step direction of gradient vector. */ - const real_t* const delta_lb, /**< Step direction of lower bounds. */ - const real_t* const delta_ub, /**< Step direction of upper bounds. */ - const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ - const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ - const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ - int BC_idx, /**< Index of blocking constraint. */ - SubjectToStatus BC_status /**< Status of blocking constraint. */ - ); - - - #ifdef PC_DEBUG /* Define print functions only for debugging! */ - - /** Prints concise information on the current iteration. - * \return SUCCESSFUL_RETURN \n */ - returnValue printIteration( int iteration, /**< Number of current iteration. */ - int BC_idx, /**< Index of blocking bound. */ - SubjectToStatus BC_status /**< Status of blocking bound. */ - ); - - #endif /* PC_DEBUG */ - - - /** Determines the maximum violation of the KKT optimality conditions - * of the current iterate within the QProblemB object. - * \return SUCCESSFUL_RETURN \n - * RET_INACCURATE_SOLUTION \n - * RET_NO_SOLUTION */ - returnValue checkKKTconditions( ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - real_t H[NVMAX*NVMAX]; /**< Hessian matrix. */ - BooleanType hasHessian; /**< Flag indicating whether H contains Hessian or corresponding Cholesky factor R; \sa init. */ - - real_t g[NVMAX]; /**< Gradient. */ - real_t lb[NVMAX]; /**< Lower bound vector (on variables). */ - real_t ub[NVMAX]; /**< Upper bound vector (on variables). */ - - Bounds bounds; /**< Data structure for problem's bounds. */ - - real_t R[NVMAX*NVMAX]; /**< Cholesky decomposition of H (i.e. H = R^T*R). */ - BooleanType hasCholesky; /**< Flag indicating whether Cholesky decomposition has already been setup. */ - - real_t x[NVMAX]; /**< Primal solution vector. */ - real_t y[NVMAX+NCMAX]; /**< Dual solution vector. */ - - real_t tau; /**< Last homotopy step length. */ - - QProblemStatus status; /**< Current status of the solution process. */ - - BooleanType infeasible; /**< QP infeasible? */ - BooleanType unbounded; /**< QP unbounded? */ - - HessianType hessianType; /**< Type of Hessian matrix. */ - - PrintLevel printlevel; /**< Print level. */ - - int count; /**< Counts the number of hotstart function calls (internal usage only!). */ -}; - - -#include - -#endif /* QPOASES_QPROBLEMB_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/QProblemB.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the QProblemB class which is able to use the newly + * developed online active set strategy for parametric quadratic programming + * for problems with (simple) bounds only. + */ + + + +#ifndef QPOASES_QPROBLEMB_HPP +#define QPOASES_QPROBLEMB_HPP + + +#include + + + +class SolutionAnalysis; + +/** Class for setting up and solving quadratic programs with (simple) bounds only. + * The main feature is the possibily to use the newly developed online active set strategy + * for parametric quadratic programming. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class QProblemB +{ + /* allow SolutionAnalysis class to access private members */ + friend class SolutionAnalysis; + + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + QProblemB( ); + + /** Constructor which takes the QP dimension only. */ + QProblemB( int _nV /**< Number of variables. */ + ); + + /** Copy constructor (deep copy). */ + QProblemB( const QProblemB& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~QProblemB( ); + + /** Assignment operator (deep copy). */ + QProblemB& operator=( const QProblemB& rhs /**< Rhs object. */ + ); + + + /** Clears all data structures of QProblemB except for QP data. + * \return SUCCESSFUL_RETURN \n + RET_RESET_FAILED */ + returnValue reset( ); + + + /** Initialises a QProblemB with given QP data and solves it + * using an initial homotopy with empty working set (at most nWSR iterations). + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED \n + RET_INVALID_ARGUMENTS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue init( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _lb, /**< Lower bounds (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub, /**< Upper bounds (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. \n + Output: Number of performed working set recalculations. */ + const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ + real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ + ); + + + /** Initialises a QProblemB with given QP data and solves it + * using an initial homotopy with empty working set (at most nWSR iterations). + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED \n + RET_INVALID_ARGUMENTS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue init( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _lb, /**< Lower bounds (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub, /**< Upper bounds (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations when using initial homotopy. \n + Output: Number of performed working set recalculations. */ + const real_t* const yOpt = 0, /**< Initial guess for dual solution vector. */ + real_t* const cputime = 0 /**< Output: CPU time required to initialise QP. */ + ); + + + /** Solves an initialised QProblemB using online active set strategy. + * \return SUCCESSFUL_RETURN \n + RET_MAX_NWSR_REACHED \n + RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED \n + RET_HOTSTART_FAILED \n + RET_SHIFT_DETERMINATION_FAILED \n + RET_STEPDIRECTION_DETERMINATION_FAILED \n + RET_STEPLENGTH_DETERMINATION_FAILED \n + RET_HOMOTOPY_STEP_FAILED \n + RET_HOTSTART_STOPPED_INFEASIBILITY \n + RET_HOTSTART_STOPPED_UNBOUNDEDNESS \n + RET_INACCURATE_SOLUTION \n + RET_NO_SOLUTION */ + returnValue hotstart( const real_t* const g_new, /**< Gradient of neighbouring QP to be solved. */ + const real_t* const lb_new, /**< Lower bounds of neighbouring QP to be solved. \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const ub_new, /**< Upper bounds of neighbouring QP to be solved. \n + If no upper bounds exist, a NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations; \n + Output: Number of performed working set recalculations. */ + real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ + ); + + + /** Returns Hessian matrix of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getH( real_t* const _H /**< Array of appropriate dimension for copying Hessian matrix.*/ + ) const; + + /** Returns gradient vector of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getG( real_t* const _g /**< Array of appropriate dimension for copying gradient vector.*/ + ) const; + + /** Returns lower bound vector of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getLB( real_t* const _lb /**< Array of appropriate dimension for copying lower bound vector.*/ + ) const; + + /** Returns single entry of lower bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue getLB( int number, /**< Number of entry to be returned. */ + real_t& value /**< Output: lb[number].*/ + ) const; + + /** Returns upper bound vector of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getUB( real_t* const _ub /**< Array of appropriate dimension for copying upper bound vector.*/ + ) const; + + /** Returns single entry of upper bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue getUB( int number, /**< Number of entry to be returned. */ + real_t& value /**< Output: ub[number].*/ + ) const; + + + /** Returns current bounds object of the QP (deep copy). + * \return SUCCESSFUL_RETURN */ + inline returnValue getBounds( Bounds* const _bounds /** Output: Bounds object. */ + ) const; + + + /** Returns the number of variables. + * \return Number of variables. */ + inline int getNV( ) const; + + /** Returns the number of free variables. + * \return Number of free variables. */ + inline int getNFR( ); + + /** Returns the number of fixed variables. + * \return Number of fixed variables. */ + inline int getNFX( ); + + /** Returns the number of implicitly fixed variables. + * \return Number of implicitly fixed variables. */ + inline int getNFV( ) const; + + /** Returns the dimension of null space. + * \return Dimension of null space. */ + int getNZ( ); + + + /** Returns the optimal objective function value. + * \return finite value: Optimal objective function value (QP was solved) \n + +infinity: QP was not yet solved */ + real_t getObjVal( ) const; + + /** Returns the objective function value at an arbitrary point x. + * \return Objective function value at point x */ + real_t getObjVal( const real_t* const _x /**< Point at which the objective function shall be evaluated. */ + ) const; + + /** Returns the primal solution vector. + * \return SUCCESSFUL_RETURN \n + RET_QP_NOT_SOLVED */ + returnValue getPrimalSolution( real_t* const xOpt /**< Output: Primal solution vector (if QP has been solved). */ + ) const; + + /** Returns the dual solution vector. + * \return SUCCESSFUL_RETURN \n + RET_QP_NOT_SOLVED */ + returnValue getDualSolution( real_t* const yOpt /**< Output: Dual solution vector (if QP has been solved). */ + ) const; + + + /** Returns status of the solution process. + * \return Status of solution process. */ + inline QProblemStatus getStatus( ) const; + + + /** Returns if the QProblem object is initialised. + * \return BT_TRUE: QProblemB initialised \n + BT_FALSE: QProblemB not initialised */ + inline BooleanType isInitialised( ) const; + + /** Returns if the QP has been solved. + * \return BT_TRUE: QProblemB solved \n + BT_FALSE: QProblemB not solved */ + inline BooleanType isSolved( ) const; + + /** Returns if the QP is infeasible. + * \return BT_TRUE: QP infeasible \n + BT_FALSE: QP feasible (or not known to be infeasible!) */ + inline BooleanType isInfeasible( ) const; + + /** Returns if the QP is unbounded. + * \return BT_TRUE: QP unbounded \n + BT_FALSE: QP unbounded (or not known to be unbounded!) */ + inline BooleanType isUnbounded( ) const; + + + /** Returns the print level. + * \return Print level. */ + inline PrintLevel getPrintLevel( ) const; + + /** Changes the print level. + * \return SUCCESSFUL_RETURN */ + returnValue setPrintLevel( PrintLevel _printlevel /**< New print level. */ + ); + + + /** Returns Hessian type flag (type is not determined due to this call!). + * \return Hessian type. */ + inline HessianType getHessianType( ) const; + + /** Changes the print level. + * \return SUCCESSFUL_RETURN */ + inline returnValue setHessianType( HessianType _hessianType /**< New Hessian type. */ + ); + + + /* + * PROTECTED MEMBER FUNCTIONS + */ + protected: + /** Checks if Hessian happens to be the identity matrix, + * and sets corresponding status flag (otherwise the flag remains unaltered!). + * \return SUCCESSFUL_RETURN */ + returnValue checkForIdentityHessian( ); + + /** Determines type of constraints and bounds (i.e. implicitly fixed, unbounded etc.). + * \return SUCCESSFUL_RETURN \n + RET_SETUPSUBJECTTOTYPE_FAILED */ + returnValue setupSubjectToType( ); + + /** Computes the Cholesky decomposition R of the (simply projected) Hessian (i.e. R^T*R = Z^T*H*Z). + * It only works in the case where Z is a simple projection matrix! + * \return SUCCESSFUL_RETURN \n + * RET_INDEXLIST_CORRUPTED */ + returnValue setupCholeskyDecomposition( ); + + + /** Solves a QProblemB whose QP data is assumed to be stored in the member variables. + * A guess for its primal/dual optimal solution vectors and the corresponding + * optimal working set can be provided. + * \return SUCCESSFUL_RETURN \n + RET_INIT_FAILED \n + RET_INIT_FAILED_CHOLESKY \n + RET_INIT_FAILED_HOTSTART \n + RET_INIT_FAILED_INFEASIBILITY \n + RET_INIT_FAILED_UNBOUNDEDNESS \n + RET_MAX_NWSR_REACHED */ + returnValue solveInitialQP( const real_t* const xOpt, /**< Optimal primal solution vector. + * A NULL pointer can be passed. */ + const real_t* const yOpt, /**< Optimal dual solution vector. + * A NULL pointer can be passed. */ + const Bounds* const guessedBounds, /**< Guessed working set for solution (xOpt,yOpt). + * A NULL pointer can be passed. */ + int& nWSR, /**< Input: Maximum number of working set recalculations; \n + * Output: Number of performed working set recalculations. */ + real_t* const cputime /**< Output: CPU time required to solve QP (or to perform nWSR iterations). */ + ); + + + /** Obtains the desired working set for the auxiliary initial QP in + * accordance with the user specifications + * \return SUCCESSFUL_RETURN \n + RET_OBTAINING_WORKINGSET_FAILED \n + RET_INVALID_ARGUMENTS */ + returnValue obtainAuxiliaryWorkingSet( const real_t* const xOpt, /**< Optimal primal solution vector. + * If a NULL pointer is passed, all entries are assumed to be zero. */ + const real_t* const yOpt, /**< Optimal dual solution vector. + * If a NULL pointer is passed, all entries are assumed to be zero. */ + const Bounds* const guessedBounds, /**< Guessed working set for solution (xOpt,yOpt). */ + Bounds* auxiliaryBounds /**< Input: Allocated bound object. \n + * Ouput: Working set for auxiliary QP. */ + ) const; + + /** Setups bound data structure according to auxiliaryBounds. + * (If the working set shall be setup afresh, make sure that + * bounds data structure has been resetted!) + * \return SUCCESSFUL_RETURN \n + RET_SETUP_WORKINGSET_FAILED \n + RET_INVALID_ARGUMENTS \n + RET_UNKNOWN BUG */ + returnValue setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, /**< Working set for auxiliary QP. */ + BooleanType setupAfresh /**< Flag indicating if given working set shall be + * setup afresh or by updating the current one. */ + ); + + /** Setups the optimal primal/dual solution of the auxiliary initial QP. + * \return SUCCESSFUL_RETURN */ + returnValue setupAuxiliaryQPsolution( const real_t* const xOpt, /**< Optimal primal solution vector. + * If a NULL pointer is passed, all entries are set to zero. */ + const real_t* const yOpt /**< Optimal dual solution vector. + * If a NULL pointer is passed, all entries are set to zero. */ + ); + + /** Setups gradient of the auxiliary initial QP for given + * optimal primal/dual solution and given initial working set + * (assumes that members X, Y and BOUNDS have already been initialised!). + * \return SUCCESSFUL_RETURN */ + returnValue setupAuxiliaryQPgradient( ); + + /** Setups bounds of the auxiliary initial QP for given + * optimal primal/dual solution and given initial working set + * (assumes that members X, Y and BOUNDS have already been initialised!). + * \return SUCCESSFUL_RETURN \n + RET_UNKNOWN BUG */ + returnValue setupAuxiliaryQPbounds( BooleanType useRelaxation /**< Flag indicating if inactive bounds shall be relaxed. */ + ); + + + /** Adds a bound to active set (specialised version for the case where no constraints exist). + * \return SUCCESSFUL_RETURN \n + RET_ADDBOUND_FAILED */ + returnValue addBound( int number, /**< Number of bound to be added to active set. */ + SubjectToStatus B_status, /**< Status of new active bound. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + /** Removes a bounds from active set (specialised version for the case where no constraints exist). + * \return SUCCESSFUL_RETURN \n + RET_HESSIAN_NOT_SPD \n + RET_REMOVEBOUND_FAILED */ + returnValue removeBound( int number, /**< Number of bound to be removed from active set. */ + BooleanType updateCholesky /**< Flag indicating if Cholesky decomposition shall be updated. */ + ); + + + /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. + * \return SUCCESSFUL_RETURN \n + RET_DIV_BY_ZERO */ + returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ + BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ + real_t* const a /**< Output: Solution vector */ + ); + + /** Solves the system Ra = b or R^Ta = b where R is an upper triangular matrix. \n + * Special variant for the case that this function is called from within "removeBound()". + * \return SUCCESSFUL_RETURN \n + RET_DIV_BY_ZERO */ + returnValue backsolveR( const real_t* const b, /**< Right hand side vector. */ + BooleanType transposed, /**< Indicates if the transposed system shall be solved. */ + BooleanType removingBound, /**< Indicates if function is called from "removeBound()". */ + real_t* const a /**< Output: Solution vector */ + ); + + + /** Determines step direction of the shift of the QP data. + * \return SUCCESSFUL_RETURN */ + returnValue hotstart_determineDataShift(const int* const FX_idx, /**< Index array of fixed variables. */ + const real_t* const g_new, /**< New gradient vector. */ + const real_t* const lb_new, /**< New lower bounds. */ + const real_t* const ub_new, /**< New upper bounds. */ + real_t* const delta_g, /**< Output: Step direction of gradient vector. */ + real_t* const delta_lb, /**< Output: Step direction of lower bounds. */ + real_t* const delta_ub, /**< Output: Step direction of upper bounds. */ + BooleanType& Delta_bB_isZero/**< Output: Indicates if active bounds are to be shifted. */ + ); + + + /** Checks if lower/upper bounds remain consistent + * (i.e. if lb <= ub) during the current step. + * \return BT_TRUE iff bounds remain consistent + */ + BooleanType areBoundsConsistent( const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub /**< Step direction of upper bounds. */ + ) const; + + + /** Setups internal QP data. + * \return SUCCESSFUL_RETURN \n + RET_INVALID_ARGUMENTS */ + returnValue setupQPdata( const real_t* const _H, /**< Hessian matrix. */ + const real_t* const _R, /**< Cholesky factorization of the Hessian matrix. */ + const real_t* const _g, /**< Gradient vector. */ + const real_t* const _lb, /**< Lower bounds (on variables). \n + If no lower bounds exist, a NULL pointer can be passed. */ + const real_t* const _ub /**< Upper bounds (on variables). \n + If no upper bounds exist, a NULL pointer can be passed. */ + ); + + + /** Sets Hessian matrix of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setH( const real_t* const H_new /**< New Hessian matrix (with correct dimension!). */ + ); + + /** Changes gradient vector of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setG( const real_t* const g_new /**< New gradient vector (with correct dimension!). */ + ); + + /** Changes lower bound vector of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setLB( const real_t* const lb_new /**< New lower bound vector (with correct dimension!). */ + ); + + /** Changes single entry of lower bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setLB( int number, /**< Number of entry to be changed. */ + real_t value /**< New value for entry of lower bound vector. */ + ); + + /** Changes upper bound vector of the QP. + * \return SUCCESSFUL_RETURN */ + inline returnValue setUB( const real_t* const ub_new /**< New upper bound vector (with correct dimension!). */ + ); + + /** Changes single entry of upper bound vector of the QP. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setUB( int number, /**< Number of entry to be changed. */ + real_t value /**< New value for entry of upper bound vector. */ + ); + + + /** Computes parameters for the Givens matrix G for which [x,y]*G = [z,0] + * \return SUCCESSFUL_RETURN */ + inline void computeGivens( real_t xold, /**< Matrix entry to be normalised. */ + real_t yold, /**< Matrix entry to be annihilated. */ + real_t& xnew, /**< Output: Normalised matrix entry. */ + real_t& ynew, /**< Output: Annihilated matrix entry. */ + real_t& c, /**< Output: Cosine entry of Givens matrix. */ + real_t& s /**< Output: Sine entry of Givens matrix. */ + ) const; + + /** Applies Givens matrix determined by c and s (cf. computeGivens). + * \return SUCCESSFUL_RETURN */ + inline void applyGivens( real_t c, /**< Cosine entry of Givens matrix. */ + real_t s, /**< Sine entry of Givens matrix. */ + real_t xold, /**< Matrix entry to be transformed corresponding to + * the normalised entry of the original matrix. */ + real_t yold, /**< Matrix entry to be transformed corresponding to + * the annihilated entry of the original matrix. */ + real_t& xnew, /**< Output: Transformed matrix entry corresponding to + * the normalised entry of the original matrix. */ + real_t& ynew /**< Output: Transformed matrix entry corresponding to + * the annihilated entry of the original matrix. */ + ) const; + + + /* + * PRIVATE MEMBER FUNCTIONS + */ + private: + /** Determines step direction of the homotopy path. + * \return SUCCESSFUL_RETURN \n + RET_STEPDIRECTION_FAILED_CHOLESKY */ + returnValue hotstart_determineStepDirection(const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const real_t* const delta_g, /**< Step direction of gradient vector. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + BooleanType Delta_bB_isZero, /**< Indicates if active bounds are to be shifted. */ + real_t* const delta_xFX, /**< Output: Primal homotopy step direction of fixed variables. */ + real_t* const delta_xFR, /**< Output: Primal homotopy step direction of free variables. */ + real_t* const delta_yFX /**< Output: Dual homotopy step direction of fixed variables' multiplier. */ + ); + + /** Determines the maximum possible step length along the homotopy path. + * \return SUCCESSFUL_RETURN */ + returnValue hotstart_determineStepLength( const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ + const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ + int& BC_idx, /**< Output: Index of blocking constraint. */ + SubjectToStatus& BC_status /**< Output: Status of blocking constraint. */ + ); + + /** Performs a step along the homotopy path (and updates active set). + * \return SUCCESSFUL_RETURN \n + RET_OPTIMAL_SOLUTION_FOUND \n + RET_REMOVE_FROM_ACTIVESET_FAILED \n + RET_ADD_TO_ACTIVESET_FAILED \n + RET_QP_INFEASIBLE */ + returnValue hotstart_performStep( const int* const FR_idx, /**< Index array of free variables. */ + const int* const FX_idx, /**< Index array of fixed variables. */ + const real_t* const delta_g, /**< Step direction of gradient vector. */ + const real_t* const delta_lb, /**< Step direction of lower bounds. */ + const real_t* const delta_ub, /**< Step direction of upper bounds. */ + const real_t* const delta_xFX, /**< Primal homotopy step direction of fixed variables. */ + const real_t* const delta_xFR, /**< Primal homotopy step direction of free variables. */ + const real_t* const delta_yFX, /**< Dual homotopy step direction of fixed variables' multiplier. */ + int BC_idx, /**< Index of blocking constraint. */ + SubjectToStatus BC_status /**< Status of blocking constraint. */ + ); + + + #ifdef PC_DEBUG /* Define print functions only for debugging! */ + + /** Prints concise information on the current iteration. + * \return SUCCESSFUL_RETURN \n */ + returnValue printIteration( int iteration, /**< Number of current iteration. */ + int BC_idx, /**< Index of blocking bound. */ + SubjectToStatus BC_status /**< Status of blocking bound. */ + ); + + #endif /* PC_DEBUG */ + + + /** Determines the maximum violation of the KKT optimality conditions + * of the current iterate within the QProblemB object. + * \return SUCCESSFUL_RETURN \n + * RET_INACCURATE_SOLUTION \n + * RET_NO_SOLUTION */ + returnValue checkKKTconditions( ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + real_t H[NVMAX*NVMAX]; /**< Hessian matrix. */ + BooleanType hasHessian; /**< Flag indicating whether H contains Hessian or corresponding Cholesky factor R; \sa init. */ + + real_t g[NVMAX]; /**< Gradient. */ + real_t lb[NVMAX]; /**< Lower bound vector (on variables). */ + real_t ub[NVMAX]; /**< Upper bound vector (on variables). */ + + Bounds bounds; /**< Data structure for problem's bounds. */ + + real_t R[NVMAX*NVMAX]; /**< Cholesky decomposition of H (i.e. H = R^T*R). */ + BooleanType hasCholesky; /**< Flag indicating whether Cholesky decomposition has already been setup. */ + + real_t x[NVMAX]; /**< Primal solution vector. */ + real_t y[NVMAX+NCMAX]; /**< Dual solution vector. */ + + real_t tau; /**< Last homotopy step length. */ + + QProblemStatus status; /**< Current status of the solution process. */ + + BooleanType infeasible; /**< QP infeasible? */ + BooleanType unbounded; /**< QP unbounded? */ + + HessianType hessianType; /**< Type of Hessian matrix. */ + + PrintLevel printlevel; /**< Print level. */ + + int count; /**< Counts the number of hotstart function calls (internal usage only!). */ +}; + + +#include + +#endif /* QPOASES_QPROBLEMB_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/SubjectTo.hpp b/phonelibs/qpoases/INCLUDE/SubjectTo.hpp index a014843ce..e07bf0421 100644 --- a/phonelibs/qpoases/INCLUDE/SubjectTo.hpp +++ b/phonelibs/qpoases/INCLUDE/SubjectTo.hpp @@ -1,178 +1,178 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/SubjectTo.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of the SubjectTo class designed to manage working sets of - * constraints and bounds within a QProblem. - */ - - -#ifndef QPOASES_SUBJECTTO_HPP -#define QPOASES_SUBJECTTO_HPP - - -#include - - - -/** This class manages working sets of constraints and bounds by storing - * index sets and other status information. - * - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - */ -class SubjectTo -{ - /* - * PUBLIC MEMBER FUNCTIONS - */ - public: - /** Default constructor. */ - SubjectTo( ); - - /** Copy constructor (deep copy). */ - SubjectTo( const SubjectTo& rhs /**< Rhs object. */ - ); - - /** Destructor. */ - ~SubjectTo( ); - - /** Assignment operator (deep copy). */ - SubjectTo& operator=( const SubjectTo& rhs /**< Rhs object. */ - ); - - - /** Pseudo-constructor takes the number of constraints or bounds. - * \return SUCCESSFUL_RETURN */ - returnValue init( int n /**< Number of constraints or bounds. */ - ); - - - /** Returns type of (constraints') bound. - * \return Type of (constraints') bound \n - RET_INDEX_OUT_OF_BOUNDS */ - inline SubjectToType getType( int i /**< Number of (constraints') bound. */ - ) const ; - - /** Returns status of (constraints') bound. - * \return Status of (constraints') bound \n - ST_UNDEFINED */ - inline SubjectToStatus getStatus( int i /**< Number of (constraints') bound. */ - ) const; - - - /** Sets type of (constraints') bound. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setType( int i, /**< Number of (constraints') bound. */ - SubjectToType value /**< Type of (constraints') bound. */ - ); - - /** Sets status of (constraints') bound. - * \return SUCCESSFUL_RETURN \n - RET_INDEX_OUT_OF_BOUNDS */ - inline returnValue setStatus( int i, /**< Number of (constraints') bound. */ - SubjectToStatus value /**< Status of (constraints') bound. */ - ); - - - /** Sets status of lower (constraints') bounds. */ - inline void setNoLower( BooleanType _status /**< Status of lower (constraints') bounds. */ - ); - - /** Sets status of upper (constraints') bounds. */ - inline void setNoUpper( BooleanType _status /**< Status of upper (constraints') bounds. */ - ); - - - /** Returns status of lower (constraints') bounds. - * \return BT_TRUE if there is no lower (constraints') bound on any variable. */ - inline BooleanType isNoLower( ) const; - - /** Returns status of upper bounds. - * \return BT_TRUE if there is no upper (constraints') bound on any variable. */ - inline BooleanType isNoUpper( ) const; - - - /* - * PROTECTED MEMBER FUNCTIONS - */ - protected: - /** Adds the index of a new constraint or bound to index set. - * \return SUCCESSFUL_RETURN \n - RET_ADDINDEX_FAILED */ - returnValue addIndex( Indexlist* const indexlist, /**< Index list to which the new index shall be added. */ - int newnumber, /**< Number of new constraint or bound. */ - SubjectToStatus newstatus /**< Status of new constraint or bound. */ - ); - - /** Removes the index of a constraint or bound from index set. - * \return SUCCESSFUL_RETURN \n - RET_UNKNOWN_BUG */ - returnValue removeIndex( Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */ - int removenumber /**< Number of constraint or bound to be removed. */ - ); - - /** Swaps the indices of two constraints or bounds within the index set. - * \return SUCCESSFUL_RETURN \n - RET_SWAPINDEX_FAILED */ - returnValue swapIndex( Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */ - int number1, /**< Number of first constraint or bound. */ - int number2 /**< Number of second constraint or bound. */ - ); - - - /* - * PROTECTED MEMBER VARIABLES - */ - protected: - SubjectToType type[NVMAX+NCMAX]; /**< Type of constraints/bounds. */ - SubjectToStatus status[NVMAX+NCMAX]; /**< Status of constraints/bounds. */ - - BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */ - BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */ - - - /* - * PRIVATE MEMBER VARIABLES - */ - private: - int size; -}; - - - -#include - -#endif /* QPOASES_SUBJECTTO_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/SubjectTo.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of the SubjectTo class designed to manage working sets of + * constraints and bounds within a QProblem. + */ + + +#ifndef QPOASES_SUBJECTTO_HPP +#define QPOASES_SUBJECTTO_HPP + + +#include + + + +/** This class manages working sets of constraints and bounds by storing + * index sets and other status information. + * + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + */ +class SubjectTo +{ + /* + * PUBLIC MEMBER FUNCTIONS + */ + public: + /** Default constructor. */ + SubjectTo( ); + + /** Copy constructor (deep copy). */ + SubjectTo( const SubjectTo& rhs /**< Rhs object. */ + ); + + /** Destructor. */ + ~SubjectTo( ); + + /** Assignment operator (deep copy). */ + SubjectTo& operator=( const SubjectTo& rhs /**< Rhs object. */ + ); + + + /** Pseudo-constructor takes the number of constraints or bounds. + * \return SUCCESSFUL_RETURN */ + returnValue init( int n /**< Number of constraints or bounds. */ + ); + + + /** Returns type of (constraints') bound. + * \return Type of (constraints') bound \n + RET_INDEX_OUT_OF_BOUNDS */ + inline SubjectToType getType( int i /**< Number of (constraints') bound. */ + ) const ; + + /** Returns status of (constraints') bound. + * \return Status of (constraints') bound \n + ST_UNDEFINED */ + inline SubjectToStatus getStatus( int i /**< Number of (constraints') bound. */ + ) const; + + + /** Sets type of (constraints') bound. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setType( int i, /**< Number of (constraints') bound. */ + SubjectToType value /**< Type of (constraints') bound. */ + ); + + /** Sets status of (constraints') bound. + * \return SUCCESSFUL_RETURN \n + RET_INDEX_OUT_OF_BOUNDS */ + inline returnValue setStatus( int i, /**< Number of (constraints') bound. */ + SubjectToStatus value /**< Status of (constraints') bound. */ + ); + + + /** Sets status of lower (constraints') bounds. */ + inline void setNoLower( BooleanType _status /**< Status of lower (constraints') bounds. */ + ); + + /** Sets status of upper (constraints') bounds. */ + inline void setNoUpper( BooleanType _status /**< Status of upper (constraints') bounds. */ + ); + + + /** Returns status of lower (constraints') bounds. + * \return BT_TRUE if there is no lower (constraints') bound on any variable. */ + inline BooleanType isNoLower( ) const; + + /** Returns status of upper bounds. + * \return BT_TRUE if there is no upper (constraints') bound on any variable. */ + inline BooleanType isNoUpper( ) const; + + + /* + * PROTECTED MEMBER FUNCTIONS + */ + protected: + /** Adds the index of a new constraint or bound to index set. + * \return SUCCESSFUL_RETURN \n + RET_ADDINDEX_FAILED */ + returnValue addIndex( Indexlist* const indexlist, /**< Index list to which the new index shall be added. */ + int newnumber, /**< Number of new constraint or bound. */ + SubjectToStatus newstatus /**< Status of new constraint or bound. */ + ); + + /** Removes the index of a constraint or bound from index set. + * \return SUCCESSFUL_RETURN \n + RET_UNKNOWN_BUG */ + returnValue removeIndex( Indexlist* const indexlist, /**< Index list from which the new index shall be removed. */ + int removenumber /**< Number of constraint or bound to be removed. */ + ); + + /** Swaps the indices of two constraints or bounds within the index set. + * \return SUCCESSFUL_RETURN \n + RET_SWAPINDEX_FAILED */ + returnValue swapIndex( Indexlist* const indexlist, /**< Index list in which the indices shold be swapped. */ + int number1, /**< Number of first constraint or bound. */ + int number2 /**< Number of second constraint or bound. */ + ); + + + /* + * PROTECTED MEMBER VARIABLES + */ + protected: + SubjectToType type[NVMAX+NCMAX]; /**< Type of constraints/bounds. */ + SubjectToStatus status[NVMAX+NCMAX]; /**< Status of constraints/bounds. */ + + BooleanType noLower; /**< This flag indicates if there is no lower bound on any variable. */ + BooleanType noUpper; /**< This flag indicates if there is no upper bound on any variable. */ + + + /* + * PRIVATE MEMBER VARIABLES + */ + private: + int size; +}; + + + +#include + +#endif /* QPOASES_SUBJECTTO_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/Types.hpp b/phonelibs/qpoases/INCLUDE/Types.hpp index 330f187c1..5b873ad07 100644 --- a/phonelibs/qpoases/INCLUDE/Types.hpp +++ b/phonelibs/qpoases/INCLUDE/Types.hpp @@ -1,131 +1,131 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Types.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2008 - * - * Declaration of all non-built-in types (except for classes). - */ - - -#ifndef QPOASES_TYPES_HPP -#define QPOASES_TYPES_HPP - - - -/** Define real_t for facilitating switching between double and float. */ -// typedef double real_t; - - -/** Summarises all possible logical values. */ -enum BooleanType -{ - BT_FALSE, /**< Logical value for "false". */ - BT_TRUE /**< Logical value for "true". */ -}; - - -/** Summarises all possible print levels. Print levels are used to describe - * the desired amount of output during runtime of qpOASES. */ -enum PrintLevel -{ - PL_NONE, /**< No output. */ - PL_LOW, /**< Print error messages only. */ - PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */ - PL_HIGH /**< Print all messages with full details. */ -}; - - -/** Defines visibility status of a message. */ -enum VisibilityStatus -{ - VS_VISIBLE, /**< Message visible. */ - VS_HIDDEN /**< Message not visible. */ -}; - - -/** Summarises all possible states of the (S)QProblem(B) object during the -solution process of a QP sequence. */ -enum QProblemStatus -{ - QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */ - QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning - * via an initial homotopy or after changing the QP matrices. */ - QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning - * via an initial homotopy or after changing the QP matrices. */ - QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active - * set strategy is performed. */ - QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */ - QPS_SOLVED /**< The solution of the actual QP was found. */ -}; - - -/** Summarises all possible types of bounds and constraints. */ -enum SubjectToType -{ - ST_UNBOUNDED, /**< Bound/constraint is unbounded. */ - ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */ - ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */ - ST_UNKNOWN /**< Type of bound/constraint unknown. */ -}; - - -/** Summarises all possible states of bounds and constraints. */ -enum SubjectToStatus -{ - ST_INACTIVE, /**< Bound/constraint is inactive. */ - ST_LOWER, /**< Bound/constraint is at its lower bound. */ - ST_UPPER, /**< Bound/constraint is at its upper bound. */ - ST_UNDEFINED /**< Status of bound/constraint undefined. */ -}; - - -/** Summarises all possible cycling states of bounds and constraints. */ -enum CyclingStatus -{ - CYC_NOT_INVOLVED, /**< Bound/constraint is not involved in current cycling. */ - CYC_PREV_ADDED, /**< Bound/constraint has previously been added during the current cycling. */ - CYC_PREV_REMOVED /**< Bound/constraint has previously been removed during the current cycling. */ -}; - - -/** Summarises all possible types of the QP's Hessian matrix. */ -enum HessianType -{ - HST_SEMIDEF, /**< Hessian is positive semi-definite. */ - HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */ - HST_POSDEF, /**< Hessian is (strictly) positive definite. */ - HST_IDENTITY /**< Hessian is identity matrix. */ -}; - - - -#endif /* QPOASES_TYPES_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Types.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2008 + * + * Declaration of all non-built-in types (except for classes). + */ + + +#ifndef QPOASES_TYPES_HPP +#define QPOASES_TYPES_HPP + + + +/** Define real_t for facilitating switching between double and float. */ +// typedef double real_t; + + +/** Summarises all possible logical values. */ +enum BooleanType +{ + BT_FALSE, /**< Logical value for "false". */ + BT_TRUE /**< Logical value for "true". */ +}; + + +/** Summarises all possible print levels. Print levels are used to describe + * the desired amount of output during runtime of qpOASES. */ +enum PrintLevel +{ + PL_NONE, /**< No output. */ + PL_LOW, /**< Print error messages only. */ + PL_MEDIUM, /**< Print error and warning messages as well as concise info messages. */ + PL_HIGH /**< Print all messages with full details. */ +}; + + +/** Defines visibility status of a message. */ +enum VisibilityStatus +{ + VS_VISIBLE, /**< Message visible. */ + VS_HIDDEN /**< Message not visible. */ +}; + + +/** Summarises all possible states of the (S)QProblem(B) object during the +solution process of a QP sequence. */ +enum QProblemStatus +{ + QPS_NOTINITIALISED, /**< QProblem object is freshly instantiated or reset. */ + QPS_PREPARINGAUXILIARYQP, /**< An auxiliary problem is currently setup, either at the very beginning + * via an initial homotopy or after changing the QP matrices. */ + QPS_AUXILIARYQPSOLVED, /**< An auxilary problem was solved, either at the very beginning + * via an initial homotopy or after changing the QP matrices. */ + QPS_PERFORMINGHOMOTOPY, /**< A homotopy according to the main idea of the online active + * set strategy is performed. */ + QPS_HOMOTOPYQPSOLVED, /**< An intermediate QP along the homotopy path was solved. */ + QPS_SOLVED /**< The solution of the actual QP was found. */ +}; + + +/** Summarises all possible types of bounds and constraints. */ +enum SubjectToType +{ + ST_UNBOUNDED, /**< Bound/constraint is unbounded. */ + ST_BOUNDED, /**< Bound/constraint is bounded but not fixed. */ + ST_EQUALITY, /**< Bound/constraint is fixed (implicit equality bound/constraint). */ + ST_UNKNOWN /**< Type of bound/constraint unknown. */ +}; + + +/** Summarises all possible states of bounds and constraints. */ +enum SubjectToStatus +{ + ST_INACTIVE, /**< Bound/constraint is inactive. */ + ST_LOWER, /**< Bound/constraint is at its lower bound. */ + ST_UPPER, /**< Bound/constraint is at its upper bound. */ + ST_UNDEFINED /**< Status of bound/constraint undefined. */ +}; + + +/** Summarises all possible cycling states of bounds and constraints. */ +enum CyclingStatus +{ + CYC_NOT_INVOLVED, /**< Bound/constraint is not involved in current cycling. */ + CYC_PREV_ADDED, /**< Bound/constraint has previously been added during the current cycling. */ + CYC_PREV_REMOVED /**< Bound/constraint has previously been removed during the current cycling. */ +}; + + +/** Summarises all possible types of the QP's Hessian matrix. */ +enum HessianType +{ + HST_SEMIDEF, /**< Hessian is positive semi-definite. */ + HST_POSDEF_NULLSPACE, /**< Hessian is positive definite on null space of active bounds/constraints. */ + HST_POSDEF, /**< Hessian is (strictly) positive definite. */ + HST_IDENTITY /**< Hessian is identity matrix. */ +}; + + + +#endif /* QPOASES_TYPES_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/INCLUDE/Utils.hpp b/phonelibs/qpoases/INCLUDE/Utils.hpp index 16546a991..a91ee78cc 100644 --- a/phonelibs/qpoases/INCLUDE/Utils.hpp +++ b/phonelibs/qpoases/INCLUDE/Utils.hpp @@ -1,197 +1,197 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file INCLUDE/Utils.hpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of global utility functions for working with qpOASES. - */ - - -#ifndef QPOASES_UTILS_HPP -#define QPOASES_UTILS_HPP - - -#include - - -#ifdef PC_DEBUG /* Define print functions only for debugging! */ - -/** Prints a vector. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const v, /**< Vector to be printed. */ - int n /**< Length of vector. */ - ); - -/** Prints a permuted vector. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const v, /**< Vector to be printed. */ - int n, /**< Length of vector. */ - const int* const V_idx /**< Pemutation vector. */ - ); - -/** Prints a named vector. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const v, /**< Vector to be printed. */ - int n, /**< Length of vector. */ - const char* name /** Name of vector. */ - ); - -/** Prints a matrix. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const M, /**< Matrix to be printed. */ - int nrow, /**< Row number of matrix. */ - int ncol /**< Column number of matrix. */ - ); - -/** Prints a permuted matrix. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const M, /**< Matrix to be printed. */ - int nrow, /**< Row number of matrix. */ - int ncol , /**< Column number of matrix. */ - const int* const ROW_idx, /**< Row pemutation vector. */ - const int* const COL_idx /**< Column pemutation vector. */ - ); - -/** Prints a named matrix. - * \return SUCCESSFUL_RETURN */ -returnValue print( const real_t* const M, /**< Matrix to be printed. */ - int nrow, /**< Row number of matrix. */ - int ncol, /**< Column number of matrix. */ - const char* name /** Name of matrix. */ - ); - -/** Prints an index array. - * \return SUCCESSFUL_RETURN */ -returnValue print( const int* const index, /**< Index array to be printed. */ - int n /**< Length of index array. */ - ); - -/** Prints a named index array. - * \return SUCCESSFUL_RETURN */ -returnValue print( const int* const index, /**< Index array to be printed. */ - int n, /**< Length of index array. */ - const char* name /**< Name of index array. */ - ); - - -/** Prints a string to desired output target (useful also for MATLAB output!). - * \return SUCCESSFUL_RETURN */ -returnValue myPrintf( const char* s /**< String to be written. */ - ); - - -/** Prints qpOASES copyright notice. - * \return SUCCESSFUL_RETURN */ -returnValue printCopyrightNotice( ); - - -/** Reads a real_t matrix from file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE \n - RET_UNABLE_TO_READ_FILE */ -returnValue readFromFile( real_t* data, /**< Matrix to be read from file. */ - int nrow, /**< Row number of matrix. */ - int ncol, /**< Column number of matrix. */ - const char* datafilename /**< Data file name. */ - ); - -/** Reads a real_t vector from file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE \n - RET_UNABLE_TO_READ_FILE */ -returnValue readFromFile( real_t* data, /**< Vector to be read from file. */ - int n, /**< Length of vector. */ - const char* datafilename /**< Data file name. */ - ); - -/** Reads an integer (column) vector from file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE \n - RET_UNABLE_TO_READ_FILE */ -returnValue readFromFile( int* data, /**< Vector to be read from file. */ - int n, /**< Length of vector. */ - const char* datafilename /**< Data file name. */ - ); - - -/** Writes a real_t matrix into a file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE */ -returnValue writeIntoFile( const real_t* const data, /**< Matrix to be written into file. */ - int nrow, /**< Row number of matrix. */ - int ncol, /**< Column number of matrix. */ - const char* datafilename, /**< Data file name. */ - BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */ - ); - -/** Writes a real_t vector into a file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE */ -returnValue writeIntoFile( const real_t* const data, /**< Vector to be written into file. */ - int n, /**< Length of vector. */ - const char* datafilename, /**< Data file name. */ - BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */ - ); - -/** Writes an integer (column) vector into a file. - * \return SUCCESSFUL_RETURN \n - RET_UNABLE_TO_OPEN_FILE */ -returnValue writeIntoFile( const int* const integer, /**< Integer vector to be written into file. */ - int n, /**< Length of vector. */ - const char* datafilename, /**< Data file name. */ - BooleanType append /**< Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). */ - ); - -#endif /* PC_DEBUG */ - - -/** Returns the current system time. - * \return current system time */ -real_t getCPUtime( ); - - -/** Returns the Euclidean norm of a vector. - * \return 0: successful */ -real_t getNorm( const real_t* const v, /**< Vector. */ - int n /**< Vector's dimension. */ - ); - -/** Returns the absolute value of a real_t. - * \return Absolute value of a real_t */ -inline real_t getAbs( real_t x /**< Input argument. */ - ); - - - -#include - -#endif /* QPOASES_UTILS_HPP */ - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file INCLUDE/Utils.hpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of global utility functions for working with qpOASES. + */ + + +#ifndef QPOASES_UTILS_HPP +#define QPOASES_UTILS_HPP + + +#include + + +#ifdef PC_DEBUG /* Define print functions only for debugging! */ + +/** Prints a vector. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const v, /**< Vector to be printed. */ + int n /**< Length of vector. */ + ); + +/** Prints a permuted vector. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const v, /**< Vector to be printed. */ + int n, /**< Length of vector. */ + const int* const V_idx /**< Pemutation vector. */ + ); + +/** Prints a named vector. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const v, /**< Vector to be printed. */ + int n, /**< Length of vector. */ + const char* name /** Name of vector. */ + ); + +/** Prints a matrix. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const M, /**< Matrix to be printed. */ + int nrow, /**< Row number of matrix. */ + int ncol /**< Column number of matrix. */ + ); + +/** Prints a permuted matrix. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const M, /**< Matrix to be printed. */ + int nrow, /**< Row number of matrix. */ + int ncol , /**< Column number of matrix. */ + const int* const ROW_idx, /**< Row pemutation vector. */ + const int* const COL_idx /**< Column pemutation vector. */ + ); + +/** Prints a named matrix. + * \return SUCCESSFUL_RETURN */ +returnValue print( const real_t* const M, /**< Matrix to be printed. */ + int nrow, /**< Row number of matrix. */ + int ncol, /**< Column number of matrix. */ + const char* name /** Name of matrix. */ + ); + +/** Prints an index array. + * \return SUCCESSFUL_RETURN */ +returnValue print( const int* const index, /**< Index array to be printed. */ + int n /**< Length of index array. */ + ); + +/** Prints a named index array. + * \return SUCCESSFUL_RETURN */ +returnValue print( const int* const index, /**< Index array to be printed. */ + int n, /**< Length of index array. */ + const char* name /**< Name of index array. */ + ); + + +/** Prints a string to desired output target (useful also for MATLAB output!). + * \return SUCCESSFUL_RETURN */ +returnValue myPrintf( const char* s /**< String to be written. */ + ); + + +/** Prints qpOASES copyright notice. + * \return SUCCESSFUL_RETURN */ +returnValue printCopyrightNotice( ); + + +/** Reads a real_t matrix from file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE \n + RET_UNABLE_TO_READ_FILE */ +returnValue readFromFile( real_t* data, /**< Matrix to be read from file. */ + int nrow, /**< Row number of matrix. */ + int ncol, /**< Column number of matrix. */ + const char* datafilename /**< Data file name. */ + ); + +/** Reads a real_t vector from file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE \n + RET_UNABLE_TO_READ_FILE */ +returnValue readFromFile( real_t* data, /**< Vector to be read from file. */ + int n, /**< Length of vector. */ + const char* datafilename /**< Data file name. */ + ); + +/** Reads an integer (column) vector from file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE \n + RET_UNABLE_TO_READ_FILE */ +returnValue readFromFile( int* data, /**< Vector to be read from file. */ + int n, /**< Length of vector. */ + const char* datafilename /**< Data file name. */ + ); + + +/** Writes a real_t matrix into a file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE */ +returnValue writeIntoFile( const real_t* const data, /**< Matrix to be written into file. */ + int nrow, /**< Row number of matrix. */ + int ncol, /**< Column number of matrix. */ + const char* datafilename, /**< Data file name. */ + BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */ + ); + +/** Writes a real_t vector into a file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE */ +returnValue writeIntoFile( const real_t* const data, /**< Vector to be written into file. */ + int n, /**< Length of vector. */ + const char* datafilename, /**< Data file name. */ + BooleanType append /**< Indicates if data shall be appended if the file already exists (otherwise it is overwritten). */ + ); + +/** Writes an integer (column) vector into a file. + * \return SUCCESSFUL_RETURN \n + RET_UNABLE_TO_OPEN_FILE */ +returnValue writeIntoFile( const int* const integer, /**< Integer vector to be written into file. */ + int n, /**< Length of vector. */ + const char* datafilename, /**< Data file name. */ + BooleanType append /**< Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). */ + ); + +#endif /* PC_DEBUG */ + + +/** Returns the current system time. + * \return current system time */ +real_t getCPUtime( ); + + +/** Returns the Euclidean norm of a vector. + * \return 0: successful */ +real_t getNorm( const real_t* const v, /**< Vector. */ + int n /**< Vector's dimension. */ + ); + +/** Returns the absolute value of a real_t. + * \return Absolute value of a real_t */ +inline real_t getAbs( real_t x /**< Input argument. */ + ); + + + +#include + +#endif /* QPOASES_UTILS_HPP */ + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/LICENSE.txt b/phonelibs/qpoases/LICENSE.txt index 5faba9d48..5ab7695ab 100644 --- a/phonelibs/qpoases/LICENSE.txt +++ b/phonelibs/qpoases/LICENSE.txt @@ -1,504 +1,504 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/phonelibs/qpoases/README.txt b/phonelibs/qpoases/README.txt index 37175d919..53fc2ab4f 100644 --- a/phonelibs/qpoases/README.txt +++ b/phonelibs/qpoases/README.txt @@ -1,92 +1,92 @@ -## -## qpOASES -- An Implementation of the Online Active Set Strategy. -## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. -## -## qpOASES is free software; you can redistribute it and/or -## modify it under the terms of the GNU Lesser General Public -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## qpOASES is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with qpOASES; if not, write to the Free Software -## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -## - - - -INTRODUCTION -============= - -qpOASES is an open-source C++ implementation of the recently proposed -online active set strategy (see [1], [2]), which was inspired by important -observations from the field of parametric quadratic programming. It has -several theoretical features that make it particularly suited for model -predictive control (MPC) applications. - -The software package qpOASES implements these ideas and has already been -successfully used for closed-loop control of a real-world Diesel engine [3]. - - -References: - -[1] H.J. Ferreau. An Online Active Set Strategy for Fast Solution of -Parametric Quadratic Programs with Applications to Predictive Engine Control. -Diplom thesis, University of Heidelberg, 2006. - -[2] H.J. Ferreau, H.G. Bock, M. Diehl. An online active set strategy to -overcome the limitations of explicit MPC. International Journal of Robust -and Nonlinear Control, 18 (8), pp. 816-830, 2008. - -[3] H.J. Ferreau, P. Ortner, P. Langthaler, L. del Re, M. Diehl. Predictive -Control of a Real-World Diesel Engine using an Extended Online Active Set -Strategy. Annual Reviews in Control, 31 (2), pp. 293-301, 2007. - - - -GETTING STARTED -================ - -1. For installation, usage and additional information on this software package - see the qpOASES User's Manual located at ./DOC/manual.pdf! - - -2. The file ./LICENSE.txt contains a copy of the GNU Lesser General Public - License. Please read it carefully before using qpOASES! - - -3. The whole software package can be downloaded from - - http://homes.esat.kuleuven.be/~optec/software/qpOASES/ - - On this webpage you will also find a list of frequently asked questions. - - - -CONTACT THE AUTHORS -==================== - -If you have got questions, remarks or comments on qpOASES -please contact the main author: - - Hans Joachim Ferreau - Katholieke Universiteit Leuven - Department of Electrical Engineering (ESAT) - Kasteelpark Arenberg 10, bus 2446 - B-3001 Leuven-Heverlee, Belgium - - Phone: +32 16 32 03 63 - E-mail: joachim.ferreau@esat.kuleuven.be - qpOASES@esat.kuleuven.be - -Also bug reports and source code extensions are most welcome! - - - -## -## end of file -## +## +## qpOASES -- An Implementation of the Online Active Set Strategy. +## Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. +## +## qpOASES is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## qpOASES is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with qpOASES; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## + + + +INTRODUCTION +============= + +qpOASES is an open-source C++ implementation of the recently proposed +online active set strategy (see [1], [2]), which was inspired by important +observations from the field of parametric quadratic programming. It has +several theoretical features that make it particularly suited for model +predictive control (MPC) applications. + +The software package qpOASES implements these ideas and has already been +successfully used for closed-loop control of a real-world Diesel engine [3]. + + +References: + +[1] H.J. Ferreau. An Online Active Set Strategy for Fast Solution of +Parametric Quadratic Programs with Applications to Predictive Engine Control. +Diplom thesis, University of Heidelberg, 2006. + +[2] H.J. Ferreau, H.G. Bock, M. Diehl. An online active set strategy to +overcome the limitations of explicit MPC. International Journal of Robust +and Nonlinear Control, 18 (8), pp. 816-830, 2008. + +[3] H.J. Ferreau, P. Ortner, P. Langthaler, L. del Re, M. Diehl. Predictive +Control of a Real-World Diesel Engine using an Extended Online Active Set +Strategy. Annual Reviews in Control, 31 (2), pp. 293-301, 2007. + + + +GETTING STARTED +================ + +1. For installation, usage and additional information on this software package + see the qpOASES User's Manual located at ./DOC/manual.pdf! + + +2. The file ./LICENSE.txt contains a copy of the GNU Lesser General Public + License. Please read it carefully before using qpOASES! + + +3. The whole software package can be downloaded from + + http://homes.esat.kuleuven.be/~optec/software/qpOASES/ + + On this webpage you will also find a list of frequently asked questions. + + + +CONTACT THE AUTHORS +==================== + +If you have got questions, remarks or comments on qpOASES +please contact the main author: + + Hans Joachim Ferreau + Katholieke Universiteit Leuven + Department of Electrical Engineering (ESAT) + Kasteelpark Arenberg 10, bus 2446 + B-3001 Leuven-Heverlee, Belgium + + Phone: +32 16 32 03 63 + E-mail: joachim.ferreau@esat.kuleuven.be + qpOASES@esat.kuleuven.be + +Also bug reports and source code extensions are most welcome! + + + +## +## end of file +## diff --git a/phonelibs/qpoases/SRC/Bounds.cpp b/phonelibs/qpoases/SRC/Bounds.cpp index 236ab2f62..cf8ed6989 100644 --- a/phonelibs/qpoases/SRC/Bounds.cpp +++ b/phonelibs/qpoases/SRC/Bounds.cpp @@ -1,252 +1,252 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/Bounds.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the Bounds class designed to manage working sets of - * bounds within a QProblem. - */ - - -#include - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * B o u n d s - */ -Bounds::Bounds( ) : SubjectTo( ), - nV( 0 ), - nFV( 0 ), - nBV( 0 ), - nUV( 0 ) -{ -} - - -/* - * B o u n d s - */ -Bounds::Bounds( const Bounds& rhs ) : SubjectTo( rhs ), - nV( rhs.nV ), - nFV( rhs.nFV ), - nBV( rhs.nBV ), - nUV( rhs.nUV ) -{ - free = rhs.free; - fixed = rhs.fixed; -} - - -/* - * ~ B o u n d s - */ -Bounds::~Bounds( ) -{ -} - - -/* - * o p e r a t o r = - */ -Bounds& Bounds::operator=( const Bounds& rhs ) -{ - if ( this != &rhs ) - { - SubjectTo::operator=( rhs ); - - nV = rhs.nV; - nFV = rhs.nFV; - nBV = rhs.nBV; - nUV = rhs.nUV; - - free = rhs.free; - fixed = rhs.fixed; - } - - return *this; -} - - -/* - * i n i t - */ -returnValue Bounds::init( int n ) -{ - nV = n; - nFV = 0; - nBV = 0; - nUV = 0; - - free.init( ); - fixed.init( ); - - return SubjectTo::init( n ); -} - - -/* - * s e t u p B o u n d - */ -returnValue Bounds::setupBound( int _number, SubjectToStatus _status - ) -{ - /* consistency check */ - if ( ( _number < 0 ) || ( _number >= getNV( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Add bound index to respective index list. */ - switch ( _status ) - { - case ST_INACTIVE: - if ( this->addIndex( this->getFree( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_BOUND_FAILED ); - break; - - case ST_LOWER: - if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_BOUND_FAILED ); - break; - - case ST_UPPER: - if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_BOUND_FAILED ); - break; - - default: - return THROWERROR( RET_INVALID_ARGUMENTS ); - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p A l l F r e e - */ -returnValue Bounds::setupAllFree( ) -{ - int i; - - /* 1) Place unbounded variables at the beginning of the index list of free variables. */ - for( i=0; i= getNV( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Move index from indexlist of fixed variables to that of free ones. */ - if ( this->removeIndex( this->getFixed( ),_number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - if ( this->addIndex( this->getFree( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - return SUCCESSFUL_RETURN; -} - - -/* - * m o v e F r e e T o F i x e d - */ -returnValue Bounds::moveFreeToFixed( int _number, SubjectToStatus _status - ) -{ - /* consistency check */ - if ( ( _number < 0 ) || ( _number >= getNV( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Move index from indexlist of free variables to that of fixed ones. */ - if ( this->removeIndex( this->getFree( ),_number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - return SUCCESSFUL_RETURN; -} - - -/* - * s w a p F r e e - */ -returnValue Bounds::swapFree( int number1, int number2 - ) -{ - /* consistency check */ - if ( ( number1 < 0 ) || ( number1 >= getNV( ) ) || ( number2 < 0 ) || ( number2 >= getNV( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Swap index within indexlist of free variables. */ - return this->swapIndex( this->getFree( ),number1,number2 ); -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/Bounds.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the Bounds class designed to manage working sets of + * bounds within a QProblem. + */ + + +#include + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * B o u n d s + */ +Bounds::Bounds( ) : SubjectTo( ), + nV( 0 ), + nFV( 0 ), + nBV( 0 ), + nUV( 0 ) +{ +} + + +/* + * B o u n d s + */ +Bounds::Bounds( const Bounds& rhs ) : SubjectTo( rhs ), + nV( rhs.nV ), + nFV( rhs.nFV ), + nBV( rhs.nBV ), + nUV( rhs.nUV ) +{ + free = rhs.free; + fixed = rhs.fixed; +} + + +/* + * ~ B o u n d s + */ +Bounds::~Bounds( ) +{ +} + + +/* + * o p e r a t o r = + */ +Bounds& Bounds::operator=( const Bounds& rhs ) +{ + if ( this != &rhs ) + { + SubjectTo::operator=( rhs ); + + nV = rhs.nV; + nFV = rhs.nFV; + nBV = rhs.nBV; + nUV = rhs.nUV; + + free = rhs.free; + fixed = rhs.fixed; + } + + return *this; +} + + +/* + * i n i t + */ +returnValue Bounds::init( int n ) +{ + nV = n; + nFV = 0; + nBV = 0; + nUV = 0; + + free.init( ); + fixed.init( ); + + return SubjectTo::init( n ); +} + + +/* + * s e t u p B o u n d + */ +returnValue Bounds::setupBound( int _number, SubjectToStatus _status + ) +{ + /* consistency check */ + if ( ( _number < 0 ) || ( _number >= getNV( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Add bound index to respective index list. */ + switch ( _status ) + { + case ST_INACTIVE: + if ( this->addIndex( this->getFree( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_BOUND_FAILED ); + break; + + case ST_LOWER: + if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_BOUND_FAILED ); + break; + + case ST_UPPER: + if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_BOUND_FAILED ); + break; + + default: + return THROWERROR( RET_INVALID_ARGUMENTS ); + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p A l l F r e e + */ +returnValue Bounds::setupAllFree( ) +{ + int i; + + /* 1) Place unbounded variables at the beginning of the index list of free variables. */ + for( i=0; i= getNV( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Move index from indexlist of fixed variables to that of free ones. */ + if ( this->removeIndex( this->getFixed( ),_number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + if ( this->addIndex( this->getFree( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + return SUCCESSFUL_RETURN; +} + + +/* + * m o v e F r e e T o F i x e d + */ +returnValue Bounds::moveFreeToFixed( int _number, SubjectToStatus _status + ) +{ + /* consistency check */ + if ( ( _number < 0 ) || ( _number >= getNV( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Move index from indexlist of free variables to that of fixed ones. */ + if ( this->removeIndex( this->getFree( ),_number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + if ( this->addIndex( this->getFixed( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + return SUCCESSFUL_RETURN; +} + + +/* + * s w a p F r e e + */ +returnValue Bounds::swapFree( int number1, int number2 + ) +{ + /* consistency check */ + if ( ( number1 < 0 ) || ( number1 >= getNV( ) ) || ( number2 < 0 ) || ( number2 >= getNV( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Swap index within indexlist of free variables. */ + return this->swapIndex( this->getFree( ),number1,number2 ); +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/Bounds.ipp b/phonelibs/qpoases/SRC/Bounds.ipp index d0e7dbbf0..d2ab1ba2d 100644 --- a/phonelibs/qpoases/SRC/Bounds.ipp +++ b/phonelibs/qpoases/SRC/Bounds.ipp @@ -1,144 +1,144 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/Bounds.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of inlined member functions of the Bounds class designed - * to manage working sets of bounds within a QProblem. - */ - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - -/* - * g e t N V - */ -inline int Bounds::getNV( ) const -{ - return nV; -} - - -/* - * g e t N F X - */ -inline int Bounds::getNFV( ) const -{ - return nFV; -} - - -/* - * g e t N B V - */ -inline int Bounds::getNBV( ) const -{ - return nBV; -} - - -/* - * g e t N U V - */ -inline int Bounds::getNUV( ) const -{ - return nUV; -} - - - -/* - * s e t N F X - */ -inline returnValue Bounds::setNFV( int n ) -{ - nFV = n; - return SUCCESSFUL_RETURN; -} - - -/* - * s e t N B V - */ -inline returnValue Bounds::setNBV( int n ) -{ - nBV = n; - return SUCCESSFUL_RETURN; -} - - -/* - * s e t N U V - */ -inline returnValue Bounds::setNUV( int n ) -{ - nUV = n; - return SUCCESSFUL_RETURN; -} - - -/* - * g e t N F R - */ -inline int Bounds::getNFR( ) -{ - return free.getLength( ); -} - - -/* - * g e t N F X - */ -inline int Bounds::getNFX( ) -{ - return fixed.getLength( ); -} - - -/* - * g e t F r e e - */ -inline Indexlist* Bounds::getFree( ) -{ - return &free; -} - - -/* - * g e t F i x e d - */ -inline Indexlist* Bounds::getFixed( ) -{ - return &fixed; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/Bounds.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of inlined member functions of the Bounds class designed + * to manage working sets of bounds within a QProblem. + */ + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t N V + */ +inline int Bounds::getNV( ) const +{ + return nV; +} + + +/* + * g e t N F X + */ +inline int Bounds::getNFV( ) const +{ + return nFV; +} + + +/* + * g e t N B V + */ +inline int Bounds::getNBV( ) const +{ + return nBV; +} + + +/* + * g e t N U V + */ +inline int Bounds::getNUV( ) const +{ + return nUV; +} + + + +/* + * s e t N F X + */ +inline returnValue Bounds::setNFV( int n ) +{ + nFV = n; + return SUCCESSFUL_RETURN; +} + + +/* + * s e t N B V + */ +inline returnValue Bounds::setNBV( int n ) +{ + nBV = n; + return SUCCESSFUL_RETURN; +} + + +/* + * s e t N U V + */ +inline returnValue Bounds::setNUV( int n ) +{ + nUV = n; + return SUCCESSFUL_RETURN; +} + + +/* + * g e t N F R + */ +inline int Bounds::getNFR( ) +{ + return free.getLength( ); +} + + +/* + * g e t N F X + */ +inline int Bounds::getNFX( ) +{ + return fixed.getLength( ); +} + + +/* + * g e t F r e e + */ +inline Indexlist* Bounds::getFree( ) +{ + return &free; +} + + +/* + * g e t F i x e d + */ +inline Indexlist* Bounds::getFixed( ) +{ + return &fixed; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/Constraints.cpp b/phonelibs/qpoases/SRC/Constraints.cpp index 81fc6ce86..b2ad5bd11 100644 --- a/phonelibs/qpoases/SRC/Constraints.cpp +++ b/phonelibs/qpoases/SRC/Constraints.cpp @@ -1,248 +1,248 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/Constraints.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the Constraints class designed to manage working sets of - * constraints within a QProblem. - */ - - -#include - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * C o n s t r a i n t s - */ -Constraints::Constraints( ) : SubjectTo( ), - nC( 0 ), - nEC( 0 ), - nIC( 0 ), - nUC( 0 ) -{ -} - - -/* - * C o n s t r a i n t s - */ -Constraints::Constraints( const Constraints& rhs ) : SubjectTo( rhs ), - nC( rhs.nC ), - nEC( rhs.nEC ), - nIC( rhs.nIC ), - nUC( rhs.nUC ) -{ - active = rhs.active; - inactive = rhs.inactive; -} - - -/* - * ~ C o n s t r a i n t s - */ -Constraints::~Constraints( ) -{ -} - - -/* - * o p e r a t o r = - */ -Constraints& Constraints::operator=( const Constraints& rhs ) -{ - if ( this != &rhs ) - { - SubjectTo::operator=( rhs ); - - nC = rhs.nC; - nEC = rhs.nEC; - nIC = rhs.nIC; - nUC = rhs.nUC; - - active = rhs.active; - inactive = rhs.inactive; - } - - return *this; -} - - -/* - * i n i t - */ -returnValue Constraints::init( int n ) -{ - nC = n; - nEC = 0; - nIC = 0; - nUC = 0; - - active.init( ); - inactive.init( ); - - return SubjectTo::init( n ); -} - - -/* - * s e t u p C o n s t r a i n t - */ -returnValue Constraints::setupConstraint( int _number, SubjectToStatus _status - ) -{ - /* consistency check */ - if ( ( _number < 0 ) || ( _number >= getNC( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Add constraint index to respective index list. */ - switch ( _status ) - { - case ST_INACTIVE: - if ( this->addIndex( this->getInactive( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); - break; - - case ST_LOWER: - if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); - break; - - case ST_UPPER: - if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); - break; - - default: - return THROWERROR( RET_INVALID_ARGUMENTS ); - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p A l l I n a c t i v e - */ -returnValue Constraints::setupAllInactive( ) -{ - int i; - - - /* 1) Place unbounded constraints at the beginning of the index list of inactive constraints. */ - for( i=0; i= getNC( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Move index from indexlist of active constraints to that of inactive ones. */ - if ( this->removeIndex( this->getActive( ),_number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - if ( this->addIndex( this->getInactive( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - return SUCCESSFUL_RETURN; -} - - -/* - * m o v e I n a c t i v e T o A c t i v e - */ -returnValue Constraints::moveInactiveToActive( int _number, SubjectToStatus _status - ) -{ - /* consistency check */ - if ( ( _number < 0 ) || ( _number >= getNC( ) ) ) - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - - /* Move index from indexlist of inactive constraints to that of active ones. */ - if ( this->removeIndex( this->getInactive( ),_number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_MOVING_BOUND_FAILED ); - - return SUCCESSFUL_RETURN; -} - - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/Constraints.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the Constraints class designed to manage working sets of + * constraints within a QProblem. + */ + + +#include + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * C o n s t r a i n t s + */ +Constraints::Constraints( ) : SubjectTo( ), + nC( 0 ), + nEC( 0 ), + nIC( 0 ), + nUC( 0 ) +{ +} + + +/* + * C o n s t r a i n t s + */ +Constraints::Constraints( const Constraints& rhs ) : SubjectTo( rhs ), + nC( rhs.nC ), + nEC( rhs.nEC ), + nIC( rhs.nIC ), + nUC( rhs.nUC ) +{ + active = rhs.active; + inactive = rhs.inactive; +} + + +/* + * ~ C o n s t r a i n t s + */ +Constraints::~Constraints( ) +{ +} + + +/* + * o p e r a t o r = + */ +Constraints& Constraints::operator=( const Constraints& rhs ) +{ + if ( this != &rhs ) + { + SubjectTo::operator=( rhs ); + + nC = rhs.nC; + nEC = rhs.nEC; + nIC = rhs.nIC; + nUC = rhs.nUC; + + active = rhs.active; + inactive = rhs.inactive; + } + + return *this; +} + + +/* + * i n i t + */ +returnValue Constraints::init( int n ) +{ + nC = n; + nEC = 0; + nIC = 0; + nUC = 0; + + active.init( ); + inactive.init( ); + + return SubjectTo::init( n ); +} + + +/* + * s e t u p C o n s t r a i n t + */ +returnValue Constraints::setupConstraint( int _number, SubjectToStatus _status + ) +{ + /* consistency check */ + if ( ( _number < 0 ) || ( _number >= getNC( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Add constraint index to respective index list. */ + switch ( _status ) + { + case ST_INACTIVE: + if ( this->addIndex( this->getInactive( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); + break; + + case ST_LOWER: + if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); + break; + + case ST_UPPER: + if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_CONSTRAINT_FAILED ); + break; + + default: + return THROWERROR( RET_INVALID_ARGUMENTS ); + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p A l l I n a c t i v e + */ +returnValue Constraints::setupAllInactive( ) +{ + int i; + + + /* 1) Place unbounded constraints at the beginning of the index list of inactive constraints. */ + for( i=0; i= getNC( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Move index from indexlist of active constraints to that of inactive ones. */ + if ( this->removeIndex( this->getActive( ),_number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + if ( this->addIndex( this->getInactive( ),_number,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + return SUCCESSFUL_RETURN; +} + + +/* + * m o v e I n a c t i v e T o A c t i v e + */ +returnValue Constraints::moveInactiveToActive( int _number, SubjectToStatus _status + ) +{ + /* consistency check */ + if ( ( _number < 0 ) || ( _number >= getNC( ) ) ) + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + + /* Move index from indexlist of inactive constraints to that of active ones. */ + if ( this->removeIndex( this->getInactive( ),_number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_MOVING_BOUND_FAILED ); + + return SUCCESSFUL_RETURN; +} + + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/Constraints.ipp b/phonelibs/qpoases/SRC/Constraints.ipp index 67add2043..1b874ef3c 100644 --- a/phonelibs/qpoases/SRC/Constraints.ipp +++ b/phonelibs/qpoases/SRC/Constraints.ipp @@ -1,144 +1,144 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/Constraints.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Declaration of inlined member functions of the Constraints class designed - * to manage working sets of constraints within a QProblem. - */ - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - -/* - * g e t N C - */ -inline int Constraints::getNC( ) const -{ - return nC; -} - - -/* - * g e t N E C - */ -inline int Constraints::getNEC( ) const -{ - return nEC; -} - - -/* - * g e t N I C - */ -inline int Constraints::getNIC( ) const -{ - return nIC; -} - - -/* - * g e t N U C - */ -inline int Constraints::getNUC( ) const -{ - return nUC; -} - - -/* - * s e t N E C - */ -inline returnValue Constraints::setNEC( int n ) -{ - nEC = n; - return SUCCESSFUL_RETURN; -} - - -/* - * s e t N I C - */ -inline returnValue Constraints::setNIC( int n ) -{ - nIC = n; - return SUCCESSFUL_RETURN; -} - - -/* - * s e t N U C - */ -inline returnValue Constraints::setNUC( int n ) -{ - nUC = n; - return SUCCESSFUL_RETURN; -} - - -/* - * g e t N A C - */ -inline int Constraints::getNAC( ) -{ - return active.getLength( ); -} - - -/* - * g e t N I A C - */ -inline int Constraints::getNIAC( ) -{ - return inactive.getLength( ); -} - - -/* - * g e t A c t i v e - */ -inline Indexlist* Constraints::getActive( ) -{ - return &active; -} - - -/* - * g e t I n a c t i v e - */ -inline Indexlist* Constraints::getInactive( ) -{ - return &inactive; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/Constraints.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Declaration of inlined member functions of the Constraints class designed + * to manage working sets of constraints within a QProblem. + */ + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t N C + */ +inline int Constraints::getNC( ) const +{ + return nC; +} + + +/* + * g e t N E C + */ +inline int Constraints::getNEC( ) const +{ + return nEC; +} + + +/* + * g e t N I C + */ +inline int Constraints::getNIC( ) const +{ + return nIC; +} + + +/* + * g e t N U C + */ +inline int Constraints::getNUC( ) const +{ + return nUC; +} + + +/* + * s e t N E C + */ +inline returnValue Constraints::setNEC( int n ) +{ + nEC = n; + return SUCCESSFUL_RETURN; +} + + +/* + * s e t N I C + */ +inline returnValue Constraints::setNIC( int n ) +{ + nIC = n; + return SUCCESSFUL_RETURN; +} + + +/* + * s e t N U C + */ +inline returnValue Constraints::setNUC( int n ) +{ + nUC = n; + return SUCCESSFUL_RETURN; +} + + +/* + * g e t N A C + */ +inline int Constraints::getNAC( ) +{ + return active.getLength( ); +} + + +/* + * g e t N I A C + */ +inline int Constraints::getNIAC( ) +{ + return inactive.getLength( ); +} + + +/* + * g e t A c t i v e + */ +inline Indexlist* Constraints::getActive( ) +{ + return &active; +} + + +/* + * g e t I n a c t i v e + */ +inline Indexlist* Constraints::getInactive( ) +{ + return &inactive; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/CyclingManager.cpp b/phonelibs/qpoases/SRC/CyclingManager.cpp index 7bbccdac2..27c2996ef 100644 --- a/phonelibs/qpoases/SRC/CyclingManager.cpp +++ b/phonelibs/qpoases/SRC/CyclingManager.cpp @@ -1,188 +1,188 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/CyclingManager.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the CyclingManager class designed to detect - * and handle possible cycling during QP iterations. - * - */ - - -#include - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * C y c l i n g M a n a g e r - */ -CyclingManager::CyclingManager( ) : nV( 0 ), - nC( 0 ) -{ - cyclingDetected = BT_FALSE; -} - - -/* - * C y c l i n g M a n a g e r - */ -CyclingManager::CyclingManager( const CyclingManager& rhs ) : nV( rhs.nV ), - nC( rhs.nC ), - cyclingDetected( rhs.cyclingDetected ) -{ - int i; - - for( i=0; i= 0 ) && ( number < nV ) ) - { - status[number] = _status; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } - else - { - /* Set cycling status of a constraint. */ - if ( ( number >= 0 ) && ( number < nC ) ) - { - status[nV+number] = _status; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } -} - - -/* - * g e t C y c l i n g S t a t u s - */ -CyclingStatus CyclingManager::getCyclingStatus( int number, BooleanType isBound ) const -{ - if ( isBound == BT_TRUE ) - { - /* Return cycling status of a bound. */ - if ( ( number >= 0 ) && ( number < nV ) ) - return status[number]; - } - else - { - /* Return cycling status of a constraint. */ - if ( ( number >= 0 ) && ( number < nC ) ) - return status[nV+number]; - } - - return CYC_NOT_INVOLVED; -} - - -/* - * c l e a r C y c l i n g D a t a - */ -returnValue CyclingManager::clearCyclingData( ) -{ - int i; - - /* Reset all status values ... */ - for( i=0; i + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * C y c l i n g M a n a g e r + */ +CyclingManager::CyclingManager( ) : nV( 0 ), + nC( 0 ) +{ + cyclingDetected = BT_FALSE; +} + + +/* + * C y c l i n g M a n a g e r + */ +CyclingManager::CyclingManager( const CyclingManager& rhs ) : nV( rhs.nV ), + nC( rhs.nC ), + cyclingDetected( rhs.cyclingDetected ) +{ + int i; + + for( i=0; i= 0 ) && ( number < nV ) ) + { + status[number] = _status; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } + else + { + /* Set cycling status of a constraint. */ + if ( ( number >= 0 ) && ( number < nC ) ) + { + status[nV+number] = _status; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } +} + + +/* + * g e t C y c l i n g S t a t u s + */ +CyclingStatus CyclingManager::getCyclingStatus( int number, BooleanType isBound ) const +{ + if ( isBound == BT_TRUE ) + { + /* Return cycling status of a bound. */ + if ( ( number >= 0 ) && ( number < nV ) ) + return status[number]; + } + else + { + /* Return cycling status of a constraint. */ + if ( ( number >= 0 ) && ( number < nC ) ) + return status[nV+number]; + } + + return CYC_NOT_INVOLVED; +} + + +/* + * c l e a r C y c l i n g D a t a + */ +returnValue CyclingManager::clearCyclingData( ) +{ + int i; + + /* Reset all status values ... */ + for( i=0; i - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * I n d e x l i s t - */ -Indexlist::Indexlist( ) : length( 0 ), - first( -1 ), - last( -1 ), - lastusedindex( -1 ), - physicallength( INDEXLISTFACTOR*(NVMAX+NCMAX) ) -{ - int i; - - for( i=0; i= 0 ) && ( number[n] >= 0 ) ) - numberarray[i] = number[n]; - else - return THROWERROR( RET_INDEXLIST_CORRUPTED ); - - n = next[n]; - } - - return SUCCESSFUL_RETURN; -} - - -/* - * g e t I n d e x - */ -int Indexlist::getIndex( int givennumber ) const -{ - int i; - int n = first; - int index = -1; /* return -1 by default */ - - /* Run trough indexlist until number is found, if so return it index. */ - for ( i=0; i + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * I n d e x l i s t + */ +Indexlist::Indexlist( ) : length( 0 ), + first( -1 ), + last( -1 ), + lastusedindex( -1 ), + physicallength( INDEXLISTFACTOR*(NVMAX+NCMAX) ) +{ + int i; + + for( i=0; i= 0 ) && ( number[n] >= 0 ) ) + numberarray[i] = number[n]; + else + return THROWERROR( RET_INDEXLIST_CORRUPTED ); + + n = next[n]; + } + + return SUCCESSFUL_RETURN; +} + + +/* + * g e t I n d e x + */ +int Indexlist::getIndex( int givennumber ) const +{ + int i; + int n = first; + int index = -1; /* return -1 by default */ + + /* Run trough indexlist until number is found, if so return it index. */ + for ( i=0; i length ) ) - return -RET_INDEXLIST_OUTOFBOUNDS; - - return number[physicalindex]; -} - - -/* - * g e t L e n g t h - */ -inline int Indexlist::getLength( ) -{ - return length; -} - - -/* - * g e t L a s t N u m b e r - */ -inline int Indexlist::getLastNumber( ) const -{ - return number[last]; -} - - -/* - * g e t L a s t N u m b e r - */ -inline BooleanType Indexlist::isMember( int _number ) const -{ - if ( getIndex( _number ) >= 0 ) - return BT_TRUE; - else - return BT_FALSE; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/Indexlist.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of inlined member functions of the Indexlist class designed + * to manage index lists of constraints and bounds within a QProblem_SubjectTo. + */ + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t N u m b e r + */ +inline int Indexlist::getNumber( int physicalindex ) const +{ + /* consistency check */ + if ( ( physicalindex < 0 ) || ( physicalindex > length ) ) + return -RET_INDEXLIST_OUTOFBOUNDS; + + return number[physicalindex]; +} + + +/* + * g e t L e n g t h + */ +inline int Indexlist::getLength( ) +{ + return length; +} + + +/* + * g e t L a s t N u m b e r + */ +inline int Indexlist::getLastNumber( ) const +{ + return number[last]; +} + + +/* + * g e t L a s t N u m b e r + */ +inline BooleanType Indexlist::isMember( int _number ) const +{ + if ( getIndex( _number ) >= 0 ) + return BT_TRUE; + else + return BT_FALSE; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/MessageHandling.cpp b/phonelibs/qpoases/SRC/MessageHandling.cpp index 6e68cd855..18a7654a1 100644 --- a/phonelibs/qpoases/SRC/MessageHandling.cpp +++ b/phonelibs/qpoases/SRC/MessageHandling.cpp @@ -1,529 +1,529 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/MessageHandling.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the MessageHandling class including global return values. - * - */ - - - -#include -#include - - - - -/** Defines pairs of global return values and messages. */ -MessageHandling::ReturnValueList returnValueList[] = -{ -/* miscellaneous */ -{ SUCCESSFUL_RETURN, "Successful return", VS_VISIBLE }, -{ RET_DIV_BY_ZERO, "Division by zero", VS_VISIBLE }, -{ RET_INDEX_OUT_OF_BOUNDS, "Index out of bounds", VS_VISIBLE }, -{ RET_INVALID_ARGUMENTS, "At least one of the arguments is invalid", VS_VISIBLE }, -{ RET_ERROR_UNDEFINED, "Error number undefined", VS_VISIBLE }, -{ RET_WARNING_UNDEFINED, "Warning number undefined", VS_VISIBLE }, -{ RET_INFO_UNDEFINED, "Info number undefined", VS_VISIBLE }, -{ RET_EWI_UNDEFINED, "Error/warning/info number undefined", VS_VISIBLE }, -{ RET_AVAILABLE_WITH_LINUX_ONLY, "This function is available under Linux only", VS_HIDDEN }, -{ RET_UNKNOWN_BUG, "The error occured is not yet known", VS_VISIBLE }, -{ RET_PRINTLEVEL_CHANGED, "Print level changed", VS_VISIBLE }, -{ RET_NOT_YET_IMPLEMENTED, "Requested function is not yet implemented.", VS_VISIBLE }, -/* Indexlist */ -{ RET_INDEXLIST_MUST_BE_REORDERD, "Index list has to be reordered", VS_VISIBLE }, -{ RET_INDEXLIST_EXCEEDS_MAX_LENGTH, "Index list exceeds its maximal physical length", VS_VISIBLE }, -{ RET_INDEXLIST_CORRUPTED, "Index list corrupted", VS_VISIBLE }, -{ RET_INDEXLIST_OUTOFBOUNDS, "Physical index is out of bounds", VS_VISIBLE }, -{ RET_INDEXLIST_ADD_FAILED, "Adding indices from another index set failed", VS_VISIBLE }, -{ RET_INDEXLIST_INTERSECT_FAILED, "Intersection with another index set failed", VS_VISIBLE }, -/* SubjectTo / Bounds / Constraints */ -{ RET_INDEX_ALREADY_OF_DESIRED_STATUS, "Index is already of desired status", VS_VISIBLE }, -{ RET_SWAPINDEX_FAILED, "Cannot swap between different indexsets", VS_VISIBLE }, -{ RET_ADDINDEX_FAILED, "Adding index to index set failed", VS_VISIBLE }, -{ RET_NOTHING_TO_DO, "Nothing to do", VS_VISIBLE }, -{ RET_SETUP_BOUND_FAILED, "Setting up bound index failed", VS_VISIBLE }, -{ RET_SETUP_CONSTRAINT_FAILED, "Setting up constraint index failed", VS_VISIBLE }, -{ RET_MOVING_BOUND_FAILED, "Moving bound between index sets failed", VS_VISIBLE }, -{ RET_MOVING_CONSTRAINT_FAILED, "Moving constraint between index sets failed", VS_VISIBLE }, -/* QProblem */ -{ RET_QP_ALREADY_INITIALISED, "QProblem has already been initialised", VS_VISIBLE }, -{ RET_NO_INIT_WITH_STANDARD_SOLVER, "Initialisation via extern QP solver is not yet implemented", VS_VISIBLE }, -{ RET_RESET_FAILED, "Reset failed", VS_VISIBLE }, -{ RET_INIT_FAILED, "Initialisation failed", VS_VISIBLE }, -{ RET_INIT_FAILED_TQ, "Initialisation failed due to TQ factorisation", VS_VISIBLE }, -{ RET_INIT_FAILED_CHOLESKY, "Initialisation failed due to Cholesky decomposition", VS_VISIBLE }, -{ RET_INIT_FAILED_HOTSTART, "Initialisation failed! QP could not be solved!", VS_VISIBLE }, -{ RET_INIT_FAILED_INFEASIBILITY, "Initial QP could not be solved due to infeasibility!", VS_VISIBLE }, -{ RET_INIT_FAILED_UNBOUNDEDNESS, "Initial QP could not be solved due to unboundedness!", VS_VISIBLE }, -{ RET_INIT_SUCCESSFUL, "Initialisation done", VS_VISIBLE }, -{ RET_OBTAINING_WORKINGSET_FAILED, "Failed to obtain working set for auxiliary QP", VS_VISIBLE }, -{ RET_SETUP_WORKINGSET_FAILED, "Failed to setup working set for auxiliary QP", VS_VISIBLE }, -{ RET_SETUP_AUXILIARYQP_FAILED, "Failed to setup auxiliary QP for initialised homotopy", VS_VISIBLE }, -{ RET_NO_EXTERN_SOLVER, "No extern QP solver available", VS_VISIBLE }, -{ RET_QP_UNBOUNDED, "QP is unbounded", VS_VISIBLE }, -{ RET_QP_INFEASIBLE, "QP is infeasible", VS_VISIBLE }, -{ RET_QP_NOT_SOLVED, "Problems occured while solving QP with standard solver", VS_VISIBLE }, -{ RET_QP_SOLVED, "QP successfully solved", VS_VISIBLE }, -{ RET_UNABLE_TO_SOLVE_QP, "Problems occured while solving QP", VS_VISIBLE }, -{ RET_INITIALISATION_STARTED, "Starting problem initialisation...", VS_VISIBLE }, -{ RET_HOTSTART_FAILED, "Unable to perform homotopy due to internal error", VS_VISIBLE }, -{ RET_HOTSTART_FAILED_TO_INIT, "Unable to initialise problem", VS_VISIBLE }, -{ RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, "Unable to perform homotopy as previous QP is not solved", VS_VISIBLE }, -{ RET_ITERATION_STARTED, "Iteration", VS_VISIBLE }, -{ RET_SHIFT_DETERMINATION_FAILED, "Determination of shift of the QP data failed", VS_VISIBLE }, -{ RET_STEPDIRECTION_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE }, -{ RET_STEPLENGTH_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE }, -{ RET_OPTIMAL_SOLUTION_FOUND, "Optimal solution of neighbouring QP found", VS_VISIBLE }, -{ RET_HOMOTOPY_STEP_FAILED, "Unable to perform homotopy step", VS_VISIBLE }, -{ RET_HOTSTART_STOPPED_INFEASIBILITY, "Premature homotopy termination because QP is infeasible", VS_VISIBLE }, -{ RET_HOTSTART_STOPPED_UNBOUNDEDNESS, "Premature homotopy termination because QP is unbounded", VS_VISIBLE }, -{ RET_WORKINGSET_UPDATE_FAILED, "Unable to update working sets according to initial guesses", VS_VISIBLE }, -{ RET_MAX_NWSR_REACHED, "Maximum number of working set recalculations performed", VS_VISIBLE }, -{ RET_CONSTRAINTS_NOT_SPECIFIED, "Problem does comprise constraints! You have to specify new constraints' bounds", VS_VISIBLE }, -{ RET_INVALID_FACTORISATION_FLAG, "Invalid factorisation flag", VS_VISIBLE }, -{ RET_UNABLE_TO_SAVE_QPDATA, "Unable to save QP data", VS_VISIBLE }, -{ RET_STEPDIRECTION_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE }, -{ RET_STEPDIRECTION_FAILED_CHOLESKY, "Abnormal termination due to Cholesky factorisation", VS_VISIBLE }, -{ RET_CYCLING_DETECTED, "Cycling detected", VS_VISIBLE }, -{ RET_CYCLING_NOT_RESOLVED, "Cycling cannot be resolved, QP is probably infeasible", VS_VISIBLE }, -{ RET_CYCLING_RESOLVED, "Cycling probably resolved", VS_VISIBLE }, -{ RET_STEPSIZE, "", VS_VISIBLE }, -{ RET_STEPSIZE_NONPOSITIVE, "", VS_VISIBLE }, -{ RET_SETUPSUBJECTTOTYPE_FAILED, "Setup of SubjectToTypes failed", VS_VISIBLE }, -{ RET_ADDCONSTRAINT_FAILED, "Addition of constraint to working set failed", VS_VISIBLE }, -{ RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, "Addition of constraint to working set failed", VS_VISIBLE }, -{ RET_ADDBOUND_FAILED, "Addition of bound to working set failed", VS_VISIBLE }, -{ RET_ADDBOUND_FAILED_INFEASIBILITY, "Addition of bound to working set failed", VS_VISIBLE }, -{ RET_REMOVECONSTRAINT_FAILED, "Removal of constraint from working set failed", VS_VISIBLE }, -{ RET_REMOVEBOUND_FAILED, "Removal of bound from working set failed", VS_VISIBLE }, -{ RET_REMOVE_FROM_ACTIVESET, "Removing from active set:", VS_VISIBLE }, -{ RET_ADD_TO_ACTIVESET, "Adding to active set:", VS_VISIBLE }, -{ RET_REMOVE_FROM_ACTIVESET_FAILED, "Removing from active set failed", VS_VISIBLE }, -{ RET_ADD_TO_ACTIVESET_FAILED, "Adding to active set failed", VS_VISIBLE }, -{ RET_CONSTRAINT_ALREADY_ACTIVE, "Constraint is already active", VS_VISIBLE }, -{ RET_ALL_CONSTRAINTS_ACTIVE, "All constraints are active, no further constraint can be added", VS_VISIBLE }, -{ RET_LINEARLY_DEPENDENT, "New bound/constraint is linearly dependent", VS_VISIBLE }, -{ RET_LINEARLY_INDEPENDENT, "New bound/constraint is linearly independent", VS_VISIBLE }, -{ RET_LI_RESOLVED, "Linear independence of active contraint matrix successfully resolved", VS_VISIBLE }, -{ RET_ENSURELI_FAILED, "Failed to ensure linear indepence of active contraint matrix", VS_VISIBLE }, -{ RET_ENSURELI_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE }, -{ RET_ENSURELI_FAILED_NOINDEX, "No index found, QP is probably infeasible", VS_VISIBLE }, -{ RET_ENSURELI_FAILED_CYCLING, "Cycling detected, QP is probably infeasible", VS_VISIBLE }, -{ RET_BOUND_ALREADY_ACTIVE, "Bound is already active", VS_VISIBLE }, -{ RET_ALL_BOUNDS_ACTIVE, "All bounds are active, no further bound can be added", VS_VISIBLE }, -{ RET_CONSTRAINT_NOT_ACTIVE, "Constraint is not active", VS_VISIBLE }, -{ RET_BOUND_NOT_ACTIVE, "Bound is not active", VS_VISIBLE }, -{ RET_HESSIAN_NOT_SPD, "Projected Hessian matrix not positive definite", VS_VISIBLE }, -{ RET_MATRIX_SHIFT_FAILED, "Unable to update matrices or to transform vectors", VS_VISIBLE }, -{ RET_MATRIX_FACTORISATION_FAILED, "Unable to calculate new matrix factorisations", VS_VISIBLE }, -{ RET_PRINT_ITERATION_FAILED, "Unable to print information on current iteration", VS_VISIBLE }, -{ RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, "No global message output file initialised", VS_VISIBLE }, -/* Utils */ -{ RET_UNABLE_TO_OPEN_FILE, "Unable to open file", VS_VISIBLE }, -{ RET_UNABLE_TO_WRITE_FILE, "Unable to write into file", VS_VISIBLE }, -{ RET_UNABLE_TO_READ_FILE, "Unable to read from file", VS_VISIBLE }, -{ RET_FILEDATA_INCONSISTENT, "File contains inconsistent data", VS_VISIBLE }, -/* SolutionAnalysis */ -{ RET_NO_SOLUTION, "QP solution does not satisfy KKT optimality conditions", VS_VISIBLE }, -{ RET_INACCURATE_SOLUTION, "KKT optimality conditions not satisfied to sufficient accuracy", VS_VISIBLE }, -{ TERMINAL_LIST_ELEMENT, "", VS_HIDDEN } /* IMPORTANT: Terminal list element! */ -}; - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * M e s s a g e H a n d l i n g - */ -MessageHandling::MessageHandling( ) : errorVisibility( VS_VISIBLE ), - warningVisibility( VS_VISIBLE ), - infoVisibility( VS_VISIBLE ), - outputFile( myStdout ), - errorCount( 0 ) -{ -} - -/* - * M e s s a g e H a n d l i n g - */ -MessageHandling::MessageHandling( myFILE* _outputFile ) : - errorVisibility( VS_VISIBLE ), - warningVisibility( VS_VISIBLE ), - infoVisibility( VS_VISIBLE ), - outputFile( _outputFile ), - errorCount( 0 ) -{ -} - -/* - * M e s s a g e H a n d l i n g - */ -MessageHandling::MessageHandling( VisibilityStatus _errorVisibility, - VisibilityStatus _warningVisibility, - VisibilityStatus _infoVisibility - ) : - errorVisibility( _errorVisibility ), - warningVisibility( _warningVisibility ), - infoVisibility( _infoVisibility ), - outputFile( myStderr ), - errorCount( 0 ) -{ -} - -/* - * M e s s a g e H a n d l i n g - */ -MessageHandling::MessageHandling( myFILE* _outputFile, - VisibilityStatus _errorVisibility, - VisibilityStatus _warningVisibility, - VisibilityStatus _infoVisibility - ) : - errorVisibility( _errorVisibility ), - warningVisibility( _warningVisibility ), - infoVisibility( _infoVisibility ), - outputFile( _outputFile ), - errorCount( 0 ) -{ -} - - - -/* - * M e s s a g e H a n d l i n g - */ -MessageHandling::MessageHandling( const MessageHandling& rhs ) : - errorVisibility( rhs.errorVisibility ), - warningVisibility( rhs.warningVisibility ), - infoVisibility( rhs.infoVisibility ), - outputFile( rhs.outputFile ), - errorCount( rhs.errorCount ) -{ -} - - -/* - * ~ M e s s a g e H a n d l i n g - */ -MessageHandling::~MessageHandling( ) -{ - #ifdef PC_DEBUG - if ( outputFile != 0 ) - fclose( outputFile ); - #endif -} - - -/* - * o p e r a t o r = - */ -MessageHandling& MessageHandling::operator=( const MessageHandling& rhs ) -{ - if ( this != &rhs ) - { - errorVisibility = rhs.errorVisibility; - warningVisibility = rhs.warningVisibility; - infoVisibility = rhs.infoVisibility; - outputFile = rhs.outputFile; - errorCount = rhs.errorCount; - } - - return *this; -} - - -/* - * t h r o w E r r o r - */ -returnValue MessageHandling::throwError( - returnValue Enumber, - const char* additionaltext, - const char* functionname, - const char* filename, - const unsigned long linenumber, - VisibilityStatus localVisibilityStatus - ) -{ - /* consistency check */ - if ( Enumber <= SUCCESSFUL_RETURN ) - return throwError( RET_ERROR_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - - /* Call to common throwMessage function if error shall be displayed. */ - if ( errorVisibility == VS_VISIBLE ) - return throwMessage( Enumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"ERROR" ); - else - return Enumber; -} - - -/* - * t h r o w W a r n i n g - */ -returnValue MessageHandling::throwWarning( - returnValue Wnumber, - const char* additionaltext, - const char* functionname, - const char* filename, - const unsigned long linenumber, - VisibilityStatus localVisibilityStatus - ) -{ - /* consistency check */ - if ( Wnumber <= SUCCESSFUL_RETURN ) - return throwError( RET_WARNING_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - - /* Call to common throwMessage function if warning shall be displayed. */ - if ( warningVisibility == VS_VISIBLE ) - return throwMessage( Wnumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"WARNING" ); - else - return Wnumber; -} - - -/* - * t h r o w I n f o - */ -returnValue MessageHandling::throwInfo( - returnValue Inumber, - const char* additionaltext, - const char* functionname, - const char* filename, - const unsigned long linenumber, - VisibilityStatus localVisibilityStatus - ) -{ - /* consistency check */ - if ( Inumber < SUCCESSFUL_RETURN ) - return throwError( RET_INFO_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - - /* Call to common throwMessage function if info shall be displayed. */ - if ( infoVisibility == VS_VISIBLE ) - return throwMessage( Inumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"INFO" ); - else - return Inumber; -} - - -/* - * r e s e t - */ -returnValue MessageHandling::reset( ) -{ - setErrorVisibilityStatus( VS_VISIBLE ); - setWarningVisibilityStatus( VS_VISIBLE ); - setInfoVisibilityStatus( VS_VISIBLE ); - - setOutputFile( myStderr ); - setErrorCount( 0 ); - - return SUCCESSFUL_RETURN; -} - - -/* - * l i s t A l l M e s s a g e s - */ -returnValue MessageHandling::listAllMessages( ) -{ - #ifdef PC_DEBUG - int keypos = 0; - char myPrintfString[160]; - - /* Run through whole returnValueList and print each item. */ - while ( returnValueList[keypos].key != TERMINAL_LIST_ELEMENT ) - { - sprintf( myPrintfString," %d - %s \n",keypos,returnValueList[keypos].data ); - myPrintf( myPrintfString ); - - ++keypos; - } - #endif - - return SUCCESSFUL_RETURN; -} - - - -/***************************************************************************** - * P R O T E C T E D * - *****************************************************************************/ - - -#ifdef PC_DEBUG /* Re-define throwMessage function for embedded code! */ - -/* - * t h r o w M e s s a g e - */ -returnValue MessageHandling::throwMessage( - returnValue RETnumber, - const char* additionaltext, - const char* functionname, - const char* filename, - const unsigned long linenumber, - VisibilityStatus localVisibilityStatus, - const char* RETstring - ) -{ - int i; - - int keypos = 0; - char myPrintfString[160]; - - /* 1) Determine number of whitespace for output. */ - char whitespaces[41]; - int numberOfWhitespaces = (errorCount-1)*2; - - if ( numberOfWhitespaces < 0 ) - numberOfWhitespaces = 0; - - if ( numberOfWhitespaces > 40 ) - numberOfWhitespaces = 40; - - for( i=0; i 0 ) - { - sprintf( myPrintfString,"%s->", whitespaces ); - myPrintf( myPrintfString ); - } - - if ( additionaltext == 0 ) - { - sprintf( myPrintfString,"%s (%s, %s:%d): \t%s\n", - RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data - ); - myPrintf( myPrintfString ); - } - else - { - sprintf( myPrintfString,"%s (%s, %s:%d): \t%s %s\n", - RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data,additionaltext - ); - myPrintf( myPrintfString ); - } - - /* take care of proper indention for subsequent error messages */ - if ( RETstring[0] == 'E' ) - { - ++errorCount; - } - else - { - if ( errorCount > 0 ) - myPrintf( "\n" ); - errorCount = 0; - } - } - - return RETnumber; -} - -#else /* = PC_DEBUG not defined */ - -/* - * t h r o w M e s s a g e - */ -returnValue MessageHandling::throwMessage( - returnValue RETnumber, - const char* additionaltext, - const char* functionname, - const char* filename, - const unsigned long linenumber, - VisibilityStatus localVisibilityStatus, - const char* RETstring - ) -{ - /* DUMMY CODE FOR PRETENDING USE OF ARGUMENTS - * FOR SUPPRESSING COMPILER WARNINGS! */ - int i = 0; - if ( additionaltext == 0 ) i++; - if ( functionname == 0 ) i++; - if ( filename == 0 ) i++; - if ( linenumber == 0 ) i++; - if ( localVisibilityStatus == VS_VISIBLE ) i++; - if ( RETstring == 0 ) i++; - /* END OF DUMMY CODE */ - - return RETnumber; -} - -#endif /* PC_DEBUG */ - - - -/***************************************************************************** - * G L O B A L M E S S A G E H A N D L E R * - *****************************************************************************/ - - -/** Global message handler for all qpOASES modules.*/ -MessageHandling globalMessageHandler( myStderr,VS_VISIBLE,VS_VISIBLE,VS_VISIBLE ); - - -/* - * g e t G l o b a l M e s s a g e H a n d l e r - */ -MessageHandling* getGlobalMessageHandler( ) -{ - return &globalMessageHandler; -} - -const char* MessageHandling::getErrorString(int error) -{ - return returnValueList[ error ].data; -} - - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/MessageHandling.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the MessageHandling class including global return values. + * + */ + + + +#include +#include + + + + +/** Defines pairs of global return values and messages. */ +MessageHandling::ReturnValueList returnValueList[] = +{ +/* miscellaneous */ +{ SUCCESSFUL_RETURN, "Successful return", VS_VISIBLE }, +{ RET_DIV_BY_ZERO, "Division by zero", VS_VISIBLE }, +{ RET_INDEX_OUT_OF_BOUNDS, "Index out of bounds", VS_VISIBLE }, +{ RET_INVALID_ARGUMENTS, "At least one of the arguments is invalid", VS_VISIBLE }, +{ RET_ERROR_UNDEFINED, "Error number undefined", VS_VISIBLE }, +{ RET_WARNING_UNDEFINED, "Warning number undefined", VS_VISIBLE }, +{ RET_INFO_UNDEFINED, "Info number undefined", VS_VISIBLE }, +{ RET_EWI_UNDEFINED, "Error/warning/info number undefined", VS_VISIBLE }, +{ RET_AVAILABLE_WITH_LINUX_ONLY, "This function is available under Linux only", VS_HIDDEN }, +{ RET_UNKNOWN_BUG, "The error occured is not yet known", VS_VISIBLE }, +{ RET_PRINTLEVEL_CHANGED, "Print level changed", VS_VISIBLE }, +{ RET_NOT_YET_IMPLEMENTED, "Requested function is not yet implemented.", VS_VISIBLE }, +/* Indexlist */ +{ RET_INDEXLIST_MUST_BE_REORDERD, "Index list has to be reordered", VS_VISIBLE }, +{ RET_INDEXLIST_EXCEEDS_MAX_LENGTH, "Index list exceeds its maximal physical length", VS_VISIBLE }, +{ RET_INDEXLIST_CORRUPTED, "Index list corrupted", VS_VISIBLE }, +{ RET_INDEXLIST_OUTOFBOUNDS, "Physical index is out of bounds", VS_VISIBLE }, +{ RET_INDEXLIST_ADD_FAILED, "Adding indices from another index set failed", VS_VISIBLE }, +{ RET_INDEXLIST_INTERSECT_FAILED, "Intersection with another index set failed", VS_VISIBLE }, +/* SubjectTo / Bounds / Constraints */ +{ RET_INDEX_ALREADY_OF_DESIRED_STATUS, "Index is already of desired status", VS_VISIBLE }, +{ RET_SWAPINDEX_FAILED, "Cannot swap between different indexsets", VS_VISIBLE }, +{ RET_ADDINDEX_FAILED, "Adding index to index set failed", VS_VISIBLE }, +{ RET_NOTHING_TO_DO, "Nothing to do", VS_VISIBLE }, +{ RET_SETUP_BOUND_FAILED, "Setting up bound index failed", VS_VISIBLE }, +{ RET_SETUP_CONSTRAINT_FAILED, "Setting up constraint index failed", VS_VISIBLE }, +{ RET_MOVING_BOUND_FAILED, "Moving bound between index sets failed", VS_VISIBLE }, +{ RET_MOVING_CONSTRAINT_FAILED, "Moving constraint between index sets failed", VS_VISIBLE }, +/* QProblem */ +{ RET_QP_ALREADY_INITIALISED, "QProblem has already been initialised", VS_VISIBLE }, +{ RET_NO_INIT_WITH_STANDARD_SOLVER, "Initialisation via extern QP solver is not yet implemented", VS_VISIBLE }, +{ RET_RESET_FAILED, "Reset failed", VS_VISIBLE }, +{ RET_INIT_FAILED, "Initialisation failed", VS_VISIBLE }, +{ RET_INIT_FAILED_TQ, "Initialisation failed due to TQ factorisation", VS_VISIBLE }, +{ RET_INIT_FAILED_CHOLESKY, "Initialisation failed due to Cholesky decomposition", VS_VISIBLE }, +{ RET_INIT_FAILED_HOTSTART, "Initialisation failed! QP could not be solved!", VS_VISIBLE }, +{ RET_INIT_FAILED_INFEASIBILITY, "Initial QP could not be solved due to infeasibility!", VS_VISIBLE }, +{ RET_INIT_FAILED_UNBOUNDEDNESS, "Initial QP could not be solved due to unboundedness!", VS_VISIBLE }, +{ RET_INIT_SUCCESSFUL, "Initialisation done", VS_VISIBLE }, +{ RET_OBTAINING_WORKINGSET_FAILED, "Failed to obtain working set for auxiliary QP", VS_VISIBLE }, +{ RET_SETUP_WORKINGSET_FAILED, "Failed to setup working set for auxiliary QP", VS_VISIBLE }, +{ RET_SETUP_AUXILIARYQP_FAILED, "Failed to setup auxiliary QP for initialised homotopy", VS_VISIBLE }, +{ RET_NO_EXTERN_SOLVER, "No extern QP solver available", VS_VISIBLE }, +{ RET_QP_UNBOUNDED, "QP is unbounded", VS_VISIBLE }, +{ RET_QP_INFEASIBLE, "QP is infeasible", VS_VISIBLE }, +{ RET_QP_NOT_SOLVED, "Problems occured while solving QP with standard solver", VS_VISIBLE }, +{ RET_QP_SOLVED, "QP successfully solved", VS_VISIBLE }, +{ RET_UNABLE_TO_SOLVE_QP, "Problems occured while solving QP", VS_VISIBLE }, +{ RET_INITIALISATION_STARTED, "Starting problem initialisation...", VS_VISIBLE }, +{ RET_HOTSTART_FAILED, "Unable to perform homotopy due to internal error", VS_VISIBLE }, +{ RET_HOTSTART_FAILED_TO_INIT, "Unable to initialise problem", VS_VISIBLE }, +{ RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, "Unable to perform homotopy as previous QP is not solved", VS_VISIBLE }, +{ RET_ITERATION_STARTED, "Iteration", VS_VISIBLE }, +{ RET_SHIFT_DETERMINATION_FAILED, "Determination of shift of the QP data failed", VS_VISIBLE }, +{ RET_STEPDIRECTION_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE }, +{ RET_STEPLENGTH_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE }, +{ RET_OPTIMAL_SOLUTION_FOUND, "Optimal solution of neighbouring QP found", VS_VISIBLE }, +{ RET_HOMOTOPY_STEP_FAILED, "Unable to perform homotopy step", VS_VISIBLE }, +{ RET_HOTSTART_STOPPED_INFEASIBILITY, "Premature homotopy termination because QP is infeasible", VS_VISIBLE }, +{ RET_HOTSTART_STOPPED_UNBOUNDEDNESS, "Premature homotopy termination because QP is unbounded", VS_VISIBLE }, +{ RET_WORKINGSET_UPDATE_FAILED, "Unable to update working sets according to initial guesses", VS_VISIBLE }, +{ RET_MAX_NWSR_REACHED, "Maximum number of working set recalculations performed", VS_VISIBLE }, +{ RET_CONSTRAINTS_NOT_SPECIFIED, "Problem does comprise constraints! You have to specify new constraints' bounds", VS_VISIBLE }, +{ RET_INVALID_FACTORISATION_FLAG, "Invalid factorisation flag", VS_VISIBLE }, +{ RET_UNABLE_TO_SAVE_QPDATA, "Unable to save QP data", VS_VISIBLE }, +{ RET_STEPDIRECTION_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE }, +{ RET_STEPDIRECTION_FAILED_CHOLESKY, "Abnormal termination due to Cholesky factorisation", VS_VISIBLE }, +{ RET_CYCLING_DETECTED, "Cycling detected", VS_VISIBLE }, +{ RET_CYCLING_NOT_RESOLVED, "Cycling cannot be resolved, QP is probably infeasible", VS_VISIBLE }, +{ RET_CYCLING_RESOLVED, "Cycling probably resolved", VS_VISIBLE }, +{ RET_STEPSIZE, "", VS_VISIBLE }, +{ RET_STEPSIZE_NONPOSITIVE, "", VS_VISIBLE }, +{ RET_SETUPSUBJECTTOTYPE_FAILED, "Setup of SubjectToTypes failed", VS_VISIBLE }, +{ RET_ADDCONSTRAINT_FAILED, "Addition of constraint to working set failed", VS_VISIBLE }, +{ RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, "Addition of constraint to working set failed", VS_VISIBLE }, +{ RET_ADDBOUND_FAILED, "Addition of bound to working set failed", VS_VISIBLE }, +{ RET_ADDBOUND_FAILED_INFEASIBILITY, "Addition of bound to working set failed", VS_VISIBLE }, +{ RET_REMOVECONSTRAINT_FAILED, "Removal of constraint from working set failed", VS_VISIBLE }, +{ RET_REMOVEBOUND_FAILED, "Removal of bound from working set failed", VS_VISIBLE }, +{ RET_REMOVE_FROM_ACTIVESET, "Removing from active set:", VS_VISIBLE }, +{ RET_ADD_TO_ACTIVESET, "Adding to active set:", VS_VISIBLE }, +{ RET_REMOVE_FROM_ACTIVESET_FAILED, "Removing from active set failed", VS_VISIBLE }, +{ RET_ADD_TO_ACTIVESET_FAILED, "Adding to active set failed", VS_VISIBLE }, +{ RET_CONSTRAINT_ALREADY_ACTIVE, "Constraint is already active", VS_VISIBLE }, +{ RET_ALL_CONSTRAINTS_ACTIVE, "All constraints are active, no further constraint can be added", VS_VISIBLE }, +{ RET_LINEARLY_DEPENDENT, "New bound/constraint is linearly dependent", VS_VISIBLE }, +{ RET_LINEARLY_INDEPENDENT, "New bound/constraint is linearly independent", VS_VISIBLE }, +{ RET_LI_RESOLVED, "Linear independence of active contraint matrix successfully resolved", VS_VISIBLE }, +{ RET_ENSURELI_FAILED, "Failed to ensure linear indepence of active contraint matrix", VS_VISIBLE }, +{ RET_ENSURELI_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE }, +{ RET_ENSURELI_FAILED_NOINDEX, "No index found, QP is probably infeasible", VS_VISIBLE }, +{ RET_ENSURELI_FAILED_CYCLING, "Cycling detected, QP is probably infeasible", VS_VISIBLE }, +{ RET_BOUND_ALREADY_ACTIVE, "Bound is already active", VS_VISIBLE }, +{ RET_ALL_BOUNDS_ACTIVE, "All bounds are active, no further bound can be added", VS_VISIBLE }, +{ RET_CONSTRAINT_NOT_ACTIVE, "Constraint is not active", VS_VISIBLE }, +{ RET_BOUND_NOT_ACTIVE, "Bound is not active", VS_VISIBLE }, +{ RET_HESSIAN_NOT_SPD, "Projected Hessian matrix not positive definite", VS_VISIBLE }, +{ RET_MATRIX_SHIFT_FAILED, "Unable to update matrices or to transform vectors", VS_VISIBLE }, +{ RET_MATRIX_FACTORISATION_FAILED, "Unable to calculate new matrix factorisations", VS_VISIBLE }, +{ RET_PRINT_ITERATION_FAILED, "Unable to print information on current iteration", VS_VISIBLE }, +{ RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, "No global message output file initialised", VS_VISIBLE }, +/* Utils */ +{ RET_UNABLE_TO_OPEN_FILE, "Unable to open file", VS_VISIBLE }, +{ RET_UNABLE_TO_WRITE_FILE, "Unable to write into file", VS_VISIBLE }, +{ RET_UNABLE_TO_READ_FILE, "Unable to read from file", VS_VISIBLE }, +{ RET_FILEDATA_INCONSISTENT, "File contains inconsistent data", VS_VISIBLE }, +/* SolutionAnalysis */ +{ RET_NO_SOLUTION, "QP solution does not satisfy KKT optimality conditions", VS_VISIBLE }, +{ RET_INACCURATE_SOLUTION, "KKT optimality conditions not satisfied to sufficient accuracy", VS_VISIBLE }, +{ TERMINAL_LIST_ELEMENT, "", VS_HIDDEN } /* IMPORTANT: Terminal list element! */ +}; + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * M e s s a g e H a n d l i n g + */ +MessageHandling::MessageHandling( ) : errorVisibility( VS_VISIBLE ), + warningVisibility( VS_VISIBLE ), + infoVisibility( VS_VISIBLE ), + outputFile( myStdout ), + errorCount( 0 ) +{ +} + +/* + * M e s s a g e H a n d l i n g + */ +MessageHandling::MessageHandling( myFILE* _outputFile ) : + errorVisibility( VS_VISIBLE ), + warningVisibility( VS_VISIBLE ), + infoVisibility( VS_VISIBLE ), + outputFile( _outputFile ), + errorCount( 0 ) +{ +} + +/* + * M e s s a g e H a n d l i n g + */ +MessageHandling::MessageHandling( VisibilityStatus _errorVisibility, + VisibilityStatus _warningVisibility, + VisibilityStatus _infoVisibility + ) : + errorVisibility( _errorVisibility ), + warningVisibility( _warningVisibility ), + infoVisibility( _infoVisibility ), + outputFile( myStderr ), + errorCount( 0 ) +{ +} + +/* + * M e s s a g e H a n d l i n g + */ +MessageHandling::MessageHandling( myFILE* _outputFile, + VisibilityStatus _errorVisibility, + VisibilityStatus _warningVisibility, + VisibilityStatus _infoVisibility + ) : + errorVisibility( _errorVisibility ), + warningVisibility( _warningVisibility ), + infoVisibility( _infoVisibility ), + outputFile( _outputFile ), + errorCount( 0 ) +{ +} + + + +/* + * M e s s a g e H a n d l i n g + */ +MessageHandling::MessageHandling( const MessageHandling& rhs ) : + errorVisibility( rhs.errorVisibility ), + warningVisibility( rhs.warningVisibility ), + infoVisibility( rhs.infoVisibility ), + outputFile( rhs.outputFile ), + errorCount( rhs.errorCount ) +{ +} + + +/* + * ~ M e s s a g e H a n d l i n g + */ +MessageHandling::~MessageHandling( ) +{ + #ifdef PC_DEBUG + if ( outputFile != 0 ) + fclose( outputFile ); + #endif +} + + +/* + * o p e r a t o r = + */ +MessageHandling& MessageHandling::operator=( const MessageHandling& rhs ) +{ + if ( this != &rhs ) + { + errorVisibility = rhs.errorVisibility; + warningVisibility = rhs.warningVisibility; + infoVisibility = rhs.infoVisibility; + outputFile = rhs.outputFile; + errorCount = rhs.errorCount; + } + + return *this; +} + + +/* + * t h r o w E r r o r + */ +returnValue MessageHandling::throwError( + returnValue Enumber, + const char* additionaltext, + const char* functionname, + const char* filename, + const unsigned long linenumber, + VisibilityStatus localVisibilityStatus + ) +{ + /* consistency check */ + if ( Enumber <= SUCCESSFUL_RETURN ) + return throwError( RET_ERROR_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + + /* Call to common throwMessage function if error shall be displayed. */ + if ( errorVisibility == VS_VISIBLE ) + return throwMessage( Enumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"ERROR" ); + else + return Enumber; +} + + +/* + * t h r o w W a r n i n g + */ +returnValue MessageHandling::throwWarning( + returnValue Wnumber, + const char* additionaltext, + const char* functionname, + const char* filename, + const unsigned long linenumber, + VisibilityStatus localVisibilityStatus + ) +{ + /* consistency check */ + if ( Wnumber <= SUCCESSFUL_RETURN ) + return throwError( RET_WARNING_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + + /* Call to common throwMessage function if warning shall be displayed. */ + if ( warningVisibility == VS_VISIBLE ) + return throwMessage( Wnumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"WARNING" ); + else + return Wnumber; +} + + +/* + * t h r o w I n f o + */ +returnValue MessageHandling::throwInfo( + returnValue Inumber, + const char* additionaltext, + const char* functionname, + const char* filename, + const unsigned long linenumber, + VisibilityStatus localVisibilityStatus + ) +{ + /* consistency check */ + if ( Inumber < SUCCESSFUL_RETURN ) + return throwError( RET_INFO_UNDEFINED,0,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + + /* Call to common throwMessage function if info shall be displayed. */ + if ( infoVisibility == VS_VISIBLE ) + return throwMessage( Inumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"INFO" ); + else + return Inumber; +} + + +/* + * r e s e t + */ +returnValue MessageHandling::reset( ) +{ + setErrorVisibilityStatus( VS_VISIBLE ); + setWarningVisibilityStatus( VS_VISIBLE ); + setInfoVisibilityStatus( VS_VISIBLE ); + + setOutputFile( myStderr ); + setErrorCount( 0 ); + + return SUCCESSFUL_RETURN; +} + + +/* + * l i s t A l l M e s s a g e s + */ +returnValue MessageHandling::listAllMessages( ) +{ + #ifdef PC_DEBUG + int keypos = 0; + char myPrintfString[160]; + + /* Run through whole returnValueList and print each item. */ + while ( returnValueList[keypos].key != TERMINAL_LIST_ELEMENT ) + { + sprintf( myPrintfString," %d - %s \n",keypos,returnValueList[keypos].data ); + myPrintf( myPrintfString ); + + ++keypos; + } + #endif + + return SUCCESSFUL_RETURN; +} + + + +/***************************************************************************** + * P R O T E C T E D * + *****************************************************************************/ + + +#ifdef PC_DEBUG /* Re-define throwMessage function for embedded code! */ + +/* + * t h r o w M e s s a g e + */ +returnValue MessageHandling::throwMessage( + returnValue RETnumber, + const char* additionaltext, + const char* functionname, + const char* filename, + const unsigned long linenumber, + VisibilityStatus localVisibilityStatus, + const char* RETstring + ) +{ + int i; + + int keypos = 0; + char myPrintfString[160]; + + /* 1) Determine number of whitespace for output. */ + char whitespaces[41]; + int numberOfWhitespaces = (errorCount-1)*2; + + if ( numberOfWhitespaces < 0 ) + numberOfWhitespaces = 0; + + if ( numberOfWhitespaces > 40 ) + numberOfWhitespaces = 40; + + for( i=0; i 0 ) + { + sprintf( myPrintfString,"%s->", whitespaces ); + myPrintf( myPrintfString ); + } + + if ( additionaltext == 0 ) + { + sprintf( myPrintfString,"%s (%s, %s:%d): \t%s\n", + RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data + ); + myPrintf( myPrintfString ); + } + else + { + sprintf( myPrintfString,"%s (%s, %s:%d): \t%s %s\n", + RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data,additionaltext + ); + myPrintf( myPrintfString ); + } + + /* take care of proper indention for subsequent error messages */ + if ( RETstring[0] == 'E' ) + { + ++errorCount; + } + else + { + if ( errorCount > 0 ) + myPrintf( "\n" ); + errorCount = 0; + } + } + + return RETnumber; +} + +#else /* = PC_DEBUG not defined */ + +/* + * t h r o w M e s s a g e + */ +returnValue MessageHandling::throwMessage( + returnValue RETnumber, + const char* additionaltext, + const char* functionname, + const char* filename, + const unsigned long linenumber, + VisibilityStatus localVisibilityStatus, + const char* RETstring + ) +{ + /* DUMMY CODE FOR PRETENDING USE OF ARGUMENTS + * FOR SUPPRESSING COMPILER WARNINGS! */ + int i = 0; + if ( additionaltext == 0 ) i++; + if ( functionname == 0 ) i++; + if ( filename == 0 ) i++; + if ( linenumber == 0 ) i++; + if ( localVisibilityStatus == VS_VISIBLE ) i++; + if ( RETstring == 0 ) i++; + /* END OF DUMMY CODE */ + + return RETnumber; +} + +#endif /* PC_DEBUG */ + + + +/***************************************************************************** + * G L O B A L M E S S A G E H A N D L E R * + *****************************************************************************/ + + +/** Global message handler for all qpOASES modules.*/ +MessageHandling globalMessageHandler( myStderr,VS_VISIBLE,VS_VISIBLE,VS_VISIBLE ); + + +/* + * g e t G l o b a l M e s s a g e H a n d l e r + */ +MessageHandling* getGlobalMessageHandler( ) +{ + return &globalMessageHandler; +} + +const char* MessageHandling::getErrorString(int error) +{ + return returnValueList[ error ].data; +} + + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/MessageHandling.ipp b/phonelibs/qpoases/SRC/MessageHandling.ipp index ad9624b3d..033957b28 100644 --- a/phonelibs/qpoases/SRC/MessageHandling.ipp +++ b/phonelibs/qpoases/SRC/MessageHandling.ipp @@ -1,137 +1,137 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/MessageHandling.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of inlined member functions of the MessageHandling class. - */ - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - -/* - * g e t E r r o r V i s i b i l i t y S t a t u s - */ -inline VisibilityStatus MessageHandling::getErrorVisibilityStatus( ) const -{ - return errorVisibility; -} - - -/* - * g e t W a r n i n g V i s i b i l i t y S t a t u s - */ -inline VisibilityStatus MessageHandling::getWarningVisibilityStatus( ) const -{ - return warningVisibility; -} - - -/* - * g e t I n f o V i s i b i l i t y S t a t u s - */ -inline VisibilityStatus MessageHandling::getInfoVisibilityStatus( ) const -{ - return infoVisibility; -} - - -/* - * g e t O u t p u t F i l e - */ -inline myFILE* MessageHandling::getOutputFile( ) const -{ - return outputFile; -} - - -/* - * g e t E r r o r C o u n t - */ -inline int MessageHandling::getErrorCount( ) const -{ - return errorCount; -} - - -/* - * s e t E r r o r V i s i b i l i t y S t a t u s - */ -inline void MessageHandling::setErrorVisibilityStatus( VisibilityStatus _errorVisibility ) -{ - errorVisibility = _errorVisibility; -} - - -/* - * s e t W a r n i n g V i s i b i l i t y S t a t u s - */ -inline void MessageHandling::setWarningVisibilityStatus( VisibilityStatus _warningVisibility ) -{ - warningVisibility = _warningVisibility; -} - - -/* - * s e t I n f o V i s i b i l i t y S t a t u s - */ -inline void MessageHandling::setInfoVisibilityStatus( VisibilityStatus _infoVisibility ) -{ - infoVisibility = _infoVisibility; -} - - -/* - * s e t O u t p u t F i l e - */ -inline void MessageHandling::setOutputFile( myFILE* _outputFile ) -{ - outputFile = _outputFile; -} - - -/* - * s e t E r r o r C o u n t - */ -inline returnValue MessageHandling::setErrorCount( int _errorCount ) -{ - if ( _errorCount >= 0 ) - { - errorCount = _errorCount; - return SUCCESSFUL_RETURN; - } - else - return RET_INVALID_ARGUMENTS; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/MessageHandling.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of inlined member functions of the MessageHandling class. + */ + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t E r r o r V i s i b i l i t y S t a t u s + */ +inline VisibilityStatus MessageHandling::getErrorVisibilityStatus( ) const +{ + return errorVisibility; +} + + +/* + * g e t W a r n i n g V i s i b i l i t y S t a t u s + */ +inline VisibilityStatus MessageHandling::getWarningVisibilityStatus( ) const +{ + return warningVisibility; +} + + +/* + * g e t I n f o V i s i b i l i t y S t a t u s + */ +inline VisibilityStatus MessageHandling::getInfoVisibilityStatus( ) const +{ + return infoVisibility; +} + + +/* + * g e t O u t p u t F i l e + */ +inline myFILE* MessageHandling::getOutputFile( ) const +{ + return outputFile; +} + + +/* + * g e t E r r o r C o u n t + */ +inline int MessageHandling::getErrorCount( ) const +{ + return errorCount; +} + + +/* + * s e t E r r o r V i s i b i l i t y S t a t u s + */ +inline void MessageHandling::setErrorVisibilityStatus( VisibilityStatus _errorVisibility ) +{ + errorVisibility = _errorVisibility; +} + + +/* + * s e t W a r n i n g V i s i b i l i t y S t a t u s + */ +inline void MessageHandling::setWarningVisibilityStatus( VisibilityStatus _warningVisibility ) +{ + warningVisibility = _warningVisibility; +} + + +/* + * s e t I n f o V i s i b i l i t y S t a t u s + */ +inline void MessageHandling::setInfoVisibilityStatus( VisibilityStatus _infoVisibility ) +{ + infoVisibility = _infoVisibility; +} + + +/* + * s e t O u t p u t F i l e + */ +inline void MessageHandling::setOutputFile( myFILE* _outputFile ) +{ + outputFile = _outputFile; +} + + +/* + * s e t E r r o r C o u n t + */ +inline returnValue MessageHandling::setErrorCount( int _errorCount ) +{ + if ( _errorCount >= 0 ) + { + errorCount = _errorCount; + return SUCCESSFUL_RETURN; + } + else + return RET_INVALID_ARGUMENTS; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/QProblem.cpp b/phonelibs/qpoases/SRC/QProblem.cpp index 68a6a79e5..75e2f324d 100644 --- a/phonelibs/qpoases/SRC/QProblem.cpp +++ b/phonelibs/qpoases/SRC/QProblem.cpp @@ -1,3867 +1,3867 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/QProblem.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the QProblem class which is able to use the newly - * developed online active set strategy for parametric quadratic programming. - */ - - -#include - -#include - -void printmatrix2(char *name, double *A, int m, int n) { - int i, j; - - printf("%s = [...\n", name); - for (i = 0; i < m; i++) { - for (j = 0; j < n; j++) - printf(" % 9.4f", A[i*n+j]); - printf(",\n"); - } - printf("];\n"); -} - -//#define __PERFORM_KKT_TEST__ - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * Q P r o b l e m - */ -QProblem::QProblem( ) : QProblemB( ) -{ - constraints.init( 0 ); - - sizeT = 0; - - cyclingManager.init( 0,0 ); -} - - -/* - * Q P r o b l e m - */ -QProblem::QProblem( int _nV, int _nC ) : QProblemB( _nV ) -{ - /* consistency checks */ - if ( _nV <= 0 ) - _nV = 1; - - if ( _nC < 0 ) - { - _nC = 0; - THROWERROR( RET_INVALID_ARGUMENTS ); - } - - constraints.init( _nC ); - - - sizeT = _nC; - if ( _nC > _nV ) - sizeT = _nV; - - cyclingManager.init( _nV,_nC ); -} - - -/* - * Q P r o b l e m - */ -QProblem::QProblem( const QProblem& rhs ) : QProblemB( rhs ) -{ - int i, j; - - int _nV = rhs.bounds.getNV( ); - int _nC = rhs.constraints.getNC( ); - - for( i=0; i<_nC; ++i ) - for( j=0; j<_nV; ++j ) - A[i*NVMAX + j] = rhs.A[i*NVMAX + j]; - - for( i=0; i<_nC; ++i ) - lbA[i] = rhs.lbA[i]; - - for( i=0; i<_nC; ++i ) - ubA[i] = rhs.ubA[i]; - - constraints = rhs.constraints; - - for( i=0; i<(_nV+_nC); ++i ) - y[i] = rhs.y[i]; - - - sizeT = rhs.sizeT; - - for( i=0; ithrowInfo( RET_ITERATION_STARTED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - /* 1) Setup index arrays. */ - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - if ( constraints.getInactive( )->getNumberArray( IAC_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - /* 2) Detemination of shift direction of the gradient and the (constraints') bounds. */ - returnvalue = hotstart_determineDataShift( FX_idx, AC_idx, - g_new,lbA_new,ubA_new,lb_new,ub_new, - delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, - Delta_bC_isZero, Delta_bB_isZero ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_SHIFT_DETERMINATION_FAILED ); - return returnvalue; - } - - /* 3) Determination of step direction of X and Y. */ - returnvalue = hotstart_determineStepDirection( FR_idx,FX_idx,AC_idx, - delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, - Delta_bC_isZero, Delta_bB_isZero, - delta_xFX,delta_xFR,delta_yAC,delta_yFX - ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_STEPDIRECTION_DETERMINATION_FAILED ); - return returnvalue; - } - - /* 4) Determination of step length TAU. */ - returnvalue = hotstart_determineStepLength( FR_idx,FX_idx,AC_idx,IAC_idx, - delta_lbA,delta_ubA,delta_lb,delta_ub, - delta_xFX,delta_xFR,delta_yAC,delta_yFX,delta_Ax, - BC_idx,BC_status,BC_isBound - ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_STEPLENGTH_DETERMINATION_FAILED ); - return returnvalue; - } - - /* 5) Realisation of the homotopy step. */ - returnvalue = hotstart_performStep( FR_idx,FX_idx,AC_idx,IAC_idx, - delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, - delta_xFX,delta_xFR,delta_yAC,delta_yFX,delta_Ax, - BC_idx,BC_status,BC_isBound - ); - - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - - /* stop runtime measurement */ - if ( cputime != 0 ) - *cputime = getCPUtime( ) - starttime; - - /* optimal solution found? */ - if ( returnvalue == RET_OPTIMAL_SOLUTION_FOUND ) - { - status = QPS_SOLVED; - - if ( printlevel == PL_HIGH ) - THROWINFO( RET_OPTIMAL_SOLUTION_FOUND ); - - #ifdef PC_DEBUG - if ( printIteration( l,BC_idx,BC_status,BC_isBound ) != SUCCESSFUL_RETURN ) - THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ - #endif - - /* check KKT optimality conditions */ - return checkKKTconditions( ); - } - else - { - /* checks for infeasibility... */ - if ( isInfeasible( ) == BT_TRUE ) - { - status = QPS_HOMOTOPYQPSOLVED; - return THROWERROR( RET_HOTSTART_STOPPED_INFEASIBILITY ); - } - - /* ...unboundedness... */ - if ( unbounded == BT_TRUE ) /* not necessary since objective function convex! */ - return THROWERROR( RET_HOTSTART_STOPPED_UNBOUNDEDNESS ); - - /* ... and throw unspecific error otherwise */ - THROWERROR( RET_HOMOTOPY_STEP_FAILED ); - return returnvalue; - } - } - - /* 6) Output information of successful QP iteration. */ - status = QPS_HOMOTOPYQPSOLVED; - - #ifdef PC_DEBUG - if ( printIteration( l,BC_idx,BC_status,BC_isBound ) != SUCCESSFUL_RETURN ) - THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ - #endif - } - - - /* stop runtime measurement */ - if ( cputime != 0 ) - *cputime = getCPUtime( ) - starttime; - - - /* if programm gets to here, output information that QP could not be solved - * within the given maximum numbers of working set changes */ - if ( printlevel == PL_HIGH ) - { - #ifdef PC_DEBUG - sprintf( messageString,"(nWSR = %d)",nWSR ); - return getGlobalMessageHandler( )->throwWarning( RET_MAX_NWSR_REACHED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - /* Finally check KKT optimality conditions. */ - returnValue returnvalueKKTcheck = checkKKTconditions( ); - - if ( returnvalueKKTcheck != SUCCESSFUL_RETURN ) - return returnvalueKKTcheck; - else - return RET_MAX_NWSR_REACHED; -} - - -/* - * g e t N Z - */ -int QProblem::getNZ( ) -{ - /* nZ = nFR - nAC */ - return bounds.getFree( )->getLength( ) - constraints.getActive( )->getLength( ); -} - - -/* - * g e t D u a l S o l u t i o n - */ -returnValue QProblem::getDualSolution( real_t* const yOpt ) const -{ - int i; - - /* return optimal dual solution vector - * only if current QP has been solved */ - if ( ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - for( i=0; i -INFTY ) - { - constraints.setNoLower( BT_FALSE ); - break; - } - } - - /* 2) Check if upper constraints' bounds are present. */ - constraints.setNoUpper( BT_TRUE ); - for( i=0; i INFTY - BOUNDTOL ) ) - { - constraints.setType( i,ST_UNBOUNDED ); - ++nUC; - } - else - { - if ( lbA[i] > ubA[i] - BOUNDTOL ) - { - constraints.setType( i,ST_EQUALITY ); - ++nEC; - } - else - { - constraints.setType( i,ST_BOUNDED ); - } - } - } - - /* 4) Set dimensions of constraints structure. */ - constraints.setNEC( nEC ); - constraints.setNUC( nUC ); - constraints.setNIC( nC - nEC - nUC ); - - return SUCCESSFUL_RETURN; -} - - -/* - * c h o l e s k y D e c o m p o s i t i o n P r o j e c t e d - */ -returnValue QProblem::setupCholeskyDecompositionProjected( ) -{ - int i, j, k, ii, kk; - int nV = getNV( ); - int nFR = getNFR( ); - int nZ = getNZ( ); - - /* 1) Initialises R with all zeros. */ - for( i=0; i 0 ) - { - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INDEXLIST_CORRUPTED ); - -#if 0 - real_t HZ[NVMAX*NVMAX]; - real_t ZHZ[NVMAX*NVMAX]; - - /* calculate H*Z */ - for ( i=0; i=0; --k ) - sum -= R[k*NVMAX + i] * R[k*NVMAX + i]; - - if ( sum > 0.0 ) - { - R[i*NVMAX + i] = sqrt( sum ); - inv = 1.0 / R[i * NVMAX + i]; - } - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - - for( j=(i+1); j=0; --k ) - sum -= R[k*NVMAX + i] * R[k*NVMAX + j]; - - R[i*NVMAX + j] = sum * inv; - } - } -#else - real_t HZ[NVMAX]; - real_t ZHZ[NVMAX]; - - real_t sum, inv; - for (j = 0; j < nZ; ++j) - { - /* Cache one column of Z. */ - for (i = 0; i < NVMAX; ++i) - ZHZ[i] = Q[i * NVMAX + j]; - - /* Create one column of the product H * Z. */ - for (i = 0; i < nFR; ++i) - { - ii = FR_idx[i]; - - sum = 0.0; - for (k = 0; k < nFR; ++k) - { - kk = FR_idx[k]; - sum += H[ii * NVMAX + kk] * ZHZ[kk]; - } - HZ[ii] = sum; - } - - /* Create one column of the product Z^T * H * Z. */ - for (i = j; i < nZ; ++i) - ZHZ[ i ] = 0.0; - - for (k = 0; k < nFR; ++k) - { - kk = FR_idx[k]; - real_t q = HZ[kk]; - for (i = j; i < nZ; ++i) - { - ZHZ[i] += Q[kk * NVMAX + i] * q; - } - } - - /* Use the computed column to update the factorization. */ - /* j == i */ - sum = ZHZ[j]; - - for (k = (j - 1); k >= 0; --k) - sum -= R[k * NVMAX + j] * R[k * NVMAX + j]; - - if (sum > 0.0) - { - R[j * NVMAX + j] = sqrt(sum); - inv = 1.0 / R[j * NVMAX + j]; - } - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - - for (i = (j + 1); i < nZ; ++i) - { - sum = ZHZ[i]; - - for (k = (j - 1); k >= 0; --k) - sum -= R[k * NVMAX + j] * R[k * NVMAX + i]; - - R[j * NVMAX + i] = sum * inv; - } - } -#endif - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p T Q f a c t o r i s a t i o n - */ -returnValue QProblem::setupTQfactorisation( ) -{ - int i, j, ii; - int nV = getNV( ); - int nFR = getNFR( ); - - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INDEXLIST_CORRUPTED ); - - /* 1) Set Q to unity matrix. */ - for( i=0; igetStatus( i ); - - if ( constraints.getType( i ) == ST_EQUALITY ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryConstraints->setupConstraint( i,guessedStatus ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - else /* No initial working set specified. */ - { - /* Obtain initial working set by "clipping". */ - if ( ( xOpt != 0 ) && ( yOpt == 0 ) ) - { - for( i=0; isetupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - if ( Ax[i] >= ubA[i] - BOUNDTOL ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_UPPER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - /* Moreover, add all equality constraints if specified. */ - if ( constraints.getType( i ) == ST_EQUALITY ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - - /* Obtain initial working set in accordance to sign of dual solution vector. */ - if ( ( xOpt == 0 ) && ( yOpt != 0 ) ) - { - for( i=0; i ZERO ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - if ( yOpt[nV+i] < -ZERO ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_UPPER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - /* Moreover, add all equality constraints if specified. */ - if ( constraints.getType( i ) == ST_EQUALITY ) - { - if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - - /* If xOpt and yOpt are null pointer and no initial working is specified, - * start with empty working set (or implicitly fixed bounds and equality constraints only) - * for auxiliary QP. */ - if ( ( xOpt == 0 ) && ( yOpt == 0 ) ) - { - for( i=0; isetupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - } - - return SUCCESSFUL_RETURN; -} - - - -/* - * s e t u p A u x i l i a r y W o r k i n g S e t - */ -returnValue QProblem::setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, - const Constraints* const auxiliaryConstraints, - BooleanType setupAfresh - ) -{ - int i; - int nV = getNV( ); - int nC = getNC( ); - - /* consistency checks */ - if ( auxiliaryBounds != 0 ) - { - for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) - return THROWERROR( RET_UNKNOWN_BUG ); - } - else - { - return THROWERROR( RET_INVALID_ARGUMENTS ); - } - - if ( auxiliaryConstraints != 0 ) - { - for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) - return THROWERROR( RET_UNKNOWN_BUG ); - } - else - { - return THROWERROR( RET_INVALID_ARGUMENTS ); - } - - - /* I) SETUP CHOLESKY FLAG: - * Cholesky decomposition shall only be updated if working set - * shall be updated (i.e. NOT setup afresh!) */ - BooleanType updateCholesky; - if ( setupAfresh == BT_TRUE ) - updateCholesky = BT_FALSE; - else - updateCholesky = BT_TRUE; - - - /* II) REMOVE FORMERLY ACTIVE (CONSTRAINTS') BOUNDS (IF NECESSARY): */ - if ( setupAfresh == BT_FALSE ) - { - /* 1) Remove all active constraints that shall be inactive AND - * all active constraints that are active at the wrong bound. */ - for( i=0; igetStatus( i ) != ST_LOWER ) ) - if ( removeConstraint( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - - if ( ( constraints.getStatus( i ) == ST_UPPER ) && ( auxiliaryConstraints->getStatus( i ) != ST_UPPER ) ) - if ( removeConstraint( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - - /* 2) Remove all active bounds that shall be inactive AND - * all active bounds that are active at the wrong bound. */ - for( i=0; igetStatus( i ) != ST_LOWER ) ) - if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - - if ( ( bounds.getStatus( i ) == ST_UPPER ) && ( auxiliaryBounds->getStatus( i ) != ST_UPPER ) ) - if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - } - - - /* III) ADD NEWLY ACTIVE (CONSTRAINTS') BOUNDS: */ - /* 1) Add all inactive bounds that shall be active AND - * all formerly active bounds that have been active at the wrong bound. */ - for( i=0; igetStatus( i ) != ST_INACTIVE ) ) - { - /* Add bound only if it is linearly independent from the current working set. */ - if ( addBound_checkLI( i ) == RET_LINEARLY_INDEPENDENT ) - { - if ( addBound( i,auxiliaryBounds->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - } - } - - /* 2) Add all inactive constraints that shall be active AND - * all formerly active constraints that have been active at the wrong bound. */ - for( i=0; igetStatus( i ) == ST_LOWER ) || ( auxiliaryConstraints->getStatus( i ) == ST_UPPER ) ) - { - /* formerly inactive */ - if ( constraints.getStatus( i ) == ST_INACTIVE ) - { - /* Add constraint only if it is linearly independent from the current working set. */ - if ( addConstraint_checkLI( i ) == RET_LINEARLY_INDEPENDENT ) - { - if ( addConstraint( i,auxiliaryConstraints->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - } - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p A u x i l i a r y Q P s o l u t i o n - */ -returnValue QProblem::setupAuxiliaryQPsolution( const real_t* const xOpt, const real_t* const yOpt - ) -{ - int i, j; - int nV = getNV( ); - int nC = getNC( ); - - - /* Setup primal/dual solution vector for auxiliary initial QP: - * if a null pointer is passed, a zero vector is assigned; - * old solution vector is kept if pointer to internal solution vevtor is passed. */ - if ( xOpt != 0 ) - { - if ( xOpt != x ) - for( i=0; igetStatus( i ) == ST_LOWER ) - lb[i] = x[i]; - else - lb[i] = x[i] - BOUNDRELAXATION; - - if ( auxiliaryBounds->getStatus( i ) == ST_UPPER ) - ub[i] = x[i]; - else - ub[i] = x[i] + BOUNDRELAXATION; - } - } - break; - - case ST_LOWER: - lb[i] = x[i]; - if ( bounds.getType( i ) == ST_EQUALITY ) - { - ub[i] = x[i]; - } - else - { - if ( useRelaxation == BT_TRUE ) - ub[i] = x[i] + BOUNDRELAXATION; - } - break; - - case ST_UPPER: - ub[i] = x[i]; - if ( bounds.getType( i ) == ST_EQUALITY ) - { - lb[i] = x[i]; - } - else - { - if ( useRelaxation == BT_TRUE ) - lb[i] = x[i] - BOUNDRELAXATION; - } - break; - - default: - return THROWERROR( RET_UNKNOWN_BUG ); - } - } - - /* 2) Setup constraints vectors. */ - for ( i=0; igetStatus( i ) == ST_LOWER ) - lbA[i] = Ax[i]; - else - lbA[i] = Ax[i] - BOUNDRELAXATION; - - if ( auxiliaryConstraints->getStatus( i ) == ST_UPPER ) - ubA[i] = Ax[i]; - else - ubA[i] = Ax[i] + BOUNDRELAXATION; - } - } - break; - - case ST_LOWER: - lbA[i] = Ax[i]; - if ( constraints.getType( i ) == ST_EQUALITY ) - { - ubA[i] = Ax[i]; - } - else - { - if ( useRelaxation == BT_TRUE ) - ubA[i] = Ax[i] + BOUNDRELAXATION; - } - break; - - case ST_UPPER: - ubA[i] = Ax[i]; - if ( constraints.getType( i ) == ST_EQUALITY ) - { - lbA[i] = Ax[i]; - } - else - { - if ( useRelaxation == BT_TRUE ) - lbA[i] = Ax[i] - BOUNDRELAXATION; - } - break; - - default: - return THROWERROR( RET_UNKNOWN_BUG ); - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * a d d C o n s t r a i n t - */ -returnValue QProblem::addConstraint( int number, SubjectToStatus C_status, - BooleanType updateCholesky - ) -{ - int i, j, ii; - - /* consistency checks */ - if ( constraints.getStatus( number ) != ST_INACTIVE ) - return THROWERROR( RET_CONSTRAINT_ALREADY_ACTIVE ); - - if ( ( constraints.getNC( ) - getNAC( ) ) == constraints.getNUC( ) ) - return THROWERROR( RET_ALL_CONSTRAINTS_ACTIVE ); - - if ( ( getStatus( ) == QPS_NOTINITIALISED ) || - ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - return THROWERROR( RET_UNKNOWN_BUG ); - } - - - /* I) ENSURE LINEAR INDEPENDENCE OF THE WORKING SET, - * i.e. remove a constraint or bound if linear dependence occurs. */ - /* check for LI only if Cholesky decomposition shall be updated! */ - if ( updateCholesky == BT_TRUE ) - { - returnValue ensureLIreturnvalue = addConstraint_ensureLI( number,C_status ); - - switch ( ensureLIreturnvalue ) - { - case SUCCESSFUL_RETURN: - break; - - case RET_LI_RESOLVED: - break; - - case RET_ENSURELI_FAILED_NOINDEX: - return THROWERROR( RET_ADDCONSTRAINT_FAILED_INFEASIBILITY ); - - case RET_ENSURELI_FAILED_CYCLING: - return THROWERROR( RET_ADDCONSTRAINT_FAILED_INFEASIBILITY ); - - default: - return THROWERROR( RET_ENSURELI_FAILED ); - } - } - - /* some definitions */ - int nFR = getNFR( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - int tcol = sizeT - nAC; - - - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ADDCONSTRAINT_FAILED ); - - real_t aFR[NVMAX]; - real_t wZ[NVMAX]; - for( i=0; i 0 ) - { - for( j=0; j 0 ) - { - /* II) RESTORE TRIANGULAR FORM OF T: */ - /* Use column-wise Givens rotations to restore reverse triangular form - * of T, simultanenous change of Q (i.e. Z) and R. */ - for( j=0; jgetNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INDEXLIST_CORRUPTED ); - - /* Check if constraint is linearly independent from the - the active ones (<=> is element of null space of Afr). */ - real_t sum; - - for( i=0; i 10.0*EPS ) - return RET_LINEARLY_INDEPENDENT; - } - - return RET_LINEARLY_DEPENDENT; -} - - -/* - * a d d C o n s t r a i n t _ e n s u r e L I - */ -returnValue QProblem::addConstraint_ensureLI( int number, SubjectToStatus C_status ) -{ - int i, j, ii, jj; - int nV = getNV( ); - int nFR = getNFR( ); - int nFX = getNFX( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - - /* I) Check if new constraint is linearly independent from the active ones. */ - returnValue returnvalueCheckLI = addConstraint_checkLI( number ); - - if ( returnvalueCheckLI == RET_INDEXLIST_CORRUPTED ) - return THROWERROR( RET_ENSURELI_FAILED ); - - if ( returnvalueCheckLI == RET_LINEARLY_INDEPENDENT ) - return SUCCESSFUL_RETURN; - - - /* II) NEW CONSTRAINT IS LINEARLY DEPENDENT: */ - /* 1) Determine coefficients of linear combination, - * cf. M.J. Best. Applied Mathematics and Parallel Computing, chapter: - * An Algorithm for the Solution of the Parametric Quadratic Programming - * Problem, pages 57-76. Physica-Verlag, Heidelberg, 1996. */ - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - int FX_idx[NVMAX]; - if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - real_t xiC[NCMAX_ALLOC]; - real_t xiC_TMP[NCMAX_ALLOC]; - real_t xiB[NVMAX]; - - /* 2) Calculate xiC */ - if ( nAC > 0 ) - { - if ( C_status == ST_LOWER ) - { - for( i=0; igetNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - if ( C_status == ST_LOWER ) - { - for( i=0; i ZERO ) && ( y[nV+ii] >= 0.0 ) ) - { - if ( y[nV+ii]/xiC[i] < y_min ) - { - y_min = y[nV+ii]/xiC[i]; - y_min_number = ii; - } - } - } - else - { - if ( ( xiC[i] < -ZERO ) && ( y[nV+ii] <= 0.0 ) ) - { - if ( y[nV+ii]/xiC[i] < y_min ) - { - y_min = y[nV+ii]/xiC[i]; - y_min_number = ii; - } - } - } - } - - /* 2) Bounds. */ - for( i=0; i ZERO ) && ( y[ii] >= 0.0 ) ) - { - if ( y[ii]/xiB[i] < y_min ) - { - y_min = y[ii]/xiB[i]; - y_min_number = ii; - y_min_isBound = BT_TRUE; - } - } - } - else - { - if ( ( xiB[i] < -ZERO ) && ( y[ii] <= 0.0 ) ) - { - if ( y[ii]/xiB[i] < y_min ) - { - y_min = y[ii]/xiB[i]; - y_min_number = ii; - y_min_isBound = BT_TRUE; - } - } - } - } - - /* setup output preferences */ - #ifdef PC_DEBUG - char messageString[80]; - VisibilityStatus visibilityStatus; - - if ( printlevel == PL_HIGH ) - visibilityStatus = VS_VISIBLE; - else - visibilityStatus = VS_HIDDEN; - #endif - - - /* IV) REMOVE CONSTRAINT/BOUND FOR RESOLVING LINEAR DEPENDENCE: */ - if ( y_min_number >= 0 ) - { - /* 1) Check for cycling due to infeasibility. */ - if ( ( cyclingManager.getCyclingStatus( number,BT_FALSE ) == CYC_PREV_REMOVED ) && - ( cyclingManager.getCyclingStatus( y_min_number,y_min_isBound ) == CYC_PREV_ADDED ) ) - { - infeasible = BT_TRUE; - - return THROWERROR( RET_ENSURELI_FAILED_CYCLING ); - } - else - { - /* set cycling data */ - cyclingManager.clearCyclingData( ); - cyclingManager.setCyclingStatus( number,BT_FALSE, CYC_PREV_ADDED ); - cyclingManager.setCyclingStatus( y_min_number,y_min_isBound, CYC_PREV_REMOVED ); - } - - /* 2) Update Lagrange multiplier... */ - for( i=0; ithrowInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeBound( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[y_min_number] = 0.0; - } - else - { - #ifdef PC_DEBUG - sprintf( messageString,"constraint no. %d.",y_min_number ); - getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeConstraint( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[nV+y_min_number] = 0.0; - } - } - else - { - /* no constraint/bound can be removed => QP is infeasible! */ - infeasible = BT_TRUE; - - return THROWERROR( RET_ENSURELI_FAILED_NOINDEX ); - } - - return getGlobalMessageHandler( )->throwInfo( RET_LI_RESOLVED,0,__FUNCTION__,__FILE__,__LINE__,VS_HIDDEN ); -} - - - -/* - * a d d B o u n d - */ -returnValue QProblem::addBound( int number, SubjectToStatus B_status, - BooleanType updateCholesky - ) -{ - int i, j, ii; - - /* consistency checks */ - if ( bounds.getStatus( number ) != ST_INACTIVE ) - return THROWERROR( RET_BOUND_ALREADY_ACTIVE ); - - if ( getNFR( ) == bounds.getNUV( ) ) - return THROWERROR( RET_ALL_BOUNDS_ACTIVE ); - - if ( ( getStatus( ) == QPS_NOTINITIALISED ) || - ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - return THROWERROR( RET_UNKNOWN_BUG ); - } - - - /* I) ENSURE LINEAR INDEPENDENCE OF THE WORKING SET, - * i.e. remove a constraint or bound if linear dependence occurs. */ - /* check for LI only if Cholesky decomposition shall be updated! */ - if ( updateCholesky == BT_TRUE ) - { - returnValue ensureLIreturnvalue = addBound_ensureLI( number,B_status ); - - switch ( ensureLIreturnvalue ) - { - case SUCCESSFUL_RETURN: - break; - - case RET_LI_RESOLVED: - break; - - case RET_ENSURELI_FAILED_NOINDEX: - return THROWERROR( RET_ADDBOUND_FAILED_INFEASIBILITY ); - - case RET_ENSURELI_FAILED_CYCLING: - return THROWERROR( RET_ADDBOUND_FAILED_INFEASIBILITY ); - - default: - return THROWERROR( RET_ENSURELI_FAILED ); - } - } - - - /* some definitions */ - int nFR = getNFR( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - int tcol = sizeT - nAC; - - - /* I) SWAP INDEXLIST OF FREE VARIABLES: - * move the variable to be fixed to the end of the list of free variables. */ - int lastfreenumber = bounds.getFree( )->getLastNumber( ); - if ( lastfreenumber != number ) - if ( bounds.swapFree( number,lastfreenumber ) != SUCCESSFUL_RETURN ) - THROWERROR( RET_ADDBOUND_FAILED ); - - - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ADDBOUND_FAILED ); - - real_t w[NVMAX]; - - - /* II) ADD NEW ACTIVE BOUND TO TOP OF MATRIX T: */ - /* 1) add row [wZ wY] = [Z Y](number) at the top of T: assign w */ - for( i=0; i 0 ) /* ( nAC == 0 ) <=> ( nZ == nFR ) <=> Y and T are empty => nothing to do */ - { - /* store new column a in a temporary vector instead of shifting T one column to the left */ - real_t tmp[NCMAX_ALLOC]; - for( i=0; i is linearly independent from the - the active ones (<=> is element of null space of Afr). */ - for( i=0; i EPS ) - return RET_LINEARLY_INDEPENDENT; - } - - return RET_LINEARLY_DEPENDENT; -} - - -/* - * a d d B o u n d _ e n s u r e L I - */ -returnValue QProblem::addBound_ensureLI( int number, SubjectToStatus B_status ) -{ - int i, j, ii, jj; - int nV = getNV( ); - int nFX = getNFX( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - - /* I) Check if new constraint is linearly independent from the active ones. */ - returnValue returnvalueCheckLI = addBound_checkLI( number ); - - if ( returnvalueCheckLI == RET_LINEARLY_INDEPENDENT ) - return SUCCESSFUL_RETURN; - - - /* II) NEW BOUND IS LINEARLY DEPENDENT: */ - /* 1) Determine coefficients of linear combination, - * cf. M.J. Best. Applied Mathematics and Parallel Computing, chapter: - * An Algorithm for the Solution of the Parametric Quadratic Programming - * Problem, pages 57-76. Physica-Verlag, Heidelberg, 1996. */ - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - int FX_idx[NVMAX]; - if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - int AC_idx[NCMAX_ALLOC]; - if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ENSURELI_FAILED ); - - real_t xiC[NCMAX_ALLOC]; - real_t xiC_TMP[NCMAX_ALLOC]; - real_t xiB[NVMAX]; - - /* 2) Calculate xiC. */ - if ( nAC > 0 ) - { - if ( B_status == ST_LOWER ) - { - for( i=0; i ZERO ) && ( y[nV+ii] >= 0.0 ) ) - { - if ( y[nV+ii]/xiC[i] < y_min ) - { - y_min = y[nV+ii]/xiC[i]; - y_min_number = ii; - } - } - } - else - { - if ( ( xiC[i] < -ZERO ) && ( y[nV+ii] <= 0.0 ) ) - { - if ( y[nV+ii]/xiC[i] < y_min ) - { - y_min = y[nV+ii]/xiC[i]; - y_min_number = ii; - } - } - } - } - - /* 2) Bounds. */ - for( i=0; i ZERO ) && ( y[ii] >= 0.0 ) ) - { - if ( y[ii]/xiB[i] < y_min ) - { - y_min = y[ii]/xiB[i]; - y_min_number = ii; - y_min_isBound = BT_TRUE; - } - } - } - else - { - if ( ( xiB[i] < -ZERO ) && ( y[ii] <= 0.0 ) ) - { - if ( y[ii]/xiB[i] < y_min ) - { - y_min = y[ii]/xiB[i]; - y_min_number = ii; - y_min_isBound = BT_TRUE; - } - } - } - } - - /* setup output preferences */ - #ifdef PC_DEBUG - char messageString[80]; - VisibilityStatus visibilityStatus; - - if ( printlevel == PL_HIGH ) - visibilityStatus = VS_VISIBLE; - else - visibilityStatus = VS_HIDDEN; - #endif - - - /* IV) REMOVE CONSTRAINT/BOUND FOR RESOLVING LINEAR DEPENDENCE: */ - if ( y_min_number >= 0 ) - { - /* 1) Check for cycling due to infeasibility. */ - if ( ( cyclingManager.getCyclingStatus( number,BT_TRUE ) == CYC_PREV_REMOVED ) && - ( cyclingManager.getCyclingStatus( y_min_number,y_min_isBound ) == CYC_PREV_ADDED ) ) - { - infeasible = BT_TRUE; - - return THROWERROR( RET_ENSURELI_FAILED_CYCLING ); - } - else - { - /* set cycling data */ - cyclingManager.clearCyclingData( ); - cyclingManager.setCyclingStatus( number,BT_TRUE, CYC_PREV_ADDED ); - cyclingManager.setCyclingStatus( y_min_number,y_min_isBound, CYC_PREV_REMOVED ); - } - - - /* 2) Update Lagrange multiplier... */ - for( i=0; ithrowInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeBound( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[y_min_number] = 0.0; - } - else - { - #ifdef PC_DEBUG - sprintf( messageString,"constraint no. %d.",y_min_number ); - getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeConstraint( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[nV+y_min_number] = 0.0; - } - } - else - { - /* no constraint/bound can be removed => QP is infeasible! */ - infeasible = BT_TRUE; - - return THROWERROR( RET_ENSURELI_FAILED_NOINDEX ); - } - - return getGlobalMessageHandler( )->throwInfo( RET_LI_RESOLVED,0,__FUNCTION__,__FILE__,__LINE__,VS_HIDDEN ); -} - - - -/* - * r e m o v e C o n s t r a i n t - */ -returnValue QProblem::removeConstraint( int number, - BooleanType updateCholesky - ) -{ - int i, j, ii, jj; - - /* consistency check */ - if ( ( getStatus( ) == QPS_NOTINITIALISED ) || - ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - return THROWERROR( RET_UNKNOWN_BUG ); - } - - /* some definitions */ - int nFR = getNFR( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - int tcol = sizeT - nAC; - int number_idx = constraints.getActive( )->getIndex( number ); - - - /* consistency checks */ - if ( constraints.getStatus( number ) == ST_INACTIVE ) - return THROWERROR( RET_CONSTRAINT_NOT_ACTIVE ); - - if ( ( number_idx < 0 ) || ( number_idx >= nAC ) ) - return THROWERROR( RET_CONSTRAINT_NOT_ACTIVE ); - - - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVECONSTRAINT_FAILED ); - - - /* I) REMOVE th ROW FROM T, - * i.e. shift rows number+1 through nAC upwards (instead of the actual - * constraint number its corresponding index within matrix A is used). */ - if ( number_idx < nAC-1 ) - { - for( i=(number_idx+1); i=0; --j ) - { - computeGivens( T[(nAC-2-j)*NVMAX + tcol+1+j],T[(nAC-2-j)*NVMAX + tcol+j], T[(nAC-2-j)*NVMAX + tcol+1+j],T[(nAC-2-j)*NVMAX + tcol+j],c,s ); - - for( i=(nAC-j-1); i<(nAC-1); ++i ) - applyGivens( c,s,T[i*NVMAX + tcol+1+j],T[i*NVMAX + tcol+j], T[i*NVMAX + tcol+1+j],T[i*NVMAX + tcol+j] ); - - for( i=0; i 0 ) - { - real_t ZHz[NVMAX]; - for ( i=0; i 0.0 ) - R[nZ*NVMAX + nZ] = sqrt( rho2 ); - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - } - - /* IV) UPDATE INDICES */ - if ( constraints.moveActiveToInactive( number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVECONSTRAINT_FAILED ); - - - return SUCCESSFUL_RETURN; -} - - -/* - * r e m o v e B o u n d - */ -returnValue QProblem::removeBound( int number, - BooleanType updateCholesky - ) -{ - int i, j, ii, jj; - - /* consistency checks */ - if ( bounds.getStatus( number ) == ST_INACTIVE ) - return THROWERROR( RET_BOUND_NOT_ACTIVE ); - - if ( ( getStatus( ) == QPS_NOTINITIALISED ) || - ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - return THROWERROR( RET_UNKNOWN_BUG ); - } - - /* some definitions */ - int nFR = getNFR( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - int tcol = sizeT - nAC; - - - /* I) UPDATE INDICES */ - if ( bounds.moveFixedToFree( number ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVEBOUND_FAILED ); - - - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVEBOUND_FAILED ); - - /* I) APPEND th UNITY VECOTR TO Q. */ - int nnFRp1 = FR_idx[nFR]; - for( i=0; i 0 ) - { - /* store new column a in a temporary vector instead of shifting T one column to the left and appending a */ - int AC_idx[NCMAX_ALLOC]; - if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVEBOUND_FAILED ); - - real_t tmp[NCMAX_ALLOC]; - for( i=0; i=0; --j ) - { - computeGivens( tmp[nAC-1-j],T[(nAC-1-j)*NVMAX + tcol+j],T[(nAC-1-j)*NVMAX + tcol+j],tmp[nAC-1-j],c,s ); - - for( i=(nAC-j); i 0 ) - { - real_t Hz[NVMAX]; - for( i=0; i 0 ) - { - real_t r[NVMAX]; - real_t rhs[NVMAX]; - for( i=0; i 0.0 ) - R[nZ*NVMAX + nZ] = sqrt( rho2 ); - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * b a c k s o l v e R (CODE DUPLICATE OF QProblemB CLASS!!!) - */ -returnValue QProblem::backsolveR( const real_t* const b, BooleanType transposed, - real_t* const a - ) -{ - /* Call standard backsolve procedure (i.e. removingBound == BT_FALSE). */ - return backsolveR( b,transposed,BT_FALSE,a ); -} - - -/* - * b a c k s o l v e R (CODE DUPLICATE OF QProblemB CLASS!!!) - */ -returnValue QProblem::backsolveR( const real_t* const b, BooleanType transposed, - BooleanType removingBound, - real_t* const a - ) -{ - int i, j; - int nR = getNZ( ); - - real_t sum; - - /* if backsolve is called while removing a bound, reduce nZ by one. */ - if ( removingBound == BT_TRUE ) - --nR; - - /* nothing to do */ - if ( nR <= 0 ) - return SUCCESSFUL_RETURN; - - - /* Solve Ra = b, where R might be transposed. */ - if ( transposed == BT_FALSE ) - { - /* solve Ra = b */ - for( i=(nR-1); i>=0; --i ) - { - sum = b[i]; - for( j=(i+1); j ZERO ) - a[i] = sum / R[i*NVMAX + i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - else - { - /* solve R^T*a = b */ - for( i=0; i ZERO ) - a[i] = sum / R[i*NVMAX + i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - - return SUCCESSFUL_RETURN; -} - - - -/* - * b a c k s o l v e T - */ -returnValue QProblem::backsolveT( const real_t* const b, BooleanType transposed, real_t* const a ) -{ - int i, j; - int nT = getNAC( ); - int tcol = sizeT - nT; - - real_t sum; - - /* nothing to do */ - if ( nT <= 0 ) - return SUCCESSFUL_RETURN; - - - /* Solve Ta = b, where T might be transposed. */ - if ( transposed == BT_FALSE ) - { - /* solve Ta = b */ - for( i=0; i ZERO ) - a[nT-1-i] = sum / T[i*NVMAX + sizeT-1-i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - else - { - /* solve T^T*a = b */ - for( i=0; i ZERO ) - a[nT-1-i] = sum / T[(nT-1-i)*NVMAX + tcol+i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - - - return SUCCESSFUL_RETURN; -} - - -/* - * h o t s t a r t _ d e t e r m i n e D a t a S h i f t - */ -returnValue QProblem::hotstart_determineDataShift( const int* const FX_idx, const int* const AC_idx, - const real_t* const g_new, const real_t* const lbA_new, const real_t* const ubA_new, - const real_t* const lb_new, const real_t* const ub_new, - real_t* const delta_g, real_t* const delta_lbA, real_t* const delta_ubA, - real_t* const delta_lb, real_t* const delta_ub, - BooleanType& Delta_bC_isZero, BooleanType& Delta_bB_isZero - ) -{ - int i, ii; - int nC = getNC( ); - int nAC = getNAC( ); - - - /* I) DETERMINE DATA SHIFT FOR BOUNDS */ - QProblemB::hotstart_determineDataShift( FX_idx,g_new,lb_new,ub_new, delta_g,delta_lb,delta_ub, Delta_bB_isZero ); - - - /* II) DETERMINE DATA SHIFT FOR CONSTRAINTS */ - /* 1) Calculate shift directions. */ - for( i=0; i EPS ) || ( getAbs( delta_ubA[ii] ) > EPS ) ) - { - Delta_bC_isZero = BT_FALSE; - break; - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * h o t s t a r t _ d e t e r m i n e S t e p D i r e c t i o n - */ -returnValue QProblem::hotstart_determineStepDirection( const int* const FR_idx, const int* const FX_idx, const int* const AC_idx, - const real_t* const delta_g, const real_t* const delta_lbA, const real_t* const delta_ubA, - const real_t* const delta_lb, const real_t* const delta_ub, - BooleanType Delta_bC_isZero, BooleanType Delta_bB_isZero, - real_t* const delta_xFX, real_t* const delta_xFR, - real_t* const delta_yAC, real_t* const delta_yFX - ) -{ - int i, j, ii, jj; - int nFR = getNFR( ); - int nFX = getNFX( ); - int nAC = getNAC( ); - int nZ = getNZ( ); - - /* initialise auxiliary vectors */ - real_t HMX_delta_xFX[NVMAX]; - real_t YFR_delta_xFRy[NVMAX]; - real_t ZFR_delta_xFRz[NVMAX]; - real_t HFR_YFR_delta_xFRy[NVMAX]; - for( i=0; i 0 ) - { - for( i=0; i 0 ) - { - /* 1) Determine delta_xFRy. */ - if ( nAC > 0 ) - { - if ( ( Delta_bC_isZero == BT_TRUE ) && ( Delta_bB_isZero == BT_TRUE ) ) - { - for( i=0; i 0 ) - { - for( i=0; i 0 ) - { - if ( ( Delta_bC_isZero == BT_FALSE ) || ( Delta_bB_isZero == BT_FALSE ) ) - { - for( i=0; i 0 ) - { - /* auxiliary variable */ - real_t delta_xFRz_TMP[NVMAX]; - real_t delta_xFRz_RHS[NVMAX]; - - - if ( ( nAC > 0 ) && ( nFX > 0 ) && ( Delta_bB_isZero == BT_FALSE ) ) - { - for( j=0; j 0 ) /* => Delta_bB_isZero == BT_TRUE, as BT_FALSE would imply nFX>0 */ - { - for( j=0; j 0 ) /* => ( nFR = nZ + nAC > 0 ) */ - { - /* auxiliary variables */ - real_t delta_yAC_TMP[NCMAX_ALLOC]; - for( i=0; i 0 ) - { - for( i=0; i 0 ) - { - if ( Delta_bB_isZero == BT_FALSE ) - { - for( i=0; i 0 ) - { - for( i=0; i 0.0 ) - maxStepLength[nV+ii] = y[nV+ii] / ( -delta_yAC[i] ); - else - maxStepLength[nV+ii] = 0.0; - } - } - else - { - /* active upper constraints' bounds */ - if ( delta_yAC[i] > ZERO ) - { - if ( y[nV+ii] < 0.0 ) - maxStepLength[nV+ii] = y[nV+ii] / ( -delta_yAC[i] ); - else - maxStepLength[nV+ii] = 0.0; - } - } - } - } - - /* 2) Ensure that active dual bounds remain valid - * (ignoring implicitly fixed variables). */ - for( i=0; i 0.0 ) - maxStepLength[ii] = y[ii] / ( -delta_yFX[i] ); - else - maxStepLength[ii] = 0.0; - } - } - else - { - /* active upper bounds */ - if ( delta_yFX[i] > ZERO ) - { - if ( y[ii] < 0.0 ) - maxStepLength[ii] = y[ii] / ( -delta_yFX[i] ); - else - maxStepLength[ii] = 0.0; - } - } - } - } - - - /* II) DETERMINE MAXIMUM PRIMAL STEPLENGTH */ - /* 1) Ensure that inactive constraints' bounds remain valid - * (ignoring unbounded constraints). */ - real_t delta_x[NVMAX]; - for( j=0; j delta_Ax[ii] ) - { - if ( Ax[ii] > lbA[ii] ) - maxStepLength[nV+ii] = ( Ax[ii] - lbA[ii] ) / ( delta_lbA[ii] - delta_Ax[ii] ); - else - maxStepLength[nV+ii] = 0.0; - } - } - - /* inactive upper constraints' bounds */ - if ( constraints.isNoUpper( ) == BT_FALSE ) - { - if ( delta_ubA[ii] < delta_Ax[ii] ) - { - if ( Ax[ii] < ubA[ii] ) - maxStepLength[nV+nC+nV+ii] = ( Ax[ii] - ubA[ii] ) / ( delta_ubA[ii] - delta_Ax[ii] ); - else - maxStepLength[nV+nC+nV+ii] = 0.0; - } - } - } - } - - - /* 2) Ensure that inactive bounds remain valid - * (ignoring unbounded variables). */ - /* inactive lower bounds */ - if ( bounds.isNoLower( ) == BT_FALSE ) - { - for( i=0; i delta_xFR[i] ) - { - if ( x[ii] > lb[ii] ) - maxStepLength[ii] = ( x[ii] - lb[ii] ) / ( delta_lb[ii] - delta_xFR[i] ); - else - maxStepLength[ii] = 0.0; - } - } - } - - /* inactive upper bounds */ - if ( bounds.isNoUpper( ) == BT_FALSE ) - { - for( i=0; i EPS ) - cyclingManager.clearCyclingData( ); - - - /* V) SET MAXIMUM HOMOTOPY STEPLENGTH */ - tau = tau_new; - - #ifdef PC_DEBUG - if ( printlevel == PL_HIGH ) - { - - char messageString[80]; - - if ( BC_status == ST_UNDEFINED ) - sprintf( messageString,"Stepsize is %.6e!",tau ); - else - sprintf( messageString,"Stepsize is %.6e! (BC_idx = %d, BC_isBound = %d, BC_status = %d)",tau,BC_idx,BC_isBound,BC_status ); - - getGlobalMessageHandler( )->throwInfo( RET_STEPSIZE_NONPOSITIVE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - #endif - - return SUCCESSFUL_RETURN; -} - - -/* - * h o t s t a r t _ p e r f o r m S t e p - */ -returnValue QProblem::hotstart_performStep( const int* const FR_idx, const int* const FX_idx, const int* const AC_idx, const int* const IAC_idx, - const real_t* const delta_g, const real_t* const delta_lbA, const real_t* const delta_ubA, - const real_t* const delta_lb, const real_t* const delta_ub, - const real_t* const delta_xFX, const real_t* const delta_xFR, - const real_t* const delta_yAC, const real_t* const delta_yFX, - const real_t* const delta_Ax, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound - ) -{ - int i, j, ii; - int nV = getNV( ); - int nC = getNC( ); - int nFR = getNFR( ); - int nFX = getNFX( ); - int nAC = getNAC( ); - int nIAC = getNIAC( ); - - - /* I) CHECK (CONSTRAINTS') BOUNDS' CONSISTENCY */ - if ( areBoundsConsistent( delta_lb,delta_ub,delta_lbA,delta_ubA ) == BT_FALSE ) - { - infeasible = BT_TRUE; - tau = 0.0; - - return THROWERROR( RET_QP_INFEASIBLE ); - } - - - /* II) GO TO ACTIVE SET CHANGE */ - if ( tau > ZERO ) - { - /* 1) Perform step in primal und dual space... */ - for( i=0; ithrowWarning( RET_STEPSIZE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - - /* setup output preferences */ - #ifdef PC_DEBUG - char messageString[80]; - VisibilityStatus visibilityStatus; - - if ( printlevel == PL_HIGH ) - visibilityStatus = VS_VISIBLE; - else - visibilityStatus = VS_HIDDEN; - #endif - - - /* III) UPDATE ACTIVE SET */ - switch ( BC_status ) - { - /* Optimal solution found as no working set change detected. */ - case ST_UNDEFINED: - return RET_OPTIMAL_SOLUTION_FOUND; - - - /* Remove one variable from active set. */ - case ST_INACTIVE: - if ( BC_isBound == BT_TRUE ) - { - #ifdef PC_DEBUG - sprintf( messageString,"bound no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeBound( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[BC_idx] = 0.0; - } - else - { - #ifdef PC_DEBUG - sprintf( messageString,"constraint no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeConstraint( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[nV+BC_idx] = 0.0; - } - break; - - - /* Add one variable to active set. */ - default: - if ( BC_isBound == BT_TRUE ) - { - #ifdef PC_DEBUG - if ( BC_status == ST_LOWER ) - sprintf( messageString,"lower bound no. %d.", BC_idx ); - else - sprintf( messageString,"upper bound no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( addBound( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); - } - else - { - #ifdef PC_DEBUG - if ( BC_status == ST_LOWER ) - sprintf( messageString,"lower constraint's bound no. %d.", BC_idx ); - else - sprintf( messageString,"upper constraint's bound no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( addConstraint( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); - } - break; - } - - return SUCCESSFUL_RETURN; -} - - -/* - * a r e B o u n d s C o n s i s t e n t - */ -BooleanType QProblem::areBoundsConsistent( const real_t* const delta_lb, const real_t* const delta_ub, - const real_t* const delta_lbA, const real_t* const delta_ubA - ) const -{ - int i; - - /* 1) Check bounds' consistency. */ - if ( QProblemB::areBoundsConsistent( delta_lb,delta_ub ) == BT_FALSE ) - return BT_FALSE; - - /* 2) Check constraints' consistency, i.e. - * check if delta_lb[i] is greater than delta_ub[i] - * for a component i whose bounds are already (numerically) equal. */ - for( i=0; i ubA[i] - BOUNDTOL ) && ( delta_lbA[i] > delta_ubA[i] + EPS ) ) - return BT_FALSE; - - return BT_TRUE; -} - - -/* - * s e t u p Q P d a t a - */ -returnValue QProblem::setupQPdata( const real_t* const _H, const real_t* const _R, const real_t* const _g, const real_t* const _A, - const real_t* const _lb, const real_t* const _ub, - const real_t* const _lbA, const real_t* const _ubA - ) -{ - int i, j; - int nV = getNV( ); - int nC = getNC( ); - - - /* 1) Load Hessian matrix as well as lower and upper bounds vectors. */ - if (QProblemB::setupQPdata(_H, _R, _g, _lb, _ub) != SUCCESSFUL_RETURN) - return THROWERROR( RET_INVALID_ARGUMENTS ); - - /* 2) Load constraint matrix. */ - if ( ( nC > 0 ) && ( _A == 0 ) ) - return THROWERROR( RET_INVALID_ARGUMENTS ); - - if ( nC > 0 ) - { - for( i=0; igetNumberArray( AC_idx ); - - /* 1) check for Hx + g - [yFX yAC]*[Id A]' = 0. */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = getAbs( tmp ); - } - - /* 2) Check for [lb lbA] <= [Id A]*x <= [ub ubA]. */ - /* lbA <= Ax <= ubA */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = lbA[i] - Ax[i]; - - if ( Ax[i] - ubA[i] > maxKKTviolation ) - maxKKTviolation = Ax[i] - ubA[i]; - } - - /* lb <= x <= ub */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = lb[i] - x[i]; - - if ( x[i] - ub[i] > maxKKTviolation ) - maxKKTviolation = x[i] - ub[i]; - } - - /* 3) Check for correct sign of y and for complementary slackness. */ - /* bounds */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = -y[i]; - if ( getAbs( x[i] - lb[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( x[i] - lb[i] ); - break; - - case ST_UPPER: - if ( y[i] > maxKKTviolation ) - maxKKTviolation = y[i]; - if ( getAbs( ub[i] - x[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( ub[i] - x[i] ); - break; - - default: /* inactive */ - if ( getAbs( y[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( y[i] ); - break; - } - } - - /* constraints */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = -y[nV+i]; - if ( getAbs( Ax[i] - lbA[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( Ax[i] - lbA[i] ); - break; - - case ST_UPPER: - if ( y[nV+i] > maxKKTviolation ) - maxKKTviolation = y[nV+i]; - if ( getAbs( ubA[i] - Ax[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( ubA[i] - Ax[i] ); - break; - - default: /* inactive */ - if ( getAbs( y[nV+i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( y[nV+i] ); - break; - } - } - - if ( maxKKTviolation > CRITICALACCURACY ) - return RET_NO_SOLUTION; - - if ( maxKKTviolation > DESIREDACCURACY ) - return RET_INACCURATE_SOLUTION; - - #endif /* __PERFORM_KKT_TEST__ */ - - return SUCCESSFUL_RETURN; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/QProblem.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the QProblem class which is able to use the newly + * developed online active set strategy for parametric quadratic programming. + */ + + +#include + +#include + +void printmatrix2(char *name, double *A, int m, int n) { + int i, j; + + printf("%s = [...\n", name); + for (i = 0; i < m; i++) { + for (j = 0; j < n; j++) + printf(" % 9.4f", A[i*n+j]); + printf(",\n"); + } + printf("];\n"); +} + +//#define __PERFORM_KKT_TEST__ + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * Q P r o b l e m + */ +QProblem::QProblem( ) : QProblemB( ) +{ + constraints.init( 0 ); + + sizeT = 0; + + cyclingManager.init( 0,0 ); +} + + +/* + * Q P r o b l e m + */ +QProblem::QProblem( int _nV, int _nC ) : QProblemB( _nV ) +{ + /* consistency checks */ + if ( _nV <= 0 ) + _nV = 1; + + if ( _nC < 0 ) + { + _nC = 0; + THROWERROR( RET_INVALID_ARGUMENTS ); + } + + constraints.init( _nC ); + + + sizeT = _nC; + if ( _nC > _nV ) + sizeT = _nV; + + cyclingManager.init( _nV,_nC ); +} + + +/* + * Q P r o b l e m + */ +QProblem::QProblem( const QProblem& rhs ) : QProblemB( rhs ) +{ + int i, j; + + int _nV = rhs.bounds.getNV( ); + int _nC = rhs.constraints.getNC( ); + + for( i=0; i<_nC; ++i ) + for( j=0; j<_nV; ++j ) + A[i*NVMAX + j] = rhs.A[i*NVMAX + j]; + + for( i=0; i<_nC; ++i ) + lbA[i] = rhs.lbA[i]; + + for( i=0; i<_nC; ++i ) + ubA[i] = rhs.ubA[i]; + + constraints = rhs.constraints; + + for( i=0; i<(_nV+_nC); ++i ) + y[i] = rhs.y[i]; + + + sizeT = rhs.sizeT; + + for( i=0; ithrowInfo( RET_ITERATION_STARTED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + /* 1) Setup index arrays. */ + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + if ( constraints.getInactive( )->getNumberArray( IAC_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + /* 2) Detemination of shift direction of the gradient and the (constraints') bounds. */ + returnvalue = hotstart_determineDataShift( FX_idx, AC_idx, + g_new,lbA_new,ubA_new,lb_new,ub_new, + delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, + Delta_bC_isZero, Delta_bB_isZero ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_SHIFT_DETERMINATION_FAILED ); + return returnvalue; + } + + /* 3) Determination of step direction of X and Y. */ + returnvalue = hotstart_determineStepDirection( FR_idx,FX_idx,AC_idx, + delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, + Delta_bC_isZero, Delta_bB_isZero, + delta_xFX,delta_xFR,delta_yAC,delta_yFX + ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_STEPDIRECTION_DETERMINATION_FAILED ); + return returnvalue; + } + + /* 4) Determination of step length TAU. */ + returnvalue = hotstart_determineStepLength( FR_idx,FX_idx,AC_idx,IAC_idx, + delta_lbA,delta_ubA,delta_lb,delta_ub, + delta_xFX,delta_xFR,delta_yAC,delta_yFX,delta_Ax, + BC_idx,BC_status,BC_isBound + ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_STEPLENGTH_DETERMINATION_FAILED ); + return returnvalue; + } + + /* 5) Realisation of the homotopy step. */ + returnvalue = hotstart_performStep( FR_idx,FX_idx,AC_idx,IAC_idx, + delta_g,delta_lbA,delta_ubA,delta_lb,delta_ub, + delta_xFX,delta_xFR,delta_yAC,delta_yFX,delta_Ax, + BC_idx,BC_status,BC_isBound + ); + + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + + /* stop runtime measurement */ + if ( cputime != 0 ) + *cputime = getCPUtime( ) - starttime; + + /* optimal solution found? */ + if ( returnvalue == RET_OPTIMAL_SOLUTION_FOUND ) + { + status = QPS_SOLVED; + + if ( printlevel == PL_HIGH ) + THROWINFO( RET_OPTIMAL_SOLUTION_FOUND ); + + #ifdef PC_DEBUG + if ( printIteration( l,BC_idx,BC_status,BC_isBound ) != SUCCESSFUL_RETURN ) + THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ + #endif + + /* check KKT optimality conditions */ + return checkKKTconditions( ); + } + else + { + /* checks for infeasibility... */ + if ( isInfeasible( ) == BT_TRUE ) + { + status = QPS_HOMOTOPYQPSOLVED; + return THROWERROR( RET_HOTSTART_STOPPED_INFEASIBILITY ); + } + + /* ...unboundedness... */ + if ( unbounded == BT_TRUE ) /* not necessary since objective function convex! */ + return THROWERROR( RET_HOTSTART_STOPPED_UNBOUNDEDNESS ); + + /* ... and throw unspecific error otherwise */ + THROWERROR( RET_HOMOTOPY_STEP_FAILED ); + return returnvalue; + } + } + + /* 6) Output information of successful QP iteration. */ + status = QPS_HOMOTOPYQPSOLVED; + + #ifdef PC_DEBUG + if ( printIteration( l,BC_idx,BC_status,BC_isBound ) != SUCCESSFUL_RETURN ) + THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ + #endif + } + + + /* stop runtime measurement */ + if ( cputime != 0 ) + *cputime = getCPUtime( ) - starttime; + + + /* if programm gets to here, output information that QP could not be solved + * within the given maximum numbers of working set changes */ + if ( printlevel == PL_HIGH ) + { + #ifdef PC_DEBUG + sprintf( messageString,"(nWSR = %d)",nWSR ); + return getGlobalMessageHandler( )->throwWarning( RET_MAX_NWSR_REACHED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + /* Finally check KKT optimality conditions. */ + returnValue returnvalueKKTcheck = checkKKTconditions( ); + + if ( returnvalueKKTcheck != SUCCESSFUL_RETURN ) + return returnvalueKKTcheck; + else + return RET_MAX_NWSR_REACHED; +} + + +/* + * g e t N Z + */ +int QProblem::getNZ( ) +{ + /* nZ = nFR - nAC */ + return bounds.getFree( )->getLength( ) - constraints.getActive( )->getLength( ); +} + + +/* + * g e t D u a l S o l u t i o n + */ +returnValue QProblem::getDualSolution( real_t* const yOpt ) const +{ + int i; + + /* return optimal dual solution vector + * only if current QP has been solved */ + if ( ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + for( i=0; i -INFTY ) + { + constraints.setNoLower( BT_FALSE ); + break; + } + } + + /* 2) Check if upper constraints' bounds are present. */ + constraints.setNoUpper( BT_TRUE ); + for( i=0; i INFTY - BOUNDTOL ) ) + { + constraints.setType( i,ST_UNBOUNDED ); + ++nUC; + } + else + { + if ( lbA[i] > ubA[i] - BOUNDTOL ) + { + constraints.setType( i,ST_EQUALITY ); + ++nEC; + } + else + { + constraints.setType( i,ST_BOUNDED ); + } + } + } + + /* 4) Set dimensions of constraints structure. */ + constraints.setNEC( nEC ); + constraints.setNUC( nUC ); + constraints.setNIC( nC - nEC - nUC ); + + return SUCCESSFUL_RETURN; +} + + +/* + * c h o l e s k y D e c o m p o s i t i o n P r o j e c t e d + */ +returnValue QProblem::setupCholeskyDecompositionProjected( ) +{ + int i, j, k, ii, kk; + int nV = getNV( ); + int nFR = getNFR( ); + int nZ = getNZ( ); + + /* 1) Initialises R with all zeros. */ + for( i=0; i 0 ) + { + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INDEXLIST_CORRUPTED ); + +#if 0 + real_t HZ[NVMAX*NVMAX]; + real_t ZHZ[NVMAX*NVMAX]; + + /* calculate H*Z */ + for ( i=0; i=0; --k ) + sum -= R[k*NVMAX + i] * R[k*NVMAX + i]; + + if ( sum > 0.0 ) + { + R[i*NVMAX + i] = sqrt( sum ); + inv = 1.0 / R[i * NVMAX + i]; + } + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + + for( j=(i+1); j=0; --k ) + sum -= R[k*NVMAX + i] * R[k*NVMAX + j]; + + R[i*NVMAX + j] = sum * inv; + } + } +#else + real_t HZ[NVMAX]; + real_t ZHZ[NVMAX]; + + real_t sum, inv; + for (j = 0; j < nZ; ++j) + { + /* Cache one column of Z. */ + for (i = 0; i < NVMAX; ++i) + ZHZ[i] = Q[i * NVMAX + j]; + + /* Create one column of the product H * Z. */ + for (i = 0; i < nFR; ++i) + { + ii = FR_idx[i]; + + sum = 0.0; + for (k = 0; k < nFR; ++k) + { + kk = FR_idx[k]; + sum += H[ii * NVMAX + kk] * ZHZ[kk]; + } + HZ[ii] = sum; + } + + /* Create one column of the product Z^T * H * Z. */ + for (i = j; i < nZ; ++i) + ZHZ[ i ] = 0.0; + + for (k = 0; k < nFR; ++k) + { + kk = FR_idx[k]; + real_t q = HZ[kk]; + for (i = j; i < nZ; ++i) + { + ZHZ[i] += Q[kk * NVMAX + i] * q; + } + } + + /* Use the computed column to update the factorization. */ + /* j == i */ + sum = ZHZ[j]; + + for (k = (j - 1); k >= 0; --k) + sum -= R[k * NVMAX + j] * R[k * NVMAX + j]; + + if (sum > 0.0) + { + R[j * NVMAX + j] = sqrt(sum); + inv = 1.0 / R[j * NVMAX + j]; + } + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + + for (i = (j + 1); i < nZ; ++i) + { + sum = ZHZ[i]; + + for (k = (j - 1); k >= 0; --k) + sum -= R[k * NVMAX + j] * R[k * NVMAX + i]; + + R[j * NVMAX + i] = sum * inv; + } + } +#endif + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p T Q f a c t o r i s a t i o n + */ +returnValue QProblem::setupTQfactorisation( ) +{ + int i, j, ii; + int nV = getNV( ); + int nFR = getNFR( ); + + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INDEXLIST_CORRUPTED ); + + /* 1) Set Q to unity matrix. */ + for( i=0; igetStatus( i ); + + if ( constraints.getType( i ) == ST_EQUALITY ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryConstraints->setupConstraint( i,guessedStatus ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + else /* No initial working set specified. */ + { + /* Obtain initial working set by "clipping". */ + if ( ( xOpt != 0 ) && ( yOpt == 0 ) ) + { + for( i=0; isetupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + if ( Ax[i] >= ubA[i] - BOUNDTOL ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_UPPER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + /* Moreover, add all equality constraints if specified. */ + if ( constraints.getType( i ) == ST_EQUALITY ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + + /* Obtain initial working set in accordance to sign of dual solution vector. */ + if ( ( xOpt == 0 ) && ( yOpt != 0 ) ) + { + for( i=0; i ZERO ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + if ( yOpt[nV+i] < -ZERO ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_UPPER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + /* Moreover, add all equality constraints if specified. */ + if ( constraints.getType( i ) == ST_EQUALITY ) + { + if ( auxiliaryConstraints->setupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + + /* If xOpt and yOpt are null pointer and no initial working is specified, + * start with empty working set (or implicitly fixed bounds and equality constraints only) + * for auxiliary QP. */ + if ( ( xOpt == 0 ) && ( yOpt == 0 ) ) + { + for( i=0; isetupConstraint( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryConstraints->setupConstraint( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + } + + return SUCCESSFUL_RETURN; +} + + + +/* + * s e t u p A u x i l i a r y W o r k i n g S e t + */ +returnValue QProblem::setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, + const Constraints* const auxiliaryConstraints, + BooleanType setupAfresh + ) +{ + int i; + int nV = getNV( ); + int nC = getNC( ); + + /* consistency checks */ + if ( auxiliaryBounds != 0 ) + { + for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) + return THROWERROR( RET_UNKNOWN_BUG ); + } + else + { + return THROWERROR( RET_INVALID_ARGUMENTS ); + } + + if ( auxiliaryConstraints != 0 ) + { + for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) + return THROWERROR( RET_UNKNOWN_BUG ); + } + else + { + return THROWERROR( RET_INVALID_ARGUMENTS ); + } + + + /* I) SETUP CHOLESKY FLAG: + * Cholesky decomposition shall only be updated if working set + * shall be updated (i.e. NOT setup afresh!) */ + BooleanType updateCholesky; + if ( setupAfresh == BT_TRUE ) + updateCholesky = BT_FALSE; + else + updateCholesky = BT_TRUE; + + + /* II) REMOVE FORMERLY ACTIVE (CONSTRAINTS') BOUNDS (IF NECESSARY): */ + if ( setupAfresh == BT_FALSE ) + { + /* 1) Remove all active constraints that shall be inactive AND + * all active constraints that are active at the wrong bound. */ + for( i=0; igetStatus( i ) != ST_LOWER ) ) + if ( removeConstraint( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + + if ( ( constraints.getStatus( i ) == ST_UPPER ) && ( auxiliaryConstraints->getStatus( i ) != ST_UPPER ) ) + if ( removeConstraint( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + + /* 2) Remove all active bounds that shall be inactive AND + * all active bounds that are active at the wrong bound. */ + for( i=0; igetStatus( i ) != ST_LOWER ) ) + if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + + if ( ( bounds.getStatus( i ) == ST_UPPER ) && ( auxiliaryBounds->getStatus( i ) != ST_UPPER ) ) + if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + } + + + /* III) ADD NEWLY ACTIVE (CONSTRAINTS') BOUNDS: */ + /* 1) Add all inactive bounds that shall be active AND + * all formerly active bounds that have been active at the wrong bound. */ + for( i=0; igetStatus( i ) != ST_INACTIVE ) ) + { + /* Add bound only if it is linearly independent from the current working set. */ + if ( addBound_checkLI( i ) == RET_LINEARLY_INDEPENDENT ) + { + if ( addBound( i,auxiliaryBounds->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + } + } + + /* 2) Add all inactive constraints that shall be active AND + * all formerly active constraints that have been active at the wrong bound. */ + for( i=0; igetStatus( i ) == ST_LOWER ) || ( auxiliaryConstraints->getStatus( i ) == ST_UPPER ) ) + { + /* formerly inactive */ + if ( constraints.getStatus( i ) == ST_INACTIVE ) + { + /* Add constraint only if it is linearly independent from the current working set. */ + if ( addConstraint_checkLI( i ) == RET_LINEARLY_INDEPENDENT ) + { + if ( addConstraint( i,auxiliaryConstraints->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + } + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p A u x i l i a r y Q P s o l u t i o n + */ +returnValue QProblem::setupAuxiliaryQPsolution( const real_t* const xOpt, const real_t* const yOpt + ) +{ + int i, j; + int nV = getNV( ); + int nC = getNC( ); + + + /* Setup primal/dual solution vector for auxiliary initial QP: + * if a null pointer is passed, a zero vector is assigned; + * old solution vector is kept if pointer to internal solution vevtor is passed. */ + if ( xOpt != 0 ) + { + if ( xOpt != x ) + for( i=0; igetStatus( i ) == ST_LOWER ) + lb[i] = x[i]; + else + lb[i] = x[i] - BOUNDRELAXATION; + + if ( auxiliaryBounds->getStatus( i ) == ST_UPPER ) + ub[i] = x[i]; + else + ub[i] = x[i] + BOUNDRELAXATION; + } + } + break; + + case ST_LOWER: + lb[i] = x[i]; + if ( bounds.getType( i ) == ST_EQUALITY ) + { + ub[i] = x[i]; + } + else + { + if ( useRelaxation == BT_TRUE ) + ub[i] = x[i] + BOUNDRELAXATION; + } + break; + + case ST_UPPER: + ub[i] = x[i]; + if ( bounds.getType( i ) == ST_EQUALITY ) + { + lb[i] = x[i]; + } + else + { + if ( useRelaxation == BT_TRUE ) + lb[i] = x[i] - BOUNDRELAXATION; + } + break; + + default: + return THROWERROR( RET_UNKNOWN_BUG ); + } + } + + /* 2) Setup constraints vectors. */ + for ( i=0; igetStatus( i ) == ST_LOWER ) + lbA[i] = Ax[i]; + else + lbA[i] = Ax[i] - BOUNDRELAXATION; + + if ( auxiliaryConstraints->getStatus( i ) == ST_UPPER ) + ubA[i] = Ax[i]; + else + ubA[i] = Ax[i] + BOUNDRELAXATION; + } + } + break; + + case ST_LOWER: + lbA[i] = Ax[i]; + if ( constraints.getType( i ) == ST_EQUALITY ) + { + ubA[i] = Ax[i]; + } + else + { + if ( useRelaxation == BT_TRUE ) + ubA[i] = Ax[i] + BOUNDRELAXATION; + } + break; + + case ST_UPPER: + ubA[i] = Ax[i]; + if ( constraints.getType( i ) == ST_EQUALITY ) + { + lbA[i] = Ax[i]; + } + else + { + if ( useRelaxation == BT_TRUE ) + lbA[i] = Ax[i] - BOUNDRELAXATION; + } + break; + + default: + return THROWERROR( RET_UNKNOWN_BUG ); + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * a d d C o n s t r a i n t + */ +returnValue QProblem::addConstraint( int number, SubjectToStatus C_status, + BooleanType updateCholesky + ) +{ + int i, j, ii; + + /* consistency checks */ + if ( constraints.getStatus( number ) != ST_INACTIVE ) + return THROWERROR( RET_CONSTRAINT_ALREADY_ACTIVE ); + + if ( ( constraints.getNC( ) - getNAC( ) ) == constraints.getNUC( ) ) + return THROWERROR( RET_ALL_CONSTRAINTS_ACTIVE ); + + if ( ( getStatus( ) == QPS_NOTINITIALISED ) || + ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + return THROWERROR( RET_UNKNOWN_BUG ); + } + + + /* I) ENSURE LINEAR INDEPENDENCE OF THE WORKING SET, + * i.e. remove a constraint or bound if linear dependence occurs. */ + /* check for LI only if Cholesky decomposition shall be updated! */ + if ( updateCholesky == BT_TRUE ) + { + returnValue ensureLIreturnvalue = addConstraint_ensureLI( number,C_status ); + + switch ( ensureLIreturnvalue ) + { + case SUCCESSFUL_RETURN: + break; + + case RET_LI_RESOLVED: + break; + + case RET_ENSURELI_FAILED_NOINDEX: + return THROWERROR( RET_ADDCONSTRAINT_FAILED_INFEASIBILITY ); + + case RET_ENSURELI_FAILED_CYCLING: + return THROWERROR( RET_ADDCONSTRAINT_FAILED_INFEASIBILITY ); + + default: + return THROWERROR( RET_ENSURELI_FAILED ); + } + } + + /* some definitions */ + int nFR = getNFR( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + int tcol = sizeT - nAC; + + + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ADDCONSTRAINT_FAILED ); + + real_t aFR[NVMAX]; + real_t wZ[NVMAX]; + for( i=0; i 0 ) + { + for( j=0; j 0 ) + { + /* II) RESTORE TRIANGULAR FORM OF T: */ + /* Use column-wise Givens rotations to restore reverse triangular form + * of T, simultanenous change of Q (i.e. Z) and R. */ + for( j=0; jgetNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INDEXLIST_CORRUPTED ); + + /* Check if constraint is linearly independent from the + the active ones (<=> is element of null space of Afr). */ + real_t sum; + + for( i=0; i 10.0*EPS ) + return RET_LINEARLY_INDEPENDENT; + } + + return RET_LINEARLY_DEPENDENT; +} + + +/* + * a d d C o n s t r a i n t _ e n s u r e L I + */ +returnValue QProblem::addConstraint_ensureLI( int number, SubjectToStatus C_status ) +{ + int i, j, ii, jj; + int nV = getNV( ); + int nFR = getNFR( ); + int nFX = getNFX( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + + /* I) Check if new constraint is linearly independent from the active ones. */ + returnValue returnvalueCheckLI = addConstraint_checkLI( number ); + + if ( returnvalueCheckLI == RET_INDEXLIST_CORRUPTED ) + return THROWERROR( RET_ENSURELI_FAILED ); + + if ( returnvalueCheckLI == RET_LINEARLY_INDEPENDENT ) + return SUCCESSFUL_RETURN; + + + /* II) NEW CONSTRAINT IS LINEARLY DEPENDENT: */ + /* 1) Determine coefficients of linear combination, + * cf. M.J. Best. Applied Mathematics and Parallel Computing, chapter: + * An Algorithm for the Solution of the Parametric Quadratic Programming + * Problem, pages 57-76. Physica-Verlag, Heidelberg, 1996. */ + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + int FX_idx[NVMAX]; + if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + real_t xiC[NCMAX_ALLOC]; + real_t xiC_TMP[NCMAX_ALLOC]; + real_t xiB[NVMAX]; + + /* 2) Calculate xiC */ + if ( nAC > 0 ) + { + if ( C_status == ST_LOWER ) + { + for( i=0; igetNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + if ( C_status == ST_LOWER ) + { + for( i=0; i ZERO ) && ( y[nV+ii] >= 0.0 ) ) + { + if ( y[nV+ii]/xiC[i] < y_min ) + { + y_min = y[nV+ii]/xiC[i]; + y_min_number = ii; + } + } + } + else + { + if ( ( xiC[i] < -ZERO ) && ( y[nV+ii] <= 0.0 ) ) + { + if ( y[nV+ii]/xiC[i] < y_min ) + { + y_min = y[nV+ii]/xiC[i]; + y_min_number = ii; + } + } + } + } + + /* 2) Bounds. */ + for( i=0; i ZERO ) && ( y[ii] >= 0.0 ) ) + { + if ( y[ii]/xiB[i] < y_min ) + { + y_min = y[ii]/xiB[i]; + y_min_number = ii; + y_min_isBound = BT_TRUE; + } + } + } + else + { + if ( ( xiB[i] < -ZERO ) && ( y[ii] <= 0.0 ) ) + { + if ( y[ii]/xiB[i] < y_min ) + { + y_min = y[ii]/xiB[i]; + y_min_number = ii; + y_min_isBound = BT_TRUE; + } + } + } + } + + /* setup output preferences */ + #ifdef PC_DEBUG + char messageString[80]; + VisibilityStatus visibilityStatus; + + if ( printlevel == PL_HIGH ) + visibilityStatus = VS_VISIBLE; + else + visibilityStatus = VS_HIDDEN; + #endif + + + /* IV) REMOVE CONSTRAINT/BOUND FOR RESOLVING LINEAR DEPENDENCE: */ + if ( y_min_number >= 0 ) + { + /* 1) Check for cycling due to infeasibility. */ + if ( ( cyclingManager.getCyclingStatus( number,BT_FALSE ) == CYC_PREV_REMOVED ) && + ( cyclingManager.getCyclingStatus( y_min_number,y_min_isBound ) == CYC_PREV_ADDED ) ) + { + infeasible = BT_TRUE; + + return THROWERROR( RET_ENSURELI_FAILED_CYCLING ); + } + else + { + /* set cycling data */ + cyclingManager.clearCyclingData( ); + cyclingManager.setCyclingStatus( number,BT_FALSE, CYC_PREV_ADDED ); + cyclingManager.setCyclingStatus( y_min_number,y_min_isBound, CYC_PREV_REMOVED ); + } + + /* 2) Update Lagrange multiplier... */ + for( i=0; ithrowInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeBound( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[y_min_number] = 0.0; + } + else + { + #ifdef PC_DEBUG + sprintf( messageString,"constraint no. %d.",y_min_number ); + getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeConstraint( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[nV+y_min_number] = 0.0; + } + } + else + { + /* no constraint/bound can be removed => QP is infeasible! */ + infeasible = BT_TRUE; + + return THROWERROR( RET_ENSURELI_FAILED_NOINDEX ); + } + + return getGlobalMessageHandler( )->throwInfo( RET_LI_RESOLVED,0,__FUNCTION__,__FILE__,__LINE__,VS_HIDDEN ); +} + + + +/* + * a d d B o u n d + */ +returnValue QProblem::addBound( int number, SubjectToStatus B_status, + BooleanType updateCholesky + ) +{ + int i, j, ii; + + /* consistency checks */ + if ( bounds.getStatus( number ) != ST_INACTIVE ) + return THROWERROR( RET_BOUND_ALREADY_ACTIVE ); + + if ( getNFR( ) == bounds.getNUV( ) ) + return THROWERROR( RET_ALL_BOUNDS_ACTIVE ); + + if ( ( getStatus( ) == QPS_NOTINITIALISED ) || + ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + return THROWERROR( RET_UNKNOWN_BUG ); + } + + + /* I) ENSURE LINEAR INDEPENDENCE OF THE WORKING SET, + * i.e. remove a constraint or bound if linear dependence occurs. */ + /* check for LI only if Cholesky decomposition shall be updated! */ + if ( updateCholesky == BT_TRUE ) + { + returnValue ensureLIreturnvalue = addBound_ensureLI( number,B_status ); + + switch ( ensureLIreturnvalue ) + { + case SUCCESSFUL_RETURN: + break; + + case RET_LI_RESOLVED: + break; + + case RET_ENSURELI_FAILED_NOINDEX: + return THROWERROR( RET_ADDBOUND_FAILED_INFEASIBILITY ); + + case RET_ENSURELI_FAILED_CYCLING: + return THROWERROR( RET_ADDBOUND_FAILED_INFEASIBILITY ); + + default: + return THROWERROR( RET_ENSURELI_FAILED ); + } + } + + + /* some definitions */ + int nFR = getNFR( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + int tcol = sizeT - nAC; + + + /* I) SWAP INDEXLIST OF FREE VARIABLES: + * move the variable to be fixed to the end of the list of free variables. */ + int lastfreenumber = bounds.getFree( )->getLastNumber( ); + if ( lastfreenumber != number ) + if ( bounds.swapFree( number,lastfreenumber ) != SUCCESSFUL_RETURN ) + THROWERROR( RET_ADDBOUND_FAILED ); + + + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ADDBOUND_FAILED ); + + real_t w[NVMAX]; + + + /* II) ADD NEW ACTIVE BOUND TO TOP OF MATRIX T: */ + /* 1) add row [wZ wY] = [Z Y](number) at the top of T: assign w */ + for( i=0; i 0 ) /* ( nAC == 0 ) <=> ( nZ == nFR ) <=> Y and T are empty => nothing to do */ + { + /* store new column a in a temporary vector instead of shifting T one column to the left */ + real_t tmp[NCMAX_ALLOC]; + for( i=0; i is linearly independent from the + the active ones (<=> is element of null space of Afr). */ + for( i=0; i EPS ) + return RET_LINEARLY_INDEPENDENT; + } + + return RET_LINEARLY_DEPENDENT; +} + + +/* + * a d d B o u n d _ e n s u r e L I + */ +returnValue QProblem::addBound_ensureLI( int number, SubjectToStatus B_status ) +{ + int i, j, ii, jj; + int nV = getNV( ); + int nFX = getNFX( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + + /* I) Check if new constraint is linearly independent from the active ones. */ + returnValue returnvalueCheckLI = addBound_checkLI( number ); + + if ( returnvalueCheckLI == RET_LINEARLY_INDEPENDENT ) + return SUCCESSFUL_RETURN; + + + /* II) NEW BOUND IS LINEARLY DEPENDENT: */ + /* 1) Determine coefficients of linear combination, + * cf. M.J. Best. Applied Mathematics and Parallel Computing, chapter: + * An Algorithm for the Solution of the Parametric Quadratic Programming + * Problem, pages 57-76. Physica-Verlag, Heidelberg, 1996. */ + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + int FX_idx[NVMAX]; + if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + int AC_idx[NCMAX_ALLOC]; + if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ENSURELI_FAILED ); + + real_t xiC[NCMAX_ALLOC]; + real_t xiC_TMP[NCMAX_ALLOC]; + real_t xiB[NVMAX]; + + /* 2) Calculate xiC. */ + if ( nAC > 0 ) + { + if ( B_status == ST_LOWER ) + { + for( i=0; i ZERO ) && ( y[nV+ii] >= 0.0 ) ) + { + if ( y[nV+ii]/xiC[i] < y_min ) + { + y_min = y[nV+ii]/xiC[i]; + y_min_number = ii; + } + } + } + else + { + if ( ( xiC[i] < -ZERO ) && ( y[nV+ii] <= 0.0 ) ) + { + if ( y[nV+ii]/xiC[i] < y_min ) + { + y_min = y[nV+ii]/xiC[i]; + y_min_number = ii; + } + } + } + } + + /* 2) Bounds. */ + for( i=0; i ZERO ) && ( y[ii] >= 0.0 ) ) + { + if ( y[ii]/xiB[i] < y_min ) + { + y_min = y[ii]/xiB[i]; + y_min_number = ii; + y_min_isBound = BT_TRUE; + } + } + } + else + { + if ( ( xiB[i] < -ZERO ) && ( y[ii] <= 0.0 ) ) + { + if ( y[ii]/xiB[i] < y_min ) + { + y_min = y[ii]/xiB[i]; + y_min_number = ii; + y_min_isBound = BT_TRUE; + } + } + } + } + + /* setup output preferences */ + #ifdef PC_DEBUG + char messageString[80]; + VisibilityStatus visibilityStatus; + + if ( printlevel == PL_HIGH ) + visibilityStatus = VS_VISIBLE; + else + visibilityStatus = VS_HIDDEN; + #endif + + + /* IV) REMOVE CONSTRAINT/BOUND FOR RESOLVING LINEAR DEPENDENCE: */ + if ( y_min_number >= 0 ) + { + /* 1) Check for cycling due to infeasibility. */ + if ( ( cyclingManager.getCyclingStatus( number,BT_TRUE ) == CYC_PREV_REMOVED ) && + ( cyclingManager.getCyclingStatus( y_min_number,y_min_isBound ) == CYC_PREV_ADDED ) ) + { + infeasible = BT_TRUE; + + return THROWERROR( RET_ENSURELI_FAILED_CYCLING ); + } + else + { + /* set cycling data */ + cyclingManager.clearCyclingData( ); + cyclingManager.setCyclingStatus( number,BT_TRUE, CYC_PREV_ADDED ); + cyclingManager.setCyclingStatus( y_min_number,y_min_isBound, CYC_PREV_REMOVED ); + } + + + /* 2) Update Lagrange multiplier... */ + for( i=0; ithrowInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeBound( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[y_min_number] = 0.0; + } + else + { + #ifdef PC_DEBUG + sprintf( messageString,"constraint no. %d.",y_min_number ); + getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeConstraint( y_min_number,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[nV+y_min_number] = 0.0; + } + } + else + { + /* no constraint/bound can be removed => QP is infeasible! */ + infeasible = BT_TRUE; + + return THROWERROR( RET_ENSURELI_FAILED_NOINDEX ); + } + + return getGlobalMessageHandler( )->throwInfo( RET_LI_RESOLVED,0,__FUNCTION__,__FILE__,__LINE__,VS_HIDDEN ); +} + + + +/* + * r e m o v e C o n s t r a i n t + */ +returnValue QProblem::removeConstraint( int number, + BooleanType updateCholesky + ) +{ + int i, j, ii, jj; + + /* consistency check */ + if ( ( getStatus( ) == QPS_NOTINITIALISED ) || + ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + return THROWERROR( RET_UNKNOWN_BUG ); + } + + /* some definitions */ + int nFR = getNFR( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + int tcol = sizeT - nAC; + int number_idx = constraints.getActive( )->getIndex( number ); + + + /* consistency checks */ + if ( constraints.getStatus( number ) == ST_INACTIVE ) + return THROWERROR( RET_CONSTRAINT_NOT_ACTIVE ); + + if ( ( number_idx < 0 ) || ( number_idx >= nAC ) ) + return THROWERROR( RET_CONSTRAINT_NOT_ACTIVE ); + + + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVECONSTRAINT_FAILED ); + + + /* I) REMOVE th ROW FROM T, + * i.e. shift rows number+1 through nAC upwards (instead of the actual + * constraint number its corresponding index within matrix A is used). */ + if ( number_idx < nAC-1 ) + { + for( i=(number_idx+1); i=0; --j ) + { + computeGivens( T[(nAC-2-j)*NVMAX + tcol+1+j],T[(nAC-2-j)*NVMAX + tcol+j], T[(nAC-2-j)*NVMAX + tcol+1+j],T[(nAC-2-j)*NVMAX + tcol+j],c,s ); + + for( i=(nAC-j-1); i<(nAC-1); ++i ) + applyGivens( c,s,T[i*NVMAX + tcol+1+j],T[i*NVMAX + tcol+j], T[i*NVMAX + tcol+1+j],T[i*NVMAX + tcol+j] ); + + for( i=0; i 0 ) + { + real_t ZHz[NVMAX]; + for ( i=0; i 0.0 ) + R[nZ*NVMAX + nZ] = sqrt( rho2 ); + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + } + + /* IV) UPDATE INDICES */ + if ( constraints.moveActiveToInactive( number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVECONSTRAINT_FAILED ); + + + return SUCCESSFUL_RETURN; +} + + +/* + * r e m o v e B o u n d + */ +returnValue QProblem::removeBound( int number, + BooleanType updateCholesky + ) +{ + int i, j, ii, jj; + + /* consistency checks */ + if ( bounds.getStatus( number ) == ST_INACTIVE ) + return THROWERROR( RET_BOUND_NOT_ACTIVE ); + + if ( ( getStatus( ) == QPS_NOTINITIALISED ) || + ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + return THROWERROR( RET_UNKNOWN_BUG ); + } + + /* some definitions */ + int nFR = getNFR( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + int tcol = sizeT - nAC; + + + /* I) UPDATE INDICES */ + if ( bounds.moveFixedToFree( number ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVEBOUND_FAILED ); + + + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVEBOUND_FAILED ); + + /* I) APPEND th UNITY VECOTR TO Q. */ + int nnFRp1 = FR_idx[nFR]; + for( i=0; i 0 ) + { + /* store new column a in a temporary vector instead of shifting T one column to the left and appending a */ + int AC_idx[NCMAX_ALLOC]; + if ( constraints.getActive( )->getNumberArray( AC_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVEBOUND_FAILED ); + + real_t tmp[NCMAX_ALLOC]; + for( i=0; i=0; --j ) + { + computeGivens( tmp[nAC-1-j],T[(nAC-1-j)*NVMAX + tcol+j],T[(nAC-1-j)*NVMAX + tcol+j],tmp[nAC-1-j],c,s ); + + for( i=(nAC-j); i 0 ) + { + real_t Hz[NVMAX]; + for( i=0; i 0 ) + { + real_t r[NVMAX]; + real_t rhs[NVMAX]; + for( i=0; i 0.0 ) + R[nZ*NVMAX + nZ] = sqrt( rho2 ); + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * b a c k s o l v e R (CODE DUPLICATE OF QProblemB CLASS!!!) + */ +returnValue QProblem::backsolveR( const real_t* const b, BooleanType transposed, + real_t* const a + ) +{ + /* Call standard backsolve procedure (i.e. removingBound == BT_FALSE). */ + return backsolveR( b,transposed,BT_FALSE,a ); +} + + +/* + * b a c k s o l v e R (CODE DUPLICATE OF QProblemB CLASS!!!) + */ +returnValue QProblem::backsolveR( const real_t* const b, BooleanType transposed, + BooleanType removingBound, + real_t* const a + ) +{ + int i, j; + int nR = getNZ( ); + + real_t sum; + + /* if backsolve is called while removing a bound, reduce nZ by one. */ + if ( removingBound == BT_TRUE ) + --nR; + + /* nothing to do */ + if ( nR <= 0 ) + return SUCCESSFUL_RETURN; + + + /* Solve Ra = b, where R might be transposed. */ + if ( transposed == BT_FALSE ) + { + /* solve Ra = b */ + for( i=(nR-1); i>=0; --i ) + { + sum = b[i]; + for( j=(i+1); j ZERO ) + a[i] = sum / R[i*NVMAX + i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + else + { + /* solve R^T*a = b */ + for( i=0; i ZERO ) + a[i] = sum / R[i*NVMAX + i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + + return SUCCESSFUL_RETURN; +} + + + +/* + * b a c k s o l v e T + */ +returnValue QProblem::backsolveT( const real_t* const b, BooleanType transposed, real_t* const a ) +{ + int i, j; + int nT = getNAC( ); + int tcol = sizeT - nT; + + real_t sum; + + /* nothing to do */ + if ( nT <= 0 ) + return SUCCESSFUL_RETURN; + + + /* Solve Ta = b, where T might be transposed. */ + if ( transposed == BT_FALSE ) + { + /* solve Ta = b */ + for( i=0; i ZERO ) + a[nT-1-i] = sum / T[i*NVMAX + sizeT-1-i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + else + { + /* solve T^T*a = b */ + for( i=0; i ZERO ) + a[nT-1-i] = sum / T[(nT-1-i)*NVMAX + tcol+i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + + + return SUCCESSFUL_RETURN; +} + + +/* + * h o t s t a r t _ d e t e r m i n e D a t a S h i f t + */ +returnValue QProblem::hotstart_determineDataShift( const int* const FX_idx, const int* const AC_idx, + const real_t* const g_new, const real_t* const lbA_new, const real_t* const ubA_new, + const real_t* const lb_new, const real_t* const ub_new, + real_t* const delta_g, real_t* const delta_lbA, real_t* const delta_ubA, + real_t* const delta_lb, real_t* const delta_ub, + BooleanType& Delta_bC_isZero, BooleanType& Delta_bB_isZero + ) +{ + int i, ii; + int nC = getNC( ); + int nAC = getNAC( ); + + + /* I) DETERMINE DATA SHIFT FOR BOUNDS */ + QProblemB::hotstart_determineDataShift( FX_idx,g_new,lb_new,ub_new, delta_g,delta_lb,delta_ub, Delta_bB_isZero ); + + + /* II) DETERMINE DATA SHIFT FOR CONSTRAINTS */ + /* 1) Calculate shift directions. */ + for( i=0; i EPS ) || ( getAbs( delta_ubA[ii] ) > EPS ) ) + { + Delta_bC_isZero = BT_FALSE; + break; + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * h o t s t a r t _ d e t e r m i n e S t e p D i r e c t i o n + */ +returnValue QProblem::hotstart_determineStepDirection( const int* const FR_idx, const int* const FX_idx, const int* const AC_idx, + const real_t* const delta_g, const real_t* const delta_lbA, const real_t* const delta_ubA, + const real_t* const delta_lb, const real_t* const delta_ub, + BooleanType Delta_bC_isZero, BooleanType Delta_bB_isZero, + real_t* const delta_xFX, real_t* const delta_xFR, + real_t* const delta_yAC, real_t* const delta_yFX + ) +{ + int i, j, ii, jj; + int nFR = getNFR( ); + int nFX = getNFX( ); + int nAC = getNAC( ); + int nZ = getNZ( ); + + /* initialise auxiliary vectors */ + real_t HMX_delta_xFX[NVMAX]; + real_t YFR_delta_xFRy[NVMAX]; + real_t ZFR_delta_xFRz[NVMAX]; + real_t HFR_YFR_delta_xFRy[NVMAX]; + for( i=0; i 0 ) + { + for( i=0; i 0 ) + { + /* 1) Determine delta_xFRy. */ + if ( nAC > 0 ) + { + if ( ( Delta_bC_isZero == BT_TRUE ) && ( Delta_bB_isZero == BT_TRUE ) ) + { + for( i=0; i 0 ) + { + for( i=0; i 0 ) + { + if ( ( Delta_bC_isZero == BT_FALSE ) || ( Delta_bB_isZero == BT_FALSE ) ) + { + for( i=0; i 0 ) + { + /* auxiliary variable */ + real_t delta_xFRz_TMP[NVMAX]; + real_t delta_xFRz_RHS[NVMAX]; + + + if ( ( nAC > 0 ) && ( nFX > 0 ) && ( Delta_bB_isZero == BT_FALSE ) ) + { + for( j=0; j 0 ) /* => Delta_bB_isZero == BT_TRUE, as BT_FALSE would imply nFX>0 */ + { + for( j=0; j 0 ) /* => ( nFR = nZ + nAC > 0 ) */ + { + /* auxiliary variables */ + real_t delta_yAC_TMP[NCMAX_ALLOC]; + for( i=0; i 0 ) + { + for( i=0; i 0 ) + { + if ( Delta_bB_isZero == BT_FALSE ) + { + for( i=0; i 0 ) + { + for( i=0; i 0.0 ) + maxStepLength[nV+ii] = y[nV+ii] / ( -delta_yAC[i] ); + else + maxStepLength[nV+ii] = 0.0; + } + } + else + { + /* active upper constraints' bounds */ + if ( delta_yAC[i] > ZERO ) + { + if ( y[nV+ii] < 0.0 ) + maxStepLength[nV+ii] = y[nV+ii] / ( -delta_yAC[i] ); + else + maxStepLength[nV+ii] = 0.0; + } + } + } + } + + /* 2) Ensure that active dual bounds remain valid + * (ignoring implicitly fixed variables). */ + for( i=0; i 0.0 ) + maxStepLength[ii] = y[ii] / ( -delta_yFX[i] ); + else + maxStepLength[ii] = 0.0; + } + } + else + { + /* active upper bounds */ + if ( delta_yFX[i] > ZERO ) + { + if ( y[ii] < 0.0 ) + maxStepLength[ii] = y[ii] / ( -delta_yFX[i] ); + else + maxStepLength[ii] = 0.0; + } + } + } + } + + + /* II) DETERMINE MAXIMUM PRIMAL STEPLENGTH */ + /* 1) Ensure that inactive constraints' bounds remain valid + * (ignoring unbounded constraints). */ + real_t delta_x[NVMAX]; + for( j=0; j delta_Ax[ii] ) + { + if ( Ax[ii] > lbA[ii] ) + maxStepLength[nV+ii] = ( Ax[ii] - lbA[ii] ) / ( delta_lbA[ii] - delta_Ax[ii] ); + else + maxStepLength[nV+ii] = 0.0; + } + } + + /* inactive upper constraints' bounds */ + if ( constraints.isNoUpper( ) == BT_FALSE ) + { + if ( delta_ubA[ii] < delta_Ax[ii] ) + { + if ( Ax[ii] < ubA[ii] ) + maxStepLength[nV+nC+nV+ii] = ( Ax[ii] - ubA[ii] ) / ( delta_ubA[ii] - delta_Ax[ii] ); + else + maxStepLength[nV+nC+nV+ii] = 0.0; + } + } + } + } + + + /* 2) Ensure that inactive bounds remain valid + * (ignoring unbounded variables). */ + /* inactive lower bounds */ + if ( bounds.isNoLower( ) == BT_FALSE ) + { + for( i=0; i delta_xFR[i] ) + { + if ( x[ii] > lb[ii] ) + maxStepLength[ii] = ( x[ii] - lb[ii] ) / ( delta_lb[ii] - delta_xFR[i] ); + else + maxStepLength[ii] = 0.0; + } + } + } + + /* inactive upper bounds */ + if ( bounds.isNoUpper( ) == BT_FALSE ) + { + for( i=0; i EPS ) + cyclingManager.clearCyclingData( ); + + + /* V) SET MAXIMUM HOMOTOPY STEPLENGTH */ + tau = tau_new; + + #ifdef PC_DEBUG + if ( printlevel == PL_HIGH ) + { + + char messageString[80]; + + if ( BC_status == ST_UNDEFINED ) + sprintf( messageString,"Stepsize is %.6e!",tau ); + else + sprintf( messageString,"Stepsize is %.6e! (BC_idx = %d, BC_isBound = %d, BC_status = %d)",tau,BC_idx,BC_isBound,BC_status ); + + getGlobalMessageHandler( )->throwInfo( RET_STEPSIZE_NONPOSITIVE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + #endif + + return SUCCESSFUL_RETURN; +} + + +/* + * h o t s t a r t _ p e r f o r m S t e p + */ +returnValue QProblem::hotstart_performStep( const int* const FR_idx, const int* const FX_idx, const int* const AC_idx, const int* const IAC_idx, + const real_t* const delta_g, const real_t* const delta_lbA, const real_t* const delta_ubA, + const real_t* const delta_lb, const real_t* const delta_ub, + const real_t* const delta_xFX, const real_t* const delta_xFR, + const real_t* const delta_yAC, const real_t* const delta_yFX, + const real_t* const delta_Ax, int BC_idx, SubjectToStatus BC_status, BooleanType BC_isBound + ) +{ + int i, j, ii; + int nV = getNV( ); + int nC = getNC( ); + int nFR = getNFR( ); + int nFX = getNFX( ); + int nAC = getNAC( ); + int nIAC = getNIAC( ); + + + /* I) CHECK (CONSTRAINTS') BOUNDS' CONSISTENCY */ + if ( areBoundsConsistent( delta_lb,delta_ub,delta_lbA,delta_ubA ) == BT_FALSE ) + { + infeasible = BT_TRUE; + tau = 0.0; + + return THROWERROR( RET_QP_INFEASIBLE ); + } + + + /* II) GO TO ACTIVE SET CHANGE */ + if ( tau > ZERO ) + { + /* 1) Perform step in primal und dual space... */ + for( i=0; ithrowWarning( RET_STEPSIZE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + + /* setup output preferences */ + #ifdef PC_DEBUG + char messageString[80]; + VisibilityStatus visibilityStatus; + + if ( printlevel == PL_HIGH ) + visibilityStatus = VS_VISIBLE; + else + visibilityStatus = VS_HIDDEN; + #endif + + + /* III) UPDATE ACTIVE SET */ + switch ( BC_status ) + { + /* Optimal solution found as no working set change detected. */ + case ST_UNDEFINED: + return RET_OPTIMAL_SOLUTION_FOUND; + + + /* Remove one variable from active set. */ + case ST_INACTIVE: + if ( BC_isBound == BT_TRUE ) + { + #ifdef PC_DEBUG + sprintf( messageString,"bound no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeBound( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[BC_idx] = 0.0; + } + else + { + #ifdef PC_DEBUG + sprintf( messageString,"constraint no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeConstraint( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[nV+BC_idx] = 0.0; + } + break; + + + /* Add one variable to active set. */ + default: + if ( BC_isBound == BT_TRUE ) + { + #ifdef PC_DEBUG + if ( BC_status == ST_LOWER ) + sprintf( messageString,"lower bound no. %d.", BC_idx ); + else + sprintf( messageString,"upper bound no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( addBound( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); + } + else + { + #ifdef PC_DEBUG + if ( BC_status == ST_LOWER ) + sprintf( messageString,"lower constraint's bound no. %d.", BC_idx ); + else + sprintf( messageString,"upper constraint's bound no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( addConstraint( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); + } + break; + } + + return SUCCESSFUL_RETURN; +} + + +/* + * a r e B o u n d s C o n s i s t e n t + */ +BooleanType QProblem::areBoundsConsistent( const real_t* const delta_lb, const real_t* const delta_ub, + const real_t* const delta_lbA, const real_t* const delta_ubA + ) const +{ + int i; + + /* 1) Check bounds' consistency. */ + if ( QProblemB::areBoundsConsistent( delta_lb,delta_ub ) == BT_FALSE ) + return BT_FALSE; + + /* 2) Check constraints' consistency, i.e. + * check if delta_lb[i] is greater than delta_ub[i] + * for a component i whose bounds are already (numerically) equal. */ + for( i=0; i ubA[i] - BOUNDTOL ) && ( delta_lbA[i] > delta_ubA[i] + EPS ) ) + return BT_FALSE; + + return BT_TRUE; +} + + +/* + * s e t u p Q P d a t a + */ +returnValue QProblem::setupQPdata( const real_t* const _H, const real_t* const _R, const real_t* const _g, const real_t* const _A, + const real_t* const _lb, const real_t* const _ub, + const real_t* const _lbA, const real_t* const _ubA + ) +{ + int i, j; + int nV = getNV( ); + int nC = getNC( ); + + + /* 1) Load Hessian matrix as well as lower and upper bounds vectors. */ + if (QProblemB::setupQPdata(_H, _R, _g, _lb, _ub) != SUCCESSFUL_RETURN) + return THROWERROR( RET_INVALID_ARGUMENTS ); + + /* 2) Load constraint matrix. */ + if ( ( nC > 0 ) && ( _A == 0 ) ) + return THROWERROR( RET_INVALID_ARGUMENTS ); + + if ( nC > 0 ) + { + for( i=0; igetNumberArray( AC_idx ); + + /* 1) check for Hx + g - [yFX yAC]*[Id A]' = 0. */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = getAbs( tmp ); + } + + /* 2) Check for [lb lbA] <= [Id A]*x <= [ub ubA]. */ + /* lbA <= Ax <= ubA */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = lbA[i] - Ax[i]; + + if ( Ax[i] - ubA[i] > maxKKTviolation ) + maxKKTviolation = Ax[i] - ubA[i]; + } + + /* lb <= x <= ub */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = lb[i] - x[i]; + + if ( x[i] - ub[i] > maxKKTviolation ) + maxKKTviolation = x[i] - ub[i]; + } + + /* 3) Check for correct sign of y and for complementary slackness. */ + /* bounds */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = -y[i]; + if ( getAbs( x[i] - lb[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( x[i] - lb[i] ); + break; + + case ST_UPPER: + if ( y[i] > maxKKTviolation ) + maxKKTviolation = y[i]; + if ( getAbs( ub[i] - x[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( ub[i] - x[i] ); + break; + + default: /* inactive */ + if ( getAbs( y[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( y[i] ); + break; + } + } + + /* constraints */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = -y[nV+i]; + if ( getAbs( Ax[i] - lbA[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( Ax[i] - lbA[i] ); + break; + + case ST_UPPER: + if ( y[nV+i] > maxKKTviolation ) + maxKKTviolation = y[nV+i]; + if ( getAbs( ubA[i] - Ax[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( ubA[i] - Ax[i] ); + break; + + default: /* inactive */ + if ( getAbs( y[nV+i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( y[nV+i] ); + break; + } + } + + if ( maxKKTviolation > CRITICALACCURACY ) + return RET_NO_SOLUTION; + + if ( maxKKTviolation > DESIREDACCURACY ) + return RET_INACCURATE_SOLUTION; + + #endif /* __PERFORM_KKT_TEST__ */ + + return SUCCESSFUL_RETURN; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/QProblem.ipp b/phonelibs/qpoases/SRC/QProblem.ipp index cec58e291..e98ada633 100644 --- a/phonelibs/qpoases/SRC/QProblem.ipp +++ b/phonelibs/qpoases/SRC/QProblem.ipp @@ -1,299 +1,299 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/QProblem.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of inlined member functions of the QProblem class which - * is able to use the newly developed online active set strategy for - * parametric quadratic programming. - */ - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - -/* - * g e t A - */ -inline returnValue QProblem::getA( real_t* const _A ) const -{ - int i; - - for ( i=0; i= 0 ) && ( number < getNC( ) ) ) - { - for ( int i=0; i= 0 ) && ( number < getNC( ) ) ) - { - value = lbA[number]; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * g e t U B A - */ -inline returnValue QProblem::getUBA( real_t* const _ubA ) const -{ - int i; - - for ( i=0; i= 0 ) && ( number < getNC( ) ) ) - { - value = ubA[number]; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * g e t C o n s t r a i n t s - */ -inline returnValue QProblem::getConstraints( Constraints* const _constraints ) const -{ - *_constraints = constraints; - - return SUCCESSFUL_RETURN; -} - - - -/* - * g e t N C - */ -inline int QProblem::getNC( ) const -{ - return constraints.getNC( ); -} - - -/* - * g e t N E C - */ -inline int QProblem::getNEC( ) const -{ - return constraints.getNEC( ); -} - - -/* - * g e t N A C - */ -inline int QProblem::getNAC( ) -{ - return constraints.getNAC( ); -} - - -/* - * g e t N I A C - */ -inline int QProblem::getNIAC( ) -{ - return constraints.getNIAC( ); -} - - - -/***************************************************************************** - * P R O T E C T E D * - *****************************************************************************/ - - -/* - * s e t A - */ -inline returnValue QProblem::setA( const real_t* const A_new ) -{ - int i, j; - int nV = getNV( ); - int nC = getNC( ); - - /* Set constraint matrix AND update member AX. */ - for( j=0; j= 0 ) && ( number < getNC( ) ) ) - { - Ax[number] = 0.0; - - for( i=0; i= 0 ) && ( number < getNC( ) ) ) - { - lbA[number] = value; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * s e t U B A - */ -inline returnValue QProblem::setUBA( const real_t* const ubA_new ) -{ - int i; - int nC = getNC(); - - for( i=0; i= 0 ) && ( number < getNC( ) ) ) - { - ubA[number] = value; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/QProblem.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of inlined member functions of the QProblem class which + * is able to use the newly developed online active set strategy for + * parametric quadratic programming. + */ + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t A + */ +inline returnValue QProblem::getA( real_t* const _A ) const +{ + int i; + + for ( i=0; i= 0 ) && ( number < getNC( ) ) ) + { + for ( int i=0; i= 0 ) && ( number < getNC( ) ) ) + { + value = lbA[number]; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * g e t U B A + */ +inline returnValue QProblem::getUBA( real_t* const _ubA ) const +{ + int i; + + for ( i=0; i= 0 ) && ( number < getNC( ) ) ) + { + value = ubA[number]; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * g e t C o n s t r a i n t s + */ +inline returnValue QProblem::getConstraints( Constraints* const _constraints ) const +{ + *_constraints = constraints; + + return SUCCESSFUL_RETURN; +} + + + +/* + * g e t N C + */ +inline int QProblem::getNC( ) const +{ + return constraints.getNC( ); +} + + +/* + * g e t N E C + */ +inline int QProblem::getNEC( ) const +{ + return constraints.getNEC( ); +} + + +/* + * g e t N A C + */ +inline int QProblem::getNAC( ) +{ + return constraints.getNAC( ); +} + + +/* + * g e t N I A C + */ +inline int QProblem::getNIAC( ) +{ + return constraints.getNIAC( ); +} + + + +/***************************************************************************** + * P R O T E C T E D * + *****************************************************************************/ + + +/* + * s e t A + */ +inline returnValue QProblem::setA( const real_t* const A_new ) +{ + int i, j; + int nV = getNV( ); + int nC = getNC( ); + + /* Set constraint matrix AND update member AX. */ + for( j=0; j= 0 ) && ( number < getNC( ) ) ) + { + Ax[number] = 0.0; + + for( i=0; i= 0 ) && ( number < getNC( ) ) ) + { + lbA[number] = value; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * s e t U B A + */ +inline returnValue QProblem::setUBA( const real_t* const ubA_new ) +{ + int i; + int nC = getNC(); + + for( i=0; i= 0 ) && ( number < getNC( ) ) ) + { + ubA[number] = value; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/QProblemB.cpp b/phonelibs/qpoases/SRC/QProblemB.cpp index f84daabc0..47ac3536f 100644 --- a/phonelibs/qpoases/SRC/QProblemB.cpp +++ b/phonelibs/qpoases/SRC/QProblemB.cpp @@ -1,2151 +1,2151 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/QProblemB.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the QProblemB class which is able to use the newly - * developed online active set strategy for parametric quadratic programming. - */ - - -#include - -#include - -void printmatrix(char *name, double *A, int m, int n) { - int i, j; - - printf("%s = [...\n", name); - for (i = 0; i < m; i++) { - for (j = 0; j < n; j++) - printf(" % 9.4f", A[i*n+j]); - printf(",\n"); - } - printf("];\n"); -} - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * Q P r o b l e m B - */ -QProblemB::QProblemB( ) -{ - /* reset global message handler */ - getGlobalMessageHandler( )->reset( ); - - hasHessian = BT_FALSE; - - bounds.init( 0 ); - - hasCholesky = BT_FALSE; - - tau = 0.0; - - hessianType = HST_POSDEF_NULLSPACE; /* Hessian is assumed to be positive definite by default */ - infeasible = BT_FALSE; - unbounded = BT_FALSE; - - status = QPS_NOTINITIALISED; - - #ifdef PC_DEBUG - printlevel = PL_MEDIUM; - setPrintLevel( PL_MEDIUM ); - #else - printlevel = QPOASES_PRINTLEVEL; - #endif - - count = 0; -} - - -/* - * Q P r o b l e m B - */ -QProblemB::QProblemB( int _nV ) -{ - /* consistency check */ - if ( _nV <= 0 ) - { - _nV = 1; - THROWERROR( RET_INVALID_ARGUMENTS ); - } - - hasHessian = BT_FALSE; - - /* reset global message handler */ - getGlobalMessageHandler( )->reset( ); - - bounds.init( _nV ); - - hasCholesky = BT_FALSE; - - tau = 0.0; - - hessianType = HST_POSDEF_NULLSPACE; /* Hessian is assumed to be positive definite by default */ - infeasible = BT_FALSE; - unbounded = BT_FALSE; - - status = QPS_NOTINITIALISED; - - #ifdef PC_DEBUG - printlevel = PL_MEDIUM; - setPrintLevel( PL_MEDIUM ); - #else - printlevel = QPOASES_PRINTLEVEL; - #endif - - count = 0; -} - - -/* - * Q P r o b l e m B - */ -QProblemB::QProblemB( const QProblemB& rhs ) -{ - int i, j; - - int _nV = rhs.bounds.getNV( ); - - for( i=0; i<_nV; ++i ) - for( j=0; j<_nV; ++j ) - H[i*NVMAX + j] = rhs.H[i*NVMAX + j]; - - hasHessian = rhs.hasHessian; - - for( i=0; i<_nV; ++i ) - g[i] = rhs.g[i]; - - for( i=0; i<_nV; ++i ) - lb[i] = rhs.lb[i]; - - for( i=0; i<_nV; ++i ) - ub[i] = rhs.ub[i]; - - - bounds = rhs.bounds; - - for( i=0; i<_nV; ++i ) - for( j=0; j<_nV; ++j ) - R[i*NVMAX + j] = rhs.R[i*NVMAX + j]; - hasCholesky = rhs.hasCholesky; - - for( i=0; i<_nV; ++i ) - x[i] = rhs.x[i]; - - for( i=0; i<_nV; ++i ) - y[i] = rhs.y[i]; - - tau = rhs.tau; - - hessianType = rhs.hessianType; - infeasible = rhs.infeasible; - unbounded = rhs.unbounded; - - status = rhs.status; - - printlevel = rhs.printlevel; - - count = rhs.count; -} - - -/* - * ~ Q P r o b l e m B - */ -QProblemB::~QProblemB( ) -{ -} - - -/* - * o p e r a t o r = - */ -QProblemB& QProblemB::operator=( const QProblemB& rhs ) -{ - int i, j; - - if ( this != &rhs ) - { - int _nV = rhs.bounds.getNV( ); - - for( i=0; i<_nV; ++i ) - for( j=0; j<_nV; ++j ) - H[i*NVMAX + j] = rhs.H[i*NVMAX + j]; - - hasHessian = rhs.hasHessian; - - for( i=0; i<_nV; ++i ) - g[i] = rhs.g[i]; - - for( i=0; i<_nV; ++i ) - lb[i] = rhs.lb[i]; - - for( i=0; i<_nV; ++i ) - ub[i] = rhs.ub[i]; - - bounds = rhs.bounds; - - for( i=0; i<_nV; ++i ) - for( j=0; j<_nV; ++j ) - R[i*NVMAX + j] = rhs.R[i*NVMAX + j]; - hasCholesky = rhs.hasCholesky; - - - for( i=0; i<_nV; ++i ) - x[i] = rhs.x[i]; - - for( i=0; i<_nV; ++i ) - y[i] = rhs.y[i]; - - tau = rhs.tau; - - hessianType = rhs.hessianType; - infeasible = rhs.infeasible; - unbounded = rhs.unbounded; - - status = rhs.status; - - printlevel = rhs.printlevel; - setPrintLevel( rhs.printlevel ); - - count = rhs.count; - } - - return *this; -} - - -/* - * r e s e t - */ -returnValue QProblemB::reset( ) -{ - int i, j; - int nV = getNV( ); - - /** 0) Reset has Hessian flag. */ - hasHessian = BT_FALSE; - - /* 1) Reset bounds. */ - bounds.init( nV ); - - /* 2) Reset Cholesky decomposition. */ - for( i=0; ithrowInfo( RET_ITERATION_STARTED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - /* 1) Setup index arrays. */ - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_HOTSTART_FAILED ); - - /* 2) Initialize shift direction of the gradient and the bounds. */ - returnvalue = hotstart_determineDataShift( FX_idx, - g_new,lb_new,ub_new, - delta_g,delta_lb,delta_ub, - Delta_bB_isZero - ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_SHIFT_DETERMINATION_FAILED ); - return returnvalue; - } - - /* 3) Determination of step direction of X and Y. */ - returnvalue = hotstart_determineStepDirection( FR_idx,FX_idx, - delta_g,delta_lb,delta_ub, - Delta_bB_isZero, - delta_xFX,delta_xFR,delta_yFX - ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_STEPDIRECTION_DETERMINATION_FAILED ); - return returnvalue; - } - - - /* 4) Determination of step length TAU. */ - returnvalue = hotstart_determineStepLength( FR_idx,FX_idx, - delta_lb,delta_ub, - delta_xFR,delta_yFX, - BC_idx,BC_status ); - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - THROWERROR( RET_STEPLENGTH_DETERMINATION_FAILED ); - return returnvalue; - } - - /* 5) Realization of the homotopy step. */ - returnvalue = hotstart_performStep( FR_idx,FX_idx, - delta_g,delta_lb,delta_ub, - delta_xFX,delta_xFR,delta_yFX, - BC_idx,BC_status - ); - - - if ( returnvalue != SUCCESSFUL_RETURN ) - { - nWSR = l; - - /* stop runtime measurement */ - if ( cputime != 0 ) - *cputime = getCPUtime( ) - starttime; - - /* optimal solution found? */ - if ( returnvalue == RET_OPTIMAL_SOLUTION_FOUND ) - { - status = QPS_SOLVED; - - if ( printlevel == PL_HIGH ) - THROWINFO( RET_OPTIMAL_SOLUTION_FOUND ); - - #ifdef PC_DEBUG - if ( printIteration( l,BC_idx,BC_status ) != SUCCESSFUL_RETURN ) - THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ - #endif - - /* check KKT optimality conditions */ - return checkKKTconditions( ); - } - else - { - /* checks for infeasibility... */ - if ( infeasible == BT_TRUE ) - { - status = QPS_HOMOTOPYQPSOLVED; - return THROWERROR( RET_HOTSTART_STOPPED_INFEASIBILITY ); - } - - /* ...unboundedness... */ - if ( unbounded == BT_TRUE ) /* not necessary since objective function convex! */ - return THROWERROR( RET_HOTSTART_STOPPED_UNBOUNDEDNESS ); - - /* ... and throw unspecific error otherwise */ - THROWERROR( RET_HOMOTOPY_STEP_FAILED ); - return returnvalue; - } - } - - /* 6) Output information of successful QP iteration. */ - status = QPS_HOMOTOPYQPSOLVED; - - #ifdef PC_DEBUG - if ( printIteration( l,BC_idx,BC_status ) != SUCCESSFUL_RETURN ) - THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ - #endif - } - - - /* stop runtime measurement */ - if ( cputime != 0 ) - *cputime = getCPUtime( ) - starttime; - - - /* if programm gets to here, output information that QP could not be solved - * within the given maximum numbers of working set changes */ - if ( printlevel == PL_HIGH ) - { - #ifdef PC_DEBUG - sprintf( messageString,"(nWSR = %d)",nWSR ); - return getGlobalMessageHandler( )->throwWarning( RET_MAX_NWSR_REACHED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - /* Finally check KKT optimality conditions. */ - returnValue returnvalueKKTcheck = checkKKTconditions( ); - - if ( returnvalueKKTcheck != SUCCESSFUL_RETURN ) - return returnvalueKKTcheck; - else - return RET_MAX_NWSR_REACHED; -} - - -/* - * g e t N Z - */ -int QProblemB::getNZ( ) -{ - /* if no constraints are present: nZ=nFR */ - return bounds.getFree( )->getLength( ); -} - - -/* - * g e t O b j V a l - */ -real_t QProblemB::getObjVal( ) const -{ - real_t objVal; - - /* calculated optimal objective function value - * only if current QP has been solved */ - if ( ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || - ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || - ( getStatus( ) == QPS_SOLVED ) ) - { - objVal = getObjVal( x ); - } - else - { - objVal = INFTY; - } - - return objVal; -} - - -/* - * g e t O b j V a l - */ -real_t QProblemB::getObjVal( const real_t* const _x ) const -{ - int i, j; - int nV = getNV( ); - - real_t obj_tmp = 0.0; - - for( i=0; i= PL_MEDIUM ) && ( printlevel != _printlevel ) ) - THROWINFO( RET_PRINTLEVEL_CHANGED ); - #endif - - printlevel = _printlevel; - - /* update message handler preferences */ - switch ( printlevel ) - { - case PL_NONE: - getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_HIDDEN ); - getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_HIDDEN ); - getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_HIDDEN ); - break; - - case PL_LOW: - getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_VISIBLE ); - getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_HIDDEN ); - getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_HIDDEN ); - break; - - default: /* PL_MEDIUM, PL_HIGH */ - getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_VISIBLE ); - getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_VISIBLE ); - getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_VISIBLE ); - break; - } - - return SUCCESSFUL_RETURN; -} - - - -/***************************************************************************** - * P R O T E C T E D * - *****************************************************************************/ - -/* - * c h e c k F o r I d e n t i t y H e s s i a n - */ -returnValue QProblemB::checkForIdentityHessian( ) -{ - int i, j; - int nV = getNV( ); - - /* nothing to do as status flag remains unaltered - * if Hessian differs from identity matrix */ - if ( hessianType == HST_IDENTITY ) - return SUCCESSFUL_RETURN; - - /* 1) If Hessian differs from identity matrix, - * return without changing the internal HessianType. */ - for ( i=0; i EPS ) - return SUCCESSFUL_RETURN; - - for ( i=0; i EPS ) || ( getAbs( H[j*NVMAX + i] ) > EPS ) ) - return SUCCESSFUL_RETURN; - } - - /* 2) If this point is reached, Hessian equals the idetity matrix. */ - hessianType = HST_IDENTITY; - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p S u b j e c t T o T y p e - */ -returnValue QProblemB::setupSubjectToType( ) -{ - int i; - int nV = getNV( ); - - - /* 1) Check if lower bounds are present. */ - bounds.setNoLower( BT_TRUE ); - for( i=0; i -INFTY ) - { - bounds.setNoLower( BT_FALSE ); - break; - } - - /* 2) Check if upper bounds are present. */ - bounds.setNoUpper( BT_TRUE ); - for( i=0; i INFTY - BOUNDTOL ) ) - { - bounds.setType( i,ST_UNBOUNDED ); - ++nUV; - } - else - { - if ( lb[i] > ub[i] - BOUNDTOL ) - { - bounds.setType( i,ST_EQUALITY ); - ++nFV; - } - else - { - bounds.setType( i,ST_BOUNDED ); - } - } - - /* 4) Set dimensions of bounds structure. */ - bounds.setNFV( nFV ); - bounds.setNUV( nUV ); - bounds.setNBV( nV - nFV - nUV ); - - return SUCCESSFUL_RETURN; -} - - -/* - * c h o l e s k y D e c o m p o s i t i o n - */ -returnValue QProblemB::setupCholeskyDecomposition( ) -{ - int i, j, k, ii, jj; - int nV = getNV( ); - int nFR = getNFR( ); - - /* If Hessian flag is false, it means that H & R already contain Cholesky - * factorization -- provided from outside. */ - if (hasHessian == BT_FALSE) - return SUCCESSFUL_RETURN; - - /* 1) Initialises R with all zeros. */ - for( i=0; i 0 ) - { - int FR_idx[NVMAX]; - if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INDEXLIST_CORRUPTED ); - - /* R'*R = H */ - real_t sum; - real_t inv; - - for( i=0; i=0; --k ) - sum -= R[k*NVMAX + i] * R[k*NVMAX + i]; - - if ( sum > 0.0 ) - { - R[i*NVMAX + i] = sqrt( sum ); - inv = 1.0 / R[i*NVMAX + i]; - } - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - - /* j > i */ - for( j=(i+1); j=0; --k ) - sum -= R[k*NVMAX + i] * R[k*NVMAX + j]; - - R[i*NVMAX + j] = sum * inv; - } - } - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s o l v e I n i t i a l Q P - */ -returnValue QProblemB::solveInitialQP( const real_t* const xOpt, const real_t* const yOpt, - const Bounds* const guessedBounds, - int& nWSR, real_t* const cputime - ) -{ - int i, nFR; - int nV = getNV( ); - - - /* start runtime measurement */ - real_t starttime = 0.0; - if ( cputime != 0 ) - starttime = getCPUtime( ); - - - status = QPS_NOTINITIALISED; - - /* I) ANALYSE QP DATA: */ - /* 1) Check if Hessian happens to be the identity matrix. */ - if ( checkForIdentityHessian( ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - /* 2) Setup type of bounds (i.e. unbounded, implicitly fixed etc.). */ - if ( setupSubjectToType( ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - status = QPS_PREPARINGAUXILIARYQP; - - - /* II) SETUP AUXILIARY QP WITH GIVEN OPTIMAL SOLUTION: */ - /* 1) Setup bounds data structure. */ - if ( bounds.setupAllFree( ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - /* 2) Setup optimal primal/dual solution for auxiliary QP. */ - if ( setupAuxiliaryQPsolution( xOpt,yOpt ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - /* 3) Obtain linear independent working set for auxiliary QP. */ - - static Bounds auxiliaryBounds; - - auxiliaryBounds.init( nV ); - - if ( obtainAuxiliaryWorkingSet( xOpt,yOpt,guessedBounds, &auxiliaryBounds ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - /* 4) Setup working set of auxiliary QP and setup cholesky decomposition. */ - if ( setupAuxiliaryWorkingSet( &auxiliaryBounds,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_INIT_FAILED ); - - nFR = getNFR(); - /* At the moment we can only provide a Cholesky of the Hessian if - * the solver is cold-started. */ - if (hasCholesky == BT_FALSE || nFR != nV) - if (setupCholeskyDecomposition() != SUCCESSFUL_RETURN) - return THROWERROR( RET_INIT_FAILED_CHOLESKY ); - - /* 5) Store original QP formulation... */ - real_t g_original[NVMAX]; - real_t lb_original[NVMAX]; - real_t ub_original[NVMAX]; - - for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryBounds->setupBound( i,guessedBounds->getStatus( i ) ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - else /* No initial working set specified. */ - { - if ( ( xOpt != 0 ) && ( yOpt == 0 ) ) - { - /* Obtain initial working set by "clipping". */ - for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - if ( xOpt[i] >= ub[i] - BOUNDTOL ) - { - if ( auxiliaryBounds->setupBound( i,ST_UPPER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - /* Moreover, add all implictly fixed variables if specified. */ - if ( bounds.getType( i ) == ST_EQUALITY ) - { - if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - - if ( ( xOpt == 0 ) && ( yOpt != 0 ) ) - { - /* Obtain initial working set in accordance to sign of dual solution vector. */ - for( i=0; i ZERO ) - { - if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - if ( yOpt[i] < -ZERO ) - { - if ( auxiliaryBounds->setupBound( i,ST_UPPER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - continue; - } - - /* Moreover, add all implictly fixed variables if specified. */ - if ( bounds.getType( i ) == ST_EQUALITY ) - { - if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - - /* If xOpt and yOpt are null pointer and no initial working is specified, - * start with empty working set (or implicitly fixed bounds only) - * for auxiliary QP. */ - if ( ( xOpt == 0 ) && ( yOpt == 0 ) ) - { - for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - else - { - if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); - } - } - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p A u x i l i a r y W o r k i n g S e t - */ -returnValue QProblemB::setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, - BooleanType setupAfresh - ) -{ - int i; - int nV = getNV( ); - - /* consistency checks */ - if ( auxiliaryBounds != 0 ) - { - for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) - return THROWERROR( RET_UNKNOWN_BUG ); - } - else - { - return THROWERROR( RET_INVALID_ARGUMENTS ); - } - - - /* I) SETUP CHOLESKY FLAG: - * Cholesky decomposition shall only be updated if working set - * shall be updated (i.e. NOT setup afresh!) */ - BooleanType updateCholesky; - if ( setupAfresh == BT_TRUE ) - updateCholesky = BT_FALSE; - else - updateCholesky = BT_TRUE; - - - /* II) REMOVE FORMERLY ACTIVE BOUNDS (IF NECESSARY): */ - if ( setupAfresh == BT_FALSE ) - { - /* Remove all active bounds that shall be inactive AND - * all active bounds that are active at the wrong bound. */ - for( i=0; igetStatus( i ) != ST_LOWER ) ) - if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - - if ( ( bounds.getStatus( i ) == ST_UPPER ) && ( auxiliaryBounds->getStatus( i ) != ST_UPPER ) ) - if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - } - - - /* III) ADD NEWLY ACTIVE BOUNDS: */ - /* Add all inactive bounds that shall be active AND - * all formerly active bounds that have been active at the wrong bound. */ - for( i=0; igetStatus( i ) != ST_INACTIVE ) ) - { - if ( addBound( i,auxiliaryBounds->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * s e t u p A u x i l i a r y Q P s o l u t i o n - */ -returnValue QProblemB::setupAuxiliaryQPsolution( const real_t* const xOpt, const real_t* const yOpt - ) -{ - int i; - int nV = getNV( ); - - - /* Setup primal/dual solution vectors for auxiliary initial QP: - * if a null pointer is passed, a zero vector is assigned; - * old solution vector is kept if pointer to internal solution vector is passed. */ - if ( xOpt != 0 ) - { - if ( xOpt != x ) - for( i=0; igetIndex( number ); - - real_t c, s; - - /* 2) Use row-wise Givens rotations to restore upper triangular form of R. */ - for( i=number_idx+1; ith column and ... */ - for( i=0; igetNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVEBOUND_FAILED ); - - /* 1) Calculate new column of cholesky decomposition. */ - real_t rhs[NVMAX]; - real_t r[NVMAX]; - real_t r0 = H[number*NVMAX + number]; - - for( i=0; i 0.0 ) - R[nFR*NVMAX + nFR] = sqrt( r0 ); - else - { - hessianType = HST_SEMIDEF; - return THROWERROR( RET_HESSIAN_NOT_SPD ); - } - - - return SUCCESSFUL_RETURN; -} - - -/* - * b a c k s o l v e R (CODE DUPLICATED IN QProblem CLASS!!!) - */ -returnValue QProblemB::backsolveR( const real_t* const b, BooleanType transposed, - real_t* const a - ) -{ - /* Call standard backsolve procedure (i.e. removingBound == BT_FALSE). */ - return backsolveR( b,transposed,BT_FALSE,a ); -} - - -/* - * b a c k s o l v e R (CODE DUPLICATED IN QProblem CLASS!!!) - */ -returnValue QProblemB::backsolveR( const real_t* const b, BooleanType transposed, - BooleanType removingBound, - real_t* const a - ) -{ - int i, j; - int nR = getNZ( ); - - real_t sum; - - /* if backsolve is called while removing a bound, reduce nZ by one. */ - if ( removingBound == BT_TRUE ) - --nR; - - /* nothing to do */ - if ( nR <= 0 ) - return SUCCESSFUL_RETURN; - - - /* Solve Ra = b, where R might be transposed. */ - if ( transposed == BT_FALSE ) - { - /* solve Ra = b */ - for( i=(nR-1); i>=0; --i ) - { - sum = b[i]; - for( j=(i+1); j ZERO ) - a[i] = sum / R[i*NVMAX + i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - else - { - /* solve R^T*a = b */ - for( i=0; i ZERO ) - a[i] = sum / R[i*NVMAX + i]; - else - return THROWERROR( RET_DIV_BY_ZERO ); - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * h o t s t a r t _ d e t e r m i n e D a t a S h i f t - */ -returnValue QProblemB::hotstart_determineDataShift( const int* const FX_idx, - const real_t* const g_new, const real_t* const lb_new, const real_t* const ub_new, - real_t* const delta_g, real_t* const delta_lb, real_t* const delta_ub, - BooleanType& Delta_bB_isZero - ) -{ - int i, ii; - int nV = getNV( ); - int nFX = getNFX( ); - - - /* 1) Calculate shift directions. */ - for( i=0; i EPS ) || ( getAbs( delta_ub[ii] ) > EPS ) ) - { - Delta_bB_isZero = BT_FALSE; - break; - } - } - - return SUCCESSFUL_RETURN; -} - - -/* - * a r e B o u n d s C o n s i s t e n t - */ -BooleanType QProblemB::areBoundsConsistent( const real_t* const delta_lb, const real_t* const delta_ub - ) const -{ - int i; - - /* Check if delta_lb[i] is greater than delta_ub[i] - * for a component i whose bounds are already (numerically) equal. */ - for( i=0; i ub[i] - BOUNDTOL ) && ( delta_lb[i] > delta_ub[i] + EPS ) ) - return BT_FALSE; - - return BT_TRUE; -} - - -/* - * s e t u p Q P d a t a - */ -returnValue QProblemB::setupQPdata( const real_t* const _H, const real_t* const _R, const real_t* const _g, - const real_t* const _lb, const real_t* const _ub - ) -{ - int i, j; - int nV = getNV( ); - - /* 1) Setup Hessian matrix and it's Cholesky factorization. */ - if (_H != 0) - { - for( i=0; i 0 ) - { - for( i=0; i 0 ) - { - /* auxiliary variables */ - real_t delta_xFRz_TMP[NVMAX]; - real_t delta_xFRz_RHS[NVMAX]; - - /* Determine delta_xFRz. */ - if ( Delta_bB_isZero == BT_FALSE ) - { - for( i=0; i 0 ) - { - for( i=0; i= 0.0 ) ) - { - tau_tmp = y[ii] / ( -delta_yFX[i] ); - if ( tau_tmp < tau_new ) - { - if ( tau_tmp >= 0.0 ) - { - tau_new = tau_tmp; - BC_idx = ii; - BC_status = ST_INACTIVE; - } - } - } - } - else - { - /* 2) Active upper bounds. */ - if ( ( delta_yFX[i] > ZERO ) && ( y[ii] <= 0.0 ) ) - { - tau_tmp = y[ii] / ( -delta_yFX[i] ); - if ( tau_tmp < tau_new ) - { - if ( tau_tmp >= 0.0 ) - { - tau_new = tau_tmp; - BC_idx = ii; - BC_status = ST_INACTIVE; - } - } - } - } - } - } - - - /* II) DETERMINE MAXIMUM PRIMAL STEPLENGTH, i.e. ensure that - * inactive bounds remain valid (ignoring unbounded variables). */ - /* 1) Inactive lower bounds. */ - if ( bounds.isNoLower( ) == BT_FALSE ) - { - for( i=0; i delta_xFR[i] ) - { - if ( x[ii] > lb[ii] ) - tau_tmp = ( x[ii] - lb[ii] ) / ( delta_lb[ii] - delta_xFR[i] ); - else - tau_tmp = 0.0; - - if ( tau_tmp < tau_new ) - { - if ( tau_tmp >= 0.0 ) - { - tau_new = tau_tmp; - BC_idx = ii; - BC_status = ST_LOWER; - } - } - } - } - } - } - - /* 2) Inactive upper bounds. */ - if ( bounds.isNoUpper( ) == BT_FALSE ) - { - for( i=0; i= 0.0 ) - { - tau_new = tau_tmp; - BC_idx = ii; - BC_status = ST_UPPER; - } - } - } - } - } - } - - - /* III) SET MAXIMUM HOMOTOPY STEPLENGTH */ - tau = tau_new; - - if ( printlevel == PL_HIGH ) - { - #ifdef PC_DEBUG - char messageString[80]; - - if ( BC_status == ST_UNDEFINED ) - sprintf( messageString,"Stepsize is %.6e!",tau ); - else - sprintf( messageString,"Stepsize is %.6e! (BC_idx = %d, BC_status = %d)",tau,BC_idx,BC_status ); - - getGlobalMessageHandler( )->throwInfo( RET_STEPSIZE_NONPOSITIVE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - return SUCCESSFUL_RETURN; -} - - -/* - * h o t s t a r t _ p e r f o r m S t e p - */ -returnValue QProblemB::hotstart_performStep( const int* const FR_idx, const int* const FX_idx, - const real_t* const delta_g, const real_t* const delta_lb, const real_t* const delta_ub, - const real_t* const delta_xFX, const real_t* const delta_xFR, - const real_t* const delta_yFX, - int BC_idx, SubjectToStatus BC_status - ) -{ - int i, ii; - int nV = getNV( ); - int nFR = getNFR( ); - int nFX = getNFX( ); - - - /* I) CHECK BOUNDS' CONSISTENCY */ - if ( areBoundsConsistent( delta_lb,delta_ub ) == BT_FALSE ) - { - infeasible = BT_TRUE; - tau = 0.0; - - return THROWERROR( RET_QP_INFEASIBLE ); - } - - - /* II) GO TO ACTIVE SET CHANGE */ - if ( tau > ZERO ) - { - /* 1) Perform step in primal und dual space. */ - for( i=0; ithrowWarning( RET_STEPSIZE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - #endif - } - - - /* setup output preferences */ - #ifdef PC_DEBUG - char messageString[80]; - VisibilityStatus visibilityStatus; - - if ( printlevel == PL_HIGH ) - visibilityStatus = VS_VISIBLE; - else - visibilityStatus = VS_HIDDEN; - #endif - - - /* III) UPDATE ACTIVE SET */ - switch ( BC_status ) - { - /* Optimal solution found as no working set change detected. */ - case ST_UNDEFINED: - return RET_OPTIMAL_SOLUTION_FOUND; - - - /* Remove one variable from active set. */ - case ST_INACTIVE: - #ifdef PC_DEBUG - sprintf( messageString,"bound no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( removeBound( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); - - y[BC_idx] = 0.0; - break; - - - /* Add one variable to active set. */ - default: - #ifdef PC_DEBUG - if ( BC_status == ST_LOWER ) - sprintf( messageString,"lower bound no. %d.", BC_idx ); - else - sprintf( messageString,"upper bound no. %d.", BC_idx ); - getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); - #endif - - if ( addBound( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); - break; - } - - return SUCCESSFUL_RETURN; -} - - -#ifdef PC_DEBUG /* Define print functions only for debugging! */ - -/* - * p r i n t I t e r a t i o n - */ -returnValue QProblemB::printIteration( int iteration, - int BC_idx, SubjectToStatus BC_status - ) -{ - char myPrintfString[160]; - - /* consistency check */ - if ( iteration < 0 ) - return THROWERROR( RET_INVALID_ARGUMENTS ); - - /* nothing to do */ - if ( printlevel != PL_MEDIUM ) - return SUCCESSFUL_RETURN; - - - /* 1) Print header at first iteration. */ - if ( iteration == 0 ) - { - sprintf( myPrintfString,"\n############## qpOASES -- QP NO.%4.1d ###############\n", count ); - myPrintf( myPrintfString ); - - sprintf( myPrintfString," Iter | StepLength | Info | nFX \n" ); - myPrintf( myPrintfString ); - } - - /* 2) Print iteration line. */ - if ( BC_status == ST_UNDEFINED ) - { - sprintf( myPrintfString," %4.1d | %1.5e | QP SOLVED | %4.1d \n", iteration,tau,getNFX( ) ); - myPrintf( myPrintfString ); - } - else - { - char info[8]; - - if ( BC_status == ST_INACTIVE ) - sprintf( info,"REM BND" ); - else - sprintf( info,"ADD BND" ); - - sprintf( myPrintfString," %4.1d | %1.5e | %s%4.1d | %4.1d \n", iteration,tau,info,BC_idx,getNFX( ) ); - myPrintf( myPrintfString ); - } - - return SUCCESSFUL_RETURN; -} - -#endif /* PC_DEBUG */ - - - -/* - * c h e c k K K T c o n d i t i o n s - */ -returnValue QProblemB::checkKKTconditions( ) -{ - #ifdef __PERFORM_KKT_TEST__ - - int i, j; - int nV = getNV( ); - - real_t tmp; - real_t maxKKTviolation = 0.0; - - - /* 1) Check for Hx + g - y*A' = 0 (here: A = Id). */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = getAbs( tmp ); - } - - /* 2) Check for lb <= x <= ub. */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = lb[i] - x[i]; - - if ( x[i] - ub[i] > maxKKTviolation ) - maxKKTviolation = x[i] - ub[i]; - } - - /* 3) Check for correct sign of y and for complementary slackness. */ - for( i=0; i maxKKTviolation ) - maxKKTviolation = -y[i]; - if ( getAbs( ( x[i] - lb[i] ) * y[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( ( x[i] - lb[i] ) * y[i] ); - break; - - case ST_UPPER: - if ( y[i] > maxKKTviolation ) - maxKKTviolation = y[i]; - if ( getAbs( ( ub[i] - x[i] ) * y[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( ( ub[i] - x[i] ) * y[i] ); - break; - - default: /* inactive */ - if ( getAbs( y[i] ) > maxKKTviolation ) - maxKKTviolation = getAbs( y[i] ); - break; - } - } - - if ( maxKKTviolation > CRITICALACCURACY ) - return RET_NO_SOLUTION; - - if ( maxKKTviolation > DESIREDACCURACY ) - return RET_INACCURATE_SOLUTION; - - #endif /* __PERFORM_KKT_TEST__ */ - - return SUCCESSFUL_RETURN; -} - - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/QProblemB.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the QProblemB class which is able to use the newly + * developed online active set strategy for parametric quadratic programming. + */ + + +#include + +#include + +void printmatrix(char *name, double *A, int m, int n) { + int i, j; + + printf("%s = [...\n", name); + for (i = 0; i < m; i++) { + for (j = 0; j < n; j++) + printf(" % 9.4f", A[i*n+j]); + printf(",\n"); + } + printf("];\n"); +} + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * Q P r o b l e m B + */ +QProblemB::QProblemB( ) +{ + /* reset global message handler */ + getGlobalMessageHandler( )->reset( ); + + hasHessian = BT_FALSE; + + bounds.init( 0 ); + + hasCholesky = BT_FALSE; + + tau = 0.0; + + hessianType = HST_POSDEF_NULLSPACE; /* Hessian is assumed to be positive definite by default */ + infeasible = BT_FALSE; + unbounded = BT_FALSE; + + status = QPS_NOTINITIALISED; + + #ifdef PC_DEBUG + printlevel = PL_MEDIUM; + setPrintLevel( PL_MEDIUM ); + #else + printlevel = QPOASES_PRINTLEVEL; + #endif + + count = 0; +} + + +/* + * Q P r o b l e m B + */ +QProblemB::QProblemB( int _nV ) +{ + /* consistency check */ + if ( _nV <= 0 ) + { + _nV = 1; + THROWERROR( RET_INVALID_ARGUMENTS ); + } + + hasHessian = BT_FALSE; + + /* reset global message handler */ + getGlobalMessageHandler( )->reset( ); + + bounds.init( _nV ); + + hasCholesky = BT_FALSE; + + tau = 0.0; + + hessianType = HST_POSDEF_NULLSPACE; /* Hessian is assumed to be positive definite by default */ + infeasible = BT_FALSE; + unbounded = BT_FALSE; + + status = QPS_NOTINITIALISED; + + #ifdef PC_DEBUG + printlevel = PL_MEDIUM; + setPrintLevel( PL_MEDIUM ); + #else + printlevel = QPOASES_PRINTLEVEL; + #endif + + count = 0; +} + + +/* + * Q P r o b l e m B + */ +QProblemB::QProblemB( const QProblemB& rhs ) +{ + int i, j; + + int _nV = rhs.bounds.getNV( ); + + for( i=0; i<_nV; ++i ) + for( j=0; j<_nV; ++j ) + H[i*NVMAX + j] = rhs.H[i*NVMAX + j]; + + hasHessian = rhs.hasHessian; + + for( i=0; i<_nV; ++i ) + g[i] = rhs.g[i]; + + for( i=0; i<_nV; ++i ) + lb[i] = rhs.lb[i]; + + for( i=0; i<_nV; ++i ) + ub[i] = rhs.ub[i]; + + + bounds = rhs.bounds; + + for( i=0; i<_nV; ++i ) + for( j=0; j<_nV; ++j ) + R[i*NVMAX + j] = rhs.R[i*NVMAX + j]; + hasCholesky = rhs.hasCholesky; + + for( i=0; i<_nV; ++i ) + x[i] = rhs.x[i]; + + for( i=0; i<_nV; ++i ) + y[i] = rhs.y[i]; + + tau = rhs.tau; + + hessianType = rhs.hessianType; + infeasible = rhs.infeasible; + unbounded = rhs.unbounded; + + status = rhs.status; + + printlevel = rhs.printlevel; + + count = rhs.count; +} + + +/* + * ~ Q P r o b l e m B + */ +QProblemB::~QProblemB( ) +{ +} + + +/* + * o p e r a t o r = + */ +QProblemB& QProblemB::operator=( const QProblemB& rhs ) +{ + int i, j; + + if ( this != &rhs ) + { + int _nV = rhs.bounds.getNV( ); + + for( i=0; i<_nV; ++i ) + for( j=0; j<_nV; ++j ) + H[i*NVMAX + j] = rhs.H[i*NVMAX + j]; + + hasHessian = rhs.hasHessian; + + for( i=0; i<_nV; ++i ) + g[i] = rhs.g[i]; + + for( i=0; i<_nV; ++i ) + lb[i] = rhs.lb[i]; + + for( i=0; i<_nV; ++i ) + ub[i] = rhs.ub[i]; + + bounds = rhs.bounds; + + for( i=0; i<_nV; ++i ) + for( j=0; j<_nV; ++j ) + R[i*NVMAX + j] = rhs.R[i*NVMAX + j]; + hasCholesky = rhs.hasCholesky; + + + for( i=0; i<_nV; ++i ) + x[i] = rhs.x[i]; + + for( i=0; i<_nV; ++i ) + y[i] = rhs.y[i]; + + tau = rhs.tau; + + hessianType = rhs.hessianType; + infeasible = rhs.infeasible; + unbounded = rhs.unbounded; + + status = rhs.status; + + printlevel = rhs.printlevel; + setPrintLevel( rhs.printlevel ); + + count = rhs.count; + } + + return *this; +} + + +/* + * r e s e t + */ +returnValue QProblemB::reset( ) +{ + int i, j; + int nV = getNV( ); + + /** 0) Reset has Hessian flag. */ + hasHessian = BT_FALSE; + + /* 1) Reset bounds. */ + bounds.init( nV ); + + /* 2) Reset Cholesky decomposition. */ + for( i=0; ithrowInfo( RET_ITERATION_STARTED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + /* 1) Setup index arrays. */ + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + if ( bounds.getFixed( )->getNumberArray( FX_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_HOTSTART_FAILED ); + + /* 2) Initialize shift direction of the gradient and the bounds. */ + returnvalue = hotstart_determineDataShift( FX_idx, + g_new,lb_new,ub_new, + delta_g,delta_lb,delta_ub, + Delta_bB_isZero + ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_SHIFT_DETERMINATION_FAILED ); + return returnvalue; + } + + /* 3) Determination of step direction of X and Y. */ + returnvalue = hotstart_determineStepDirection( FR_idx,FX_idx, + delta_g,delta_lb,delta_ub, + Delta_bB_isZero, + delta_xFX,delta_xFR,delta_yFX + ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_STEPDIRECTION_DETERMINATION_FAILED ); + return returnvalue; + } + + + /* 4) Determination of step length TAU. */ + returnvalue = hotstart_determineStepLength( FR_idx,FX_idx, + delta_lb,delta_ub, + delta_xFR,delta_yFX, + BC_idx,BC_status ); + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + THROWERROR( RET_STEPLENGTH_DETERMINATION_FAILED ); + return returnvalue; + } + + /* 5) Realization of the homotopy step. */ + returnvalue = hotstart_performStep( FR_idx,FX_idx, + delta_g,delta_lb,delta_ub, + delta_xFX,delta_xFR,delta_yFX, + BC_idx,BC_status + ); + + + if ( returnvalue != SUCCESSFUL_RETURN ) + { + nWSR = l; + + /* stop runtime measurement */ + if ( cputime != 0 ) + *cputime = getCPUtime( ) - starttime; + + /* optimal solution found? */ + if ( returnvalue == RET_OPTIMAL_SOLUTION_FOUND ) + { + status = QPS_SOLVED; + + if ( printlevel == PL_HIGH ) + THROWINFO( RET_OPTIMAL_SOLUTION_FOUND ); + + #ifdef PC_DEBUG + if ( printIteration( l,BC_idx,BC_status ) != SUCCESSFUL_RETURN ) + THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ + #endif + + /* check KKT optimality conditions */ + return checkKKTconditions( ); + } + else + { + /* checks for infeasibility... */ + if ( infeasible == BT_TRUE ) + { + status = QPS_HOMOTOPYQPSOLVED; + return THROWERROR( RET_HOTSTART_STOPPED_INFEASIBILITY ); + } + + /* ...unboundedness... */ + if ( unbounded == BT_TRUE ) /* not necessary since objective function convex! */ + return THROWERROR( RET_HOTSTART_STOPPED_UNBOUNDEDNESS ); + + /* ... and throw unspecific error otherwise */ + THROWERROR( RET_HOMOTOPY_STEP_FAILED ); + return returnvalue; + } + } + + /* 6) Output information of successful QP iteration. */ + status = QPS_HOMOTOPYQPSOLVED; + + #ifdef PC_DEBUG + if ( printIteration( l,BC_idx,BC_status ) != SUCCESSFUL_RETURN ) + THROWERROR( RET_PRINT_ITERATION_FAILED ); /* do not pass this as return value! */ + #endif + } + + + /* stop runtime measurement */ + if ( cputime != 0 ) + *cputime = getCPUtime( ) - starttime; + + + /* if programm gets to here, output information that QP could not be solved + * within the given maximum numbers of working set changes */ + if ( printlevel == PL_HIGH ) + { + #ifdef PC_DEBUG + sprintf( messageString,"(nWSR = %d)",nWSR ); + return getGlobalMessageHandler( )->throwWarning( RET_MAX_NWSR_REACHED,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + /* Finally check KKT optimality conditions. */ + returnValue returnvalueKKTcheck = checkKKTconditions( ); + + if ( returnvalueKKTcheck != SUCCESSFUL_RETURN ) + return returnvalueKKTcheck; + else + return RET_MAX_NWSR_REACHED; +} + + +/* + * g e t N Z + */ +int QProblemB::getNZ( ) +{ + /* if no constraints are present: nZ=nFR */ + return bounds.getFree( )->getLength( ); +} + + +/* + * g e t O b j V a l + */ +real_t QProblemB::getObjVal( ) const +{ + real_t objVal; + + /* calculated optimal objective function value + * only if current QP has been solved */ + if ( ( getStatus( ) == QPS_AUXILIARYQPSOLVED ) || + ( getStatus( ) == QPS_HOMOTOPYQPSOLVED ) || + ( getStatus( ) == QPS_SOLVED ) ) + { + objVal = getObjVal( x ); + } + else + { + objVal = INFTY; + } + + return objVal; +} + + +/* + * g e t O b j V a l + */ +real_t QProblemB::getObjVal( const real_t* const _x ) const +{ + int i, j; + int nV = getNV( ); + + real_t obj_tmp = 0.0; + + for( i=0; i= PL_MEDIUM ) && ( printlevel != _printlevel ) ) + THROWINFO( RET_PRINTLEVEL_CHANGED ); + #endif + + printlevel = _printlevel; + + /* update message handler preferences */ + switch ( printlevel ) + { + case PL_NONE: + getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_HIDDEN ); + getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_HIDDEN ); + getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_HIDDEN ); + break; + + case PL_LOW: + getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_VISIBLE ); + getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_HIDDEN ); + getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_HIDDEN ); + break; + + default: /* PL_MEDIUM, PL_HIGH */ + getGlobalMessageHandler( )->setErrorVisibilityStatus( VS_VISIBLE ); + getGlobalMessageHandler( )->setWarningVisibilityStatus( VS_VISIBLE ); + getGlobalMessageHandler( )->setInfoVisibilityStatus( VS_VISIBLE ); + break; + } + + return SUCCESSFUL_RETURN; +} + + + +/***************************************************************************** + * P R O T E C T E D * + *****************************************************************************/ + +/* + * c h e c k F o r I d e n t i t y H e s s i a n + */ +returnValue QProblemB::checkForIdentityHessian( ) +{ + int i, j; + int nV = getNV( ); + + /* nothing to do as status flag remains unaltered + * if Hessian differs from identity matrix */ + if ( hessianType == HST_IDENTITY ) + return SUCCESSFUL_RETURN; + + /* 1) If Hessian differs from identity matrix, + * return without changing the internal HessianType. */ + for ( i=0; i EPS ) + return SUCCESSFUL_RETURN; + + for ( i=0; i EPS ) || ( getAbs( H[j*NVMAX + i] ) > EPS ) ) + return SUCCESSFUL_RETURN; + } + + /* 2) If this point is reached, Hessian equals the idetity matrix. */ + hessianType = HST_IDENTITY; + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p S u b j e c t T o T y p e + */ +returnValue QProblemB::setupSubjectToType( ) +{ + int i; + int nV = getNV( ); + + + /* 1) Check if lower bounds are present. */ + bounds.setNoLower( BT_TRUE ); + for( i=0; i -INFTY ) + { + bounds.setNoLower( BT_FALSE ); + break; + } + + /* 2) Check if upper bounds are present. */ + bounds.setNoUpper( BT_TRUE ); + for( i=0; i INFTY - BOUNDTOL ) ) + { + bounds.setType( i,ST_UNBOUNDED ); + ++nUV; + } + else + { + if ( lb[i] > ub[i] - BOUNDTOL ) + { + bounds.setType( i,ST_EQUALITY ); + ++nFV; + } + else + { + bounds.setType( i,ST_BOUNDED ); + } + } + + /* 4) Set dimensions of bounds structure. */ + bounds.setNFV( nFV ); + bounds.setNUV( nUV ); + bounds.setNBV( nV - nFV - nUV ); + + return SUCCESSFUL_RETURN; +} + + +/* + * c h o l e s k y D e c o m p o s i t i o n + */ +returnValue QProblemB::setupCholeskyDecomposition( ) +{ + int i, j, k, ii, jj; + int nV = getNV( ); + int nFR = getNFR( ); + + /* If Hessian flag is false, it means that H & R already contain Cholesky + * factorization -- provided from outside. */ + if (hasHessian == BT_FALSE) + return SUCCESSFUL_RETURN; + + /* 1) Initialises R with all zeros. */ + for( i=0; i 0 ) + { + int FR_idx[NVMAX]; + if ( bounds.getFree( )->getNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INDEXLIST_CORRUPTED ); + + /* R'*R = H */ + real_t sum; + real_t inv; + + for( i=0; i=0; --k ) + sum -= R[k*NVMAX + i] * R[k*NVMAX + i]; + + if ( sum > 0.0 ) + { + R[i*NVMAX + i] = sqrt( sum ); + inv = 1.0 / R[i*NVMAX + i]; + } + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + + /* j > i */ + for( j=(i+1); j=0; --k ) + sum -= R[k*NVMAX + i] * R[k*NVMAX + j]; + + R[i*NVMAX + j] = sum * inv; + } + } + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s o l v e I n i t i a l Q P + */ +returnValue QProblemB::solveInitialQP( const real_t* const xOpt, const real_t* const yOpt, + const Bounds* const guessedBounds, + int& nWSR, real_t* const cputime + ) +{ + int i, nFR; + int nV = getNV( ); + + + /* start runtime measurement */ + real_t starttime = 0.0; + if ( cputime != 0 ) + starttime = getCPUtime( ); + + + status = QPS_NOTINITIALISED; + + /* I) ANALYSE QP DATA: */ + /* 1) Check if Hessian happens to be the identity matrix. */ + if ( checkForIdentityHessian( ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + /* 2) Setup type of bounds (i.e. unbounded, implicitly fixed etc.). */ + if ( setupSubjectToType( ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + status = QPS_PREPARINGAUXILIARYQP; + + + /* II) SETUP AUXILIARY QP WITH GIVEN OPTIMAL SOLUTION: */ + /* 1) Setup bounds data structure. */ + if ( bounds.setupAllFree( ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + /* 2) Setup optimal primal/dual solution for auxiliary QP. */ + if ( setupAuxiliaryQPsolution( xOpt,yOpt ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + /* 3) Obtain linear independent working set for auxiliary QP. */ + + static Bounds auxiliaryBounds; + + auxiliaryBounds.init( nV ); + + if ( obtainAuxiliaryWorkingSet( xOpt,yOpt,guessedBounds, &auxiliaryBounds ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + /* 4) Setup working set of auxiliary QP and setup cholesky decomposition. */ + if ( setupAuxiliaryWorkingSet( &auxiliaryBounds,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_INIT_FAILED ); + + nFR = getNFR(); + /* At the moment we can only provide a Cholesky of the Hessian if + * the solver is cold-started. */ + if (hasCholesky == BT_FALSE || nFR != nV) + if (setupCholeskyDecomposition() != SUCCESSFUL_RETURN) + return THROWERROR( RET_INIT_FAILED_CHOLESKY ); + + /* 5) Store original QP formulation... */ + real_t g_original[NVMAX]; + real_t lb_original[NVMAX]; + real_t ub_original[NVMAX]; + + for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryBounds->setupBound( i,guessedBounds->getStatus( i ) ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + else /* No initial working set specified. */ + { + if ( ( xOpt != 0 ) && ( yOpt == 0 ) ) + { + /* Obtain initial working set by "clipping". */ + for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + if ( xOpt[i] >= ub[i] - BOUNDTOL ) + { + if ( auxiliaryBounds->setupBound( i,ST_UPPER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + /* Moreover, add all implictly fixed variables if specified. */ + if ( bounds.getType( i ) == ST_EQUALITY ) + { + if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + + if ( ( xOpt == 0 ) && ( yOpt != 0 ) ) + { + /* Obtain initial working set in accordance to sign of dual solution vector. */ + for( i=0; i ZERO ) + { + if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + if ( yOpt[i] < -ZERO ) + { + if ( auxiliaryBounds->setupBound( i,ST_UPPER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + continue; + } + + /* Moreover, add all implictly fixed variables if specified. */ + if ( bounds.getType( i ) == ST_EQUALITY ) + { + if ( auxiliaryBounds->setupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + + /* If xOpt and yOpt are null pointer and no initial working is specified, + * start with empty working set (or implicitly fixed bounds only) + * for auxiliary QP. */ + if ( ( xOpt == 0 ) && ( yOpt == 0 ) ) + { + for( i=0; isetupBound( i,ST_LOWER ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + else + { + if ( auxiliaryBounds->setupBound( i,ST_INACTIVE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_OBTAINING_WORKINGSET_FAILED ); + } + } + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p A u x i l i a r y W o r k i n g S e t + */ +returnValue QProblemB::setupAuxiliaryWorkingSet( const Bounds* const auxiliaryBounds, + BooleanType setupAfresh + ) +{ + int i; + int nV = getNV( ); + + /* consistency checks */ + if ( auxiliaryBounds != 0 ) + { + for( i=0; igetStatus( i ) == ST_UNDEFINED ) ) + return THROWERROR( RET_UNKNOWN_BUG ); + } + else + { + return THROWERROR( RET_INVALID_ARGUMENTS ); + } + + + /* I) SETUP CHOLESKY FLAG: + * Cholesky decomposition shall only be updated if working set + * shall be updated (i.e. NOT setup afresh!) */ + BooleanType updateCholesky; + if ( setupAfresh == BT_TRUE ) + updateCholesky = BT_FALSE; + else + updateCholesky = BT_TRUE; + + + /* II) REMOVE FORMERLY ACTIVE BOUNDS (IF NECESSARY): */ + if ( setupAfresh == BT_FALSE ) + { + /* Remove all active bounds that shall be inactive AND + * all active bounds that are active at the wrong bound. */ + for( i=0; igetStatus( i ) != ST_LOWER ) ) + if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + + if ( ( bounds.getStatus( i ) == ST_UPPER ) && ( auxiliaryBounds->getStatus( i ) != ST_UPPER ) ) + if ( removeBound( i,updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + } + + + /* III) ADD NEWLY ACTIVE BOUNDS: */ + /* Add all inactive bounds that shall be active AND + * all formerly active bounds that have been active at the wrong bound. */ + for( i=0; igetStatus( i ) != ST_INACTIVE ) ) + { + if ( addBound( i,auxiliaryBounds->getStatus( i ),updateCholesky ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SETUP_WORKINGSET_FAILED ); + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * s e t u p A u x i l i a r y Q P s o l u t i o n + */ +returnValue QProblemB::setupAuxiliaryQPsolution( const real_t* const xOpt, const real_t* const yOpt + ) +{ + int i; + int nV = getNV( ); + + + /* Setup primal/dual solution vectors for auxiliary initial QP: + * if a null pointer is passed, a zero vector is assigned; + * old solution vector is kept if pointer to internal solution vector is passed. */ + if ( xOpt != 0 ) + { + if ( xOpt != x ) + for( i=0; igetIndex( number ); + + real_t c, s; + + /* 2) Use row-wise Givens rotations to restore upper triangular form of R. */ + for( i=number_idx+1; ith column and ... */ + for( i=0; igetNumberArray( FR_idx ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVEBOUND_FAILED ); + + /* 1) Calculate new column of cholesky decomposition. */ + real_t rhs[NVMAX]; + real_t r[NVMAX]; + real_t r0 = H[number*NVMAX + number]; + + for( i=0; i 0.0 ) + R[nFR*NVMAX + nFR] = sqrt( r0 ); + else + { + hessianType = HST_SEMIDEF; + return THROWERROR( RET_HESSIAN_NOT_SPD ); + } + + + return SUCCESSFUL_RETURN; +} + + +/* + * b a c k s o l v e R (CODE DUPLICATED IN QProblem CLASS!!!) + */ +returnValue QProblemB::backsolveR( const real_t* const b, BooleanType transposed, + real_t* const a + ) +{ + /* Call standard backsolve procedure (i.e. removingBound == BT_FALSE). */ + return backsolveR( b,transposed,BT_FALSE,a ); +} + + +/* + * b a c k s o l v e R (CODE DUPLICATED IN QProblem CLASS!!!) + */ +returnValue QProblemB::backsolveR( const real_t* const b, BooleanType transposed, + BooleanType removingBound, + real_t* const a + ) +{ + int i, j; + int nR = getNZ( ); + + real_t sum; + + /* if backsolve is called while removing a bound, reduce nZ by one. */ + if ( removingBound == BT_TRUE ) + --nR; + + /* nothing to do */ + if ( nR <= 0 ) + return SUCCESSFUL_RETURN; + + + /* Solve Ra = b, where R might be transposed. */ + if ( transposed == BT_FALSE ) + { + /* solve Ra = b */ + for( i=(nR-1); i>=0; --i ) + { + sum = b[i]; + for( j=(i+1); j ZERO ) + a[i] = sum / R[i*NVMAX + i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + else + { + /* solve R^T*a = b */ + for( i=0; i ZERO ) + a[i] = sum / R[i*NVMAX + i]; + else + return THROWERROR( RET_DIV_BY_ZERO ); + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * h o t s t a r t _ d e t e r m i n e D a t a S h i f t + */ +returnValue QProblemB::hotstart_determineDataShift( const int* const FX_idx, + const real_t* const g_new, const real_t* const lb_new, const real_t* const ub_new, + real_t* const delta_g, real_t* const delta_lb, real_t* const delta_ub, + BooleanType& Delta_bB_isZero + ) +{ + int i, ii; + int nV = getNV( ); + int nFX = getNFX( ); + + + /* 1) Calculate shift directions. */ + for( i=0; i EPS ) || ( getAbs( delta_ub[ii] ) > EPS ) ) + { + Delta_bB_isZero = BT_FALSE; + break; + } + } + + return SUCCESSFUL_RETURN; +} + + +/* + * a r e B o u n d s C o n s i s t e n t + */ +BooleanType QProblemB::areBoundsConsistent( const real_t* const delta_lb, const real_t* const delta_ub + ) const +{ + int i; + + /* Check if delta_lb[i] is greater than delta_ub[i] + * for a component i whose bounds are already (numerically) equal. */ + for( i=0; i ub[i] - BOUNDTOL ) && ( delta_lb[i] > delta_ub[i] + EPS ) ) + return BT_FALSE; + + return BT_TRUE; +} + + +/* + * s e t u p Q P d a t a + */ +returnValue QProblemB::setupQPdata( const real_t* const _H, const real_t* const _R, const real_t* const _g, + const real_t* const _lb, const real_t* const _ub + ) +{ + int i, j; + int nV = getNV( ); + + /* 1) Setup Hessian matrix and it's Cholesky factorization. */ + if (_H != 0) + { + for( i=0; i 0 ) + { + for( i=0; i 0 ) + { + /* auxiliary variables */ + real_t delta_xFRz_TMP[NVMAX]; + real_t delta_xFRz_RHS[NVMAX]; + + /* Determine delta_xFRz. */ + if ( Delta_bB_isZero == BT_FALSE ) + { + for( i=0; i 0 ) + { + for( i=0; i= 0.0 ) ) + { + tau_tmp = y[ii] / ( -delta_yFX[i] ); + if ( tau_tmp < tau_new ) + { + if ( tau_tmp >= 0.0 ) + { + tau_new = tau_tmp; + BC_idx = ii; + BC_status = ST_INACTIVE; + } + } + } + } + else + { + /* 2) Active upper bounds. */ + if ( ( delta_yFX[i] > ZERO ) && ( y[ii] <= 0.0 ) ) + { + tau_tmp = y[ii] / ( -delta_yFX[i] ); + if ( tau_tmp < tau_new ) + { + if ( tau_tmp >= 0.0 ) + { + tau_new = tau_tmp; + BC_idx = ii; + BC_status = ST_INACTIVE; + } + } + } + } + } + } + + + /* II) DETERMINE MAXIMUM PRIMAL STEPLENGTH, i.e. ensure that + * inactive bounds remain valid (ignoring unbounded variables). */ + /* 1) Inactive lower bounds. */ + if ( bounds.isNoLower( ) == BT_FALSE ) + { + for( i=0; i delta_xFR[i] ) + { + if ( x[ii] > lb[ii] ) + tau_tmp = ( x[ii] - lb[ii] ) / ( delta_lb[ii] - delta_xFR[i] ); + else + tau_tmp = 0.0; + + if ( tau_tmp < tau_new ) + { + if ( tau_tmp >= 0.0 ) + { + tau_new = tau_tmp; + BC_idx = ii; + BC_status = ST_LOWER; + } + } + } + } + } + } + + /* 2) Inactive upper bounds. */ + if ( bounds.isNoUpper( ) == BT_FALSE ) + { + for( i=0; i= 0.0 ) + { + tau_new = tau_tmp; + BC_idx = ii; + BC_status = ST_UPPER; + } + } + } + } + } + } + + + /* III) SET MAXIMUM HOMOTOPY STEPLENGTH */ + tau = tau_new; + + if ( printlevel == PL_HIGH ) + { + #ifdef PC_DEBUG + char messageString[80]; + + if ( BC_status == ST_UNDEFINED ) + sprintf( messageString,"Stepsize is %.6e!",tau ); + else + sprintf( messageString,"Stepsize is %.6e! (BC_idx = %d, BC_status = %d)",tau,BC_idx,BC_status ); + + getGlobalMessageHandler( )->throwInfo( RET_STEPSIZE_NONPOSITIVE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + return SUCCESSFUL_RETURN; +} + + +/* + * h o t s t a r t _ p e r f o r m S t e p + */ +returnValue QProblemB::hotstart_performStep( const int* const FR_idx, const int* const FX_idx, + const real_t* const delta_g, const real_t* const delta_lb, const real_t* const delta_ub, + const real_t* const delta_xFX, const real_t* const delta_xFR, + const real_t* const delta_yFX, + int BC_idx, SubjectToStatus BC_status + ) +{ + int i, ii; + int nV = getNV( ); + int nFR = getNFR( ); + int nFX = getNFX( ); + + + /* I) CHECK BOUNDS' CONSISTENCY */ + if ( areBoundsConsistent( delta_lb,delta_ub ) == BT_FALSE ) + { + infeasible = BT_TRUE; + tau = 0.0; + + return THROWERROR( RET_QP_INFEASIBLE ); + } + + + /* II) GO TO ACTIVE SET CHANGE */ + if ( tau > ZERO ) + { + /* 1) Perform step in primal und dual space. */ + for( i=0; ithrowWarning( RET_STEPSIZE,messageString,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + #endif + } + + + /* setup output preferences */ + #ifdef PC_DEBUG + char messageString[80]; + VisibilityStatus visibilityStatus; + + if ( printlevel == PL_HIGH ) + visibilityStatus = VS_VISIBLE; + else + visibilityStatus = VS_HIDDEN; + #endif + + + /* III) UPDATE ACTIVE SET */ + switch ( BC_status ) + { + /* Optimal solution found as no working set change detected. */ + case ST_UNDEFINED: + return RET_OPTIMAL_SOLUTION_FOUND; + + + /* Remove one variable from active set. */ + case ST_INACTIVE: + #ifdef PC_DEBUG + sprintf( messageString,"bound no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_REMOVE_FROM_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( removeBound( BC_idx,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_REMOVE_FROM_ACTIVESET_FAILED ); + + y[BC_idx] = 0.0; + break; + + + /* Add one variable to active set. */ + default: + #ifdef PC_DEBUG + if ( BC_status == ST_LOWER ) + sprintf( messageString,"lower bound no. %d.", BC_idx ); + else + sprintf( messageString,"upper bound no. %d.", BC_idx ); + getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNCTION__,__FILE__,__LINE__,visibilityStatus ); + #endif + + if ( addBound( BC_idx,BC_status,BT_TRUE ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_ADD_TO_ACTIVESET_FAILED ); + break; + } + + return SUCCESSFUL_RETURN; +} + + +#ifdef PC_DEBUG /* Define print functions only for debugging! */ + +/* + * p r i n t I t e r a t i o n + */ +returnValue QProblemB::printIteration( int iteration, + int BC_idx, SubjectToStatus BC_status + ) +{ + char myPrintfString[160]; + + /* consistency check */ + if ( iteration < 0 ) + return THROWERROR( RET_INVALID_ARGUMENTS ); + + /* nothing to do */ + if ( printlevel != PL_MEDIUM ) + return SUCCESSFUL_RETURN; + + + /* 1) Print header at first iteration. */ + if ( iteration == 0 ) + { + sprintf( myPrintfString,"\n############## qpOASES -- QP NO.%4.1d ###############\n", count ); + myPrintf( myPrintfString ); + + sprintf( myPrintfString," Iter | StepLength | Info | nFX \n" ); + myPrintf( myPrintfString ); + } + + /* 2) Print iteration line. */ + if ( BC_status == ST_UNDEFINED ) + { + sprintf( myPrintfString," %4.1d | %1.5e | QP SOLVED | %4.1d \n", iteration,tau,getNFX( ) ); + myPrintf( myPrintfString ); + } + else + { + char info[8]; + + if ( BC_status == ST_INACTIVE ) + sprintf( info,"REM BND" ); + else + sprintf( info,"ADD BND" ); + + sprintf( myPrintfString," %4.1d | %1.5e | %s%4.1d | %4.1d \n", iteration,tau,info,BC_idx,getNFX( ) ); + myPrintf( myPrintfString ); + } + + return SUCCESSFUL_RETURN; +} + +#endif /* PC_DEBUG */ + + + +/* + * c h e c k K K T c o n d i t i o n s + */ +returnValue QProblemB::checkKKTconditions( ) +{ + #ifdef __PERFORM_KKT_TEST__ + + int i, j; + int nV = getNV( ); + + real_t tmp; + real_t maxKKTviolation = 0.0; + + + /* 1) Check for Hx + g - y*A' = 0 (here: A = Id). */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = getAbs( tmp ); + } + + /* 2) Check for lb <= x <= ub. */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = lb[i] - x[i]; + + if ( x[i] - ub[i] > maxKKTviolation ) + maxKKTviolation = x[i] - ub[i]; + } + + /* 3) Check for correct sign of y and for complementary slackness. */ + for( i=0; i maxKKTviolation ) + maxKKTviolation = -y[i]; + if ( getAbs( ( x[i] - lb[i] ) * y[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( ( x[i] - lb[i] ) * y[i] ); + break; + + case ST_UPPER: + if ( y[i] > maxKKTviolation ) + maxKKTviolation = y[i]; + if ( getAbs( ( ub[i] - x[i] ) * y[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( ( ub[i] - x[i] ) * y[i] ); + break; + + default: /* inactive */ + if ( getAbs( y[i] ) > maxKKTviolation ) + maxKKTviolation = getAbs( y[i] ); + break; + } + } + + if ( maxKKTviolation > CRITICALACCURACY ) + return RET_NO_SOLUTION; + + if ( maxKKTviolation > DESIREDACCURACY ) + return RET_INACCURATE_SOLUTION; + + #endif /* __PERFORM_KKT_TEST__ */ + + return SUCCESSFUL_RETURN; +} + + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/QProblemB.ipp b/phonelibs/qpoases/SRC/QProblemB.ipp index 0c1c8b231..0b031301e 100644 --- a/phonelibs/qpoases/SRC/QProblemB.ipp +++ b/phonelibs/qpoases/SRC/QProblemB.ipp @@ -1,425 +1,425 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/QProblemB.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of inlined member functions of the QProblemB class which - * is able to use the newly developed online active set strategy for - * parametric quadratic programming. - */ - - - -#include - - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - -/* - * g e t H - */ -inline returnValue QProblemB::getH( real_t* const _H ) const -{ - int i; - - for ( i=0; i= 0 ) && ( number < getNV( ) ) ) - { - value = lb[number]; - return SUCCESSFUL_RETURN; - } - else - { - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } -} - - -/* - * g e t U B - */ -inline returnValue QProblemB::getUB( real_t* const _ub ) const -{ - int i; - - for ( i=0; i= 0 ) && ( number < getNV( ) ) ) - { - value = ub[number]; - return SUCCESSFUL_RETURN; - } - else - { - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } -} - - -/* - * g e t B o u n d s - */ -inline returnValue QProblemB::getBounds( Bounds* const _bounds ) const -{ - *_bounds = bounds; - - return SUCCESSFUL_RETURN; -} - - -/* - * g e t N V - */ -inline int QProblemB::getNV( ) const -{ - return bounds.getNV( ); -} - - -/* - * g e t N F R - */ -inline int QProblemB::getNFR( ) -{ - return bounds.getNFR( ); -} - - -/* - * g e t N F X - */ -inline int QProblemB::getNFX( ) -{ - return bounds.getNFX( ); -} - - -/* - * g e t N F V - */ -inline int QProblemB::getNFV( ) const -{ - return bounds.getNFV( ); -} - - -/* - * g e t S t a t u s - */ -inline QProblemStatus QProblemB::getStatus( ) const -{ - return status; -} - - -/* - * i s I n i t i a l i s e d - */ -inline BooleanType QProblemB::isInitialised( ) const -{ - if ( status == QPS_NOTINITIALISED ) - return BT_FALSE; - else - return BT_TRUE; -} - - -/* - * i s S o l v e d - */ -inline BooleanType QProblemB::isSolved( ) const -{ - if ( status == QPS_SOLVED ) - return BT_TRUE; - else - return BT_FALSE; -} - - -/* - * i s I n f e a s i b l e - */ -inline BooleanType QProblemB::isInfeasible( ) const -{ - return infeasible; -} - - -/* - * i s U n b o u n d e d - */ -inline BooleanType QProblemB::isUnbounded( ) const -{ - return unbounded; -} - - -/* - * g e t P r i n t L e v e l - */ -inline PrintLevel QProblemB::getPrintLevel( ) const -{ - return printlevel; -} - - -/* - * g e t H e s s i a n T y p e - */ -inline HessianType QProblemB::getHessianType( ) const -{ - return hessianType; -} - - -/* - * s e t H e s s i a n T y p e - */ -inline returnValue QProblemB::setHessianType( HessianType _hessianType ) -{ - hessianType = _hessianType; - return SUCCESSFUL_RETURN; -} - - - -/***************************************************************************** - * P R O T E C T E D * - *****************************************************************************/ - -/* - * s e t H - */ -inline returnValue QProblemB::setH( const real_t* const H_new ) -{ - int i, j; - - int nV = getNV(); - - for( i=0; i= 0 ) && ( number < getNV( ) ) ) - { - lb[number] = value; - return SUCCESSFUL_RETURN; - } - else - { - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } -} - - -/* - * s e t U B - */ -inline returnValue QProblemB::setUB( const real_t* const ub_new ) -{ - int i; - - int nV = getNV(); - - for( i=0; i= 0 ) && ( number < getNV( ) ) ) - { - ub[number] = value; - - return SUCCESSFUL_RETURN; - } - else - { - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); - } -} - - -/* - * c o m p u t e G i v e n s - */ -inline void QProblemB::computeGivens( real_t xold, real_t yold, real_t& xnew, real_t& ynew, - real_t& c, real_t& s - ) const -{ - if ( getAbs( yold ) <= ZERO ) - { - c = 1.0; - s = 0.0; - - xnew = xold; - ynew = yold; - } - else - { - real_t t, mu; - - mu = getAbs( xold ); - if ( getAbs( yold ) > mu ) - mu = getAbs( yold ); - - t = mu * sqrt( (xold/mu)*(xold/mu) + (yold/mu)*(yold/mu) ); - - if ( xold < 0.0 ) - t = -t; - - c = xold/t; - s = yold/t; - xnew = t; - ynew = 0.0; - } - - return; -} - - -/* - * a p p l y G i v e n s - */ -inline void QProblemB::applyGivens( real_t c, real_t s, real_t xold, real_t yold, - real_t& xnew, real_t& ynew - ) const -{ - /* Usual Givens plane rotation requiring four multiplications. */ - xnew = c*xold + s*yold; - ynew = -s*xold + c*yold; -// double nu = s/(1.0+c); -// -// xnew = xold*c + yold*s; -// ynew = (xnew+xold)*nu - yold; - - return; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/QProblemB.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of inlined member functions of the QProblemB class which + * is able to use the newly developed online active set strategy for + * parametric quadratic programming. + */ + + + +#include + + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + +/* + * g e t H + */ +inline returnValue QProblemB::getH( real_t* const _H ) const +{ + int i; + + for ( i=0; i= 0 ) && ( number < getNV( ) ) ) + { + value = lb[number]; + return SUCCESSFUL_RETURN; + } + else + { + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } +} + + +/* + * g e t U B + */ +inline returnValue QProblemB::getUB( real_t* const _ub ) const +{ + int i; + + for ( i=0; i= 0 ) && ( number < getNV( ) ) ) + { + value = ub[number]; + return SUCCESSFUL_RETURN; + } + else + { + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } +} + + +/* + * g e t B o u n d s + */ +inline returnValue QProblemB::getBounds( Bounds* const _bounds ) const +{ + *_bounds = bounds; + + return SUCCESSFUL_RETURN; +} + + +/* + * g e t N V + */ +inline int QProblemB::getNV( ) const +{ + return bounds.getNV( ); +} + + +/* + * g e t N F R + */ +inline int QProblemB::getNFR( ) +{ + return bounds.getNFR( ); +} + + +/* + * g e t N F X + */ +inline int QProblemB::getNFX( ) +{ + return bounds.getNFX( ); +} + + +/* + * g e t N F V + */ +inline int QProblemB::getNFV( ) const +{ + return bounds.getNFV( ); +} + + +/* + * g e t S t a t u s + */ +inline QProblemStatus QProblemB::getStatus( ) const +{ + return status; +} + + +/* + * i s I n i t i a l i s e d + */ +inline BooleanType QProblemB::isInitialised( ) const +{ + if ( status == QPS_NOTINITIALISED ) + return BT_FALSE; + else + return BT_TRUE; +} + + +/* + * i s S o l v e d + */ +inline BooleanType QProblemB::isSolved( ) const +{ + if ( status == QPS_SOLVED ) + return BT_TRUE; + else + return BT_FALSE; +} + + +/* + * i s I n f e a s i b l e + */ +inline BooleanType QProblemB::isInfeasible( ) const +{ + return infeasible; +} + + +/* + * i s U n b o u n d e d + */ +inline BooleanType QProblemB::isUnbounded( ) const +{ + return unbounded; +} + + +/* + * g e t P r i n t L e v e l + */ +inline PrintLevel QProblemB::getPrintLevel( ) const +{ + return printlevel; +} + + +/* + * g e t H e s s i a n T y p e + */ +inline HessianType QProblemB::getHessianType( ) const +{ + return hessianType; +} + + +/* + * s e t H e s s i a n T y p e + */ +inline returnValue QProblemB::setHessianType( HessianType _hessianType ) +{ + hessianType = _hessianType; + return SUCCESSFUL_RETURN; +} + + + +/***************************************************************************** + * P R O T E C T E D * + *****************************************************************************/ + +/* + * s e t H + */ +inline returnValue QProblemB::setH( const real_t* const H_new ) +{ + int i, j; + + int nV = getNV(); + + for( i=0; i= 0 ) && ( number < getNV( ) ) ) + { + lb[number] = value; + return SUCCESSFUL_RETURN; + } + else + { + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } +} + + +/* + * s e t U B + */ +inline returnValue QProblemB::setUB( const real_t* const ub_new ) +{ + int i; + + int nV = getNV(); + + for( i=0; i= 0 ) && ( number < getNV( ) ) ) + { + ub[number] = value; + + return SUCCESSFUL_RETURN; + } + else + { + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); + } +} + + +/* + * c o m p u t e G i v e n s + */ +inline void QProblemB::computeGivens( real_t xold, real_t yold, real_t& xnew, real_t& ynew, + real_t& c, real_t& s + ) const +{ + if ( getAbs( yold ) <= ZERO ) + { + c = 1.0; + s = 0.0; + + xnew = xold; + ynew = yold; + } + else + { + real_t t, mu; + + mu = getAbs( xold ); + if ( getAbs( yold ) > mu ) + mu = getAbs( yold ); + + t = mu * sqrt( (xold/mu)*(xold/mu) + (yold/mu)*(yold/mu) ); + + if ( xold < 0.0 ) + t = -t; + + c = xold/t; + s = yold/t; + xnew = t; + ynew = 0.0; + } + + return; +} + + +/* + * a p p l y G i v e n s + */ +inline void QProblemB::applyGivens( real_t c, real_t s, real_t xold, real_t yold, + real_t& xnew, real_t& ynew + ) const +{ + /* Usual Givens plane rotation requiring four multiplications. */ + xnew = c*xold + s*yold; + ynew = -s*xold + c*yold; +// double nu = s/(1.0+c); +// +// xnew = xold*c + yold*s; +// ynew = (xnew+xold)*nu - yold; + + return; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/SubjectTo.cpp b/phonelibs/qpoases/SRC/SubjectTo.cpp index 5dbf707c9..371f0d76d 100644 --- a/phonelibs/qpoases/SRC/SubjectTo.cpp +++ b/phonelibs/qpoases/SRC/SubjectTo.cpp @@ -1,200 +1,200 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/SubjectTo.cpp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the SubjectTo class designed to manage working sets of - * constraints and bounds within a QProblem. - */ - - -#include - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * S u b j e c t T o - */ -SubjectTo::SubjectTo( ) : noLower( BT_TRUE ), - noUpper( BT_TRUE ), - size( 0 ) -{ - int i; - - for( i=0; iaddNumber( newnumber ) == RET_INDEXLIST_EXCEEDS_MAX_LENGTH ) - return THROWERROR( RET_ADDINDEX_FAILED ); - - return SUCCESSFUL_RETURN; -} - - -/* - * r e m o v e I n d e x - */ -returnValue SubjectTo::removeIndex( Indexlist* const indexlist, - int removenumber - ) -{ - status[removenumber] = ST_UNDEFINED; - - if ( indexlist->removeNumber( removenumber ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_UNKNOWN_BUG ); - - return SUCCESSFUL_RETURN; -} - - -/* - * s w a p I n d e x - */ -returnValue SubjectTo::swapIndex( Indexlist* const indexlist, - int number1, int number2 - ) -{ - /* consistency checks */ - if ( status[number1] != status[number2] ) - return THROWERROR( RET_SWAPINDEX_FAILED ); - - if ( number1 == number2 ) - { - THROWWARNING( RET_NOTHING_TO_DO ); - return SUCCESSFUL_RETURN; - } - - if ( indexlist->swapNumbers( number1,number2 ) != SUCCESSFUL_RETURN ) - return THROWERROR( RET_SWAPINDEX_FAILED ); - - return SUCCESSFUL_RETURN; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/SubjectTo.cpp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the SubjectTo class designed to manage working sets of + * constraints and bounds within a QProblem. + */ + + +#include + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * S u b j e c t T o + */ +SubjectTo::SubjectTo( ) : noLower( BT_TRUE ), + noUpper( BT_TRUE ), + size( 0 ) +{ + int i; + + for( i=0; iaddNumber( newnumber ) == RET_INDEXLIST_EXCEEDS_MAX_LENGTH ) + return THROWERROR( RET_ADDINDEX_FAILED ); + + return SUCCESSFUL_RETURN; +} + + +/* + * r e m o v e I n d e x + */ +returnValue SubjectTo::removeIndex( Indexlist* const indexlist, + int removenumber + ) +{ + status[removenumber] = ST_UNDEFINED; + + if ( indexlist->removeNumber( removenumber ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_UNKNOWN_BUG ); + + return SUCCESSFUL_RETURN; +} + + +/* + * s w a p I n d e x + */ +returnValue SubjectTo::swapIndex( Indexlist* const indexlist, + int number1, int number2 + ) +{ + /* consistency checks */ + if ( status[number1] != status[number2] ) + return THROWERROR( RET_SWAPINDEX_FAILED ); + + if ( number1 == number2 ) + { + THROWWARNING( RET_NOTHING_TO_DO ); + return SUCCESSFUL_RETURN; + } + + if ( indexlist->swapNumbers( number1,number2 ) != SUCCESSFUL_RETURN ) + return THROWERROR( RET_SWAPINDEX_FAILED ); + + return SUCCESSFUL_RETURN; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/SubjectTo.ipp b/phonelibs/qpoases/SRC/SubjectTo.ipp index 7cd6dc69f..32215ba7e 100644 --- a/phonelibs/qpoases/SRC/SubjectTo.ipp +++ b/phonelibs/qpoases/SRC/SubjectTo.ipp @@ -1,132 +1,132 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/SubjectTo.ipp - * \author Hans Joachim Ferreau - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of the inlined member functions of the SubjectTo class - * designed to manage working sets of constraints and bounds within a QProblem. - */ - - -/***************************************************************************** - * P U B L I C * - *****************************************************************************/ - - -/* - * g e t T y p e - */ -inline SubjectToType SubjectTo::getType( int i ) const -{ - if ( ( i >= 0 ) && ( i < size ) ) - return type[i]; - else - return ST_UNKNOWN; -} - - -/* - * g e t S t a t u s - */ -inline SubjectToStatus SubjectTo::getStatus( int i ) const -{ - if ( ( i >= 0 ) && ( i < size ) ) - return status[i]; - else - return ST_UNDEFINED; -} - - -/* - * s e t T y p e - */ -inline returnValue SubjectTo::setType( int i, SubjectToType value ) -{ - if ( ( i >= 0 ) && ( i < size ) ) - { - type[i] = value; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * s e t S t a t u s - */ -inline returnValue SubjectTo::setStatus( int i, SubjectToStatus value ) -{ - if ( ( i >= 0 ) && ( i < size ) ) - { - status[i] = value; - return SUCCESSFUL_RETURN; - } - else - return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); -} - - -/* - * s e t N o L o w e r - */ -inline void SubjectTo::setNoLower( BooleanType _status ) -{ - noLower = _status; -} - - -/* - * s e t N o U p p e r - */ -inline void SubjectTo::setNoUpper( BooleanType _status ) -{ - noUpper = _status; -} - - -/* - * i s N o L o w e r - */ -inline BooleanType SubjectTo::isNoLower( ) const -{ - return noLower; -} - - -/* - * i s N o L o w e r - */ -inline BooleanType SubjectTo::isNoUpper( ) const -{ - return noUpper; -} - - -/* - * end of file - */ +/* + * This file is part of qpOASES. + * + * qpOASES -- An Implementation of the Online Active Set Strategy. + * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. + * + * qpOASES is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * qpOASES is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with qpOASES; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + + +/** + * \file SRC/SubjectTo.ipp + * \author Hans Joachim Ferreau + * \version 1.3embedded + * \date 2007-2008 + * + * Implementation of the inlined member functions of the SubjectTo class + * designed to manage working sets of constraints and bounds within a QProblem. + */ + + +/***************************************************************************** + * P U B L I C * + *****************************************************************************/ + + +/* + * g e t T y p e + */ +inline SubjectToType SubjectTo::getType( int i ) const +{ + if ( ( i >= 0 ) && ( i < size ) ) + return type[i]; + else + return ST_UNKNOWN; +} + + +/* + * g e t S t a t u s + */ +inline SubjectToStatus SubjectTo::getStatus( int i ) const +{ + if ( ( i >= 0 ) && ( i < size ) ) + return status[i]; + else + return ST_UNDEFINED; +} + + +/* + * s e t T y p e + */ +inline returnValue SubjectTo::setType( int i, SubjectToType value ) +{ + if ( ( i >= 0 ) && ( i < size ) ) + { + type[i] = value; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * s e t S t a t u s + */ +inline returnValue SubjectTo::setStatus( int i, SubjectToStatus value ) +{ + if ( ( i >= 0 ) && ( i < size ) ) + { + status[i] = value; + return SUCCESSFUL_RETURN; + } + else + return THROWERROR( RET_INDEX_OUT_OF_BOUNDS ); +} + + +/* + * s e t N o L o w e r + */ +inline void SubjectTo::setNoLower( BooleanType _status ) +{ + noLower = _status; +} + + +/* + * s e t N o U p p e r + */ +inline void SubjectTo::setNoUpper( BooleanType _status ) +{ + noUpper = _status; +} + + +/* + * i s N o L o w e r + */ +inline BooleanType SubjectTo::isNoLower( ) const +{ + return noLower; +} + + +/* + * i s N o L o w e r + */ +inline BooleanType SubjectTo::isNoUpper( ) const +{ + return noUpper; +} + + +/* + * end of file + */ diff --git a/phonelibs/qpoases/SRC/Utils.cpp b/phonelibs/qpoases/SRC/Utils.cpp index 7a3d0a522..c11722c47 100644 --- a/phonelibs/qpoases/SRC/Utils.cpp +++ b/phonelibs/qpoases/SRC/Utils.cpp @@ -1,471 +1,471 @@ -/* - * This file is part of qpOASES. - * - * qpOASES -- An Implementation of the Online Active Set Strategy. - * Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved. - * - * qpOASES is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * qpOASES is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with qpOASES; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - - -/** - * \file SRC/Utils.cpp - * \author Hans Joachim Ferreau, Eckhard Arnold - * \version 1.3embedded - * \date 2007-2008 - * - * Implementation of some inlined utilities for working with the different QProblem - * classes. - */ - - -#include - -#if defined(__WIN32__) || defined(WIN32) - #include -#elif defined(LINUX) - #include - #include -#endif - -#ifdef __MATLAB__ - #include -#endif - - -#include - - - -#ifdef PC_DEBUG /* Define print functions only for debugging! */ -/* - * p r i n t - */ -returnValue print( const real_t* const v, int n ) -{ - int i; - char myPrintfString[160]; - - /* Print a vector. */ - myPrintf( "[\t" ); - for( i=0; ithrowError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - - /* 2) Read data from file. */ - for( i=0; ithrowError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - data[i*ncol + j] = ( (real_t) float_data ); - } - } - - /* 3) Close file. */ - fclose( datafile ); - - return SUCCESSFUL_RETURN; -} - - -/* - * r e a d F r o m F i l e - */ -returnValue readFromFile( real_t* data, int n, - const char* datafilename - ) -{ - return readFromFile( data, n, 1, datafilename ); -} - - - -/* - * r e a d F r o m F i l e - */ -returnValue readFromFile( int* data, int n, - const char* datafilename - ) -{ - int i; - myFILE* datafile; - - /* 1) Open file. */ - if ( ( datafile = fopen( datafilename, "r" ) ) == 0 ) - { - char errstr[80]; - sprintf( errstr,"(%s)",datafilename ); - return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - - /* 2) Read data from file. */ - for( i=0; ithrowError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - } - - /* 3) Close file. */ - fclose( datafile ); - - return SUCCESSFUL_RETURN; -} - - -/* - * w r i t e I n t o F i l e - */ -returnValue writeIntoFile( const real_t* const data, int nrow, int ncol, - const char* datafilename, BooleanType append - ) -{ - int i, j; - myFILE* datafile; - - /* 1) Open file. */ - if ( append == BT_TRUE ) - { - /* append data */ - if ( ( datafile = fopen( datafilename, "a" ) ) == 0 ) - { - char errstr[80]; - sprintf( errstr,"(%s)",datafilename ); - return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - } - else - { - /* do not append data */ - if ( ( datafile = fopen( datafilename, "w" ) ) == 0 ) - { - char errstr[80]; - sprintf( errstr,"(%s)",datafilename ); - return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - } - - /* 2) Write data into file. */ - for( i=0; ithrowError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - } - else - { - /* do not append data */ - if ( ( datafile = fopen( datafilename, "w" ) ) == 0 ) - { - char errstr[80]; - sprintf( errstr,"(%s)",datafilename ); - return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); - } - } - - /* 2) Write data into file. */ - for( i=0; i + +#if defined(__WIN32__) || defined(WIN32) + #include +#elif defined(LINUX) + #include + #include +#endif + +#ifdef __MATLAB__ + #include +#endif + + +#include + + + +#ifdef PC_DEBUG /* Define print functions only for debugging! */ +/* + * p r i n t + */ +returnValue print( const real_t* const v, int n ) +{ + int i; + char myPrintfString[160]; + + /* Print a vector. */ + myPrintf( "[\t" ); + for( i=0; ithrowError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + + /* 2) Read data from file. */ + for( i=0; ithrowError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + data[i*ncol + j] = ( (real_t) float_data ); + } + } + + /* 3) Close file. */ + fclose( datafile ); + + return SUCCESSFUL_RETURN; +} + + +/* + * r e a d F r o m F i l e + */ +returnValue readFromFile( real_t* data, int n, + const char* datafilename + ) +{ + return readFromFile( data, n, 1, datafilename ); +} + + + +/* + * r e a d F r o m F i l e + */ +returnValue readFromFile( int* data, int n, + const char* datafilename + ) +{ + int i; + myFILE* datafile; + + /* 1) Open file. */ + if ( ( datafile = fopen( datafilename, "r" ) ) == 0 ) + { + char errstr[80]; + sprintf( errstr,"(%s)",datafilename ); + return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + + /* 2) Read data from file. */ + for( i=0; ithrowError( RET_UNABLE_TO_READ_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + } + + /* 3) Close file. */ + fclose( datafile ); + + return SUCCESSFUL_RETURN; +} + + +/* + * w r i t e I n t o F i l e + */ +returnValue writeIntoFile( const real_t* const data, int nrow, int ncol, + const char* datafilename, BooleanType append + ) +{ + int i, j; + myFILE* datafile; + + /* 1) Open file. */ + if ( append == BT_TRUE ) + { + /* append data */ + if ( ( datafile = fopen( datafilename, "a" ) ) == 0 ) + { + char errstr[80]; + sprintf( errstr,"(%s)",datafilename ); + return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + } + else + { + /* do not append data */ + if ( ( datafile = fopen( datafilename, "w" ) ) == 0 ) + { + char errstr[80]; + sprintf( errstr,"(%s)",datafilename ); + return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + } + + /* 2) Write data into file. */ + for( i=0; ithrowError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + } + else + { + /* do not append data */ + if ( ( datafile = fopen( datafilename, "w" ) ) == 0 ) + { + char errstr[80]; + sprintf( errstr,"(%s)",datafilename ); + return getGlobalMessageHandler( )->throwError( RET_UNABLE_TO_OPEN_FILE,errstr,__FUNCTION__,__FILE__,__LINE__,VS_VISIBLE ); + } + } + + /* 2) Write data into file. */ + for( i=0; i= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -namespace YAML { -typedef std::size_t anchor_t; -const anchor_t NullAnchor = 0; -} - -#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/binary.h b/phonelibs/yaml-cpp/include/yaml-cpp/binary.h deleted file mode 100644 index 29d5dbd02..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/binary.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include - -#include "yaml-cpp/dll.h" - -namespace YAML { -YAML_CPP_API std::string EncodeBase64(const unsigned char *data, - std::size_t size); -YAML_CPP_API std::vector DecodeBase64(const std::string &input); - -class YAML_CPP_API Binary { - public: - Binary() : m_unownedData(0), m_unownedSize(0) {} - Binary(const unsigned char *data_, std::size_t size_) - : m_unownedData(data_), m_unownedSize(size_) {} - - bool owned() const { return !m_unownedData; } - std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; } - const unsigned char *data() const { - return owned() ? &m_data[0] : m_unownedData; - } - - void swap(std::vector &rhs) { - if (m_unownedData) { - m_data.swap(rhs); - rhs.clear(); - rhs.resize(m_unownedSize); - std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin()); - m_unownedData = 0; - m_unownedSize = 0; - } else { - m_data.swap(rhs); - } - } - - bool operator==(const Binary &rhs) const { - const std::size_t s = size(); - if (s != rhs.size()) - return false; - const unsigned char *d1 = data(); - const unsigned char *d2 = rhs.data(); - for (std::size_t i = 0; i < s; i++) { - if (*d1++ != *d2++) - return false; - } - return true; - } - - bool operator!=(const Binary &rhs) const { return !(*this == rhs); } - - private: - std::vector m_data; - const unsigned char *m_unownedData; - std::size_t m_unownedSize; -}; -} - -#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h b/phonelibs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h deleted file mode 100644 index 78db9ec92..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/contrib/anchordict.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -#include "../anchor.h" - -namespace YAML { -/** - * An object that stores and retrieves values correlating to {@link anchor_t} - * values. - * - *

Efficient implementation that can make assumptions about how - * {@code anchor_t} values are assigned by the {@link Parser} class. - */ -template -class AnchorDict { - public: - void Register(anchor_t anchor, T value) { - if (anchor > m_data.size()) { - m_data.resize(anchor); - } - m_data[anchor - 1] = value; - } - - T Get(anchor_t anchor) const { return m_data[anchor - 1]; } - - private: - std::vector m_data; -}; -} - -#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h b/phonelibs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h deleted file mode 100644 index 7c2159b46..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/mark.h" -#include - -namespace YAML { -class Parser; - -// GraphBuilderInterface -// . Abstraction of node creation -// . pParentNode is always NULL or the return value of one of the NewXXX() -// functions. -class GraphBuilderInterface { - public: - // Create and return a new node with a null value. - virtual void *NewNull(const Mark &mark, void *pParentNode) = 0; - - // Create and return a new node with the given tag and value. - virtual void *NewScalar(const Mark &mark, const std::string &tag, - void *pParentNode, const std::string &value) = 0; - - // Create and return a new sequence node - virtual void *NewSequence(const Mark &mark, const std::string &tag, - void *pParentNode) = 0; - - // Add pNode to pSequence. pNode was created with one of the NewXxx() - // functions and pSequence with NewSequence(). - virtual void AppendToSequence(void *pSequence, void *pNode) = 0; - - // Note that no moew entries will be added to pSequence - virtual void SequenceComplete(void *pSequence) { (void)pSequence; } - - // Create and return a new map node - virtual void *NewMap(const Mark &mark, const std::string &tag, - void *pParentNode) = 0; - - // Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode - // were created with one of the NewXxx() methods and pMap with NewMap(). - virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0; - - // Note that no more assignments will be made in pMap - virtual void MapComplete(void *pMap) { (void)pMap; } - - // Return the node that should be used in place of an alias referencing - // pNode (pNode by default) - virtual void *AnchorReference(const Mark &mark, void *pNode) { - (void)mark; - return pNode; - } -}; - -// Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines -// Node, Sequence, and Map types. Sequence and Map must derive from Node -// (unless Node is defined as void). Impl must also implement function with -// all of the same names as the virtual functions in GraphBuilderInterface -// -- including the ones with default implementations -- but with the -// prototypes changed to accept an explicit Node*, Sequence*, or Map* where -// appropriate. -template -class GraphBuilder : public GraphBuilderInterface { - public: - typedef typename Impl::Node Node; - typedef typename Impl::Sequence Sequence; - typedef typename Impl::Map Map; - - GraphBuilder(Impl &impl) : m_impl(impl) { - Map *pMap = NULL; - Sequence *pSeq = NULL; - Node *pNode = NULL; - - // Type consistency checks - pNode = pMap; - pNode = pSeq; - } - - GraphBuilderInterface &AsBuilderInterface() { return *this; } - - virtual void *NewNull(const Mark &mark, void *pParentNode) { - return CheckType(m_impl.NewNull(mark, AsNode(pParentNode))); - } - - virtual void *NewScalar(const Mark &mark, const std::string &tag, - void *pParentNode, const std::string &value) { - return CheckType( - m_impl.NewScalar(mark, tag, AsNode(pParentNode), value)); - } - - virtual void *NewSequence(const Mark &mark, const std::string &tag, - void *pParentNode) { - return CheckType( - m_impl.NewSequence(mark, tag, AsNode(pParentNode))); - } - virtual void AppendToSequence(void *pSequence, void *pNode) { - m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode)); - } - virtual void SequenceComplete(void *pSequence) { - m_impl.SequenceComplete(AsSequence(pSequence)); - } - - virtual void *NewMap(const Mark &mark, const std::string &tag, - void *pParentNode) { - return CheckType(m_impl.NewMap(mark, tag, AsNode(pParentNode))); - } - virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) { - m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode)); - } - virtual void MapComplete(void *pMap) { m_impl.MapComplete(AsMap(pMap)); } - - virtual void *AnchorReference(const Mark &mark, void *pNode) { - return CheckType(m_impl.AnchorReference(mark, AsNode(pNode))); - } - - private: - Impl &m_impl; - - // Static check for pointer to T - template - static T *CheckType(U *p) { - return p; - } - - static Node *AsNode(void *pNode) { return static_cast(pNode); } - static Sequence *AsSequence(void *pSeq) { - return static_cast(pSeq); - } - static Map *AsMap(void *pMap) { return static_cast(pMap); } -}; - -void *BuildGraphOfNextDocument(Parser &parser, - GraphBuilderInterface &graphBuilder); - -template -typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) { - GraphBuilder graphBuilder(impl); - return static_cast( - BuildGraphOfNextDocument(parser, graphBuilder)); -} -} - -#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/dll.h b/phonelibs/yaml-cpp/include/yaml-cpp/dll.h deleted file mode 100644 index a32c06b2e..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/dll.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -// The following ifdef block is the standard way of creating macros which make -// exporting from a DLL simpler. All files within this DLL are compiled with the -// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not -// be defined on any project that uses this DLL. This way any other project -// whose source files include this file see YAML_CPP_API functions as being -// imported from a DLL, whereas this DLL sees symbols defined with this macro as -// being exported. -#undef YAML_CPP_API - -#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined - // manually) -#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake - // or defined manually) -// #pragma message( "Defining YAML_CPP_API for DLL export" ) -#define YAML_CPP_API __declspec(dllexport) -#else // yaml_cpp_EXPORTS -// #pragma message( "Defining YAML_CPP_API for DLL import" ) -#define YAML_CPP_API __declspec(dllimport) -#endif // yaml_cpp_EXPORTS -#else // YAML_CPP_DLL -#define YAML_CPP_API -#endif // YAML_CPP_DLL - -#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/emitfromevents.h b/phonelibs/yaml-cpp/include/yaml-cpp/emitfromevents.h deleted file mode 100644 index f14b051ab..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/emitfromevents.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -#include "yaml-cpp/anchor.h" -#include "yaml-cpp/emitterstyle.h" -#include "yaml-cpp/eventhandler.h" - -namespace YAML { -struct Mark; -} // namespace YAML - -namespace YAML { -class Emitter; - -class EmitFromEvents : public EventHandler { - public: - EmitFromEvents(Emitter& emitter); - - virtual void OnDocumentStart(const Mark& mark); - virtual void OnDocumentEnd(); - - virtual void OnNull(const Mark& mark, anchor_t anchor); - virtual void OnAlias(const Mark& mark, anchor_t anchor); - virtual void OnScalar(const Mark& mark, const std::string& tag, - anchor_t anchor, const std::string& value); - - virtual void OnSequenceStart(const Mark& mark, const std::string& tag, - anchor_t anchor, EmitterStyle::value style); - virtual void OnSequenceEnd(); - - virtual void OnMapStart(const Mark& mark, const std::string& tag, - anchor_t anchor, EmitterStyle::value style); - virtual void OnMapEnd(); - - private: - void BeginNode(); - void EmitProps(const std::string& tag, anchor_t anchor); - - private: - Emitter& m_emitter; - - struct State { - enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue }; - }; - std::stack m_stateStack; -}; -} - -#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/emitter.h b/phonelibs/yaml-cpp/include/yaml-cpp/emitter.h deleted file mode 100644 index ef92cc403..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/emitter.h +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include -#include -#include - -#include "yaml-cpp/binary.h" -#include "yaml-cpp/dll.h" -#include "yaml-cpp/emitterdef.h" -#include "yaml-cpp/emittermanip.h" -#include "yaml-cpp/noncopyable.h" -#include "yaml-cpp/null.h" -#include "yaml-cpp/ostream_wrapper.h" - -namespace YAML { -class Binary; -struct _Null; -} // namespace YAML - -namespace YAML { -class EmitterState; - -class YAML_CPP_API Emitter : private noncopyable { - public: - Emitter(); - explicit Emitter(std::ostream& stream); - ~Emitter(); - - // output - const char* c_str() const; - std::size_t size() const; - - // state checking - bool good() const; - const std::string GetLastError() const; - - // global setters - bool SetOutputCharset(EMITTER_MANIP value); - bool SetStringFormat(EMITTER_MANIP value); - bool SetBoolFormat(EMITTER_MANIP value); - bool SetIntBase(EMITTER_MANIP value); - bool SetSeqFormat(EMITTER_MANIP value); - bool SetMapFormat(EMITTER_MANIP value); - bool SetIndent(std::size_t n); - bool SetPreCommentIndent(std::size_t n); - bool SetPostCommentIndent(std::size_t n); - bool SetFloatPrecision(std::size_t n); - bool SetDoublePrecision(std::size_t n); - - // local setters - Emitter& SetLocalValue(EMITTER_MANIP value); - Emitter& SetLocalIndent(const _Indent& indent); - Emitter& SetLocalPrecision(const _Precision& precision); - - // overloads of write - Emitter& Write(const std::string& str); - Emitter& Write(bool b); - Emitter& Write(char ch); - Emitter& Write(const _Alias& alias); - Emitter& Write(const _Anchor& anchor); - Emitter& Write(const _Tag& tag); - Emitter& Write(const _Comment& comment); - Emitter& Write(const _Null& n); - Emitter& Write(const Binary& binary); - - template - Emitter& WriteIntegralType(T value); - - template - Emitter& WriteStreamable(T value); - - private: - template - void SetStreamablePrecision(std::stringstream&) {} - std::size_t GetFloatPrecision() const; - std::size_t GetDoublePrecision() const; - - void PrepareIntegralStream(std::stringstream& stream) const; - void StartedScalar(); - - private: - void EmitBeginDoc(); - void EmitEndDoc(); - void EmitBeginSeq(); - void EmitEndSeq(); - void EmitBeginMap(); - void EmitEndMap(); - void EmitNewline(); - void EmitKindTag(); - void EmitTag(bool verbatim, const _Tag& tag); - - void PrepareNode(EmitterNodeType::value child); - void PrepareTopNode(EmitterNodeType::value child); - void FlowSeqPrepareNode(EmitterNodeType::value child); - void BlockSeqPrepareNode(EmitterNodeType::value child); - - void FlowMapPrepareNode(EmitterNodeType::value child); - - void FlowMapPrepareLongKey(EmitterNodeType::value child); - void FlowMapPrepareLongKeyValue(EmitterNodeType::value child); - void FlowMapPrepareSimpleKey(EmitterNodeType::value child); - void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child); - - void BlockMapPrepareNode(EmitterNodeType::value child); - - void BlockMapPrepareLongKey(EmitterNodeType::value child); - void BlockMapPrepareLongKeyValue(EmitterNodeType::value child); - void BlockMapPrepareSimpleKey(EmitterNodeType::value child); - void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child); - - void SpaceOrIndentTo(bool requireSpace, std::size_t indent); - - const char* ComputeFullBoolName(bool b) const; - bool CanEmitNewline() const; - - private: - std::unique_ptr m_pState; - ostream_wrapper m_stream; -}; - -template -inline Emitter& Emitter::WriteIntegralType(T value) { - if (!good()) - return *this; - - PrepareNode(EmitterNodeType::Scalar); - - std::stringstream stream; - PrepareIntegralStream(stream); - stream << value; - m_stream << stream.str(); - - StartedScalar(); - - return *this; -} - -template -inline Emitter& Emitter::WriteStreamable(T value) { - if (!good()) - return *this; - - PrepareNode(EmitterNodeType::Scalar); - - std::stringstream stream; - SetStreamablePrecision(stream); - stream << value; - m_stream << stream.str(); - - StartedScalar(); - - return *this; -} - -template <> -inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { - stream.precision(static_cast(GetFloatPrecision())); -} - -template <> -inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { - stream.precision(static_cast(GetDoublePrecision())); -} - -// overloads of insertion -inline Emitter& operator<<(Emitter& emitter, const std::string& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, bool v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, char v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, unsigned char v) { - return emitter.Write(static_cast(v)); -} -inline Emitter& operator<<(Emitter& emitter, const _Alias& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, const _Tag& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, const _Comment& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, const _Null& v) { - return emitter.Write(v); -} -inline Emitter& operator<<(Emitter& emitter, const Binary& b) { - return emitter.Write(b); -} - -inline Emitter& operator<<(Emitter& emitter, const char* v) { - return emitter.Write(std::string(v)); -} - -inline Emitter& operator<<(Emitter& emitter, int v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, unsigned int v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, short v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, unsigned short v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, long v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, unsigned long v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, long long v) { - return emitter.WriteIntegralType(v); -} -inline Emitter& operator<<(Emitter& emitter, unsigned long long v) { - return emitter.WriteIntegralType(v); -} - -inline Emitter& operator<<(Emitter& emitter, float v) { - return emitter.WriteStreamable(v); -} -inline Emitter& operator<<(Emitter& emitter, double v) { - return emitter.WriteStreamable(v); -} - -inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) { - return emitter.SetLocalValue(value); -} - -inline Emitter& operator<<(Emitter& emitter, _Indent indent) { - return emitter.SetLocalIndent(indent); -} - -inline Emitter& operator<<(Emitter& emitter, _Precision precision) { - return emitter.SetLocalPrecision(precision); -} -} - -#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/emitterdef.h b/phonelibs/yaml-cpp/include/yaml-cpp/emitterdef.h deleted file mode 100644 index 0b426957f..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/emitterdef.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -namespace YAML { -struct EmitterNodeType { - enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap }; -}; -} - -#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/emittermanip.h b/phonelibs/yaml-cpp/include/yaml-cpp/emittermanip.h deleted file mode 100644 index 89f725671..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/emittermanip.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -namespace YAML { -enum EMITTER_MANIP { - // general manipulators - Auto, - TagByKind, - Newline, - - // output character set - EmitNonAscii, - EscapeNonAscii, - - // string manipulators - // Auto, // duplicate - SingleQuoted, - DoubleQuoted, - Literal, - - // bool manipulators - YesNoBool, // yes, no - TrueFalseBool, // true, false - OnOffBool, // on, off - UpperCase, // TRUE, N - LowerCase, // f, yes - CamelCase, // No, Off - LongBool, // yes, On - ShortBool, // y, t - - // int manipulators - Dec, - Hex, - Oct, - - // document manipulators - BeginDoc, - EndDoc, - - // sequence manipulators - BeginSeq, - EndSeq, - Flow, - Block, - - // map manipulators - BeginMap, - EndMap, - Key, - Value, - // Flow, // duplicate - // Block, // duplicate - // Auto, // duplicate - LongKey -}; - -struct _Indent { - _Indent(int value_) : value(value_) {} - int value; -}; - -inline _Indent Indent(int value) { return _Indent(value); } - -struct _Alias { - _Alias(const std::string& content_) : content(content_) {} - std::string content; -}; - -inline _Alias Alias(const std::string content) { return _Alias(content); } - -struct _Anchor { - _Anchor(const std::string& content_) : content(content_) {} - std::string content; -}; - -inline _Anchor Anchor(const std::string content) { return _Anchor(content); } - -struct _Tag { - struct Type { - enum value { Verbatim, PrimaryHandle, NamedHandle }; - }; - - explicit _Tag(const std::string& prefix_, const std::string& content_, - Type::value type_) - : prefix(prefix_), content(content_), type(type_) {} - std::string prefix; - std::string content; - Type::value type; -}; - -inline _Tag VerbatimTag(const std::string content) { - return _Tag("", content, _Tag::Type::Verbatim); -} - -inline _Tag LocalTag(const std::string content) { - return _Tag("", content, _Tag::Type::PrimaryHandle); -} - -inline _Tag LocalTag(const std::string& prefix, const std::string content) { - return _Tag(prefix, content, _Tag::Type::NamedHandle); -} - -inline _Tag SecondaryTag(const std::string content) { - return _Tag("", content, _Tag::Type::NamedHandle); -} - -struct _Comment { - _Comment(const std::string& content_) : content(content_) {} - std::string content; -}; - -inline _Comment Comment(const std::string content) { return _Comment(content); } - -struct _Precision { - _Precision(int floatPrecision_, int doublePrecision_) - : floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {} - - int floatPrecision; - int doublePrecision; -}; - -inline _Precision FloatPrecision(int n) { return _Precision(n, -1); } - -inline _Precision DoublePrecision(int n) { return _Precision(-1, n); } - -inline _Precision Precision(int n) { return _Precision(n, n); } -} - -#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/emitterstyle.h b/phonelibs/yaml-cpp/include/yaml-cpp/emitterstyle.h deleted file mode 100644 index 67bb3981b..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/emitterstyle.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -namespace YAML { -struct EmitterStyle { - enum value { Default, Block, Flow }; -}; -} - -#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/eventhandler.h b/phonelibs/yaml-cpp/include/yaml-cpp/eventhandler.h deleted file mode 100644 index efe381c62..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/eventhandler.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -#include "yaml-cpp/anchor.h" -#include "yaml-cpp/emitterstyle.h" - -namespace YAML { -struct Mark; - -class EventHandler { - public: - virtual ~EventHandler() {} - - virtual void OnDocumentStart(const Mark& mark) = 0; - virtual void OnDocumentEnd() = 0; - - virtual void OnNull(const Mark& mark, anchor_t anchor) = 0; - virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0; - virtual void OnScalar(const Mark& mark, const std::string& tag, - anchor_t anchor, const std::string& value) = 0; - - virtual void OnSequenceStart(const Mark& mark, const std::string& tag, - anchor_t anchor, EmitterStyle::value style) = 0; - virtual void OnSequenceEnd() = 0; - - virtual void OnMapStart(const Mark& mark, const std::string& tag, - anchor_t anchor, EmitterStyle::value style) = 0; - virtual void OnMapEnd() = 0; -}; -} - -#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/exceptions.h b/phonelibs/yaml-cpp/include/yaml-cpp/exceptions.h deleted file mode 100644 index a0b7e3c72..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/exceptions.h +++ /dev/null @@ -1,257 +0,0 @@ -#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/mark.h" -#include "yaml-cpp/traits.h" -#include -#include -#include - -namespace YAML { -// error messages -namespace ErrorMsg { -const char* const YAML_DIRECTIVE_ARGS = - "YAML directives must have exactly one argument"; -const char* const YAML_VERSION = "bad YAML version: "; -const char* const YAML_MAJOR_VERSION = "YAML major version too large"; -const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive"; -const char* const TAG_DIRECTIVE_ARGS = - "TAG directives must have exactly two arguments"; -const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive"; -const char* const CHAR_IN_TAG_HANDLE = - "illegal character found while scanning tag handle"; -const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix"; -const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found"; -const char* const END_OF_MAP = "end of map not found"; -const char* const END_OF_MAP_FLOW = "end of map flow not found"; -const char* const END_OF_SEQ = "end of sequence not found"; -const char* const END_OF_SEQ_FLOW = "end of sequence flow not found"; -const char* const MULTIPLE_TAGS = - "cannot assign multiple tags to the same node"; -const char* const MULTIPLE_ANCHORS = - "cannot assign multiple anchors to the same node"; -const char* const MULTIPLE_ALIASES = - "cannot assign multiple aliases to the same node"; -const char* const ALIAS_CONTENT = - "aliases can't have any content, *including* tags"; -const char* const INVALID_HEX = "bad character found while scanning hex number"; -const char* const INVALID_UNICODE = "invalid unicode: "; -const char* const INVALID_ESCAPE = "unknown escape character: "; -const char* const UNKNOWN_TOKEN = "unknown token"; -const char* const DOC_IN_SCALAR = "illegal document indicator in scalar"; -const char* const EOF_IN_SCALAR = "illegal EOF in scalar"; -const char* const CHAR_IN_SCALAR = "illegal character in scalar"; -const char* const TAB_IN_INDENTATION = - "illegal tab when looking for indentation"; -const char* const FLOW_END = "illegal flow end"; -const char* const BLOCK_ENTRY = "illegal block entry"; -const char* const MAP_KEY = "illegal map key"; -const char* const MAP_VALUE = "illegal map value"; -const char* const ALIAS_NOT_FOUND = "alias not found after *"; -const char* const ANCHOR_NOT_FOUND = "anchor not found after &"; -const char* const CHAR_IN_ALIAS = - "illegal character found while scanning alias"; -const char* const CHAR_IN_ANCHOR = - "illegal character found while scanning anchor"; -const char* const ZERO_INDENT_IN_BLOCK = - "cannot set zero indentation for a block scalar"; -const char* const CHAR_IN_BLOCK = "unexpected character in block scalar"; -const char* const AMBIGUOUS_ANCHOR = - "cannot assign the same alias to multiple nodes"; -const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined"; - -const char* const INVALID_NODE = - "invalid node; this may result from using a map iterator as a sequence " - "iterator, or vice-versa"; -const char* const INVALID_SCALAR = "invalid scalar"; -const char* const KEY_NOT_FOUND = "key not found"; -const char* const BAD_CONVERSION = "bad conversion"; -const char* const BAD_DEREFERENCE = "bad dereference"; -const char* const BAD_SUBSCRIPT = "operator[] call on a scalar"; -const char* const BAD_PUSHBACK = "appending to a non-sequence"; -const char* const BAD_INSERT = "inserting in a non-convertible-to-map"; - -const char* const UNMATCHED_GROUP_TAG = "unmatched group tag"; -const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token"; -const char* const UNEXPECTED_END_MAP = "unexpected end map token"; -const char* const SINGLE_QUOTED_CHAR = - "invalid character in single-quoted string"; -const char* const INVALID_ANCHOR = "invalid anchor"; -const char* const INVALID_ALIAS = "invalid alias"; -const char* const INVALID_TAG = "invalid tag"; -const char* const BAD_FILE = "bad file"; - -template -inline const std::string KEY_NOT_FOUND_WITH_KEY( - const T&, typename disable_if>::type* = 0) { - return KEY_NOT_FOUND; -} - -inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) { - std::stringstream stream; - stream << KEY_NOT_FOUND << ": " << key; - return stream.str(); -} - -template -inline const std::string KEY_NOT_FOUND_WITH_KEY( - const T& key, typename enable_if>::type* = 0) { - std::stringstream stream; - stream << KEY_NOT_FOUND << ": " << key; - return stream.str(); -} -} - -class YAML_CPP_API Exception : public std::runtime_error { - public: - Exception(const Mark& mark_, const std::string& msg_) - : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {} - virtual ~Exception() noexcept; - - Exception(const Exception&) = default; - - Mark mark; - std::string msg; - - private: - static const std::string build_what(const Mark& mark, - const std::string& msg) { - if (mark.is_null()) { - return msg.c_str(); - } - - std::stringstream output; - output << "yaml-cpp: error at line " << mark.line + 1 << ", column " - << mark.column + 1 << ": " << msg; - return output.str(); - } -}; - -class YAML_CPP_API ParserException : public Exception { - public: - ParserException(const Mark& mark_, const std::string& msg_) - : Exception(mark_, msg_) {} - ParserException(const ParserException&) = default; - virtual ~ParserException() noexcept; -}; - -class YAML_CPP_API RepresentationException : public Exception { - public: - RepresentationException(const Mark& mark_, const std::string& msg_) - : Exception(mark_, msg_) {} - RepresentationException(const RepresentationException&) = default; - virtual ~RepresentationException() noexcept; -}; - -// representation exceptions -class YAML_CPP_API InvalidScalar : public RepresentationException { - public: - InvalidScalar(const Mark& mark_) - : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {} - InvalidScalar(const InvalidScalar&) = default; - virtual ~InvalidScalar() noexcept; -}; - -class YAML_CPP_API KeyNotFound : public RepresentationException { - public: - template - KeyNotFound(const Mark& mark_, const T& key_) - : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) { - } - KeyNotFound(const KeyNotFound&) = default; - virtual ~KeyNotFound() noexcept; -}; - -template -class YAML_CPP_API TypedKeyNotFound : public KeyNotFound { - public: - TypedKeyNotFound(const Mark& mark_, const T& key_) - : KeyNotFound(mark_, key_), key(key_) {} - virtual ~TypedKeyNotFound() noexcept {} - - T key; -}; - -template -inline TypedKeyNotFound MakeTypedKeyNotFound(const Mark& mark, - const T& key) { - return TypedKeyNotFound(mark, key); -} - -class YAML_CPP_API InvalidNode : public RepresentationException { - public: - InvalidNode() - : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {} - InvalidNode(const InvalidNode&) = default; - virtual ~InvalidNode() noexcept; -}; - -class YAML_CPP_API BadConversion : public RepresentationException { - public: - explicit BadConversion(const Mark& mark_) - : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {} - BadConversion(const BadConversion&) = default; - virtual ~BadConversion() noexcept; -}; - -template -class TypedBadConversion : public BadConversion { - public: - explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {} -}; - -class YAML_CPP_API BadDereference : public RepresentationException { - public: - BadDereference() - : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {} - BadDereference(const BadDereference&) = default; - virtual ~BadDereference() noexcept; -}; - -class YAML_CPP_API BadSubscript : public RepresentationException { - public: - BadSubscript() - : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {} - BadSubscript(const BadSubscript&) = default; - virtual ~BadSubscript() noexcept; -}; - -class YAML_CPP_API BadPushback : public RepresentationException { - public: - BadPushback() - : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {} - BadPushback(const BadPushback&) = default; - virtual ~BadPushback() noexcept; -}; - -class YAML_CPP_API BadInsert : public RepresentationException { - public: - BadInsert() - : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {} - BadInsert(const BadInsert&) = default; - virtual ~BadInsert() noexcept; -}; - -class YAML_CPP_API EmitterException : public Exception { - public: - EmitterException(const std::string& msg_) - : Exception(Mark::null_mark(), msg_) {} - EmitterException(const EmitterException&) = default; - virtual ~EmitterException() noexcept; -}; - -class YAML_CPP_API BadFile : public Exception { - public: - BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {} - BadFile(const BadFile&) = default; - virtual ~BadFile() noexcept; -}; -} - -#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/mark.h b/phonelibs/yaml-cpp/include/yaml-cpp/mark.h deleted file mode 100644 index bf94b4f41..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/mark.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" - -namespace YAML { -struct YAML_CPP_API Mark { - Mark() : pos(0), line(0), column(0) {} - - static const Mark null_mark() { return Mark(-1, -1, -1); } - - bool is_null() const { return pos == -1 && line == -1 && column == -1; } - - int pos; - int line, column; - - private: - Mark(int pos_, int line_, int column_) - : pos(pos_), line(line_), column(column_) {} -}; -} - -#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/convert.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/convert.h deleted file mode 100644 index 45a878ab0..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/convert.h +++ /dev/null @@ -1,331 +0,0 @@ -#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include -#include -#include -#include -#include - -#include "yaml-cpp/binary.h" -#include "yaml-cpp/node/impl.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/type.h" -#include "yaml-cpp/null.h" - -namespace YAML { -class Binary; -struct _Null; -template -struct convert; -} // namespace YAML - -namespace YAML { -namespace conversion { -inline bool IsInfinity(const std::string& input) { - return input == ".inf" || input == ".Inf" || input == ".INF" || - input == "+.inf" || input == "+.Inf" || input == "+.INF"; -} - -inline bool IsNegativeInfinity(const std::string& input) { - return input == "-.inf" || input == "-.Inf" || input == "-.INF"; -} - -inline bool IsNaN(const std::string& input) { - return input == ".nan" || input == ".NaN" || input == ".NAN"; -} -} - -// Node -template <> -struct convert { - static Node encode(const Node& rhs) { return rhs; } - - static bool decode(const Node& node, Node& rhs) { - rhs.reset(node); - return true; - } -}; - -// std::string -template <> -struct convert { - static Node encode(const std::string& rhs) { return Node(rhs); } - - static bool decode(const Node& node, std::string& rhs) { - if (!node.IsScalar()) - return false; - rhs = node.Scalar(); - return true; - } -}; - -// C-strings can only be encoded -template <> -struct convert { - static Node encode(const char*& rhs) { return Node(rhs); } -}; - -template -struct convert { - static Node encode(const char(&rhs)[N]) { return Node(rhs); } -}; - -template <> -struct convert<_Null> { - static Node encode(const _Null& /* rhs */) { return Node(); } - - static bool decode(const Node& node, _Null& /* rhs */) { - return node.IsNull(); - } -}; - -#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \ - template <> \ - struct convert { \ - static Node encode(const type& rhs) { \ - std::stringstream stream; \ - stream.precision(std::numeric_limits::digits10 + 1); \ - stream << rhs; \ - return Node(stream.str()); \ - } \ - \ - static bool decode(const Node& node, type& rhs) { \ - if (node.Type() != NodeType::Scalar) \ - return false; \ - const std::string& input = node.Scalar(); \ - std::stringstream stream(input); \ - stream.unsetf(std::ios::dec); \ - if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \ - return true; \ - if (std::numeric_limits::has_infinity) { \ - if (conversion::IsInfinity(input)) { \ - rhs = std::numeric_limits::infinity(); \ - return true; \ - } else if (conversion::IsNegativeInfinity(input)) { \ - rhs = negative_op std::numeric_limits::infinity(); \ - return true; \ - } \ - } \ - \ - if (std::numeric_limits::has_quiet_NaN && \ - conversion::IsNaN(input)) { \ - rhs = std::numeric_limits::quiet_NaN(); \ - return true; \ - } \ - \ - return false; \ - } \ - } - -#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \ - YAML_DEFINE_CONVERT_STREAMABLE(type, -) - -#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \ - YAML_DEFINE_CONVERT_STREAMABLE(type, +) - -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long); -YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned); -YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short); -YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long); -YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long); - -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char); -YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char); - -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double); -YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double); - -#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED -#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED -#undef YAML_DEFINE_CONVERT_STREAMABLE - -// bool -template <> -struct convert { - static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); } - - YAML_CPP_API static bool decode(const Node& node, bool& rhs); -}; - -// std::map -template -struct convert> { - static Node encode(const std::map& rhs) { - Node node(NodeType::Map); - for (typename std::map::const_iterator it = rhs.begin(); - it != rhs.end(); ++it) - node.force_insert(it->first, it->second); - return node; - } - - static bool decode(const Node& node, std::map& rhs) { - if (!node.IsMap()) - return false; - - rhs.clear(); - for (const_iterator it = node.begin(); it != node.end(); ++it) -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs[it->first.template as()] = it->second.template as(); -#else - rhs[it->first.as()] = it->second.as(); -#endif - return true; - } -}; - -// std::vector -template -struct convert> { - static Node encode(const std::vector& rhs) { - Node node(NodeType::Sequence); - for (typename std::vector::const_iterator it = rhs.begin(); - it != rhs.end(); ++it) - node.push_back(*it); - return node; - } - - static bool decode(const Node& node, std::vector& rhs) { - if (!node.IsSequence()) - return false; - - rhs.clear(); - for (const_iterator it = node.begin(); it != node.end(); ++it) -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs.push_back(it->template as()); -#else - rhs.push_back(it->as()); -#endif - return true; - } -}; - -// std::list -template -struct convert> { - static Node encode(const std::list& rhs) { - Node node(NodeType::Sequence); - for (typename std::list::const_iterator it = rhs.begin(); - it != rhs.end(); ++it) - node.push_back(*it); - return node; - } - - static bool decode(const Node& node, std::list& rhs) { - if (!node.IsSequence()) - return false; - - rhs.clear(); - for (const_iterator it = node.begin(); it != node.end(); ++it) -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs.push_back(it->template as()); -#else - rhs.push_back(it->as()); -#endif - return true; - } -}; - -// std::array -template -struct convert> { - static Node encode(const std::array& rhs) { - Node node(NodeType::Sequence); - for (const auto& element : rhs) { - node.push_back(element); - } - return node; - } - - static bool decode(const Node& node, std::array& rhs) { - if (!isNodeValid(node)) { - return false; - } - - for (auto i = 0u; i < node.size(); ++i) { -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs[i] = node[i].template as(); -#else - rhs[i] = node[i].as(); -#endif - } - return true; - } - - private: - static bool isNodeValid(const Node& node) { - return node.IsSequence() && node.size() == N; - } -}; - -// std::pair -template -struct convert> { - static Node encode(const std::pair& rhs) { - Node node(NodeType::Sequence); - node.push_back(rhs.first); - node.push_back(rhs.second); - return node; - } - - static bool decode(const Node& node, std::pair& rhs) { - if (!node.IsSequence()) - return false; - if (node.size() != 2) - return false; - -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs.first = node[0].template as(); -#else - rhs.first = node[0].as(); -#endif -#if defined(__GNUC__) && __GNUC__ < 4 - // workaround for GCC 3: - rhs.second = node[1].template as(); -#else - rhs.second = node[1].as(); -#endif - return true; - } -}; - -// binary -template <> -struct convert { - static Node encode(const Binary& rhs) { - return Node(EncodeBase64(rhs.data(), rhs.size())); - } - - static bool decode(const Node& node, Binary& rhs) { - if (!node.IsScalar()) - return false; - - std::vector data = DecodeBase64(node.Scalar()); - if (data.empty() && !node.Scalar().empty()) - return false; - - rhs.swap(data); - return true; - } -}; -} - -#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h deleted file mode 100644 index 2c80705c9..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -namespace YAML { -namespace detail { -struct unspecified_bool { - struct NOT_ALLOWED; - static void true_value(NOT_ALLOWED*) {} -}; -typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*); -} -} - -#define YAML_CPP_OPERATOR_BOOL() \ - operator YAML::detail::unspecified_bool_type() const { \ - return this->operator!() ? 0 \ - : &YAML::detail::unspecified_bool::true_value; \ - } - -#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/impl.h deleted file mode 100644 index 59318264a..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/impl.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/node/detail/node.h" -#include "yaml-cpp/node/detail/node_data.h" -#include - -namespace YAML { -namespace detail { -template -struct get_idx { - static node* get(const std::vector& /* sequence */, - const Key& /* key */, shared_memory_holder /* pMemory */) { - return 0; - } -}; - -template -struct get_idx::value && - !std::is_same::value>::type> { - static node* get(const std::vector& sequence, const Key& key, - shared_memory_holder /* pMemory */) { - return key < sequence.size() ? sequence[key] : 0; - } - - static node* get(std::vector& sequence, const Key& key, - shared_memory_holder pMemory) { - if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined())) - return 0; - if (key == sequence.size()) - sequence.push_back(&pMemory->create_node()); - return sequence[key]; - } -}; - -template -struct get_idx::value>::type> { - static node* get(const std::vector& sequence, const Key& key, - shared_memory_holder pMemory) { - return key >= 0 ? get_idx::get( - sequence, static_cast(key), pMemory) - : 0; - } - static node* get(std::vector& sequence, const Key& key, - shared_memory_holder pMemory) { - return key >= 0 ? get_idx::get( - sequence, static_cast(key), pMemory) - : 0; - } -}; - -template -inline bool node::equals(const T& rhs, shared_memory_holder pMemory) { - T lhs; - if (convert::decode(Node(*this, pMemory), lhs)) { - return lhs == rhs; - } - return false; -} - -inline bool node::equals(const char* rhs, shared_memory_holder pMemory) { - return equals(rhs, pMemory); -} - -// indexing -template -inline node* node_data::get(const Key& key, - shared_memory_holder pMemory) const { - switch (m_type) { - case NodeType::Map: - break; - case NodeType::Undefined: - case NodeType::Null: - return NULL; - case NodeType::Sequence: - if (node* pNode = get_idx::get(m_sequence, key, pMemory)) - return pNode; - return NULL; - case NodeType::Scalar: - throw BadSubscript(); - } - - for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { - if (it->first->equals(key, pMemory)) { - return it->second; - } - } - - return NULL; -} - -template -inline node& node_data::get(const Key& key, shared_memory_holder pMemory) { - switch (m_type) { - case NodeType::Map: - break; - case NodeType::Undefined: - case NodeType::Null: - case NodeType::Sequence: - if (node* pNode = get_idx::get(m_sequence, key, pMemory)) { - m_type = NodeType::Sequence; - return *pNode; - } - - convert_to_map(pMemory); - break; - case NodeType::Scalar: - throw BadSubscript(); - } - - for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) { - if (it->first->equals(key, pMemory)) { - return *it->second; - } - } - - node& k = convert_to_node(key, pMemory); - node& v = pMemory->create_node(); - insert_map_pair(k, v); - return v; -} - -template -inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) { - if (m_type != NodeType::Map) - return false; - - kv_pairs::iterator it = m_undefinedPairs.begin(); - while (it != m_undefinedPairs.end()) { - kv_pairs::iterator jt = std::next(it); - if (it->first->equals(key, pMemory)) - m_undefinedPairs.erase(it); - it = jt; - } - - for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) { - if (it->first->equals(key, pMemory)) { - m_map.erase(it); - return true; - } - } - - return false; -} - -// map -template -inline void node_data::force_insert(const Key& key, const Value& value, - shared_memory_holder pMemory) { - switch (m_type) { - case NodeType::Map: - break; - case NodeType::Undefined: - case NodeType::Null: - case NodeType::Sequence: - convert_to_map(pMemory); - break; - case NodeType::Scalar: - throw BadInsert(); - } - - node& k = convert_to_node(key, pMemory); - node& v = convert_to_node(value, pMemory); - insert_map_pair(k, v); -} - -template -inline node& node_data::convert_to_node(const T& rhs, - shared_memory_holder pMemory) { - Node value = convert::encode(rhs); - value.EnsureNodeExists(); - pMemory->merge(*value.m_pMemory); - return *value.m_pNode; -} -} -} - -#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h deleted file mode 100644 index 65f815249..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/detail/node_iterator.h" -#include -#include - -namespace YAML { -namespace detail { -struct iterator_value; - -template -class iterator_base : public std::iterator { - - private: - template - friend class iterator_base; - struct enabler {}; - typedef node_iterator base_type; - - struct proxy { - explicit proxy(const V& x) : m_ref(x) {} - V* operator->() { return std::addressof(m_ref); } - operator V*() { return std::addressof(m_ref); } - - V m_ref; - }; - - public: - typedef typename iterator_base::value_type value_type; - - public: - iterator_base() : m_iterator(), m_pMemory() {} - explicit iterator_base(base_type rhs, shared_memory_holder pMemory) - : m_iterator(rhs), m_pMemory(pMemory) {} - - template - iterator_base(const iterator_base& rhs, - typename std::enable_if::value, - enabler>::type = enabler()) - : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {} - - iterator_base& operator++() { - ++m_iterator; - return *this; - } - - iterator_base operator++(int) { - iterator_base iterator_pre(*this); - ++(*this); - return iterator_pre; - } - - template - bool operator==(const iterator_base& rhs) const { - return m_iterator == rhs.m_iterator; - } - - template - bool operator!=(const iterator_base& rhs) const { - return m_iterator != rhs.m_iterator; - } - - value_type operator*() const { - const typename base_type::value_type& v = *m_iterator; - if (v.pNode) - return value_type(Node(*v, m_pMemory)); - if (v.first && v.second) - return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory)); - return value_type(); - } - - proxy operator->() const { return proxy(**this); } - - private: - base_type m_iterator; - shared_memory_holder m_pMemory; -}; -} -} - -#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h deleted file mode 100644 index 5f1ffe743..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include -#include -#include - -namespace YAML { - -namespace detail { -struct iterator_value; -template -class iterator_base; -} - -typedef detail::iterator_base iterator; -typedef detail::iterator_base const_iterator; -} - -#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/memory.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/memory.h deleted file mode 100644 index 8f2bc2657..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/memory.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/ptr.h" - -namespace YAML { -namespace detail { -class node; -} // namespace detail -} // namespace YAML - -namespace YAML { -namespace detail { -class YAML_CPP_API memory { - public: - node& create_node(); - void merge(const memory& rhs); - - private: - typedef std::set Nodes; - Nodes m_nodes; -}; - -class YAML_CPP_API memory_holder { - public: - memory_holder() : m_pMemory(new memory) {} - - node& create_node() { return m_pMemory->create_node(); } - void merge(memory_holder& rhs); - - private: - shared_memory m_pMemory; -}; -} -} - -#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node.h deleted file mode 100644 index 3154a527c..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/emitterstyle.h" -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/type.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/detail/node_ref.h" -#include - -namespace YAML { -namespace detail { -class node { - public: - node() : m_pRef(new node_ref) {} - node(const node&) = delete; - node& operator=(const node&) = delete; - - bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; } - const node_ref* ref() const { return m_pRef.get(); } - - bool is_defined() const { return m_pRef->is_defined(); } - const Mark& mark() const { return m_pRef->mark(); } - NodeType::value type() const { return m_pRef->type(); } - - const std::string& scalar() const { return m_pRef->scalar(); } - const std::string& tag() const { return m_pRef->tag(); } - EmitterStyle::value style() const { return m_pRef->style(); } - - template - bool equals(const T& rhs, shared_memory_holder pMemory); - bool equals(const char* rhs, shared_memory_holder pMemory); - - void mark_defined() { - if (is_defined()) - return; - - m_pRef->mark_defined(); - for (nodes::iterator it = m_dependencies.begin(); - it != m_dependencies.end(); ++it) - (*it)->mark_defined(); - m_dependencies.clear(); - } - - void add_dependency(node& rhs) { - if (is_defined()) - rhs.mark_defined(); - else - m_dependencies.insert(&rhs); - } - - void set_ref(const node& rhs) { - if (rhs.is_defined()) - mark_defined(); - m_pRef = rhs.m_pRef; - } - void set_data(const node& rhs) { - if (rhs.is_defined()) - mark_defined(); - m_pRef->set_data(*rhs.m_pRef); - } - - void set_mark(const Mark& mark) { m_pRef->set_mark(mark); } - - void set_type(NodeType::value type) { - if (type != NodeType::Undefined) - mark_defined(); - m_pRef->set_type(type); - } - void set_null() { - mark_defined(); - m_pRef->set_null(); - } - void set_scalar(const std::string& scalar) { - mark_defined(); - m_pRef->set_scalar(scalar); - } - void set_tag(const std::string& tag) { - mark_defined(); - m_pRef->set_tag(tag); - } - - // style - void set_style(EmitterStyle::value style) { - mark_defined(); - m_pRef->set_style(style); - } - - // size/iterator - std::size_t size() const { return m_pRef->size(); } - - const_node_iterator begin() const { - return static_cast(*m_pRef).begin(); - } - node_iterator begin() { return m_pRef->begin(); } - - const_node_iterator end() const { - return static_cast(*m_pRef).end(); - } - node_iterator end() { return m_pRef->end(); } - - // sequence - void push_back(node& node, shared_memory_holder pMemory) { - m_pRef->push_back(node, pMemory); - node.add_dependency(*this); - } - void insert(node& key, node& value, shared_memory_holder pMemory) { - m_pRef->insert(key, value, pMemory); - key.add_dependency(*this); - value.add_dependency(*this); - } - - // indexing - template - node* get(const Key& key, shared_memory_holder pMemory) const { - // NOTE: this returns a non-const node so that the top-level Node can wrap - // it, and returns a pointer so that it can be NULL (if there is no such - // key). - return static_cast(*m_pRef).get(key, pMemory); - } - template - node& get(const Key& key, shared_memory_holder pMemory) { - node& value = m_pRef->get(key, pMemory); - value.add_dependency(*this); - return value; - } - template - bool remove(const Key& key, shared_memory_holder pMemory) { - return m_pRef->remove(key, pMemory); - } - - node* get(node& key, shared_memory_holder pMemory) const { - // NOTE: this returns a non-const node so that the top-level Node can wrap - // it, and returns a pointer so that it can be NULL (if there is no such - // key). - return static_cast(*m_pRef).get(key, pMemory); - } - node& get(node& key, shared_memory_holder pMemory) { - node& value = m_pRef->get(key, pMemory); - key.add_dependency(*this); - value.add_dependency(*this); - return value; - } - bool remove(node& key, shared_memory_holder pMemory) { - return m_pRef->remove(key, pMemory); - } - - // map - template - void force_insert(const Key& key, const Value& value, - shared_memory_holder pMemory) { - m_pRef->force_insert(key, value, pMemory); - } - - private: - shared_node_ref m_pRef; - typedef std::set nodes; - nodes m_dependencies; -}; -} -} - -#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h deleted file mode 100644 index 50bcd7435..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_data.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include -#include -#include -#include - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/detail/node_iterator.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/type.h" - -namespace YAML { -namespace detail { -class node; -} // namespace detail -} // namespace YAML - -namespace YAML { -namespace detail { -class YAML_CPP_API node_data { - public: - node_data(); - node_data(const node_data&) = delete; - node_data& operator=(const node_data&) = delete; - - void mark_defined(); - void set_mark(const Mark& mark); - void set_type(NodeType::value type); - void set_tag(const std::string& tag); - void set_null(); - void set_scalar(const std::string& scalar); - void set_style(EmitterStyle::value style); - - bool is_defined() const { return m_isDefined; } - const Mark& mark() const { return m_mark; } - NodeType::value type() const { - return m_isDefined ? m_type : NodeType::Undefined; - } - const std::string& scalar() const { return m_scalar; } - const std::string& tag() const { return m_tag; } - EmitterStyle::value style() const { return m_style; } - - // size/iterator - std::size_t size() const; - - const_node_iterator begin() const; - node_iterator begin(); - - const_node_iterator end() const; - node_iterator end(); - - // sequence - void push_back(node& node, shared_memory_holder pMemory); - void insert(node& key, node& value, shared_memory_holder pMemory); - - // indexing - template - node* get(const Key& key, shared_memory_holder pMemory) const; - template - node& get(const Key& key, shared_memory_holder pMemory); - template - bool remove(const Key& key, shared_memory_holder pMemory); - - node* get(node& key, shared_memory_holder pMemory) const; - node& get(node& key, shared_memory_holder pMemory); - bool remove(node& key, shared_memory_holder pMemory); - - // map - template - void force_insert(const Key& key, const Value& value, - shared_memory_holder pMemory); - - public: - static std::string empty_scalar; - - private: - void compute_seq_size() const; - void compute_map_size() const; - - void reset_sequence(); - void reset_map(); - - void insert_map_pair(node& key, node& value); - void convert_to_map(shared_memory_holder pMemory); - void convert_sequence_to_map(shared_memory_holder pMemory); - - template - static node& convert_to_node(const T& rhs, shared_memory_holder pMemory); - - private: - bool m_isDefined; - Mark m_mark; - NodeType::value m_type; - std::string m_tag; - EmitterStyle::value m_style; - - // scalar - std::string m_scalar; - - // sequence - typedef std::vector node_seq; - node_seq m_sequence; - - mutable std::size_t m_seqSize; - - // map - typedef std::vector> node_map; - node_map m_map; - - typedef std::pair kv_pair; - typedef std::list kv_pairs; - mutable kv_pairs m_undefinedPairs; -}; -} -} - -#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h deleted file mode 100644 index 4337df416..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/ptr.h" -#include -#include -#include -#include -#include -#include - -namespace YAML { -namespace detail { -struct iterator_type { - enum value { None, Sequence, Map }; -}; - -template -struct node_iterator_value : public std::pair { - typedef std::pair kv; - - node_iterator_value() : kv(), pNode(0) {} - explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {} - explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {} - - V& operator*() const { return *pNode; } - V& operator->() const { return *pNode; } - - V* pNode; -}; - -typedef std::vector node_seq; -typedef std::vector> node_map; - -template -struct node_iterator_type { - typedef node_seq::iterator seq; - typedef node_map::iterator map; -}; - -template -struct node_iterator_type { - typedef node_seq::const_iterator seq; - typedef node_map::const_iterator map; -}; - -template -class node_iterator_base - : public std::iterator, - std::ptrdiff_t, node_iterator_value*, - node_iterator_value> { - private: - struct enabler {}; - - struct proxy { - explicit proxy(const node_iterator_value& x) : m_ref(x) {} - node_iterator_value* operator->() { return std::addressof(m_ref); } - operator node_iterator_value*() { return std::addressof(m_ref); } - - node_iterator_value m_ref; - }; - - public: - typedef typename node_iterator_type::seq SeqIter; - typedef typename node_iterator_type::map MapIter; - typedef node_iterator_value value_type; - - node_iterator_base() - : m_type(iterator_type::None), m_seqIt(), m_mapIt(), m_mapEnd() {} - explicit node_iterator_base(SeqIter seqIt) - : m_type(iterator_type::Sequence), - m_seqIt(seqIt), - m_mapIt(), - m_mapEnd() {} - explicit node_iterator_base(MapIter mapIt, MapIter mapEnd) - : m_type(iterator_type::Map), - m_seqIt(), - m_mapIt(mapIt), - m_mapEnd(mapEnd) { - m_mapIt = increment_until_defined(m_mapIt); - } - - template - node_iterator_base(const node_iterator_base& rhs, - typename std::enable_if::value, - enabler>::type = enabler()) - : m_type(rhs.m_type), - m_seqIt(rhs.m_seqIt), - m_mapIt(rhs.m_mapIt), - m_mapEnd(rhs.m_mapEnd) {} - - template - friend class node_iterator_base; - - template - bool operator==(const node_iterator_base& rhs) const { - if (m_type != rhs.m_type) - return false; - - switch (m_type) { - case iterator_type::None: - return true; - case iterator_type::Sequence: - return m_seqIt == rhs.m_seqIt; - case iterator_type::Map: - return m_mapIt == rhs.m_mapIt; - } - return true; - } - - template - bool operator!=(const node_iterator_base& rhs) const { - return !(*this == rhs); - } - - node_iterator_base& operator++() { - switch (m_type) { - case iterator_type::None: - break; - case iterator_type::Sequence: - ++m_seqIt; - break; - case iterator_type::Map: - ++m_mapIt; - m_mapIt = increment_until_defined(m_mapIt); - break; - } - return *this; - } - - node_iterator_base operator++(int) { - node_iterator_base iterator_pre(*this); - ++(*this); - return iterator_pre; - } - - value_type operator*() const { - switch (m_type) { - case iterator_type::None: - return value_type(); - case iterator_type::Sequence: - return value_type(**m_seqIt); - case iterator_type::Map: - return value_type(*m_mapIt->first, *m_mapIt->second); - } - return value_type(); - } - - proxy operator->() const { return proxy(**this); } - - MapIter increment_until_defined(MapIter it) { - while (it != m_mapEnd && !is_defined(it)) - ++it; - return it; - } - - bool is_defined(MapIter it) const { - return it->first->is_defined() && it->second->is_defined(); - } - - private: - typename iterator_type::value m_type; - - SeqIter m_seqIt; - MapIter m_mapIt, m_mapEnd; -}; - -typedef node_iterator_base node_iterator; -typedef node_iterator_base const_node_iterator; -} -} - -#endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h deleted file mode 100644 index d8a94f8b8..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/type.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/detail/node_data.h" - -namespace YAML { -namespace detail { -class node_ref { - public: - node_ref() : m_pData(new node_data) {} - node_ref(const node_ref&) = delete; - node_ref& operator=(const node_ref&) = delete; - - bool is_defined() const { return m_pData->is_defined(); } - const Mark& mark() const { return m_pData->mark(); } - NodeType::value type() const { return m_pData->type(); } - const std::string& scalar() const { return m_pData->scalar(); } - const std::string& tag() const { return m_pData->tag(); } - EmitterStyle::value style() const { return m_pData->style(); } - - void mark_defined() { m_pData->mark_defined(); } - void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; } - - void set_mark(const Mark& mark) { m_pData->set_mark(mark); } - void set_type(NodeType::value type) { m_pData->set_type(type); } - void set_tag(const std::string& tag) { m_pData->set_tag(tag); } - void set_null() { m_pData->set_null(); } - void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); } - void set_style(EmitterStyle::value style) { m_pData->set_style(style); } - - // size/iterator - std::size_t size() const { return m_pData->size(); } - - const_node_iterator begin() const { - return static_cast(*m_pData).begin(); - } - node_iterator begin() { return m_pData->begin(); } - - const_node_iterator end() const { - return static_cast(*m_pData).end(); - } - node_iterator end() { return m_pData->end(); } - - // sequence - void push_back(node& node, shared_memory_holder pMemory) { - m_pData->push_back(node, pMemory); - } - void insert(node& key, node& value, shared_memory_holder pMemory) { - m_pData->insert(key, value, pMemory); - } - - // indexing - template - node* get(const Key& key, shared_memory_holder pMemory) const { - return static_cast(*m_pData).get(key, pMemory); - } - template - node& get(const Key& key, shared_memory_holder pMemory) { - return m_pData->get(key, pMemory); - } - template - bool remove(const Key& key, shared_memory_holder pMemory) { - return m_pData->remove(key, pMemory); - } - - node* get(node& key, shared_memory_holder pMemory) const { - return static_cast(*m_pData).get(key, pMemory); - } - node& get(node& key, shared_memory_holder pMemory) { - return m_pData->get(key, pMemory); - } - bool remove(node& key, shared_memory_holder pMemory) { - return m_pData->remove(key, pMemory); - } - - // map - template - void force_insert(const Key& key, const Value& value, - shared_memory_holder pMemory) { - m_pData->force_insert(key, value, pMemory); - } - - private: - shared_node_data m_pData; -}; -} -} - -#endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/emit.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/emit.h deleted file mode 100644 index 032268c5d..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/emit.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include - -#include "yaml-cpp/dll.h" - -namespace YAML { -class Emitter; -class Node; - -/** - * Emits the node to the given {@link Emitter}. If there is an error in writing, - * {@link Emitter#good} will return false. - */ -YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node); - -/** Emits the node to the given output stream. */ -YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); - -/** Converts the node to a YAML string. */ -YAML_CPP_API std::string Dump(const Node& node); -} // namespace YAML - -#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/impl.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/impl.h deleted file mode 100644 index 20c487a68..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/impl.h +++ /dev/null @@ -1,448 +0,0 @@ -#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/node/detail/memory.h" -#include "yaml-cpp/node/detail/node.h" -#include "yaml-cpp/exceptions.h" -#include - -namespace YAML { -inline Node::Node() : m_isValid(true), m_pNode(NULL) {} - -inline Node::Node(NodeType::value type) - : m_isValid(true), - m_pMemory(new detail::memory_holder), - m_pNode(&m_pMemory->create_node()) { - m_pNode->set_type(type); -} - -template -inline Node::Node(const T& rhs) - : m_isValid(true), - m_pMemory(new detail::memory_holder), - m_pNode(&m_pMemory->create_node()) { - Assign(rhs); -} - -inline Node::Node(const detail::iterator_value& rhs) - : m_isValid(rhs.m_isValid), - m_pMemory(rhs.m_pMemory), - m_pNode(rhs.m_pNode) {} - -inline Node::Node(const Node& rhs) - : m_isValid(rhs.m_isValid), - m_pMemory(rhs.m_pMemory), - m_pNode(rhs.m_pNode) {} - -inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {} - -inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory) - : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {} - -inline Node::~Node() {} - -inline void Node::EnsureNodeExists() const { - if (!m_isValid) - throw InvalidNode(); - if (!m_pNode) { - m_pMemory.reset(new detail::memory_holder); - m_pNode = &m_pMemory->create_node(); - m_pNode->set_null(); - } -} - -inline bool Node::IsDefined() const { - if (!m_isValid) { - return false; - } - return m_pNode ? m_pNode->is_defined() : true; -} - -inline Mark Node::Mark() const { - if (!m_isValid) { - throw InvalidNode(); - } - return m_pNode ? m_pNode->mark() : Mark::null_mark(); -} - -inline NodeType::value Node::Type() const { - if (!m_isValid) - throw InvalidNode(); - return m_pNode ? m_pNode->type() : NodeType::Null; -} - -// access - -// template helpers -template -struct as_if { - explicit as_if(const Node& node_) : node(node_) {} - const Node& node; - - T operator()(const S& fallback) const { - if (!node.m_pNode) - return fallback; - - T t; - if (convert::decode(node, t)) - return t; - return fallback; - } -}; - -template -struct as_if { - explicit as_if(const Node& node_) : node(node_) {} - const Node& node; - - std::string operator()(const S& fallback) const { - if (node.Type() != NodeType::Scalar) - return fallback; - return node.Scalar(); - } -}; - -template -struct as_if { - explicit as_if(const Node& node_) : node(node_) {} - const Node& node; - - T operator()() const { - if (!node.m_pNode) - throw TypedBadConversion(node.Mark()); - - T t; - if (convert::decode(node, t)) - return t; - throw TypedBadConversion(node.Mark()); - } -}; - -template <> -struct as_if { - explicit as_if(const Node& node_) : node(node_) {} - const Node& node; - - std::string operator()() const { - if (node.Type() != NodeType::Scalar) - throw TypedBadConversion(node.Mark()); - return node.Scalar(); - } -}; - -// access functions -template -inline T Node::as() const { - if (!m_isValid) - throw InvalidNode(); - return as_if(*this)(); -} - -template -inline T Node::as(const S& fallback) const { - if (!m_isValid) - return fallback; - return as_if(*this)(fallback); -} - -inline const std::string& Node::Scalar() const { - if (!m_isValid) - throw InvalidNode(); - return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar; -} - -inline const std::string& Node::Tag() const { - if (!m_isValid) - throw InvalidNode(); - return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar; -} - -inline void Node::SetTag(const std::string& tag) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->set_tag(tag); -} - -inline EmitterStyle::value Node::Style() const { - if (!m_isValid) - throw InvalidNode(); - return m_pNode ? m_pNode->style() : EmitterStyle::Default; -} - -inline void Node::SetStyle(EmitterStyle::value style) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->set_style(style); -} - -// assignment -inline bool Node::is(const Node& rhs) const { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - if (!m_pNode || !rhs.m_pNode) - return false; - return m_pNode->is(*rhs.m_pNode); -} - -template -inline Node& Node::operator=(const T& rhs) { - if (!m_isValid) - throw InvalidNode(); - Assign(rhs); - return *this; -} - -inline void Node::reset(const YAML::Node& rhs) { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - m_pMemory = rhs.m_pMemory; - m_pNode = rhs.m_pNode; -} - -template -inline void Node::Assign(const T& rhs) { - if (!m_isValid) - throw InvalidNode(); - AssignData(convert::encode(rhs)); -} - -template <> -inline void Node::Assign(const std::string& rhs) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->set_scalar(rhs); -} - -inline void Node::Assign(const char* rhs) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->set_scalar(rhs); -} - -inline void Node::Assign(char* rhs) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->set_scalar(rhs); -} - -inline Node& Node::operator=(const Node& rhs) { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - if (is(rhs)) - return *this; - AssignNode(rhs); - return *this; -} - -inline void Node::AssignData(const Node& rhs) { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - rhs.EnsureNodeExists(); - - m_pNode->set_data(*rhs.m_pNode); - m_pMemory->merge(*rhs.m_pMemory); -} - -inline void Node::AssignNode(const Node& rhs) { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - rhs.EnsureNodeExists(); - - if (!m_pNode) { - m_pNode = rhs.m_pNode; - m_pMemory = rhs.m_pMemory; - return; - } - - m_pNode->set_ref(*rhs.m_pNode); - m_pMemory->merge(*rhs.m_pMemory); - m_pNode = rhs.m_pNode; -} - -// size/iterator -inline std::size_t Node::size() const { - if (!m_isValid) - throw InvalidNode(); - return m_pNode ? m_pNode->size() : 0; -} - -inline const_iterator Node::begin() const { - if (!m_isValid) - return const_iterator(); - return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory) - : const_iterator(); -} - -inline iterator Node::begin() { - if (!m_isValid) - return iterator(); - return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator(); -} - -inline const_iterator Node::end() const { - if (!m_isValid) - return const_iterator(); - return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator(); -} - -inline iterator Node::end() { - if (!m_isValid) - return iterator(); - return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator(); -} - -// sequence -template -inline void Node::push_back(const T& rhs) { - if (!m_isValid) - throw InvalidNode(); - push_back(Node(rhs)); -} - -inline void Node::push_back(const Node& rhs) { - if (!m_isValid || !rhs.m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - rhs.EnsureNodeExists(); - - m_pNode->push_back(*rhs.m_pNode, m_pMemory); - m_pMemory->merge(*rhs.m_pMemory); -} - -// helpers for indexing -namespace detail { -template -struct to_value_t { - explicit to_value_t(const T& t_) : t(t_) {} - const T& t; - typedef const T& return_type; - - const T& operator()() const { return t; } -}; - -template <> -struct to_value_t { - explicit to_value_t(const char* t_) : t(t_) {} - const char* t; - typedef std::string return_type; - - const std::string operator()() const { return t; } -}; - -template <> -struct to_value_t { - explicit to_value_t(char* t_) : t(t_) {} - const char* t; - typedef std::string return_type; - - const std::string operator()() const { return t; } -}; - -template -struct to_value_t { - explicit to_value_t(const char* t_) : t(t_) {} - const char* t; - typedef std::string return_type; - - const std::string operator()() const { return t; } -}; - -// converts C-strings to std::strings so they can be copied -template -inline typename to_value_t::return_type to_value(const T& t) { - return to_value_t(t)(); -} -} - -// indexing -template -inline const Node Node::operator[](const Key& key) const { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - detail::node* value = static_cast(*m_pNode) - .get(detail::to_value(key), m_pMemory); - if (!value) { - return Node(ZombieNode); - } - return Node(*value, m_pMemory); -} - -template -inline Node Node::operator[](const Key& key) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory); - return Node(value, m_pMemory); -} - -template -inline bool Node::remove(const Key& key) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - return m_pNode->remove(detail::to_value(key), m_pMemory); -} - -inline const Node Node::operator[](const Node& key) const { - if (!m_isValid || !key.m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - key.EnsureNodeExists(); - m_pMemory->merge(*key.m_pMemory); - detail::node* value = - static_cast(*m_pNode).get(*key.m_pNode, m_pMemory); - if (!value) { - return Node(ZombieNode); - } - return Node(*value, m_pMemory); -} - -inline Node Node::operator[](const Node& key) { - if (!m_isValid || !key.m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - key.EnsureNodeExists(); - m_pMemory->merge(*key.m_pMemory); - detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory); - return Node(value, m_pMemory); -} - -inline bool Node::remove(const Node& key) { - if (!m_isValid || !key.m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - key.EnsureNodeExists(); - return m_pNode->remove(*key.m_pNode, m_pMemory); -} - -// map -template -inline void Node::force_insert(const Key& key, const Value& value) { - if (!m_isValid) - throw InvalidNode(); - EnsureNodeExists(); - m_pNode->force_insert(detail::to_value(key), detail::to_value(value), - m_pMemory); -} - -// free functions -inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); } -} - -#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/iterator.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/iterator.h deleted file mode 100644 index 366a9c807..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/iterator.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/detail/iterator_fwd.h" -#include "yaml-cpp/node/detail/iterator.h" -#include -#include -#include - -namespace YAML { -namespace detail { -struct iterator_value : public Node, std::pair { - iterator_value() {} - explicit iterator_value(const Node& rhs) - : Node(rhs), - std::pair(Node(Node::ZombieNode), Node(Node::ZombieNode)) {} - explicit iterator_value(const Node& key, const Node& value) - : Node(Node::ZombieNode), std::pair(key, value) {} -}; -} -} - -#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/node.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/node.h deleted file mode 100644 index 1ded7d27b..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/node.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/emitterstyle.h" -#include "yaml-cpp/mark.h" -#include "yaml-cpp/node/detail/bool_type.h" -#include "yaml-cpp/node/detail/iterator_fwd.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/type.h" - -namespace YAML { -namespace detail { -class node; -class node_data; -struct iterator_value; -} // namespace detail -} // namespace YAML - -namespace YAML { -class YAML_CPP_API Node { - public: - friend class NodeBuilder; - friend class NodeEvents; - friend struct detail::iterator_value; - friend class detail::node; - friend class detail::node_data; - template - friend class detail::iterator_base; - template - friend struct as_if; - - typedef YAML::iterator iterator; - typedef YAML::const_iterator const_iterator; - - Node(); - explicit Node(NodeType::value type); - template - explicit Node(const T& rhs); - explicit Node(const detail::iterator_value& rhs); - Node(const Node& rhs); - ~Node(); - - YAML::Mark Mark() const; - NodeType::value Type() const; - bool IsDefined() const; - bool IsNull() const { return Type() == NodeType::Null; } - bool IsScalar() const { return Type() == NodeType::Scalar; } - bool IsSequence() const { return Type() == NodeType::Sequence; } - bool IsMap() const { return Type() == NodeType::Map; } - - // bool conversions - YAML_CPP_OPERATOR_BOOL() - bool operator!() const { return !IsDefined(); } - - // access - template - T as() const; - template - T as(const S& fallback) const; - const std::string& Scalar() const; - - const std::string& Tag() const; - void SetTag(const std::string& tag); - - // style - // WARNING: This API might change in future releases. - EmitterStyle::value Style() const; - void SetStyle(EmitterStyle::value style); - - // assignment - bool is(const Node& rhs) const; - template - Node& operator=(const T& rhs); - Node& operator=(const Node& rhs); - void reset(const Node& rhs = Node()); - - // size/iterator - std::size_t size() const; - - const_iterator begin() const; - iterator begin(); - - const_iterator end() const; - iterator end(); - - // sequence - template - void push_back(const T& rhs); - void push_back(const Node& rhs); - - // indexing - template - const Node operator[](const Key& key) const; - template - Node operator[](const Key& key); - template - bool remove(const Key& key); - - const Node operator[](const Node& key) const; - Node operator[](const Node& key); - bool remove(const Node& key); - - // map - template - void force_insert(const Key& key, const Value& value); - - private: - enum Zombie { ZombieNode }; - explicit Node(Zombie); - explicit Node(detail::node& node, detail::shared_memory_holder pMemory); - - void EnsureNodeExists() const; - - template - void Assign(const T& rhs); - void Assign(const char* rhs); - void Assign(char* rhs); - - void AssignData(const Node& rhs); - void AssignNode(const Node& rhs); - - private: - bool m_isValid; - mutable detail::shared_memory_holder m_pMemory; - mutable detail::node* m_pNode; -}; - -YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs); - -YAML_CPP_API Node Clone(const Node& node); - -template -struct convert; -} - -#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/parse.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/parse.h deleted file mode 100644 index 7745fd724..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/parse.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include -#include - -#include "yaml-cpp/dll.h" - -namespace YAML { -class Node; - -/** - * Loads the input string as a single YAML document. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API Node Load(const std::string& input); - -/** - * Loads the input string as a single YAML document. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API Node Load(const char* input); - -/** - * Loads the input stream as a single YAML document. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API Node Load(std::istream& input); - -/** - * Loads the input file as a single YAML document. - * - * @throws {@link ParserException} if it is malformed. - * @throws {@link BadFile} if the file cannot be loaded. - */ -YAML_CPP_API Node LoadFile(const std::string& filename); - -/** - * Loads the input string as a list of YAML documents. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API std::vector LoadAll(const std::string& input); - -/** - * Loads the input string as a list of YAML documents. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API std::vector LoadAll(const char* input); - -/** - * Loads the input stream as a list of YAML documents. - * - * @throws {@link ParserException} if it is malformed. - */ -YAML_CPP_API std::vector LoadAll(std::istream& input); - -/** - * Loads the input file as a list of YAML documents. - * - * @throws {@link ParserException} if it is malformed. - * @throws {@link BadFile} if the file cannot be loaded. - */ -YAML_CPP_API std::vector LoadAllFromFile(const std::string& filename); -} // namespace YAML - -#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/ptr.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/ptr.h deleted file mode 100644 index ce085dd5c..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/ptr.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include - -namespace YAML { -namespace detail { -class node; -class node_ref; -class node_data; -class memory; -class memory_holder; - -typedef std::shared_ptr shared_node; -typedef std::shared_ptr shared_node_ref; -typedef std::shared_ptr shared_node_data; -typedef std::shared_ptr shared_memory_holder; -typedef std::shared_ptr shared_memory; -} -} - -#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/node/type.h b/phonelibs/yaml-cpp/include/yaml-cpp/node/type.h deleted file mode 100644 index 9d55ca966..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/node/type.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -namespace YAML { -struct NodeType { - enum value { Undefined, Null, Scalar, Sequence, Map }; -}; -} - -#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/noncopyable.h b/phonelibs/yaml-cpp/include/yaml-cpp/noncopyable.h deleted file mode 100644 index a26104073..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/noncopyable.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" - -namespace YAML { -// this is basically boost::noncopyable -class YAML_CPP_API noncopyable { - protected: - noncopyable() {} - ~noncopyable() {} - - private: - noncopyable(const noncopyable&); - const noncopyable& operator=(const noncopyable&); -}; -} - -#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/null.h b/phonelibs/yaml-cpp/include/yaml-cpp/null.h deleted file mode 100644 index b9521d488..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/null.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/dll.h" -#include - -namespace YAML { -class Node; - -struct YAML_CPP_API _Null {}; -inline bool operator==(const _Null&, const _Null&) { return true; } -inline bool operator!=(const _Null&, const _Null&) { return false; } - -YAML_CPP_API bool IsNull(const Node& node); // old API only -YAML_CPP_API bool IsNullString(const std::string& str); - -extern YAML_CPP_API _Null Null; -} - -#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/ostream_wrapper.h b/phonelibs/yaml-cpp/include/yaml-cpp/ostream_wrapper.h deleted file mode 100644 index 09d45f39b..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/ostream_wrapper.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include - -#include "yaml-cpp/dll.h" - -namespace YAML { -class YAML_CPP_API ostream_wrapper { - public: - ostream_wrapper(); - explicit ostream_wrapper(std::ostream& stream); - ~ostream_wrapper(); - - void write(const std::string& str); - void write(const char* str, std::size_t size); - - void set_comment() { m_comment = true; } - - const char* str() const { - if (m_pStream) { - return 0; - } else { - m_buffer[m_pos] = '\0'; - return &m_buffer[0]; - } - } - - std::size_t row() const { return m_row; } - std::size_t col() const { return m_col; } - std::size_t pos() const { return m_pos; } - bool comment() const { return m_comment; } - - private: - void update_pos(char ch); - - private: - mutable std::vector m_buffer; - std::ostream* const m_pStream; - - std::size_t m_pos; - std::size_t m_row, m_col; - bool m_comment; -}; - -template -inline ostream_wrapper& operator<<(ostream_wrapper& stream, - const char(&str)[N]) { - stream.write(str, N - 1); - return stream; -} - -inline ostream_wrapper& operator<<(ostream_wrapper& stream, - const std::string& str) { - stream.write(str); - return stream; -} - -inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) { - stream.write(&ch, 1); - return stream; -} -} - -#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/parser.h b/phonelibs/yaml-cpp/include/yaml-cpp/parser.h deleted file mode 100644 index ceac22d02..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/parser.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include - -#include "yaml-cpp/dll.h" -#include "yaml-cpp/noncopyable.h" - -namespace YAML { -class EventHandler; -class Node; -class Scanner; -struct Directives; -struct Token; - -/** - * A parser turns a stream of bytes into one stream of "events" per YAML - * document in the input stream. - */ -class YAML_CPP_API Parser : private noncopyable { - public: - /** Constructs an empty parser (with no input. */ - Parser(); - - /** - * Constructs a parser from the given input stream. The input stream must - * live as long as the parser. - */ - explicit Parser(std::istream& in); - - ~Parser(); - - /** Evaluates to true if the parser has some valid input to be read. */ - explicit operator bool() const; - - /** - * Resets the parser with the given input stream. Any existing state is - * erased. - */ - void Load(std::istream& in); - - /** - * Handles the next document by calling events on the {@code eventHandler}. - * - * @throw a ParserException on error. - * @return false if there are no more documents - */ - bool HandleNextDocument(EventHandler& eventHandler); - - void PrintTokens(std::ostream& out); - - private: - /** - * Reads any directives that are next in the queue, setting the internal - * {@code m_pDirectives} state. - */ - void ParseDirectives(); - - void HandleDirective(const Token& token); - - /** - * Handles a "YAML" directive, which should be of the form 'major.minor' (like - * a version number). - */ - void HandleYamlDirective(const Token& token); - - /** - * Handles a "TAG" directive, which should be of the form 'handle prefix', - * where 'handle' is converted to 'prefix' in the file. - */ - void HandleTagDirective(const Token& token); - - private: - std::unique_ptr m_pScanner; - std::unique_ptr m_pDirectives; -}; -} - -#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/stlemitter.h b/phonelibs/yaml-cpp/include/yaml-cpp/stlemitter.h deleted file mode 100644 index 06780c861..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/stlemitter.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include -#include -#include -#include - -namespace YAML { -template -inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { - emitter << BeginSeq; - for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it) - emitter << *it; - emitter << EndSeq; - return emitter; -} - -template -inline Emitter& operator<<(Emitter& emitter, const std::vector& v) { - return EmitSeq(emitter, v); -} - -template -inline Emitter& operator<<(Emitter& emitter, const std::list& v) { - return EmitSeq(emitter, v); -} - -template -inline Emitter& operator<<(Emitter& emitter, const std::set& v) { - return EmitSeq(emitter, v); -} - -template -inline Emitter& operator<<(Emitter& emitter, const std::map& m) { - typedef typename std::map map; - emitter << BeginMap; - for (typename map::const_iterator it = m.begin(); it != m.end(); ++it) - emitter << Key << it->first << Value << it->second; - emitter << EndMap; - return emitter; -} -} - -#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/traits.h b/phonelibs/yaml-cpp/include/yaml-cpp/traits.h deleted file mode 100644 index f33d0e1f6..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/traits.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -namespace YAML { -template -struct is_numeric { - enum { value = false }; -}; - -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -#if defined(_MSC_VER) && (_MSC_VER < 1310) -template <> -struct is_numeric<__int64> { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -#else -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -#endif -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; -template <> -struct is_numeric { - enum { value = true }; -}; - -template -struct enable_if_c { - typedef T type; -}; - -template -struct enable_if_c {}; - -template -struct enable_if : public enable_if_c {}; - -template -struct disable_if_c { - typedef T type; -}; - -template -struct disable_if_c {}; - -template -struct disable_if : public disable_if_c {}; -} - -#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/include/yaml-cpp/yaml.h b/phonelibs/yaml-cpp/include/yaml-cpp/yaml.h deleted file mode 100644 index 7f515efb9..000000000 --- a/phonelibs/yaml-cpp/include/yaml-cpp/yaml.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include "yaml-cpp/parser.h" -#include "yaml-cpp/emitter.h" -#include "yaml-cpp/emitterstyle.h" -#include "yaml-cpp/stlemitter.h" -#include "yaml-cpp/exceptions.h" - -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/impl.h" -#include "yaml-cpp/node/convert.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/node/detail/impl.h" -#include "yaml-cpp/node/parse.h" -#include "yaml-cpp/node/emit.h" - -#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 diff --git a/phonelibs/yaml-cpp/lib/libyaml-cpp.a b/phonelibs/yaml-cpp/lib/libyaml-cpp.a deleted file mode 100644 index f871781d3..000000000 Binary files a/phonelibs/yaml-cpp/lib/libyaml-cpp.a and /dev/null differ diff --git a/phonelibs/yaml-cpp/x64/lib/libyaml-cpp.a b/phonelibs/yaml-cpp/x64/lib/libyaml-cpp.a deleted file mode 100644 index eb1a3637d..000000000 Binary files a/phonelibs/yaml-cpp/x64/lib/libyaml-cpp.a and /dev/null differ diff --git a/phonelibs/zmq/x64/include/czmq.h b/phonelibs/zmq/x64/include/czmq.h deleted file mode 100644 index dbf1fe5e4..000000000 --- a/phonelibs/zmq/x64/include/czmq.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ========================================================================= - CZMQ - a high-level binding in C for ZeroMQ - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= - - "Tell them I was a writer. - A maker of software. - A humanist. A father. - And many things. - But above all, a writer. - Thank You. :) - - Pieter Hintjens -*/ - -#ifndef __CZMQ_H_INCLUDED__ -#define __CZMQ_H_INCLUDED__ - -// These are signatures for handler functions that customize the -// behavior of CZMQ containers. These are shared between all CZMQ -// container types. - -// -- destroy an item -typedef void (czmq_destructor) (void **item); -// -- duplicate an item -typedef void *(czmq_duplicator) (const void *item); -// - compare two items, for sorting -typedef int (czmq_comparator) (const void *item1, const void *item2); - -// Include the project library file -#include "czmq_library.h" - -#endif diff --git a/phonelibs/zmq/x64/include/czmq_library.h b/phonelibs/zmq/x64/include/czmq_library.h deleted file mode 100644 index 89dc4eb91..000000000 --- a/phonelibs/zmq/x64/include/czmq_library.h +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================= - czmq - generated layer of public API - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - ========================================================================= -*/ - -#ifndef CZMQ_LIBRARY_H_INCLUDED -#define CZMQ_LIBRARY_H_INCLUDED - -// Set up environment for the application -#include "czmq_prelude.h" - -// External dependencies -#include - -// CZMQ version macros for compile-time API detection -#define CZMQ_VERSION_MAJOR 4 -#define CZMQ_VERSION_MINOR 0 -#define CZMQ_VERSION_PATCH 2 - -#define CZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define CZMQ_VERSION \ - CZMQ_MAKE_VERSION(CZMQ_VERSION_MAJOR, CZMQ_VERSION_MINOR, CZMQ_VERSION_PATCH) - -#if defined (__WINDOWS__) -# if defined CZMQ_STATIC -# define CZMQ_EXPORT -# elif defined CZMQ_INTERNAL_BUILD -# if defined DLL_EXPORT -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT -# endif -# elif defined CZMQ_EXPORTS -# define CZMQ_EXPORT __declspec(dllexport) -# else -# define CZMQ_EXPORT __declspec(dllimport) -# endif -# define CZMQ_PRIVATE -#else -# define CZMQ_EXPORT -# if (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define CZMQ_PRIVATE __attribute__ ((visibility ("hidden"))) -# else -# define CZMQ_PRIVATE -# endif -#endif - -// Opaque class structures to allow forward references -// These classes are stable or legacy and built in all releases -typedef struct _zactor_t zactor_t; -#define ZACTOR_T_DEFINED -typedef struct _zarmour_t zarmour_t; -#define ZARMOUR_T_DEFINED -typedef struct _zcert_t zcert_t; -#define ZCERT_T_DEFINED -typedef struct _zcertstore_t zcertstore_t; -#define ZCERTSTORE_T_DEFINED -typedef struct _zchunk_t zchunk_t; -#define ZCHUNK_T_DEFINED -typedef struct _zclock_t zclock_t; -#define ZCLOCK_T_DEFINED -typedef struct _zconfig_t zconfig_t; -#define ZCONFIG_T_DEFINED -typedef struct _zdigest_t zdigest_t; -#define ZDIGEST_T_DEFINED -typedef struct _zdir_t zdir_t; -#define ZDIR_T_DEFINED -typedef struct _zdir_patch_t zdir_patch_t; -#define ZDIR_PATCH_T_DEFINED -typedef struct _zfile_t zfile_t; -#define ZFILE_T_DEFINED -typedef struct _zframe_t zframe_t; -#define ZFRAME_T_DEFINED -typedef struct _zhash_t zhash_t; -#define ZHASH_T_DEFINED -typedef struct _zhashx_t zhashx_t; -#define ZHASHX_T_DEFINED -typedef struct _ziflist_t ziflist_t; -#define ZIFLIST_T_DEFINED -typedef struct _zlist_t zlist_t; -#define ZLIST_T_DEFINED -typedef struct _zlistx_t zlistx_t; -#define ZLISTX_T_DEFINED -typedef struct _zloop_t zloop_t; -#define ZLOOP_T_DEFINED -typedef struct _zmsg_t zmsg_t; -#define ZMSG_T_DEFINED -typedef struct _zpoller_t zpoller_t; -#define ZPOLLER_T_DEFINED -typedef struct _zsock_t zsock_t; -#define ZSOCK_T_DEFINED -typedef struct _zstr_t zstr_t; -#define ZSTR_T_DEFINED -typedef struct _zuuid_t zuuid_t; -#define ZUUID_T_DEFINED -typedef struct _zauth_t zauth_t; -#define ZAUTH_T_DEFINED -typedef struct _zbeacon_t zbeacon_t; -#define ZBEACON_T_DEFINED -typedef struct _zgossip_t zgossip_t; -#define ZGOSSIP_T_DEFINED -typedef struct _zmonitor_t zmonitor_t; -#define ZMONITOR_T_DEFINED -typedef struct _zproxy_t zproxy_t; -#define ZPROXY_T_DEFINED -typedef struct _zrex_t zrex_t; -#define ZREX_T_DEFINED -typedef struct _zsys_t zsys_t; -#define ZSYS_T_DEFINED -// Draft classes are by default not built in stable releases -#ifdef CZMQ_BUILD_DRAFT_API -typedef struct _zproc_t zproc_t; -#define ZPROC_T_DEFINED -typedef struct _ztimerset_t ztimerset_t; -#define ZTIMERSET_T_DEFINED -typedef struct _ztrie_t ztrie_t; -#define ZTRIE_T_DEFINED -#endif // CZMQ_BUILD_DRAFT_API - - -// Public classes, each with its own header file -#include "zactor.h" -#include "zarmour.h" -#include "zcert.h" -#include "zcertstore.h" -#include "zchunk.h" -#include "zclock.h" -#include "zconfig.h" -#include "zdigest.h" -#include "zdir.h" -#include "zdir_patch.h" -#include "zfile.h" -#include "zframe.h" -#include "zhash.h" -#include "zhashx.h" -#include "ziflist.h" -#include "zlist.h" -#include "zlistx.h" -#include "zloop.h" -#include "zmsg.h" -#include "zpoller.h" -#include "zsock.h" -#include "zstr.h" -#include "zuuid.h" -#include "zauth.h" -#include "zbeacon.h" -#include "zgossip.h" -#include "zmonitor.h" -#include "zproxy.h" -#include "zrex.h" -#include "zsys.h" -#ifdef CZMQ_BUILD_DRAFT_API -#include "zproc.h" -#include "ztimerset.h" -#include "ztrie.h" -#endif // CZMQ_BUILD_DRAFT_API - -#endif -/* -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ -*/ diff --git a/phonelibs/zmq/x64/include/czmq_prelude.h b/phonelibs/zmq/x64/include/czmq_prelude.h deleted file mode 100644 index 534f47023..000000000 --- a/phonelibs/zmq/x64/include/czmq_prelude.h +++ /dev/null @@ -1,647 +0,0 @@ -/* ========================================================================= - czmq_prelude.h - CZMQ environment - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __CZMQ_PRELUDE_H_INCLUDED__ -#define __CZMQ_PRELUDE_H_INCLUDED__ - -//- Establish the compiler and computer system ------------------------------ -/* - * Defines zero or more of these symbols, for use in any non-portable - * code: - * - * __WINDOWS__ Microsoft C/C++ with Windows calls - * __MSDOS__ System is MS-DOS (set if __WINDOWS__ set) - * __VMS__ System is VAX/VMS or Alpha/OpenVMS - * __UNIX__ System is UNIX - * __OS2__ System is OS/2 - * - * __IS_32BIT__ OS/compiler is 32 bits - * __IS_64BIT__ OS/compiler is 64 bits - * - * When __UNIX__ is defined, we also define exactly one of these: - * - * __UTYPE_AUX Apple AUX - * __UTYPE_BEOS BeOS - * __UTYPE_BSDOS BSD/OS - * __UTYPE_DECALPHA Digital UNIX (Alpha) - * __UTYPE_IBMAIX IBM RS/6000 AIX - * __UTYPE_FREEBSD FreeBSD - * __UTYPE_HPUX HP/UX - * __UTYPE_ANDROID Android - * __UTYPE_LINUX Linux - * __UTYPE_GNU GNU/Hurd - * __UTYPE_MIPS MIPS (BSD 4.3/System V mixture) - * __UTYPE_NETBSD NetBSD - * __UTYPE_NEXT NeXT - * __UTYPE_OPENBSD OpenBSD - * __UTYPE_OSX Apple Macintosh OS X - * __UTYPE_IOS Apple iOS - * __UTYPE_QNX QNX - * __UTYPE_IRIX Silicon Graphics IRIX - * __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix) - * __UTYPE_SUNOS SunOS - * __UTYPE_SUNSOLARIS Sun Solaris - * __UTYPE_UNIXWARE SCO UnixWare - * ... these are the ones I know about so far. - * __UTYPE_GENERIC Any other UNIX - * - * When __VMS__ is defined, we may define one or more of these: - * - * __VMS_XOPEN Supports XOPEN functions - */ - -#if (defined (__64BIT__) || defined (__x86_64__)) -# define __IS_64BIT__ // May have 64-bit OS/compiler -#else -# define __IS_32BIT__ // Else assume 32-bit OS/compiler -#endif - -#if (defined WIN32 || defined _WIN32) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -#endif - -#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__) -# undef __WINDOWS__ -# define __WINDOWS__ -# undef __MSDOS__ -# define __MSDOS__ -// Stop cheeky warnings about "deprecated" functions like fopen -# if _MSC_VER >= 1500 -# undef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -# pragma warning(disable: 4996) -# endif -#endif - -// MSDOS Microsoft C -// _MSC_VER Microsoft C -#if (defined (MSDOS) || defined (_MSC_VER)) -# undef __MSDOS__ -# define __MSDOS__ -# if (defined (_DEBUG) && !defined (DEBUG)) -# define DEBUG -# endif -#endif - -#if (defined (__EMX__) && defined (__i386__)) -# undef __OS2__ -# define __OS2__ -#endif - -// VMS VAX C (VAX/VMS) -// __VMS Dec C (Alpha/OpenVMS) -// __vax__ gcc -#if (defined (VMS) || defined (__VMS) || defined (__vax__)) -# undef __VMS__ -# define __VMS__ -# if (__VMS_VER >= 70000000) -# define __VMS_XOPEN -# endif -#endif - -// Try to define a __UTYPE_xxx symbol... -// unix SunOS at least -// __unix__ gcc -// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS -#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE)) -# if (!defined (__VMS__)) -# undef __UNIX__ -# define __UNIX__ -# if (defined (__alpha)) // Digital UNIX is 64-bit -# undef __IS_32BIT__ -# define __IS_64BIT__ -# define __UTYPE_DECALPHA -# endif -# endif -#endif - -#if (defined (_AUX)) -# define __UTYPE_AUX -# define __UNIX__ -#elif (defined (__BEOS__)) -# define __UTYPE_BEOS -# define __UNIX__ -#elif (defined (__hpux)) -# define __UTYPE_HPUX -# define __UNIX__ -# define _INCLUDE_HPUX_SOURCE -# define _INCLUDE_XOPEN_SOURCE -# define _INCLUDE_POSIX_SOURCE -#elif (defined (_AIX) || defined (AIX)) -# define __UTYPE_IBMAIX -# define __UNIX__ -#elif (defined (BSD) || defined (bsd)) -# define __UTYPE_BSDOS -# define __UNIX__ -#elif (defined (__ANDROID__)) -# define __UTYPE_ANDROID -# define __UNIX__ -#elif (defined (LINUX) || defined (linux) || defined (__linux__)) -# define __UTYPE_LINUX -# define __UNIX__ -# ifndef __NO_CTYPE -# define __NO_CTYPE // Suppress warnings on tolower() -# endif -# ifndef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix -# endif -#elif (defined (__GNU__)) -# define __UTYPE_GNU -# define __UNIX__ -#elif (defined (Mips)) -# define __UTYPE_MIPS -# define __UNIX__ -#elif (defined (FreeBSD) || defined (__FreeBSD__)) -# define __UTYPE_FREEBSD -# define __UNIX__ -#elif (defined (NetBSD) || defined (__NetBSD__)) -# define __UTYPE_NETBSD -# define __UNIX__ -#elif (defined (OpenBSD) || defined (__OpenBSD__)) -# define __UTYPE_OPENBSD -# define __UNIX__ -#elif (defined (APPLE) || defined (__APPLE__)) -# include -# define __UNIX__ -# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR -# define __UTYPE_IOS -# else -# define __UTYPE_OSX -# endif -#elif (defined (NeXT)) -# define __UTYPE_NEXT -# define __UNIX__ -#elif (defined (__QNX__)) -# define __UTYPE_QNX -# define __UNIX__ -#elif (defined (sgi)) -# define __UTYPE_IRIX -# define __UNIX__ -#elif (defined (sinix)) -# define __UTYPE_SINIX -# define __UNIX__ -#elif (defined (SOLARIS) || defined (__SVR4)) || defined (SVR4) -# define __UTYPE_SUNSOLARIS -# define __UNIX__ -#elif (defined (SUNOS) || defined (SUN) || defined (sun)) -# define __UTYPE_SUNOS -# define __UNIX__ -#elif (defined (__USLC__) || defined (UnixWare)) -# define __UTYPE_UNIXWARE -# define __UNIX__ -#elif (defined (__CYGWIN__)) -# define __UTYPE_CYGWIN -# define __UNIX__ -#elif (defined (__UNIX__)) -# define __UTYPE_GENERIC -#endif - -//- Always include ZeroMQ headers ------------------------------------------- - -#include "zmq.h" -#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0)) -# include "zmq_utils.h" -#endif - -//- Standard ANSI include files --------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//- System-specific include files ------------------------------------------- - -#if (defined (__MSDOS__)) -# if (defined (__WINDOWS__)) -# if (_WIN32_WINNT < 0x0600) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -# endif -# if (!defined (FD_SETSIZE)) -# define FD_SETSIZE 1024 // Max. filehandles/sockets -# endif -# include -# include -# include -# include -# include // For getnameinfo () -# include // For GetAdaptersAddresses () -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__UNIX__)) -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Let CZMQ build with libzmq/3.x -# include // Must come before arpa/inet.h -# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \ - && (!defined (__UTYPE_HPUX)) -# include -# endif -# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS) -# include -# endif -# if (!defined (__UTYPE_BEOS)) -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -# endif -# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX)) -# include -# endif -# if (defined (__UTYPE_BEOS)) -# include -# endif -# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \ - || (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L))) -# include -# endif -# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS)) -# include -# include // For monotonic clocks -# endif -# if (defined (__UTYPE_OSX)) -# include // For _NSGetEnviron() -# endif -# if (defined (__UTYPE_ANDROID)) -# include -# endif -# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD)) -# include -# endif -#endif - -#if (defined (__VMS__)) -# if (!defined (vaxc)) -# include // Not provided by Vax C -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#if (defined (__OS2__)) -# include // Required near top -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include // Must come before arpa/inet.h -# include -# include -# if (!defined (TCP_NODELAY)) -# include -# endif -#endif - -// Add missing defines for non-POSIX systems -#ifndef S_IRUSR -# define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -# define S_IWUSR S_IWRITE -#endif -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFDIR) != 0) -#endif -#ifndef S_ISREG -# define S_ISREG(m) (((m) & S_IFREG) != 0) -#endif - - -//- Check compiler data type sizes ------------------------------------------ - -#if (UCHAR_MAX != 0xFF) -# error "Cannot compile: must change definition of 'byte'." -#endif -#if (USHRT_MAX != 0xFFFFU) -# error "Cannot compile: must change definition of 'dbyte'." -#endif -#if (UINT_MAX != 0xFFFFFFFFU) -# error "Cannot compile: must change definition of 'qbyte'." -#endif - -//- Data types -------------------------------------------------------------- - -typedef unsigned char byte; // Single unsigned byte = 8 bits -typedef unsigned short dbyte; // Double byte = 16 bits -typedef unsigned int qbyte; // Quad byte = 32 bits -typedef struct sockaddr_in inaddr_t; // Internet socket address structure -typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure - -// Common structure to hold inaddr_t and in6addr_t with length -typedef struct { - union { - inaddr_t __addr; // IPv4 address - in6addr_t __addr6; // IPv6 address - } __inaddr_u; -#define ipv4addr __inaddr_u.__addr -#define ipv6addr __inaddr_u.__addr6 - int inaddrlen; -} inaddr_storage_t; - -//- Inevitable macros ------------------------------------------------------- - -#define streq(s1,s2) (!strcmp ((s1), (s2))) -#define strneq(s1,s2) (strcmp ((s1), (s2))) - -// Provide random number from 0..(num-1) -// Note that (at least in Solaris) while rand() returns an int limited by -// RAND_MAX, random() returns a 32-bit value all filled with random bits. -#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \ - || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS)) || (defined (__UTYPE_SOLARIS)) -# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0)) -#else -# if defined(RAND_MAX) -# define randof(num) (int) ((float) (num) * (random () % RAND_MAX) / (RAND_MAX + 1.0)) -# else -# define randof(num) (int) ((float) (num) * (uint32_t)random () / (UINT32_MAX + 1.0)) -# endif -#endif - -// Windows MSVS doesn't have stdbool -#if (defined (_MSC_VER)) -# if (!defined (__cplusplus) && (!defined (true))) -# define true 1 -# define false 0 - typedef char bool; -# endif -#else -# include -#endif - -//- A number of POSIX and C99 keywords and data types ----------------------- -// CZMQ uses uint for array indices; equivalent to unsigned int, but more -// convenient in code. We define it in czmq_prelude.h on systems that do -// not define it by default. - -#if (defined (__WINDOWS__)) -# if (!defined (__cplusplus) && (!defined (inline))) -# define inline __inline -# endif -# define strtoull _strtoui64 -# define atoll _atoi64 -# define srandom srand -# define TIMEZONE _timezone -# if (!defined (__MINGW32__)) -# define snprintf _snprintf -# define vsnprintf _vsnprintf -# endif - typedef unsigned long ulong; - typedef unsigned int uint; -# if (!defined (__MINGW32__)) - typedef int mode_t; -# if !defined (_SSIZE_T_DEFINED) -typedef intptr_t ssize_t; -# define _SSIZE_T_DEFINED -# endif -# endif -# if ((!defined (__MINGW32__) \ - || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ - && !defined (ZMQ_DEFINED_STDINT)) - typedef __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef __int64 int64_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int64 uint64_t; -# endif - typedef uint32_t in_addr_t; -# if (!defined (PRId8)) -# define PRId8 "d" -# endif -# if (!defined (PRId16)) -# define PRId16 "d" -# endif -# if (!defined (PRId32)) -# define PRId32 "d" -# endif -# if (!defined (PRId64)) -# define PRId64 "I64d" -# endif -# if (!defined (PRIu8)) -# define PRIu8 "u" -# endif -# if (!defined (PRIu16)) -# define PRIu16 "u" -# endif -# if (!defined (PRIu32)) -# define PRIu32 "u" -# endif -# if (!defined (PRIu64)) -# define PRIu64 "I64u" -# endif -# if (!defined (va_copy)) - // MSVC does not support C99's va_copy so we use a regular assignment -# define va_copy(dest,src) (dest) = (src) -# endif -#elif (defined (__UTYPE_OSX)) - typedef unsigned long ulong; - typedef unsigned int uint; - // This fixes header-order dependence problem with some Linux versions -#elif (defined (__UTYPE_LINUX)) -# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC)) - typedef unsigned int uint; -# endif -#endif - -//- Non-portable declaration specifiers ------------------------------------- - -// For thread-local storage -#if defined (__WINDOWS__) -# define CZMQ_THREADLS __declspec(thread) -#else -# define CZMQ_THREADLS __thread -#endif - -// Replacement for malloc() which asserts if we run out of heap, and -// which zeroes the allocated block. -static inline void * -safe_malloc (size_t size, const char *file, unsigned line) -{ -// printf ("%s:%u %08d\n", file, line, (int) size); - void *mem = calloc (1, size); - if (mem == NULL) { - fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line); - fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n"); - fflush (stderr); - abort (); - } - return mem; -} - -// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace, -// otherwise all allocations will claim to come from czmq_prelude.h. For best -// results, compile all classes so you see dangling object allocations. -// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate -// out of memory condition back up the call stack. -#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC) -# define zmalloc(size) calloc(1,(size)) -#else -# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__) -#endif - -// GCC supports validating format strings for functions that act like printf -#if defined (__GNUC__) && (__GNUC__ >= 2) -# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1))) -#else -# define CHECK_PRINTF(a) -#endif - -// Lets us write code that compiles both on Windows and normal platforms -#if !defined (__WINDOWS__) -typedef int SOCKET; -# define closesocket close -# define INVALID_SOCKET -1 -# define SOCKET_ERROR -1 -# define O_BINARY 0 -#endif - -//- Include non-portable header files based on platform.h ------------------- - -#if defined (HAVE_LINUX_WIRELESS_H) -# include -// This would normally come from net/if.h -unsigned int if_nametoindex (const char *ifname); -#else -# if defined (HAVE_NET_IF_H) -# include -# endif -# if defined (HAVE_NET_IF_MEDIA_H) -# include -# endif -#endif - -#if defined (__WINDOWS__) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (__UTYPE_OSX) && !defined (HAVE_UUID) -# define HAVE_UUID 1 -#endif -#if defined (HAVE_UUID) -# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD) -# include -# elif defined __UTYPE_HPUX -# include -# elif defined (__UNIX__) -# include -# endif -#endif - -// ZMQ compatibility macros - -#if ZMQ_VERSION_MAJOR == 4 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec - -#elif ZMQ_VERSION_MAJOR == 3 -# define ZMQ_POLL_MSEC 1 // zmq_poll is msec -# if ZMQ_VERSION_MINOR < 2 -# define zmq_ctx_new zmq_init -# endif -# define zmq_ctx_term zmq_term - -#elif ZMQ_VERSION_MAJOR == 2 -# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec -# define zmq_sendmsg zmq_send // Smooth out 2.x changes -# define zmq_recvmsg zmq_recv -# define zmq_ctx_new zmq_init -# define zmq_ctx_term zmq_term -# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f)) -# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f)) - // Older libzmq APIs may be missing some aspects of libzmq v3.0 -# ifndef ZMQ_ROUTER -# define ZMQ_ROUTER ZMQ_XREP -# endif -# ifndef ZMQ_DEALER -# define ZMQ_DEALER ZMQ_XREQ -# endif -# ifndef ZMQ_DONTWAIT -# define ZMQ_DONTWAIT ZMQ_NOBLOCK -# endif -# ifndef ZMQ_XSUB -# error "please upgrade your libzmq from http://zeromq.org" -# endif -# if ZMQ_VERSION_MINOR == 0 \ - || (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7) -# error "CZMQ requires at least libzmq/2.1.7 stable" -# endif -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zactor.h b/phonelibs/zmq/x64/include/zactor.h deleted file mode 100644 index c865c65da..000000000 --- a/phonelibs/zmq/x64/include/zactor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* ========================================================================= - zactor - actor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZACTOR_H_INCLUDED__ -#define __ZACTOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zactor.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Actors get a pipe and arguments from caller -typedef void (zactor_fn) ( - zsock_t *pipe, void *args); - -// Create a new actor passing arbitrary arguments reference. -CZMQ_EXPORT zactor_t * - zactor_new (zactor_fn task, void *args); - -// Destroy an actor. -CZMQ_EXPORT void - zactor_destroy (zactor_t **self_p); - -// Send a zmsg message to the actor, take ownership of the message -// and destroy when it has been sent. -CZMQ_EXPORT int - zactor_send (zactor_t *self, zmsg_t **msg_p); - -// Receive a zmsg message from the actor. Returns NULL if the actor -// was interrupted before the message could be received, or if there -// was a timeout on the actor. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zactor_recv (zactor_t *self); - -// Probe the supplied object, and report if it looks like a zactor_t. -CZMQ_EXPORT bool - zactor_is (void *self); - -// Probe the supplied reference. If it looks like a zactor_t instance, -// return the underlying libzmq actor handle; else if it looks like -// a libzmq actor handle, return the supplied value. -CZMQ_EXPORT void * - zactor_resolve (void *self); - -// Return the actor's zsock handle. Use this when you absolutely need -// to work with the zsock instance rather than the actor. -CZMQ_EXPORT zsock_t * - zactor_sock (zactor_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zactor_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zarmour.h b/phonelibs/zmq/x64/include/zarmour.h deleted file mode 100644 index c7f299f7a..000000000 --- a/phonelibs/zmq/x64/include/zarmour.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ========================================================================= - zarmour - armoured text encoding and decoding - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZARMOUR_H_INCLUDED__ -#define __ZARMOUR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zarmour.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZARMOUR_MODE_BASE64_STD 0 // Standard base 64 -#define ZARMOUR_MODE_BASE64_URL 1 // URL and filename friendly base 64 -#define ZARMOUR_MODE_BASE32_STD 2 // Standard base 32 -#define ZARMOUR_MODE_BASE32_HEX 3 // Extended hex base 32 -#define ZARMOUR_MODE_BASE16 4 // Standard base 16 -#define ZARMOUR_MODE_Z85 5 // Z85 from ZeroMQ RFC 32 - -// Create a new zarmour -CZMQ_EXPORT zarmour_t * - zarmour_new (void); - -// Destroy the zarmour -CZMQ_EXPORT void - zarmour_destroy (zarmour_t **self_p); - -// Encode a stream of bytes into an armoured string. Returns the armoured -// string, or NULL if there was insufficient memory available to allocate -// a new string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zarmour_encode (zarmour_t *self, const byte *data, size_t size); - -// Decode an armoured string into a chunk. The decoded output is -// null-terminated, so it may be treated as a string, if that's what -// it was prior to encoding. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zarmour_decode (zarmour_t *self, const char *data); - -// Get the mode property. -CZMQ_EXPORT int - zarmour_mode (zarmour_t *self); - -// Get printable string for mode. -CZMQ_EXPORT const char * - zarmour_mode_str (zarmour_t *self); - -// Set the mode property. -CZMQ_EXPORT void - zarmour_set_mode (zarmour_t *self, int mode); - -// Return true if padding is turned on. -CZMQ_EXPORT bool - zarmour_pad (zarmour_t *self); - -// Turn padding on or off. Default is on. -CZMQ_EXPORT void - zarmour_set_pad (zarmour_t *self, bool pad); - -// Get the padding character. -CZMQ_EXPORT char - zarmour_pad_char (zarmour_t *self); - -// Set the padding character. -CZMQ_EXPORT void - zarmour_set_pad_char (zarmour_t *self, char pad_char); - -// Return if splitting output into lines is turned on. Default is off. -CZMQ_EXPORT bool - zarmour_line_breaks (zarmour_t *self); - -// Turn splitting output into lines on or off. -CZMQ_EXPORT void - zarmour_set_line_breaks (zarmour_t *self, bool line_breaks); - -// Get the line length used for splitting lines. -CZMQ_EXPORT size_t - zarmour_line_length (zarmour_t *self); - -// Set the line length used for splitting lines. -CZMQ_EXPORT void - zarmour_set_line_length (zarmour_t *self, size_t line_length); - -// Print properties of object -CZMQ_EXPORT void - zarmour_print (zarmour_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zarmour_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zauth.h b/phonelibs/zmq/x64/include/zauth.h deleted file mode 100644 index 3e0e59eca..000000000 --- a/phonelibs/zmq/x64/include/zauth.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ========================================================================= - zauth - authentication for ZeroMQ security mechanisms - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZAUTH_H_INCLUDED__ -#define __ZAUTH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define CURVE_ALLOW_ANY "*" - -// CZMQ v3 API (for use with zsock, not zsocket, which is deprecated). -// -// Create new zauth actor instance. This installs authentication on all -// zsock sockets. Until you add policies, all incoming NULL connections are -// allowed (classic ZeroMQ behaviour), and all PLAIN and CURVE connections -// are denied: -// -// zactor_t *auth = zactor_new (zauth, NULL); -// -// Destroy zauth instance. This removes authentication and allows all -// connections to pass, without authentication: -// -// zactor_destroy (&auth); -// -// Note that all zauth commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity. Verbose logging can help -// debug non-trivial authentication policies: -// -// zstr_send (auth, "VERBOSE"); -// zsock_wait (auth); -// -// Allow (whitelist) a list of IP addresses. For NULL, all clients from -// these addresses will be accepted. For PLAIN and CURVE, they will be -// allowed to continue with authentication. You can call this method -// multiple times to whitelist more IP addresses. If you whitelist one -// or more addresses, any non-whitelisted addresses are treated as -// blacklisted: -// -// zstr_sendx (auth, "ALLOW", "127.0.0.1", "127.0.0.2", NULL); -// zsock_wait (auth); -// -// Deny (blacklist) a list of IP addresses. For all security mechanisms, -// this rejects the connection without any further authentication. Use -// either a whitelist, or a blacklist, not not both. If you define both -// a whitelist and a blacklist, only the whitelist takes effect: -// -// zstr_sendx (auth, "DENY", "192.168.0.1", "192.168.0.2", NULL); -// zsock_wait (auth); -// -// Configure PLAIN authentication using a plain-text password file. You can -// modify the password file at any time; zauth will reload it automatically -// if modified externally: -// -// zstr_sendx (auth, "PLAIN", filename, NULL); -// zsock_wait (auth); -// -// Configure CURVE authentication, using a directory that holds all public -// client certificates, i.e. their public keys. The certificates must be in -// zcert_save format. You can add and remove certificates in that directory -// at any time. To allow all client keys without checking, specify -// CURVE_ALLOW_ANY for the directory name: -// -// zstr_sendx (auth, "CURVE", directory, NULL); -// zsock_wait (auth); -// -// Configure GSSAPI authentication, using an underlying mechanism (usually -// Kerberos) to establish a secure context and perform mutual authentication: -// -// zstr_sendx (auth, "GSSAPI", NULL); -// zsock_wait (auth); -// -// This is the zauth constructor as a zactor_fn: -CZMQ_EXPORT void - zauth (zsock_t *pipe, void *certstore); - -// Selftest -CZMQ_EXPORT void - zauth_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zbeacon.h b/phonelibs/zmq/x64/include/zbeacon.h deleted file mode 100644 index 78917e957..000000000 --- a/phonelibs/zmq/x64/include/zbeacon.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ========================================================================= - zbeacon - LAN discovery and presence - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZBEACON_H_INCLUDED__ -#define __ZBEACON_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zbeacon actor instance: -// -// zactor_t *beacon = zactor_new (zbeacon, NULL); -// -// Destroy zbeacon instance: -// -// zactor_destroy (&beacon); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (beacon, "VERBOSE"); -// -// Configure beacon to run on specified UDP port, and return the name of -// the host, which can be used as endpoint for incoming connections. To -// force the beacon to operate on a given interface, set the environment -// variable ZSYS_INTERFACE, or call zsys_set_interface() before creating -// the beacon. If the system does not support UDP broadcasts (lacking a -// workable interface), returns an empty hostname: -// -// // Pictures: 's' = C string, 'i' = int -// zsock_send (beacon, "si", "CONFIGURE", port_number); -// char *hostname = zstr_recv (beacon); -// -// Start broadcasting a beacon at a specified interval in msec. The beacon -// data can be at most UDP_FRAME_MAX bytes; this constant is defined in -// zsys.h to be 255: -// -// // Pictures: 'b' = byte * data + size_t size -// zsock_send (beacon, "sbi", "PUBLISH", data, size, interval); -// -// Stop broadcasting the beacon: -// -// zstr_sendx (beacon, "SILENCE", NULL); -// -// Start listening to beacons from peers. The filter is used to do a prefix -// match on received beacons, to remove junk. Note that any received data -// that is identical to our broadcast beacon_data is discarded in any case. -// If the filter size is zero, we get all peer beacons: -// -// zsock_send (beacon, "sb", "SUBSCRIBE", filter_data, filter_size); -// -// Stop listening to other peers -// -// zstr_sendx (beacon, "UNSUBSCRIBE", NULL); -// -// Receive next beacon from a peer. Received beacons are always a 2-frame -// message containing the ipaddress of the sender, and then the binary -// beacon data as published by the sender: -// -// zmsg_t *msg = zmsg_recv (beacon); -// -// This is the zbeacon constructor as a zactor_fn: -CZMQ_EXPORT void - zbeacon (zsock_t *pipe, void *unused); - -// Self test of this class -CZMQ_EXPORT void - zbeacon_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zcert.h b/phonelibs/zmq/x64/include/zcert.h deleted file mode 100644 index 3161bc059..000000000 --- a/phonelibs/zmq/x64/include/zcert.h +++ /dev/null @@ -1,128 +0,0 @@ -/* ========================================================================= - zcert - work with CURVE security certificates - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERT_H_INCLUDED__ -#define __ZCERT_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcert.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create and initialize a new certificate in memory -CZMQ_EXPORT zcert_t * - zcert_new (void); - -// Accepts public/secret key pair from caller -CZMQ_EXPORT zcert_t * - zcert_new_from (const byte *public_key, const byte *secret_key); - -// Load certificate from file -CZMQ_EXPORT zcert_t * - zcert_load (const char *filename); - -// Destroy a certificate in memory -CZMQ_EXPORT void - zcert_destroy (zcert_t **self_p); - -// Return public part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_public_key (zcert_t *self); - -// Return secret part of key pair as 32-byte binary string -CZMQ_EXPORT const byte * - zcert_secret_key (zcert_t *self); - -// Return public part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_public_txt (zcert_t *self); - -// Return secret part of key pair as Z85 armored string -CZMQ_EXPORT const char * - zcert_secret_txt (zcert_t *self); - -// Set certificate metadata from formatted string. -CZMQ_EXPORT void - zcert_set_meta (zcert_t *self, const char *name, const char *format, ...) CHECK_PRINTF (3); - -// Get metadata value from certificate; if the metadata value doesn't -// exist, returns NULL. -CZMQ_EXPORT const char * - zcert_meta (zcert_t *self, const char *name); - -// Get list of metadata fields from certificate. Caller is responsible for -// destroying list. Caller should not modify the values of list items. -CZMQ_EXPORT zlist_t * - zcert_meta_keys (zcert_t *self); - -// Save full certificate (public + secret) to file for persistent storage -// This creates one public file and one secret file (filename + "_secret"). -CZMQ_EXPORT int - zcert_save (zcert_t *self, const char *filename); - -// Save public certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_public (zcert_t *self, const char *filename); - -// Save secret certificate only to file for persistent storage -CZMQ_EXPORT int - zcert_save_secret (zcert_t *self, const char *filename); - -// Apply certificate to socket, i.e. use for CURVE security on socket. -// If certificate was loaded from public file, the secret key will be -// undefined, and this certificate will not work successfully. -CZMQ_EXPORT void - zcert_apply (zcert_t *self, void *socket); - -// Return copy of certificate; if certificate is NULL or we exhausted -// heap memory, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zcert_t * - zcert_dup (zcert_t *self); - -// Return true if two certificates have the same keys -CZMQ_EXPORT bool - zcert_eq (zcert_t *self, zcert_t *compare); - -// Print certificate contents to stdout -CZMQ_EXPORT void - zcert_print (zcert_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcert_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Unset certificate metadata. -CZMQ_EXPORT void - zcert_unset_meta (zcert_t *self, const char *name); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcert_dump(s) zcert_print(s) - -#endif diff --git a/phonelibs/zmq/x64/include/zcertstore.h b/phonelibs/zmq/x64/include/zcertstore.h deleted file mode 100644 index 689b228ac..000000000 --- a/phonelibs/zmq/x64/include/zcertstore.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ========================================================================= - zcertstore - work with CURVE security certificate stores - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCERTSTORE_H_INCLUDED__ -#define __ZCERTSTORE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zcertstore.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new certificate store from a disk directory, loading and -// indexing all certificates in that location. The directory itself may be -// absent, and created later, or modified at any time. The certificate store -// is automatically refreshed on any zcertstore_lookup() call. If the -// location is specified as NULL, creates a pure-memory store, which you -// can work with by inserting certificates at runtime. -CZMQ_EXPORT zcertstore_t * - zcertstore_new (const char *location); - -// Destroy a certificate store object in memory. Does not affect anything -// stored on disk. -CZMQ_EXPORT void - zcertstore_destroy (zcertstore_t **self_p); - -// Look up certificate by public key, returns zcert_t object if found, -// else returns NULL. The public key is provided in Z85 text format. -CZMQ_EXPORT zcert_t * - zcertstore_lookup (zcertstore_t *self, const char *public_key); - -// Insert certificate into certificate store in memory. Note that this -// does not save the certificate to disk. To do that, use zcert_save() -// directly on the certificate. Takes ownership of zcert_t object. -CZMQ_EXPORT void - zcertstore_insert (zcertstore_t *self, zcert_t **cert_p); - -// Print list of certificates in store to logging facility -CZMQ_EXPORT void - zcertstore_print (zcertstore_t *self); - -// Self test of this class -CZMQ_EXPORT void - zcertstore_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// Loaders retrieve certificates from an arbitrary source. -typedef void (zcertstore_loader) ( - zcertstore_t *self); - -// Destructor for loader state. -typedef void (zcertstore_destructor) ( - void **self_p); - -// *** Draft method, for development use, may change without warning *** -// Override the default disk loader with a custom loader fn. -CZMQ_EXPORT void - zcertstore_set_loader (zcertstore_t *self, zcertstore_loader loader, zcertstore_destructor destructor, void *state); - -// *** Draft method, for development use, may change without warning *** -// Empty certificate hashtable. This wrapper exists to be friendly to bindings, -// which don't usually have access to struct internals. -CZMQ_EXPORT void - zcertstore_empty (zcertstore_t *self); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zcertstore_dump(s) zcertstore_print(s) - -#endif diff --git a/phonelibs/zmq/x64/include/zchunk.h b/phonelibs/zmq/x64/include/zchunk.h deleted file mode 100644 index 56f29b161..000000000 --- a/phonelibs/zmq/x64/include/zchunk.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zchunk - work with memory chunks - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCHUNK_H_INCLUDED__ -#define __ZCHUNK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zchunk.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new chunk of the specified size. If you specify the data, it -// is copied into the chunk. If you do not specify the data, the chunk is -// allocated and left empty, and you can then add data using zchunk_append. -CZMQ_EXPORT zchunk_t * - zchunk_new (const void *data, size_t size); - -// Destroy a chunk -CZMQ_EXPORT void - zchunk_destroy (zchunk_t **self_p); - -// Resizes chunk max_size as requested; chunk_cur size is set to zero -CZMQ_EXPORT void - zchunk_resize (zchunk_t *self, size_t size); - -// Return chunk cur size -CZMQ_EXPORT size_t - zchunk_size (zchunk_t *self); - -// Return chunk max size -CZMQ_EXPORT size_t - zchunk_max_size (zchunk_t *self); - -// Return chunk data -CZMQ_EXPORT byte * - zchunk_data (zchunk_t *self); - -// Set chunk data from user-supplied data; truncate if too large. Data may -// be null. Returns actual size of chunk -CZMQ_EXPORT size_t - zchunk_set (zchunk_t *self, const void *data, size_t size); - -// Fill chunk data from user-supplied octet -CZMQ_EXPORT size_t - zchunk_fill (zchunk_t *self, byte filler, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, it is truncated. If you want to -// grow the chunk to accommodate new data, use the zchunk_extend method. -CZMQ_EXPORT size_t - zchunk_append (zchunk_t *self, const void *data, size_t size); - -// Append user-supplied data to chunk, return resulting chunk size. If the -// data would exceeded the available space, the chunk grows in size. -CZMQ_EXPORT size_t - zchunk_extend (zchunk_t *self, const void *data, size_t size); - -// Copy as much data from 'source' into the chunk as possible; returns the -// new size of chunk. If all data from 'source' is used, returns exhausted -// on the source chunk. Source can be consumed as many times as needed until -// it is exhausted. If source was already exhausted, does not change chunk. -CZMQ_EXPORT size_t - zchunk_consume (zchunk_t *self, zchunk_t *source); - -// Returns true if the chunk was exhausted by consume methods, or if the -// chunk has a size of zero. -CZMQ_EXPORT bool - zchunk_exhausted (zchunk_t *self); - -// Read chunk from an open file descriptor -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_read (FILE *handle, size_t bytes); - -// Write chunk to an open file descriptor -CZMQ_EXPORT int - zchunk_write (zchunk_t *self, FILE *handle); - -// Try to slurp an entire file into a chunk. Will read up to maxsize of -// the file. If maxsize is 0, will attempt to read the entire file and -// fail with an assertion if that cannot fit into memory. Returns a new -// chunk containing the file data, or NULL if the file could not be read. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_slurp (const char *filename, size_t maxsize); - -// Create copy of chunk, as new chunk object. Returns a fresh zchunk_t -// object, or null if there was not enough heap memory. If chunk is null, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_dup (zchunk_t *self); - -// Return chunk data encoded as printable hex string. Caller must free -// string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strhex (zchunk_t *self); - -// Return chunk data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zchunk_strdup (zchunk_t *self); - -// Return TRUE if chunk body is equal to string, excluding terminator -CZMQ_EXPORT bool - zchunk_streq (zchunk_t *self, const char *string); - -// Transform zchunk into a zframe that can be sent in a message. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zchunk_pack (zchunk_t *self); - -// Transform a zframe into a zchunk. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zchunk_unpack (zframe_t *frame); - -// Calculate SHA1 digest for chunk, using zdigest class. -CZMQ_EXPORT const char * - zchunk_digest (zchunk_t *self); - -// Dump chunk to FILE stream, for debugging and tracing. -CZMQ_EXPORT void - zchunk_fprint (zchunk_t *self, FILE *file); - -// Dump message to stderr, for debugging and tracing. -// See zchunk_fprint for details -CZMQ_EXPORT void - zchunk_print (zchunk_t *self); - -// Probe the supplied object, and report if it looks like a zchunk_t. -CZMQ_EXPORT bool - zchunk_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zchunk_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/x64/include/zclock.h b/phonelibs/zmq/x64/include/zclock.h deleted file mode 100644 index eb064162c..000000000 --- a/phonelibs/zmq/x64/include/zclock.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zclock - millisecond clocks and delays - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCLOCK_H_INCLUDED__ -#define __ZCLOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zclock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Sleep for a number of milliseconds -CZMQ_EXPORT void - zclock_sleep (int msecs); - -// Return current system clock as milliseconds. Note that this clock can -// jump backwards (if the system clock is changed) so is unsafe to use for -// timers and time offsets. Use zclock_mono for that instead. -CZMQ_EXPORT int64_t - zclock_time (void); - -// Return current monotonic clock in milliseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_mono (void); - -// Return current monotonic clock in microseconds. Use this when you compute -// time offsets. The monotonic clock is not affected by system changes and -// so will never be reset backwards, unlike a system clock. -CZMQ_EXPORT int64_t - zclock_usecs (void); - -// Return formatted date/time as fresh string. Free using zstr_free(). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zclock_timestr (void); - -// Self test of this class. -CZMQ_EXPORT void - zclock_test (bool verbose); - -// @end - - -// DEPRECATED in favor of zsys logging, see issue #519 -// Print formatted string to stdout, prefixed by date/time and -// terminated with a newline. -CZMQ_EXPORT void - zclock_log (const char *format, ...); - -// Compiler hints -CZMQ_EXPORT void zclock_log (const char *format, ...) CHECK_PRINTF (1); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zconfig.h b/phonelibs/zmq/x64/include/zconfig.h deleted file mode 100644 index df0c70849..000000000 --- a/phonelibs/zmq/x64/include/zconfig.h +++ /dev/null @@ -1,185 +0,0 @@ -/* ========================================================================= - zconfig - work with config files written in rfc.zeromq.org/spec:4/ZPL. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZCONFIG_H_INCLUDED__ -#define __ZCONFIG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zconfig.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// -typedef int (zconfig_fct) ( - zconfig_t *self, void *arg, int level); - -// Create new config item -CZMQ_EXPORT zconfig_t * - zconfig_new (const char *name, zconfig_t *parent); - -// Load a config tree from a specified ZPL text file; returns a zconfig_t -// reference for the root, if the file exists and is readable. Returns NULL -// if the file does not exist. -CZMQ_EXPORT zconfig_t * - zconfig_load (const char *filename); - -// Equivalent to zconfig_load, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT zconfig_t * - zconfig_loadf (const char *format, ...) CHECK_PRINTF (1); - -// Destroy a config item and all its children -CZMQ_EXPORT void - zconfig_destroy (zconfig_t **self_p); - -// Return name of config item -CZMQ_EXPORT char * - zconfig_name (zconfig_t *self); - -// Return value of config item -CZMQ_EXPORT char * - zconfig_value (zconfig_t *self); - -// Insert or update configuration key with value -CZMQ_EXPORT void - zconfig_put (zconfig_t *self, const char *path, const char *value); - -// Equivalent to zconfig_put, accepting a format specifier and variable -// argument list, instead of a single string value. -CZMQ_EXPORT void - zconfig_putf (zconfig_t *self, const char *path, const char *format, ...) CHECK_PRINTF (3); - -// Get value for config item into a string value; leading slash is optional -// and ignored. -CZMQ_EXPORT char * - zconfig_get (zconfig_t *self, const char *path, const char *default_value); - -// Set config item name, name may be NULL -CZMQ_EXPORT void - zconfig_set_name (zconfig_t *self, const char *name); - -// Set new value for config item. The new value may be a string, a printf -// format, or NULL. Note that if string may possibly contain '%', or if it -// comes from an insecure source, you must use '%s' as the format, followed -// by the string. -CZMQ_EXPORT void - zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Find our first child, if any -CZMQ_EXPORT zconfig_t * - zconfig_child (zconfig_t *self); - -// Find our first sibling, if any -CZMQ_EXPORT zconfig_t * - zconfig_next (zconfig_t *self); - -// Find a config item along a path; leading slash is optional and ignored. -CZMQ_EXPORT zconfig_t * - zconfig_locate (zconfig_t *self, const char *path); - -// Locate the last config item at a specified depth -CZMQ_EXPORT zconfig_t * - zconfig_at_depth (zconfig_t *self, int level); - -// Execute a callback for each config item in the tree; returns zero if -// successful, else -1. -CZMQ_EXPORT int - zconfig_execute (zconfig_t *self, zconfig_fct handler, void *arg); - -// Add comment to config item before saving to disk. You can add as many -// comment lines as you like. If you use a null format, all comments are -// deleted. -CZMQ_EXPORT void - zconfig_set_comment (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Return comments of config item, as zlist. -CZMQ_EXPORT zlist_t * - zconfig_comments (zconfig_t *self); - -// Save a config tree to a specified ZPL text file, where a filename -// "-" means dump to standard output. -CZMQ_EXPORT int - zconfig_save (zconfig_t *self, const char *filename); - -// Equivalent to zconfig_save, taking a format string instead of a fixed -// filename. -CZMQ_EXPORT int - zconfig_savef (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Report filename used during zconfig_load, or NULL if none -CZMQ_EXPORT const char * - zconfig_filename (zconfig_t *self); - -// Reload config tree from same file that it was previously loaded from. -// Returns 0 if OK, -1 if there was an error (and then does not change -// existing data). -CZMQ_EXPORT int - zconfig_reload (zconfig_t **self_p); - -// Load a config tree from a memory chunk -CZMQ_EXPORT zconfig_t * - zconfig_chunk_load (zchunk_t *chunk); - -// Save a config tree to a new memory chunk -CZMQ_EXPORT zchunk_t * - zconfig_chunk_save (zconfig_t *self); - -// Load a config tree from a null-terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zconfig_t * - zconfig_str_load (const char *string); - -// Save a config tree to a new null terminated string -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zconfig_str_save (zconfig_t *self); - -// Return true if a configuration tree was loaded from a file and that -// file has changed in since the tree was loaded. -CZMQ_EXPORT bool - zconfig_has_changed (zconfig_t *self); - -// Print the config file to open stream -CZMQ_EXPORT void - zconfig_fprint (zconfig_t *self, FILE *file); - -// Print properties of object -CZMQ_EXPORT void - zconfig_print (zconfig_t *self); - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// @end - -// Self test of this class -CZMQ_EXPORT void - zconfig_test (bool verbose); - -// Compiler hints -CZMQ_EXPORT void zconfig_set_value (zconfig_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zconfig_dump(s) zconfig_print(s) -#define zconfig_resolve(s,p,d) zconfig_get((s),(p),(d)) - -#endif diff --git a/phonelibs/zmq/x64/include/zdigest.h b/phonelibs/zmq/x64/include/zdigest.h deleted file mode 100644 index def9e8605..000000000 --- a/phonelibs/zmq/x64/include/zdigest.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================= - zdigest - provides hashing functions (SHA-1 at present) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIGEST_H_INCLUDED__ -#define __ZDIGEST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdigest.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Constructor - creates new digest object, which you use to build up a -// digest by repeatedly calling zdigest_update() on chunks of data. -CZMQ_EXPORT zdigest_t * - zdigest_new (void); - -// Destroy a digest object -CZMQ_EXPORT void - zdigest_destroy (zdigest_t **self_p); - -// Add buffer into digest calculation -CZMQ_EXPORT void - zdigest_update (zdigest_t *self, const byte *buffer, size_t length); - -// Return final digest hash data. If built without crypto support, -// returns NULL. -CZMQ_EXPORT const byte * - zdigest_data (zdigest_t *self); - -// Return final digest hash size -CZMQ_EXPORT size_t - zdigest_size (zdigest_t *self); - -// Return digest as printable hex string; caller should not modify nor -// free this string. After calling this, you may not use zdigest_update() -// on the same digest. If built without crypto support, returns NULL. -CZMQ_EXPORT char * - zdigest_string (zdigest_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdigest_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zdir.h b/phonelibs/zmq/x64/include/zdir.h deleted file mode 100644 index 6c5551b57..000000000 --- a/phonelibs/zmq/x64/include/zdir.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - zdir - work with file-system directories - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_H_INCLUDED__ -#define __ZDIR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new directory item that loads in the full tree of the specified -// path, optionally located under some parent path. If parent is "-", then -// loads only the top-level directory, and does not use parent as a path. -CZMQ_EXPORT zdir_t * - zdir_new (const char *path, const char *parent); - -// Destroy a directory tree and all children it contains. -CZMQ_EXPORT void - zdir_destroy (zdir_t **self_p); - -// Return directory path -CZMQ_EXPORT const char * - zdir_path (zdir_t *self); - -// Return last modification time for directory. -CZMQ_EXPORT time_t - zdir_modified (zdir_t *self); - -// Return total hierarchy size, in bytes of data contained in all files -// in the directory tree. -CZMQ_EXPORT off_t - zdir_cursize (zdir_t *self); - -// Return directory count -CZMQ_EXPORT size_t - zdir_count (zdir_t *self); - -// Returns a sorted list of zfile objects; Each entry in the list is a pointer -// to a zfile_t item already allocated in the zdir tree. Do not destroy the -// original zdir tree until you are done with this list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_list (zdir_t *self); - -// Remove directory, optionally including all files that it contains, at -// all levels. If force is false, will only remove the directory if empty. -// If force is true, will remove all files and all subdirectories. -CZMQ_EXPORT void - zdir_remove (zdir_t *self, bool force); - -// Calculate differences between two versions of a directory tree. -// Returns a list of zdir_patch_t patches. Either older or newer may -// be null, indicating the directory is empty/absent. If alias is set, -// generates virtual filename (minus path, plus alias). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_diff (zdir_t *older, zdir_t *newer, const char *alias); - -// Return full contents of directory as a zdir_patch list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zdir_resync (zdir_t *self, const char *alias); - -// Load directory cache; returns a hash table containing the SHA-1 digests -// of every file in the tree. The cache is saved between runs in .cache. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zdir_cache (zdir_t *self); - -// Print contents of directory to open stream -CZMQ_EXPORT void - zdir_fprint (zdir_t *self, FILE *file, int indent); - -// Print contents of directory to stdout -CZMQ_EXPORT void - zdir_print (zdir_t *self, int indent); - -// Create a new zdir_watch actor instance: -// -// zactor_t *watch = zactor_new (zdir_watch, NULL); -// -// Destroy zdir_watch instance: -// -// zactor_destroy (&watch); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (watch, "VERBOSE"); -// -// Subscribe to changes to a directory path: -// -// zsock_send (watch, "ss", "SUBSCRIBE", "directory_path"); -// -// Unsubscribe from changes to a directory path: -// -// zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path"); -// -// Receive directory changes: -// zsock_recv (watch, "sp", &path, &patches); -// -// // Delete the received data. -// free (path); -// zlist_destroy (&patches); -CZMQ_EXPORT void - zdir_watch (zsock_t *pipe, void *unused); - -// Self test of this class. -CZMQ_EXPORT void - zdir_test (bool verbose); - -// @end - - -// Returns a sorted array of zfile objects; returns a single block of memory, -// that you destroy by calling zstr_free(). Each entry in the array is a pointer -// to a zfile_t item already allocated in the zdir tree. The array ends with -// a null pointer. Do not destroy the original zdir tree until you are done -// with this array. -CZMQ_EXPORT zfile_t ** - zdir_flatten (zdir_t *self); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zdir_flatten_free (zfile_t ***files_p); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zdir_dump(s,i) zdir_print(s,i) - -#endif diff --git a/phonelibs/zmq/x64/include/zdir_patch.h b/phonelibs/zmq/x64/include/zdir_patch.h deleted file mode 100644 index 8d15b9aeb..000000000 --- a/phonelibs/zmq/x64/include/zdir_patch.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zdir_patch - work with directory patches - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZDIR_PATCH_H_INCLUDED__ -#define __ZDIR_PATCH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// un-namespaced enumeration values -#define patch_create ZDIR_PATCH_CREATE -#define patch_delete ZDIR_PATCH_DELETE - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zdir_patch.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -#define ZDIR_PATCH_CREATE 1 // Creates a new file -#define ZDIR_PATCH_DELETE 2 // Delete a file - -// Create new patch -CZMQ_EXPORT zdir_patch_t * - zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias); - -// Destroy a patch -CZMQ_EXPORT void - zdir_patch_destroy (zdir_patch_t **self_p); - -// Create copy of a patch. If the patch is null, or memory was exhausted, -// returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zdir_patch_t * - zdir_patch_dup (zdir_patch_t *self); - -// Return patch file directory path -CZMQ_EXPORT const char * - zdir_patch_path (zdir_patch_t *self); - -// Return patch file item -CZMQ_EXPORT zfile_t * - zdir_patch_file (zdir_patch_t *self); - -// Return operation -CZMQ_EXPORT int - zdir_patch_op (zdir_patch_t *self); - -// Return patch virtual file path -CZMQ_EXPORT const char * - zdir_patch_vpath (zdir_patch_t *self); - -// Calculate hash digest for file (create only) -CZMQ_EXPORT void - zdir_patch_digest_set (zdir_patch_t *self); - -// Return hash digest for patch file -CZMQ_EXPORT const char * - zdir_patch_digest (zdir_patch_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zdir_patch_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zfile.h b/phonelibs/zmq/x64/include/zfile.h deleted file mode 100644 index 75c35774b..000000000 --- a/phonelibs/zmq/x64/include/zfile.h +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= - zfile - helper functions for working with files. - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFILE_H_INCLUDED__ -#define __ZFILE_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zfile.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// If file exists, populates properties. CZMQ supports portable symbolic -// links, which are files with the extension ".ln". A symbolic link is a -// text file containing one line, the filename of a target file. Reading -// data from the symbolic link actually reads from the target file. Path -// may be NULL, in which case it is not used. -CZMQ_EXPORT zfile_t * - zfile_new (const char *path, const char *name); - -// Destroy a file item -CZMQ_EXPORT void - zfile_destroy (zfile_t **self_p); - -// Duplicate a file item, returns a newly constructed item. If the file -// is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zfile_t * - zfile_dup (zfile_t *self); - -// Return file name, remove path if provided -CZMQ_EXPORT const char * - zfile_filename (zfile_t *self, const char *path); - -// Refresh file properties from disk; this is not done automatically -// on access methods, otherwise it is not possible to compare directory -// snapshots. -CZMQ_EXPORT void - zfile_restat (zfile_t *self); - -// Return when the file was last modified. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT time_t - zfile_modified (zfile_t *self); - -// Return the last-known size of the file. If you want this to reflect the -// current situation, call zfile_restat before checking this property. -CZMQ_EXPORT off_t - zfile_cursize (zfile_t *self); - -// Return true if the file is a directory. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_directory (zfile_t *self); - -// Return true if the file is a regular file. If you want this to reflect -// any external changes, call zfile_restat before checking this property. -CZMQ_EXPORT bool - zfile_is_regular (zfile_t *self); - -// Return true if the file is readable by this process. If you want this to -// reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_readable (zfile_t *self); - -// Return true if the file is writeable by this process. If you want this -// to reflect any external changes, call zfile_restat before checking this -// property. -CZMQ_EXPORT bool - zfile_is_writeable (zfile_t *self); - -// Check if file has stopped changing and can be safely processed. -// Updates the file statistics from disk at every call. -CZMQ_EXPORT bool - zfile_is_stable (zfile_t *self); - -// Return true if the file was changed on disk since the zfile_t object -// was created, or the last zfile_restat() call made on it. -CZMQ_EXPORT bool - zfile_has_changed (zfile_t *self); - -// Remove the file from disk -CZMQ_EXPORT void - zfile_remove (zfile_t *self); - -// Open file for reading -// Returns 0 if OK, -1 if not found or not accessible -CZMQ_EXPORT int - zfile_input (zfile_t *self); - -// Open file for writing, creating directory if needed -// File is created if necessary; chunks can be written to file at any -// location. Returns 0 if OK, -1 if error. -CZMQ_EXPORT int - zfile_output (zfile_t *self); - -// Read chunk from file at specified position. If this was the last chunk, -// sets the eof property. Returns a null chunk in case of error. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zchunk_t * - zfile_read (zfile_t *self, size_t bytes, off_t offset); - -// Returns true if zfile_read() just read the last chunk in the file. -CZMQ_EXPORT bool - zfile_eof (zfile_t *self); - -// Write chunk to file at specified position -// Return 0 if OK, else -1 -CZMQ_EXPORT int - zfile_write (zfile_t *self, zchunk_t *chunk, off_t offset); - -// Read next line of text from file. Returns a pointer to the text line, -// or NULL if there was nothing more to read from the file. -CZMQ_EXPORT const char * - zfile_readln (zfile_t *self); - -// Close file, if open -CZMQ_EXPORT void - zfile_close (zfile_t *self); - -// Return file handle, if opened -CZMQ_EXPORT FILE * - zfile_handle (zfile_t *self); - -// Calculate SHA1 digest for file, using zdigest class. -CZMQ_EXPORT const char * - zfile_digest (zfile_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zfile_test (bool verbose); - -// @end - - -// @interface -// These methods are deprecated, and now moved to zsys class. -CZMQ_EXPORT bool - zfile_exists (const char *filename); -CZMQ_EXPORT ssize_t - zfile_size (const char *filename); -CZMQ_EXPORT mode_t - zfile_mode (const char *filename); -CZMQ_EXPORT int - zfile_delete (const char *filename); -CZMQ_EXPORT bool - zfile_stable (const char *filename); -CZMQ_EXPORT int - zfile_mkdir (const char *pathname); -CZMQ_EXPORT int - zfile_rmdir (const char *pathname); -CZMQ_EXPORT void - zfile_mode_private (void); -CZMQ_EXPORT void - zfile_mode_default (void); -// @end - -#ifdef __cplusplus -} -#endif - - -#endif // __ZFILE_H_INCLUDED__ diff --git a/phonelibs/zmq/x64/include/zframe.h b/phonelibs/zmq/x64/include/zframe.h deleted file mode 100644 index 728093c36..000000000 --- a/phonelibs/zmq/x64/include/zframe.h +++ /dev/null @@ -1,176 +0,0 @@ -/* ========================================================================= - zframe - working with single message frames - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZFRAME_H_INCLUDED__ -#define __ZFRAME_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zframe.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -#define ZFRAME_MORE 1 // -#define ZFRAME_REUSE 2 // -#define ZFRAME_DONTWAIT 4 // - -// Create a new frame. If size is not null, allocates the frame data -// to the specified size. If additionally, data is not null, copies -// size octets from the specified data into the frame body. -CZMQ_EXPORT zframe_t * - zframe_new (const void *data, size_t size); - -// Create an empty (zero-sized) frame -CZMQ_EXPORT zframe_t * - zframe_new_empty (void); - -// Create a frame with a specified string content. -CZMQ_EXPORT zframe_t * - zframe_from (const char *string); - -// Receive frame from socket, returns zframe_t object or NULL if the recv -// was interrupted. Does a blocking recv, if you want to not block then use -// zpoller or zloop. -CZMQ_EXPORT zframe_t * - zframe_recv (void *source); - -// Destroy a frame -CZMQ_EXPORT void - zframe_destroy (zframe_t **self_p); - -// Send a frame to a socket, destroy frame after sending. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_send (zframe_t **self_p, void *dest, int flags); - -// Return number of bytes in frame data -CZMQ_EXPORT size_t - zframe_size (zframe_t *self); - -// Return address of frame data -CZMQ_EXPORT byte * - zframe_data (zframe_t *self); - -// Return meta data property for frame -// Caller must free string when finished with it. -CZMQ_EXPORT const char * - zframe_meta (zframe_t *self, const char *property); - -// Create a new frame that duplicates an existing frame. If frame is null, -// or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zframe_dup (zframe_t *self); - -// Return frame data encoded as printable hex string, useful for 0MQ UUIDs. -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strhex (zframe_t *self); - -// Return frame data copied into freshly allocated string -// Caller must free string when finished with it. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zframe_strdup (zframe_t *self); - -// Return TRUE if frame body is equal to string, excluding terminator -CZMQ_EXPORT bool - zframe_streq (zframe_t *self, const char *string); - -// Return frame MORE indicator (1 or 0), set when reading frame from socket -// or by the zframe_set_more() method -CZMQ_EXPORT int - zframe_more (zframe_t *self); - -// Set frame MORE indicator (1 or 0). Note this is NOT used when sending -// frame to socket, you have to specify flag explicitly. -CZMQ_EXPORT void - zframe_set_more (zframe_t *self, int more); - -// Return TRUE if two frames have identical size and data -// If either frame is NULL, equality is always false. -CZMQ_EXPORT bool - zframe_eq (zframe_t *self, zframe_t *other); - -// Set new contents for frame -CZMQ_EXPORT void - zframe_reset (zframe_t *self, const void *data, size_t size); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). Prefix shows before frame, if not null. -CZMQ_EXPORT void - zframe_print (zframe_t *self, const char *prefix); - -// Probe the supplied object, and report if it looks like a zframe_t. -CZMQ_EXPORT bool - zframe_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zframe_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return frame routing ID, if the frame came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zframe_routing_id (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on frame. This is used if/when the frame is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zframe_set_routing_id (zframe_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Return frame group of radio-dish pattern. -CZMQ_EXPORT const char * - zframe_group (zframe_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set group on frame. This is used if/when the frame is sent to a -// ZMQ_RADIO socket. -// Return -1 on error, 0 on success. -CZMQ_EXPORT int - zframe_set_group (zframe_t *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive a new frame off the socket. Returns newly allocated frame, or -// NULL if there was no input waiting, or if the read was interrupted. -CZMQ_EXPORT zframe_t * - zframe_recv_nowait (void *source); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print contents of the frame to FILE stream. -CZMQ_EXPORT void - zframe_fprint (zframe_t *self, const char *prefix, FILE *file); - -// Deprecated method aliases -#define zframe_print_to_stream(s,p,F) zframe_fprint(s,p,F) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zgossip.h b/phonelibs/zmq/x64/include/zgossip.h deleted file mode 100644 index 647cb28c0..000000000 --- a/phonelibs/zmq/x64/include/zgossip.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - zgossip - zgossip server - - ** WARNING ************************************************************* - THIS SOURCE FILE IS 100% GENERATED. If you edit this file, you will lose - your changes at the next build cycle. This is great for temporary printf - statements. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP. The correct places - for commits are: - - * The XML model used for this code generation: zgossip.xml, or - * The code generation script that built this file: zproto_server_c - ************************************************************************ - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZGOSSIP_H_INCLUDED -#define ZGOSSIP_H_INCLUDED - -#include "czmq.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// To work with zgossip, use the CZMQ zactor API: -// -// Create new zgossip instance, passing logging prefix: -// -// zactor_t *zgossip = zactor_new (zgossip, "myname"); -// -// Destroy zgossip instance -// -// zactor_destroy (&zgossip); -// -// Enable verbose logging of commands and activity: -// -// zstr_send (zgossip, "VERBOSE"); -// -// Bind zgossip to specified endpoint. TCP endpoints may specify -// the port number as "*" to aquire an ephemeral port: -// -// zstr_sendx (zgossip, "BIND", endpoint, NULL); -// -// Return assigned port number, specifically when BIND was done using an -// an ephemeral port: -// -// zstr_sendx (zgossip, "PORT", NULL); -// char *command, *port_str; -// zstr_recvx (zgossip, &command, &port_str, NULL); -// assert (streq (command, "PORT")); -// -// Specify configuration file to load, overwriting any previous loaded -// configuration file or options: -// -// zstr_sendx (zgossip, "LOAD", filename, NULL); -// -// Set configuration path value: -// -// zstr_sendx (zgossip, "SET", path, value, NULL); -// -// Save configuration data to config file on disk: -// -// zstr_sendx (zgossip, "SAVE", filename, NULL); -// -// Send zmsg_t instance to zgossip: -// -// zactor_send (zgossip, &msg); -// -// Receive zmsg_t instance from zgossip: -// -// zmsg_t *msg = zactor_recv (zgossip); -// -// This is the zgossip constructor as a zactor_fn: -// -CZMQ_EXPORT void - zgossip (zsock_t *pipe, void *args); - -// Self test of this class -CZMQ_EXPORT void - zgossip_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zhash.h b/phonelibs/zmq/x64/include/zhash.h deleted file mode 100644 index 138adf63a..000000000 --- a/phonelibs/zmq/x64/include/zhash.h +++ /dev/null @@ -1,182 +0,0 @@ -/* ========================================================================= - zhash - generic type-free hash container (simple) - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASH_H_INCLUDED__ -#define __ZHASH_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhash.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for zhash_freefn method -typedef void (zhash_free_fn) ( - void *data); - -// Create a new, empty hash container -CZMQ_EXPORT zhash_t * - zhash_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhash_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhash_t * - zhash_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhash_destroy (zhash_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhash_insert (zhash_t *self, const char *key, void *item); - -// Update item into hash table with specified key and item. -// If key is already present, destroys old item and inserts new one. -// Use free_fn method to ensure deallocator is properly called on item. -CZMQ_EXPORT void - zhash_update (zhash_t *self, const char *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhash_delete (zhash_t *self, const char *key); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhash_lookup (zhash_t *self, const char *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhash_rename (zhash_t *self, const char *old_key, const char *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhash_freefn (zhash_t *self, const char *key, zhash_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhash_size (zhash_t *self); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhash_t * - zhash_dup (zhash_t *self); - -// Return keys for items in table -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zhash_keys (zhash_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhash_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhash_first (zhash_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhash_first() to process all items in a hash table. If you need the -// items in sorted order, use zhash_keys() and then zlist_sort(). To -// access the key for this item use zhash_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhash_next (zhash_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const char * - zhash_cursor (zhash_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhash_comment (zhash_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhash_pack (zhash_t *self); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhash_save (zhash_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhash_load (zhash_t *self, const char *filename); - -// When a hash table was loaded from a file by zhash_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhash_refresh (zhash_t *self); - -// Set hash for automatic value destruction -CZMQ_EXPORT void - zhash_autofree (zhash_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhash_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zhashx.h b/phonelibs/zmq/x64/include/zhashx.h deleted file mode 100644 index 360a773ee..000000000 --- a/phonelibs/zmq/x64/include/zhashx.h +++ /dev/null @@ -1,277 +0,0 @@ -/* ========================================================================= - zhashx - extended generic type-free hash container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZHASHX_H_INCLUDED__ -#define __ZHASHX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zhashx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Destroy an item -typedef void (zhashx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zhashx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zhashx_comparator_fn) ( - const void *item1, const void *item2); - -// compare two items, for sorting -typedef void (zhashx_free_fn) ( - void *data); - -// compare two items, for sorting -typedef size_t (zhashx_hash_fn) ( - const void *key); - -// Serializes an item to a longstr. -// The caller takes ownership of the newly created object. -typedef char * (zhashx_serializer_fn) ( - const void *item); - -// Deserializes a longstr into an item. -// The caller takes ownership of the newly created object. -typedef void * (zhashx_deserializer_fn) ( - const char *item_str); - -// Create a new, empty hash container -CZMQ_EXPORT zhashx_t * - zhashx_new (void); - -// Unpack binary frame into a new hash table. Packed data must follow format -// defined by zhashx_pack. Hash table is set to autofree. An empty frame -// unpacks to an empty hash table. -CZMQ_EXPORT zhashx_t * - zhashx_unpack (zframe_t *frame); - -// Destroy a hash container and all items in it -CZMQ_EXPORT void - zhashx_destroy (zhashx_t **self_p); - -// Insert item into hash table with specified key and item. -// If key is already present returns -1 and leaves existing item unchanged -// Returns 0 on success. -CZMQ_EXPORT int - zhashx_insert (zhashx_t *self, const void *key, void *item); - -// Update or insert item into hash table with specified key and item. If the -// key is already present, destroys old item and inserts new one. If you set -// a container item destructor, this is called on the old value. If the key -// was not already present, inserts a new item. Sets the hash cursor to the -// new item. -CZMQ_EXPORT void - zhashx_update (zhashx_t *self, const void *key, void *item); - -// Remove an item specified by key from the hash table. If there was no such -// item, this function does nothing. -CZMQ_EXPORT void - zhashx_delete (zhashx_t *self, const void *key); - -// Delete all items from the hash table. If the key destructor is -// set, calls it on every key. If the item destructor is set, calls -// it on every item. -CZMQ_EXPORT void - zhashx_purge (zhashx_t *self); - -// Return the item at the specified key, or null -CZMQ_EXPORT void * - zhashx_lookup (zhashx_t *self, const void *key); - -// Reindexes an item from an old key to a new key. If there was no such -// item, does nothing. Returns 0 if successful, else -1. -CZMQ_EXPORT int - zhashx_rename (zhashx_t *self, const void *old_key, const void *new_key); - -// Set a free function for the specified hash table item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when hash items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zhashx_freefn (zhashx_t *self, const void *key, zhashx_free_fn free_fn); - -// Return the number of keys/items in the hash table -CZMQ_EXPORT size_t - zhashx_size (zhashx_t *self); - -// Return a zlistx_t containing the keys for the items in the -// table. Uses the key_duplicator to duplicate all keys and sets the -// key_destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_keys (zhashx_t *self); - -// Return a zlistx_t containing the values for the items in the -// table. Uses the duplicator to duplicate all items and sets the -// destructor as destructor for the list. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlistx_t * - zhashx_values (zhashx_t *self); - -// Simple iterator; returns first item in hash table, in no given order, -// or NULL if the table is empty. This method is simpler to use than the -// foreach() method, which is deprecated. To access the key for this item -// use zhashx_cursor(). NOTE: do NOT modify the table while iterating. -CZMQ_EXPORT void * - zhashx_first (zhashx_t *self); - -// Simple iterator; returns next item in hash table, in no given order, -// or NULL if the last item was already returned. Use this together with -// zhashx_first() to process all items in a hash table. If you need the -// items in sorted order, use zhashx_keys() and then zlistx_sort(). To -// access the key for this item use zhashx_cursor(). NOTE: do NOT modify -// the table while iterating. -CZMQ_EXPORT void * - zhashx_next (zhashx_t *self); - -// After a successful first/next method, returns the key for the item that -// was returned. This is a constant string that you may not modify or -// deallocate, and which lasts as long as the item in the hash. After an -// unsuccessful first/next, returns NULL. -CZMQ_EXPORT const void * - zhashx_cursor (zhashx_t *self); - -// Add a comment to hash table before saving to disk. You can add as many -// comment lines as you like. These comment lines are discarded when loading -// the file. If you use a null format, all comments are deleted. -CZMQ_EXPORT void - zhashx_comment (zhashx_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Save hash table to a text file in name=value format. Hash values must be -// printable strings; keys may not contain '=' character. Returns 0 if OK, -// else -1 if a file error occurred. -CZMQ_EXPORT int - zhashx_save (zhashx_t *self, const char *filename); - -// Load hash table from a text file in name=value format; hash table must -// already exist. Hash values must printable strings; keys may not contain -// '=' character. Returns 0 if OK, else -1 if a file was not readable. -CZMQ_EXPORT int - zhashx_load (zhashx_t *self, const char *filename); - -// When a hash table was loaded from a file by zhashx_load, this method will -// reload the file if it has been modified since, and is "stable", i.e. not -// still changing. Returns 0 if OK, -1 if there was an error reloading the -// file. -CZMQ_EXPORT int - zhashx_refresh (zhashx_t *self); - -// Serialize hash table to a binary frame that can be sent in a message. -// The packed format is compatible with the 'dictionary' type defined in -// http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto: -// -// ; A list of name/value pairs -// dictionary = dict-count *( dict-name dict-value ) -// dict-count = number-4 -// dict-value = longstr -// dict-name = string -// -// ; Strings are always length + text contents -// longstr = number-4 *VCHAR -// string = number-1 *VCHAR -// -// ; Numbers are unsigned integers in network byte order -// number-1 = 1OCTET -// number-4 = 4OCTET -// -// Comments are not included in the packed data. Item values MUST be -// strings. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack (zhashx_t *self); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. Note that this method's behavior changed slightly for CZMQ -// v3.x, as it does not set nor respect autofree. It does however let you -// duplicate any hash table safely. The old behavior is in zhashx_dup_v2. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zhashx_t * - zhashx_dup (zhashx_t *self); - -// Set a user-defined deallocator for hash items; by default items are not -// freed when the hash is destroyed. -CZMQ_EXPORT void - zhashx_set_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for hash items; by default items are not -// copied when the hash is duplicated. -CZMQ_EXPORT void - zhashx_set_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined deallocator for keys; by default keys are freed -// when the hash is destroyed using free(). -CZMQ_EXPORT void - zhashx_set_key_destructor (zhashx_t *self, zhashx_destructor_fn destructor); - -// Set a user-defined duplicator for keys; by default keys are duplicated -// using strdup. -CZMQ_EXPORT void - zhashx_set_key_duplicator (zhashx_t *self, zhashx_duplicator_fn duplicator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_comparator (zhashx_t *self, zhashx_comparator_fn comparator); - -// Set a user-defined comparator for keys; by default keys are -// compared using strcmp. -CZMQ_EXPORT void - zhashx_set_key_hasher (zhashx_t *self, zhashx_hash_fn hasher); - -// Make copy of hash table; if supplied table is null, returns null. -// Does not copy items themselves. Rebuilds new table so may be slow on -// very large tables. NOTE: only works with item values that are strings -// since there's no other way to know how to duplicate the item value. -CZMQ_EXPORT zhashx_t * - zhashx_dup_v2 (zhashx_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zhashx_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Same as unpack but uses a user-defined deserializer function to convert -// a longstr back into item format. -CZMQ_EXPORT zhashx_t * - zhashx_unpack_own (zframe_t *frame, zhashx_deserializer_fn deserializer); - -// *** Draft method, for development use, may change without warning *** -// Same as pack but uses a user-defined serializer function to convert items -// into longstr. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zhashx_pack_own (zhashx_t *self, zhashx_serializer_fn serializer); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ziflist.h b/phonelibs/zmq/x64/include/ziflist.h deleted file mode 100644 index cb2b14480..000000000 --- a/phonelibs/zmq/x64/include/ziflist.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ========================================================================= - ziflist - List of network interfaces available on system - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZIFLIST_H_INCLUDED__ -#define __ZIFLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ziflist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Get a list of network interfaces currently defined on the system -CZMQ_EXPORT ziflist_t * - ziflist_new (void); - -// Destroy a ziflist instance -CZMQ_EXPORT void - ziflist_destroy (ziflist_t **self_p); - -// Reload network interfaces from system -CZMQ_EXPORT void - ziflist_reload (ziflist_t *self); - -// Return the number of network interfaces on system -CZMQ_EXPORT size_t - ziflist_size (ziflist_t *self); - -// Get first network interface, return NULL if there are none -CZMQ_EXPORT const char * - ziflist_first (ziflist_t *self); - -// Get next network interface, return NULL if we hit the last one -CZMQ_EXPORT const char * - ziflist_next (ziflist_t *self); - -// Return the current interface IP address as a printable string -CZMQ_EXPORT const char * - ziflist_address (ziflist_t *self); - -// Return the current interface broadcast address as a printable string -CZMQ_EXPORT const char * - ziflist_broadcast (ziflist_t *self); - -// Return the current interface network mask as a printable string -CZMQ_EXPORT const char * - ziflist_netmask (ziflist_t *self); - -// Return the list of interfaces. -CZMQ_EXPORT void - ziflist_print (ziflist_t *self); - -// Self test of this class. -CZMQ_EXPORT void - ziflist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zlist.h b/phonelibs/zmq/x64/include/zlist.h deleted file mode 100644 index 1dcd39b99..000000000 --- a/phonelibs/zmq/x64/include/zlist.h +++ /dev/null @@ -1,158 +0,0 @@ -/* ========================================================================= - zlist - simple generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLIST_H_INCLUDED__ -#define __ZLIST_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlist.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Comparison function e.g. for sorting and removing. -typedef int (zlist_compare_fn) ( - void *item1, void *item2); - -// Callback function for zlist_freefn method -typedef void (zlist_free_fn) ( - void *data); - -// Create a new list container -CZMQ_EXPORT zlist_t * - zlist_new (void); - -// Destroy a list container -CZMQ_EXPORT void - zlist_destroy (zlist_t **self_p); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_first (zlist_t *self); - -// Return the next item. If the list is empty, returns NULL. To move to -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT void * - zlist_next (zlist_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_last (zlist_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_head (zlist_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlist_tail (zlist_t *self); - -// Return the current item of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the current item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlist_item (zlist_t *self); - -// Append an item to the end of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_append (zlist_t *self, void *item); - -// Push an item to the start of the list, return 0 if OK or -1 if this -// failed for some reason (out of memory). Note that if a duplicator has -// been set, this method will also duplicate the item. -CZMQ_EXPORT int - zlist_push (zlist_t *self, void *item); - -// Pop the item off the start of the list, if any -CZMQ_EXPORT void * - zlist_pop (zlist_t *self); - -// Checks if an item already is present. Uses compare method to determine if -// items are equal. If the compare method is NULL the check will only compare -// pointers. Returns true if item is present else false. -CZMQ_EXPORT bool - zlist_exists (zlist_t *self, void *item); - -// Remove the specified item from the list if present -CZMQ_EXPORT void - zlist_remove (zlist_t *self, void *item); - -// Make a copy of list. If the list has autofree set, the copied list will -// duplicate all items, which must be strings. Otherwise, the list will hold -// pointers back to the items in the original list. If list is null, returns -// NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zlist_t * - zlist_dup (zlist_t *self); - -// Purge all items from list -CZMQ_EXPORT void - zlist_purge (zlist_t *self); - -// Return number of items in the list -CZMQ_EXPORT size_t - zlist_size (zlist_t *self); - -// Sort the list. If the compare function is null, sorts the list by -// ascending key value using a straight ASCII comparison. If you specify -// a compare function, this decides how items are sorted. The sort is not -// stable, so may reorder items with the same keys. The algorithm used is -// combsort, a compromise between performance and simplicity. -CZMQ_EXPORT void - zlist_sort (zlist_t *self, zlist_compare_fn compare); - -// Set list for automatic item destruction; item values MUST be strings. -// By default a list item refers to a value held elsewhere. When you set -// this, each time you append or push a list item, zlist will take a copy -// of the string value. Then, when you destroy the list, it will free all -// item values automatically. If you use any other technique to allocate -// list values, you must free them explicitly before destroying the list. -// The usual technique is to pop list items and destroy them, until the -// list is empty. -CZMQ_EXPORT void - zlist_autofree (zlist_t *self); - -// Sets a compare function for this list. The function compares two items. -// It returns an integer less than, equal to, or greater than zero if the -// first item is found, respectively, to be less than, to match, or be -// greater than the second item. -// This function is used for sorting, removal and exists checking. -CZMQ_EXPORT void - zlist_comparefn (zlist_t *self, zlist_compare_fn fn); - -// Set a free function for the specified list item. When the item is -// destroyed, the free function, if any, is called on that item. -// Use this when list items are dynamically allocated, to ensure that -// you don't have memory leaks. You can pass 'free' or NULL as a free_fn. -// Returns the item, or NULL if there is no such item. -CZMQ_EXPORT void * - zlist_freefn (zlist_t *self, void *item, zlist_free_fn fn, bool at_tail); - -// Self test of this class. -CZMQ_EXPORT void - zlist_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zlistx.h b/phonelibs/zmq/x64/include/zlistx.h deleted file mode 100644 index 512637cef..000000000 --- a/phonelibs/zmq/x64/include/zlistx.h +++ /dev/null @@ -1,205 +0,0 @@ -/* ========================================================================= - zlistx - extended generic list container - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLISTX_H_INCLUDED__ -#define __ZLISTX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zlistx.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Destroy an item -typedef void (zlistx_destructor_fn) ( - void **item); - -// Duplicate an item -typedef void * (zlistx_duplicator_fn) ( - const void *item); - -// Compare two items, for sorting -typedef int (zlistx_comparator_fn) ( - const void *item1, const void *item2); - -// Create a new, empty list. -CZMQ_EXPORT zlistx_t * - zlistx_new (void); - -// Destroy a list. If an item destructor was specified, all items in the -// list are automatically destroyed as well. -CZMQ_EXPORT void - zlistx_destroy (zlistx_t **self_p); - -// Add an item to the head of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_start (zlistx_t *self, void *item); - -// Add an item to the tail of the list. Calls the item duplicator, if any, -// on the item. Resets cursor to list head. Returns an item handle on -// success, NULL if memory was exhausted. -CZMQ_EXPORT void * - zlistx_add_end (zlistx_t *self, void *item); - -// Return the number of items in the list -CZMQ_EXPORT size_t - zlistx_size (zlistx_t *self); - -// Return first item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_head (zlistx_t *self); - -// Return last item in the list, or null, leaves the cursor -CZMQ_EXPORT void * - zlistx_tail (zlistx_t *self); - -// Return the item at the head of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the head item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_first (zlistx_t *self); - -// Return the next item. At the end of the list (or in an empty list), -// returns NULL. Use repeated zlistx_next () calls to work through the list -// from zlistx_first (). First time, acts as zlistx_first(). -CZMQ_EXPORT void * - zlistx_next (zlistx_t *self); - -// Return the previous item. At the start of the list (or in an empty list), -// returns NULL. Use repeated zlistx_prev () calls to work through the list -// backwards from zlistx_last (). First time, acts as zlistx_last(). -CZMQ_EXPORT void * - zlistx_prev (zlistx_t *self); - -// Return the item at the tail of list. If the list is empty, returns NULL. -// Leaves cursor pointing at the tail item, or NULL if the list is empty. -CZMQ_EXPORT void * - zlistx_last (zlistx_t *self); - -// Returns the value of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_item (zlistx_t *self); - -// Returns the handle of the item at the cursor, or NULL if the cursor is -// not pointing to an item. -CZMQ_EXPORT void * - zlistx_cursor (zlistx_t *self); - -// Returns the item associated with the given list handle, or NULL if passed -// in handle is NULL. Asserts that the passed in handle points to a list element. -CZMQ_EXPORT void * - zlistx_handle_item (void *handle); - -// Find an item in the list, searching from the start. Uses the item -// comparator, if any, else compares item values directly. Returns the -// item handle found, or NULL. Sets the cursor to the found item, if any. -CZMQ_EXPORT void * - zlistx_find (zlistx_t *self, void *item); - -// Detach an item from the list, using its handle. The item is not modified, -// and the caller is responsible for destroying it if necessary. If handle is -// null, detaches the first item on the list. Returns item that was detached, -// or null if none was. If cursor was at item, moves cursor to previous item, -// so you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach (zlistx_t *self, void *handle); - -// Detach item at the cursor, if any, from the list. The item is not modified, -// and the caller is responsible for destroying it as necessary. Returns item -// that was detached, or null if none was. Moves cursor to previous item, so -// you can detach items while iterating forwards through a list. -CZMQ_EXPORT void * - zlistx_detach_cur (zlistx_t *self); - -// Delete an item, using its handle. Calls the item destructor is any is -// set. If handle is null, deletes the first item on the list. Returns 0 -// if an item was deleted, -1 if not. If cursor was at item, moves cursor -// to previous item, so you can delete items while iterating forwards -// through a list. -CZMQ_EXPORT int - zlistx_delete (zlistx_t *self, void *handle); - -// Move an item to the start of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_start (zlistx_t *self, void *handle); - -// Move an item to the end of the list, via its handle. -CZMQ_EXPORT void - zlistx_move_end (zlistx_t *self, void *handle); - -// Remove all items from the list, and destroy them if the item destructor -// is set. -CZMQ_EXPORT void - zlistx_purge (zlistx_t *self); - -// Sort the list. If an item comparator was set, calls that to compare -// items, otherwise compares on item value. The sort is not stable, so may -// reorder equal items. -CZMQ_EXPORT void - zlistx_sort (zlistx_t *self); - -// Create a new node and insert it into a sorted list. Calls the item -// duplicator, if any, on the item. If low_value is true, starts searching -// from the start of the list, otherwise searches from the end. Use the item -// comparator, if any, to find where to place the new node. Returns a handle -// to the new node, or NULL if memory was exhausted. Resets the cursor to the -// list head. -CZMQ_EXPORT void * - zlistx_insert (zlistx_t *self, void *item, bool low_value); - -// Move an item, specified by handle, into position in a sorted list. Uses -// the item comparator, if any, to determine the new location. If low_value -// is true, starts searching from the start of the list, otherwise searches -// from the end. -CZMQ_EXPORT void - zlistx_reorder (zlistx_t *self, void *handle, bool low_value); - -// Make a copy of the list; items are duplicated if you set a duplicator -// for the list, otherwise not. Copying a null reference returns a null -// reference. -CZMQ_EXPORT zlistx_t * - zlistx_dup (zlistx_t *self); - -// Set a user-defined deallocator for list items; by default items are not -// freed when the list is destroyed. -CZMQ_EXPORT void - zlistx_set_destructor (zlistx_t *self, zlistx_destructor_fn destructor); - -// Set a user-defined duplicator for list items; by default items are not -// copied when the list is duplicated. -CZMQ_EXPORT void - zlistx_set_duplicator (zlistx_t *self, zlistx_duplicator_fn duplicator); - -// Set a user-defined comparator for zlistx_find and zlistx_sort; the method -// must return -1, 0, or 1 depending on whether item1 is less than, equal to, -// or greater than, item2. -CZMQ_EXPORT void - zlistx_set_comparator (zlistx_t *self, zlistx_comparator_fn comparator); - -// Self test of this class. -CZMQ_EXPORT void - zlistx_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zloop.h b/phonelibs/zmq/x64/include/zloop.h deleted file mode 100644 index 83f46f282..000000000 --- a/phonelibs/zmq/x64/include/zloop.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ========================================================================= - zloop - event-driven reactor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZLOOP_H_INCLUDED__ -#define __ZLOOP_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zloop.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Callback function for reactor socket activity -typedef int (zloop_reader_fn) ( - zloop_t *loop, zsock_t *reader, void *arg); - -// Callback function for reactor events (low-level) -typedef int (zloop_fn) ( - zloop_t *loop, zmq_pollitem_t *item, void *arg); - -// Callback for reactor timer events -typedef int (zloop_timer_fn) ( - zloop_t *loop, int timer_id, void *arg); - -// Create a new zloop reactor -CZMQ_EXPORT zloop_t * - zloop_new (void); - -// Destroy a reactor -CZMQ_EXPORT void - zloop_destroy (zloop_t **self_p); - -// Register socket reader with the reactor. When the reader has messages, -// the reactor will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the same socket more than once, -// each instance will invoke its corresponding handler. -CZMQ_EXPORT int - zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg); - -// Cancel a socket reader from the reactor. If multiple readers exist for -// same socket, cancels ALL of them. -CZMQ_EXPORT void - zloop_reader_end (zloop_t *self, zsock_t *sock); - -// Configure a registered reader to ignore errors. If you do not set this, -// then readers that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_reader_set_tolerant (zloop_t *self, zsock_t *sock); - -// Register low-level libzmq pollitem with the reactor. When the pollitem -// is ready, will call the handler, passing the arg. Returns 0 if OK, -1 -// if there was an error. If you register the pollitem more than once, each -// instance will invoke its corresponding handler. A pollitem with -// socket=NULL and fd=0 means 'poll on FD zero'. -CZMQ_EXPORT int - zloop_poller (zloop_t *self, zmq_pollitem_t *item, zloop_fn handler, void *arg); - -// Cancel a pollitem from the reactor, specified by socket or FD. If both -// are specified, uses only socket. If multiple poll items exist for same -// socket/FD, cancels ALL of them. -CZMQ_EXPORT void - zloop_poller_end (zloop_t *self, zmq_pollitem_t *item); - -// Configure a registered poller to ignore errors. If you do not set this, -// then poller that have errors are removed from the reactor silently. -CZMQ_EXPORT void - zloop_poller_set_tolerant (zloop_t *self, zmq_pollitem_t *item); - -// Register a timer that expires after some delay and repeats some number of -// times. At each expiry, will call the handler, passing the arg. To run a -// timer forever, use 0 times. Returns a timer_id that is used to cancel the -// timer in the future. Returns -1 if there was an error. -CZMQ_EXPORT int - zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg); - -// Cancel a specific timer identified by a specific timer_id (as returned by -// zloop_timer). -CZMQ_EXPORT int - zloop_timer_end (zloop_t *self, int timer_id); - -// Register a ticket timer. Ticket timers are very fast in the case where -// you use a lot of timers (thousands), and frequently remove and add them. -// The main use case is expiry timers for servers that handle many clients, -// and which reset the expiry timer for each message received from a client. -// Whereas normal timers perform poorly as the number of clients grows, the -// cost of ticket timers is constant, no matter the number of clients. You -// must set the ticket delay using zloop_set_ticket_delay before creating a -// ticket. Returns a handle to the timer that you should use in -// zloop_ticket_reset and zloop_ticket_delete. -CZMQ_EXPORT void * - zloop_ticket (zloop_t *self, zloop_timer_fn handler, void *arg); - -// Reset a ticket timer, which moves it to the end of the ticket list and -// resets its execution time. This is a very fast operation. -CZMQ_EXPORT void - zloop_ticket_reset (zloop_t *self, void *handle); - -// Delete a ticket timer. We do not actually delete the ticket here, as -// other code may still refer to the ticket. We mark as deleted, and remove -// later and safely. -CZMQ_EXPORT void - zloop_ticket_delete (zloop_t *self, void *handle); - -// Set the ticket delay, which applies to all tickets. If you lower the -// delay and there are already tickets created, the results are undefined. -CZMQ_EXPORT void - zloop_set_ticket_delay (zloop_t *self, size_t ticket_delay); - -// Set hard limit on number of timers allowed. Setting more than a small -// number of timers (10-100) can have a dramatic impact on the performance -// of the reactor. For high-volume cases, use ticket timers. If the hard -// limit is reached, the reactor stops creating new timers and logs an -// error. -CZMQ_EXPORT void - zloop_set_max_timers (zloop_t *self, size_t max_timers); - -// Set verbose tracing of reactor on/off. The default verbose setting is -// off (false). -CZMQ_EXPORT void - zloop_set_verbose (zloop_t *self, bool verbose); - -// By default the reactor stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zloop_set_nonstop (zloop_t *self, bool nonstop); - -// Start the reactor. Takes control of the thread and returns when the 0MQ -// context is terminated or the process is interrupted, or any event handler -// returns -1. Event handlers may register new sockets and timers, and -// cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler. -CZMQ_EXPORT int - zloop_start (zloop_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zloop_test (bool verbose); - -// @end - - -// Deprecated method aliases -#define zloop_set_tolerant(s,i) zloop_poller_set_tolerant(s,i) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmonitor.h b/phonelibs/zmq/x64/include/zmonitor.h deleted file mode 100644 index b490bcb1a..000000000 --- a/phonelibs/zmq/x64/include/zmonitor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ========================================================================= - zmonitor - socket event monitor - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMONITOR_H_INCLUDED__ -#define __ZMONITOR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zmonitor actor instance to monitor a zsock_t socket: -// -// zactor_t *monitor = zactor_new (zmonitor, mysocket); -// -// Destroy zmonitor instance. -// -// zactor_destroy (&monitor); -// -// Enable verbose logging of commands and activity. -// -// zstr_send (monitor, "VERBOSE"); -// -// Listen to monitor event type (zero or types, ending in NULL): -// zstr_sendx (monitor, "LISTEN", type, ..., NULL); -// -// Events: -// CONNECTED -// CONNECT_DELAYED -// CONNECT_RETRIED -// LISTENING -// BIND_FAILED -// ACCEPTED -// ACCEPT_FAILED -// CLOSED -// CLOSE_FAILED -// DISCONNECTED -// MONITOR_STOPPED -// ALL -// -// Start monitor; after this, any further LISTEN commands are ignored. -// -// zstr_send (monitor, "START"); -// zsock_wait (monitor); -// -// Receive next monitor event: -// -// zmsg_t *msg = zmsg_recv (monitor); -// -// This is the zmonitor constructor as a zactor_fn; the argument can be -// a zactor_t, zsock_t, or libzmq void * socket: -CZMQ_EXPORT void - zmonitor (zsock_t *pipe, void *sock); - -// Selftest -CZMQ_EXPORT void - zmonitor_test (bool verbose); -// @end -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmq.h b/phonelibs/zmq/x64/include/zmq.h deleted file mode 100644 index 21a78eb65..000000000 --- a/phonelibs/zmq/x64/include/zmq.h +++ /dev/null @@ -1,643 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - - ************************************************************************* - NOTE to contributors. This file comprises the principal public contract - for ZeroMQ API users. Any change to this file supplied in a stable - release SHOULD not break existing applications. - In practice this means that the value of constants must not change, and - that old values may not be reused for new constants. - ************************************************************************* -*/ - -#ifndef __ZMQ_H_INCLUDED__ -#define __ZMQ_H_INCLUDED__ - -/* Version macros for compile-time API version detection */ -#define ZMQ_VERSION_MAJOR 4 -#define ZMQ_VERSION_MINOR 2 -#define ZMQ_VERSION_PATCH 2 - -#define ZMQ_MAKE_VERSION(major, minor, patch) \ - ((major) * 10000 + (minor) * 100 + (patch)) -#define ZMQ_VERSION \ - ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined _WIN32_WCE -#include -#endif -#include -#include -#if defined _WIN32 -// Set target version to Windows Server 2008, Windows Vista or higher. -// Windows XP (0x0501) is supported but without client & server socket types. -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - -#ifdef __MINGW32__ -// Require Windows XP or higher with MinGW for getaddrinfo(). -#if(_WIN32_WINNT >= 0x0600) -#else -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#endif -#include -#endif - -/* Handle DSO symbol visibility */ -#if defined _WIN32 -# if defined ZMQ_STATIC -# define ZMQ_EXPORT -# elif defined DLL_EXPORT -# define ZMQ_EXPORT __declspec(dllexport) -# else -# define ZMQ_EXPORT __declspec(dllimport) -# endif -#else -# if defined __SUNPRO_C || defined __SUNPRO_CC -# define ZMQ_EXPORT __global -# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER -# define ZMQ_EXPORT __attribute__ ((visibility("default"))) -# else -# define ZMQ_EXPORT -# endif -#endif - -/* Define integer types needed for event interface */ -#define ZMQ_DEFINED_STDINT 1 -#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS -# include -#elif defined _MSC_VER && _MSC_VER < 1600 -# ifndef int32_t - typedef __int32 int32_t; -# endif -# ifndef uint16_t - typedef unsigned __int16 uint16_t; -# endif -# ifndef uint8_t - typedef unsigned __int8 uint8_t; -# endif -#else -# include -#endif - -// 32-bit AIX's pollfd struct members are called reqevents and rtnevents so it -// defines compatibility macros for them. Need to include that header first to -// stop build failures since zmq_pollset_t defines them as events and revents. -#ifdef ZMQ_HAVE_AIX - #include -#endif - - -/******************************************************************************/ -/* 0MQ errors. */ -/******************************************************************************/ - -/* A number random enough not to collide with different errno ranges on */ -/* different OSes. The assumption is that error_t is at least 32-bit type. */ -#define ZMQ_HAUSNUMERO 156384712 - -/* On Windows platform some of the standard POSIX errnos are not defined. */ -#ifndef ENOTSUP -#define ENOTSUP (ZMQ_HAUSNUMERO + 1) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2) -#endif -#ifndef ENOBUFS -#define ENOBUFS (ZMQ_HAUSNUMERO + 3) -#endif -#ifndef ENETDOWN -#define ENETDOWN (ZMQ_HAUSNUMERO + 4) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (ZMQ_HAUSNUMERO + 5) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (ZMQ_HAUSNUMERO + 8) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (ZMQ_HAUSNUMERO + 9) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (ZMQ_HAUSNUMERO + 10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (ZMQ_HAUSNUMERO + 12) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (ZMQ_HAUSNUMERO + 13) -#endif -#ifndef ECONNRESET -#define ECONNRESET (ZMQ_HAUSNUMERO + 14) -#endif -#ifndef ENOTCONN -#define ENOTCONN (ZMQ_HAUSNUMERO + 15) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17) -#endif -#ifndef ENETRESET -#define ENETRESET (ZMQ_HAUSNUMERO + 18) -#endif - -/* Native 0MQ error codes. */ -#define EFSM (ZMQ_HAUSNUMERO + 51) -#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52) -#define ETERM (ZMQ_HAUSNUMERO + 53) -#define EMTHREAD (ZMQ_HAUSNUMERO + 54) - -/* This function retrieves the errno as it is known to 0MQ library. The goal */ -/* of this function is to make the code 100% portable, including where 0MQ */ -/* compiled with certain CRT library (on Windows) is linked to an */ -/* application that uses different CRT library. */ -ZMQ_EXPORT int zmq_errno (void); - -/* Resolves system errors and 0MQ errors to human-readable string. */ -ZMQ_EXPORT const char *zmq_strerror (int errnum); - -/* Run-time API version detection */ -ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch); - -/******************************************************************************/ -/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */ -/******************************************************************************/ - -/* Context options */ -#define ZMQ_IO_THREADS 1 -#define ZMQ_MAX_SOCKETS 2 -#define ZMQ_SOCKET_LIMIT 3 -#define ZMQ_THREAD_PRIORITY 3 -#define ZMQ_THREAD_SCHED_POLICY 4 -#define ZMQ_MAX_MSGSZ 5 - -/* Default for new contexts */ -#define ZMQ_IO_THREADS_DFLT 1 -#define ZMQ_MAX_SOCKETS_DFLT 1023 -#define ZMQ_THREAD_PRIORITY_DFLT -1 -#define ZMQ_THREAD_SCHED_POLICY_DFLT -1 - -ZMQ_EXPORT void *zmq_ctx_new (void); -ZMQ_EXPORT int zmq_ctx_term (void *context); -ZMQ_EXPORT int zmq_ctx_shutdown (void *context); -ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval); -ZMQ_EXPORT int zmq_ctx_get (void *context, int option); - -/* Old (legacy) API */ -ZMQ_EXPORT void *zmq_init (int io_threads); -ZMQ_EXPORT int zmq_term (void *context); -ZMQ_EXPORT int zmq_ctx_destroy (void *context); - - -/******************************************************************************/ -/* 0MQ message definition. */ -/******************************************************************************/ - -/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer - * alignment and raise sigbus on violations. Make sure applications allocate - * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue. - */ -typedef struct zmq_msg_t { -#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \ - (defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - unsigned char _ [64] __attribute__ ((aligned (sizeof (void *)))); -#elif defined (_MSC_VER) && (defined (_M_X64) || defined (_M_ARM64)) - __declspec (align (8)) unsigned char _ [64]; -#elif defined (_MSC_VER) && (defined (_M_IX86) || defined (_M_ARM_ARMV7VE)) - __declspec (align (4)) unsigned char _ [64]; -#else - unsigned char _ [64]; -#endif -} zmq_msg_t; - -typedef void (zmq_free_fn) (void *data, void *hint); - -ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size); -ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint); -ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags); -ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); -ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); -ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); -ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); - -/******************************************************************************/ -/* 0MQ socket definition. */ -/******************************************************************************/ - -/* Socket types. */ -#define ZMQ_PAIR 0 -#define ZMQ_PUB 1 -#define ZMQ_SUB 2 -#define ZMQ_REQ 3 -#define ZMQ_REP 4 -#define ZMQ_DEALER 5 -#define ZMQ_ROUTER 6 -#define ZMQ_PULL 7 -#define ZMQ_PUSH 8 -#define ZMQ_XPUB 9 -#define ZMQ_XSUB 10 -#define ZMQ_STREAM 11 - -/* Deprecated aliases */ -#define ZMQ_XREQ ZMQ_DEALER -#define ZMQ_XREP ZMQ_ROUTER - -/* Socket options. */ -#define ZMQ_AFFINITY 4 -#define ZMQ_IDENTITY 5 -#define ZMQ_SUBSCRIBE 6 -#define ZMQ_UNSUBSCRIBE 7 -#define ZMQ_RATE 8 -#define ZMQ_RECOVERY_IVL 9 -#define ZMQ_SNDBUF 11 -#define ZMQ_RCVBUF 12 -#define ZMQ_RCVMORE 13 -#define ZMQ_FD 14 -#define ZMQ_EVENTS 15 -#define ZMQ_TYPE 16 -#define ZMQ_LINGER 17 -#define ZMQ_RECONNECT_IVL 18 -#define ZMQ_BACKLOG 19 -#define ZMQ_RECONNECT_IVL_MAX 21 -#define ZMQ_MAXMSGSIZE 22 -#define ZMQ_SNDHWM 23 -#define ZMQ_RCVHWM 24 -#define ZMQ_MULTICAST_HOPS 25 -#define ZMQ_RCVTIMEO 27 -#define ZMQ_SNDTIMEO 28 -#define ZMQ_LAST_ENDPOINT 32 -#define ZMQ_ROUTER_MANDATORY 33 -#define ZMQ_TCP_KEEPALIVE 34 -#define ZMQ_TCP_KEEPALIVE_CNT 35 -#define ZMQ_TCP_KEEPALIVE_IDLE 36 -#define ZMQ_TCP_KEEPALIVE_INTVL 37 -#define ZMQ_IMMEDIATE 39 -#define ZMQ_XPUB_VERBOSE 40 -#define ZMQ_ROUTER_RAW 41 -#define ZMQ_IPV6 42 -#define ZMQ_MECHANISM 43 -#define ZMQ_PLAIN_SERVER 44 -#define ZMQ_PLAIN_USERNAME 45 -#define ZMQ_PLAIN_PASSWORD 46 -#define ZMQ_CURVE_SERVER 47 -#define ZMQ_CURVE_PUBLICKEY 48 -#define ZMQ_CURVE_SECRETKEY 49 -#define ZMQ_CURVE_SERVERKEY 50 -#define ZMQ_PROBE_ROUTER 51 -#define ZMQ_REQ_CORRELATE 52 -#define ZMQ_REQ_RELAXED 53 -#define ZMQ_CONFLATE 54 -#define ZMQ_ZAP_DOMAIN 55 -#define ZMQ_ROUTER_HANDOVER 56 -#define ZMQ_TOS 57 -#define ZMQ_CONNECT_RID 61 -#define ZMQ_GSSAPI_SERVER 62 -#define ZMQ_GSSAPI_PRINCIPAL 63 -#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64 -#define ZMQ_GSSAPI_PLAINTEXT 65 -#define ZMQ_HANDSHAKE_IVL 66 -#define ZMQ_SOCKS_PROXY 68 -#define ZMQ_XPUB_NODROP 69 -#define ZMQ_BLOCKY 70 -#define ZMQ_XPUB_MANUAL 71 -#define ZMQ_XPUB_WELCOME_MSG 72 -#define ZMQ_STREAM_NOTIFY 73 -#define ZMQ_INVERT_MATCHING 74 -#define ZMQ_HEARTBEAT_IVL 75 -#define ZMQ_HEARTBEAT_TTL 76 -#define ZMQ_HEARTBEAT_TIMEOUT 77 -#define ZMQ_XPUB_VERBOSER 78 -#define ZMQ_CONNECT_TIMEOUT 79 -#define ZMQ_TCP_MAXRT 80 -#define ZMQ_THREAD_SAFE 81 -#define ZMQ_MULTICAST_MAXTPDU 84 -#define ZMQ_VMCI_BUFFER_SIZE 85 -#define ZMQ_VMCI_BUFFER_MIN_SIZE 86 -#define ZMQ_VMCI_BUFFER_MAX_SIZE 87 -#define ZMQ_VMCI_CONNECT_TIMEOUT 88 -#define ZMQ_USE_FD 89 - -/* Message options */ -#define ZMQ_MORE 1 -#define ZMQ_SHARED 3 - -/* Send/recv options. */ -#define ZMQ_DONTWAIT 1 -#define ZMQ_SNDMORE 2 - -/* Security mechanisms */ -#define ZMQ_NULL 0 -#define ZMQ_PLAIN 1 -#define ZMQ_CURVE 2 -#define ZMQ_GSSAPI 3 - -/* RADIO-DISH protocol */ -#define ZMQ_GROUP_MAX_LENGTH 15 - -/* Deprecated options and aliases */ -#define ZMQ_TCP_ACCEPT_FILTER 38 -#define ZMQ_IPC_FILTER_PID 58 -#define ZMQ_IPC_FILTER_UID 59 -#define ZMQ_IPC_FILTER_GID 60 -#define ZMQ_IPV4ONLY 31 -#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE -#define ZMQ_NOBLOCK ZMQ_DONTWAIT -#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY -#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY - -/* Deprecated Message options */ -#define ZMQ_SRCFD 2 - -/******************************************************************************/ -/* 0MQ socket events and monitoring */ -/******************************************************************************/ - -/* Socket transport events (TCP, IPC and TIPC only) */ - -#define ZMQ_EVENT_CONNECTED 0x0001 -#define ZMQ_EVENT_CONNECT_DELAYED 0x0002 -#define ZMQ_EVENT_CONNECT_RETRIED 0x0004 -#define ZMQ_EVENT_LISTENING 0x0008 -#define ZMQ_EVENT_BIND_FAILED 0x0010 -#define ZMQ_EVENT_ACCEPTED 0x0020 -#define ZMQ_EVENT_ACCEPT_FAILED 0x0040 -#define ZMQ_EVENT_CLOSED 0x0080 -#define ZMQ_EVENT_CLOSE_FAILED 0x0100 -#define ZMQ_EVENT_DISCONNECTED 0x0200 -#define ZMQ_EVENT_MONITOR_STOPPED 0x0400 -#define ZMQ_EVENT_ALL 0xFFFF - -ZMQ_EXPORT void *zmq_socket (void *, int type); -ZMQ_EXPORT int zmq_close (void *s); -ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval, - size_t optvallen); -ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval, - size_t *optvallen); -ZMQ_EXPORT int zmq_bind (void *s, const char *addr); -ZMQ_EXPORT int zmq_connect (void *s, const char *addr); -ZMQ_EXPORT int zmq_unbind (void *s, const char *addr); -ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr); -ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags); -ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events); - - -/******************************************************************************/ -/* I/O multiplexing. */ -/******************************************************************************/ - -#define ZMQ_POLLIN 1 -#define ZMQ_POLLOUT 2 -#define ZMQ_POLLERR 4 -#define ZMQ_POLLPRI 8 - -typedef struct zmq_pollitem_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - short events; - short revents; -} zmq_pollitem_t; - -#define ZMQ_POLLITEMS_DFLT 16 - -ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); - -/******************************************************************************/ -/* Message proxying */ -/******************************************************************************/ - -ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture); -ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control); - -/******************************************************************************/ -/* Probe library capabilities */ -/******************************************************************************/ - -#define ZMQ_HAS_CAPABILITIES 1 -ZMQ_EXPORT int zmq_has (const char *capability); - -/* Deprecated aliases */ -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -/* Deprecated methods */ -ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend); -ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags); -ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags); -struct iovec; -ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags); -ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags); - -/******************************************************************************/ -/* Encryption functions */ -/******************************************************************************/ - -/* Encode data with Z85 encoding. Returns encoded data */ -ZMQ_EXPORT char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size); - -/* Decode data with Z85 encoding. Returns decoded data */ -ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string); - -/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); - -/* Derive the z85-encoded public key from the z85-encoded secret key. */ -/* Returns 0 on success. */ -ZMQ_EXPORT int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); - -/******************************************************************************/ -/* Atomic utility methods */ -/******************************************************************************/ - -ZMQ_EXPORT void *zmq_atomic_counter_new (void); -ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value); -ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter); -ZMQ_EXPORT int zmq_atomic_counter_value (void *counter); -ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p); - - -/******************************************************************************/ -/* These functions are not documented by man pages -- use at your own risk. */ -/* If you need these to be part of the formal ZMQ API, then (a) write a man */ -/* page, and (b) write a test case in tests. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -ZMQ_EXPORT void *zmq_stopwatch_start (void); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -ZMQ_EXPORT void zmq_sleep (int seconds_); - -typedef void (zmq_thread_fn) (void*); - -/* Start a thread. Returns a handle to the thread. */ -ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg); - -/* Wait for thread to complete then free up resources. */ -ZMQ_EXPORT void zmq_threadclose (void* thread); - - -/******************************************************************************/ -/* These functions are DRAFT and disabled in stable releases, and subject to */ -/* change at ANY time until declared stable. */ -/******************************************************************************/ - -#ifdef ZMQ_BUILD_DRAFT_API - -/* DRAFT Socket types. */ -#define ZMQ_SERVER 12 -#define ZMQ_CLIENT 13 -#define ZMQ_RADIO 14 -#define ZMQ_DISH 15 -#define ZMQ_GATHER 16 -#define ZMQ_SCATTER 17 -#define ZMQ_DGRAM 18 - -/* DRAFT 0MQ socket events and monitoring */ -#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800 -#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000 - -/* DRAFT Context options */ -#define ZMQ_MSG_T_SIZE 6 - -/* DRAFT Socket methods. */ -ZMQ_EXPORT int zmq_join (void *s, const char *group); -ZMQ_EXPORT int zmq_leave (void *s, const char *group); - -/* DRAFT Msg methods. */ -ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id); -ZMQ_EXPORT uint32_t zmq_msg_routing_id(zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_set_group(zmq_msg_t *msg, const char *group); -ZMQ_EXPORT const char *zmq_msg_group(zmq_msg_t *msg); - -/******************************************************************************/ -/* Poller polling on sockets,fd and thread-safe sockets */ -/******************************************************************************/ - -#define ZMQ_HAVE_POLLER - -typedef struct zmq_poller_event_t -{ - void *socket; -#if defined _WIN32 - SOCKET fd; -#else - int fd; -#endif - void *user_data; - short events; -} zmq_poller_event_t; - -ZMQ_EXPORT void *zmq_poller_new (void); -ZMQ_EXPORT int zmq_poller_destroy (void **poller_p); -ZMQ_EXPORT int zmq_poller_add (void *poller, void *socket, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify (void *poller, void *socket, short events); -ZMQ_EXPORT int zmq_poller_remove (void *poller, void *socket); -ZMQ_EXPORT int zmq_poller_wait (void *poller, zmq_poller_event_t *event, long timeout); -ZMQ_EXPORT int zmq_poller_wait_all (void *poller, zmq_poller_event_t *events, int n_events, long timeout); - -#if defined _WIN32 -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, SOCKET fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, SOCKET fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, SOCKET fd); -#else -ZMQ_EXPORT int zmq_poller_add_fd (void *poller, int fd, void *user_data, short events); -ZMQ_EXPORT int zmq_poller_modify_fd (void *poller, int fd, short events); -ZMQ_EXPORT int zmq_poller_remove_fd (void *poller, int fd); -#endif - -/******************************************************************************/ -/* Scheduling timers */ -/******************************************************************************/ - -#define ZMQ_HAVE_TIMERS - -typedef void (zmq_timer_fn)(int timer_id, void *arg); - -ZMQ_EXPORT void *zmq_timers_new (void); -ZMQ_EXPORT int zmq_timers_destroy (void **timers_p); -ZMQ_EXPORT int zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg); -ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id); -ZMQ_EXPORT int zmq_timers_set_interval (void *timers, int timer_id, size_t interval); -ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id); -ZMQ_EXPORT long zmq_timers_timeout (void *timers); -ZMQ_EXPORT int zmq_timers_execute (void *timers); - -#endif // ZMQ_BUILD_DRAFT_API - - -#undef ZMQ_EXPORT - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zmq_utils.h b/phonelibs/zmq/x64/include/zmq_utils.h deleted file mode 100644 index f29638d55..000000000 --- a/phonelibs/zmq/x64/include/zmq_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file - - This file is part of libzmq, the ZeroMQ core engine in C++. - - libzmq is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License (LGPL) as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - As a special exception, the Contributors give you permission to link - this library with independent modules to produce an executable, - regardless of the license terms of these independent modules, and to - copy and distribute the resulting executable under terms of your choice, - provided that you also meet, for each linked independent module, the - terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. - If you modify this library, you must extend this exception to your - version of the library. - - libzmq is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -/* This file is deprecated, and all its functionality provided by zmq.h */ -/* Note that -Wpedantic compilation requires GCC to avoid using its custom - extensions such as #warning, hence the trick below. Also, pragmas for - warnings or other messages are not standard, not portable, and not all - compilers even have an equivalent concept. - So in the worst case, this include file is treated as silently empty. */ - -#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wcpp" -#pragma GCC diagnostic ignored "-Werror" -#pragma GCC diagnostic ignored "-Wall" -#endif -#pragma message("Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.") -#if defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif -#endif diff --git a/phonelibs/zmq/x64/include/zmsg.h b/phonelibs/zmq/x64/include/zmsg.h deleted file mode 100644 index d8a84d1f4..000000000 --- a/phonelibs/zmq/x64/include/zmsg.h +++ /dev/null @@ -1,280 +0,0 @@ -/* ========================================================================= - zmsg - working with multipart messages - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZMSG_H_INCLUDED__ -#define __ZMSG_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zmsg.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new empty message object -CZMQ_EXPORT zmsg_t * - zmsg_new (void); - -// Receive message from socket, returns zmsg_t object or NULL if the recv -// was interrupted. Does a blocking recv. If you want to not block then use -// the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input -// before receiving. -CZMQ_EXPORT zmsg_t * - zmsg_recv (void *source); - -// Load/append an open file into new message, return the message. -// Returns NULL if the message could not be loaded. -CZMQ_EXPORT zmsg_t * - zmsg_load (FILE *file); - -// Decodes a serialized message frame created by zmsg_encode () and returns -// a new zmsg_t object. Returns NULL if the frame was badly formatted or -// there was insufficient memory to work. -CZMQ_EXPORT zmsg_t * - zmsg_decode (zframe_t *frame); - -// Generate a signal message encoding the given status. A signal is a short -// message carrying a 1-byte success/failure code (by convention, 0 means -// OK). Signals are encoded to be distinguishable from "normal" messages. -CZMQ_EXPORT zmsg_t * - zmsg_new_signal (byte status); - -// Destroy a message object and all frames it contains -CZMQ_EXPORT void - zmsg_destroy (zmsg_t **self_p); - -// Send message to destination socket, and destroy the message after sending -// it successfully. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_send (zmsg_t **self_p, void *dest); - -// Send message to destination socket as part of a multipart sequence, and -// destroy the message after sending it successfully. Note that after a -// zmsg_sendm, you must call zmsg_send or another method that sends a final -// message part. If the message has no frames, sends nothing but destroys -// the message anyhow. Nullifies the caller's reference to the message (as -// it is a destructor). -CZMQ_EXPORT int - zmsg_sendm (zmsg_t **self_p, void *dest); - -// Return size of message, i.e. number of frames (0 or more). -CZMQ_EXPORT size_t - zmsg_size (zmsg_t *self); - -// Return total size of all frames in message. -CZMQ_EXPORT size_t - zmsg_content_size (zmsg_t *self); - -// Push frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not -// nullify the caller's frame reference. -CZMQ_EXPORT int - zmsg_prepend (zmsg_t *self, zframe_t **frame_p); - -// Add frame to the end of the message, i.e. after all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success. Deprecates zmsg_add, which did not nullify the -// caller's frame reference. -CZMQ_EXPORT int - zmsg_append (zmsg_t *self, zframe_t **frame_p); - -// Remove first frame from message, if any. Returns frame, or NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_pop (zmsg_t *self); - -// Push block of memory to front of message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushmem (zmsg_t *self, const void *data, size_t size); - -// Add block of memory to the end of the message, as a new frame. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addmem (zmsg_t *self, const void *data, size_t size); - -// Push string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstr (zmsg_t *self, const char *string); - -// Push string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstr (zmsg_t *self, const char *string); - -// Push formatted string as new frame to front of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Push formatted string as new frame to end of message. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Pop frame off front of message, return as fresh string. If there were -// no more frames in the message, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zmsg_popstr (zmsg_t *self); - -// Push encoded message as a new frame. Message takes ownership of -// submessage, so the original is destroyed in this call. Returns 0 on -// success, -1 on error. -CZMQ_EXPORT int - zmsg_addmsg (zmsg_t *self, zmsg_t **msg_p); - -// Remove first submessage from message, if any. Returns zmsg_t, or NULL if -// decoding was not successful. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_popmsg (zmsg_t *self); - -// Remove specified frame from list, if present. Does not destroy frame. -CZMQ_EXPORT void - zmsg_remove (zmsg_t *self, zframe_t *frame); - -// Set cursor to first frame in message. Returns frame, or NULL, if the -// message is empty. Use this to navigate the frames as a list. -CZMQ_EXPORT zframe_t * - zmsg_first (zmsg_t *self); - -// Return the next frame. If there are no more frames, returns NULL. To move -// to the first frame call zmsg_first(). Advances the cursor. -CZMQ_EXPORT zframe_t * - zmsg_next (zmsg_t *self); - -// Return the last frame. If there are no frames, returns NULL. -CZMQ_EXPORT zframe_t * - zmsg_last (zmsg_t *self); - -// Save message to an open file, return 0 if OK, else -1. The message is -// saved as a series of frames, each with length and data. Note that the -// file is NOT guaranteed to be portable between operating systems, not -// versions of CZMQ. The file format is at present undocumented and liable -// to arbitrary change. -CZMQ_EXPORT int - zmsg_save (zmsg_t *self, FILE *file); - -// Serialize multipart message to a single message frame. Use this method -// to send structured messages across transports that do not support -// multipart data. Allocates and returns a new frame containing the -// serialized message. To decode a serialized message frame, use -// zmsg_decode (). -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zframe_t * - zmsg_encode (zmsg_t *self); - -// Create copy of message, as new message object. Returns a fresh zmsg_t -// object. If message is null, or memory was exhausted, returns null. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT zmsg_t * - zmsg_dup (zmsg_t *self); - -// Send message to zsys log sink (may be stdout, or system facility as -// configured by zsys_set_logstream). -CZMQ_EXPORT void - zmsg_print (zmsg_t *self); - -// Return true if the two messages have the same number of frames and each -// frame in the first message is identical to the corresponding frame in the -// other message. As with zframe_eq, return false if either message is NULL. -CZMQ_EXPORT bool - zmsg_eq (zmsg_t *self, zmsg_t *other); - -// Return signal value, 0 or greater, if message is a signal, -1 if not. -CZMQ_EXPORT int - zmsg_signal (zmsg_t *self); - -// Probe the supplied object, and report if it looks like a zmsg_t. -CZMQ_EXPORT bool - zmsg_is (void *self); - -// Self test of this class. -CZMQ_EXPORT void - zmsg_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Return message routing ID, if the message came from a ZMQ_SERVER socket. -// Else returns zero. -CZMQ_EXPORT uint32_t - zmsg_routing_id (zmsg_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on message. This is used if/when the message is sent to a -// ZMQ_SERVER socket. -CZMQ_EXPORT void - zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as over-engineered, poor style -// Pop frame off front of message, caller now owns frame -// If next frame is empty, pops and destroys that empty frame. -CZMQ_EXPORT zframe_t * - zmsg_unwrap (zmsg_t *self); - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive message from socket, returns zmsg_t object, or NULL either if -// there was no input waiting, or the recv was interrupted. -CZMQ_EXPORT zmsg_t * - zmsg_recv_nowait (void *source); - -// DEPRECATED as unsafe -- does not nullify frame reference. -// Push frame plus empty frame to front of message, before first frame. -// Message takes ownership of frame, will destroy it when message is sent. -CZMQ_EXPORT void - zmsg_wrap (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next + 1 stable release -// Add frame to the front of the message, i.e. before all other frames. -// Message takes ownership of frame, will destroy it when message is sent. -// Returns 0 on success, -1 on error. -CZMQ_EXPORT int - zmsg_push (zmsg_t *self, zframe_t *frame); - -// DEPRECATED - will be removed for next stable release -CZMQ_EXPORT int - zmsg_add (zmsg_t *self, zframe_t *frame); - -// DEPRECATED as inconsistent; breaks principle that logging should all go -// to a single destination. -// Print message to open stream -// Truncates to first 10 frames, for readability. -CZMQ_EXPORT void - zmsg_fprint (zmsg_t *self, FILE *file); - -// Compiler hints -CZMQ_EXPORT int zmsg_addstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); -CZMQ_EXPORT int zmsg_pushstrf (zmsg_t *self, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -// Deprecated method aliases -#define zmsg_dump(s) zmsg_print(s) -#define zmsg_dump_to_stream(s,F) zmsg_fprint(s,F) - -#endif diff --git a/phonelibs/zmq/x64/include/zpoller.h b/phonelibs/zmq/x64/include/zpoller.h deleted file mode 100644 index 3b394c351..000000000 --- a/phonelibs/zmq/x64/include/zpoller.h +++ /dev/null @@ -1,87 +0,0 @@ -/* ========================================================================= - zpoller - trivial socket poller class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __zpoller_H_INCLUDED__ -#define __zpoller_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zpoller.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create new poller, specifying zero or more readers. The list of -// readers ends in a NULL. Each reader can be a zsock_t instance, a -// zactor_t instance, a libzmq socket (void *), or a file handle. -CZMQ_EXPORT zpoller_t * - zpoller_new (void *reader, ...); - -// Destroy a poller -CZMQ_EXPORT void - zpoller_destroy (zpoller_t **self_p); - -// Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may -// be a libzmq void * socket, a zsock_t instance, or a zactor_t instance. -CZMQ_EXPORT int - zpoller_add (zpoller_t *self, void *reader); - -// Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader -// must have been passed during construction, or in an zpoller_add () call. -CZMQ_EXPORT int - zpoller_remove (zpoller_t *self, void *reader); - -// By default the poller stops if the process receives a SIGINT or SIGTERM -// signal. This makes it impossible to shut-down message based architectures -// like zactors. This method lets you switch off break handling. The default -// nonstop setting is off (false). -CZMQ_EXPORT void - zpoller_set_nonstop (zpoller_t *self, bool nonstop); - -// Poll the registered readers for I/O, return first reader that has input. -// The reader will be a libzmq void * socket, or a zsock_t or zactor_t -// instance as specified in zpoller_new/zpoller_add. The timeout should be -// zero or greater, or -1 to wait indefinitely. Socket priority is defined -// by their order in the poll list. If you need a balanced poll, use the low -// level zmq_poll method directly. If the poll call was interrupted (SIGINT), -// or the ZMQ context was destroyed, or the timeout expired, returns NULL. -// You can test the actual exit condition by calling zpoller_expired () and -// zpoller_terminated (). The timeout is in msec. -CZMQ_EXPORT void * - zpoller_wait (zpoller_t *self, int timeout); - -// Return true if the last zpoller_wait () call ended because the timeout -// expired, without any error. -CZMQ_EXPORT bool - zpoller_expired (zpoller_t *self); - -// Return true if the last zpoller_wait () call ended because the process -// was interrupted, or the parent context was destroyed. -CZMQ_EXPORT bool - zpoller_terminated (zpoller_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zpoller_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/phonelibs/zmq/x64/include/zproc.h b/phonelibs/zmq/x64/include/zproc.h deleted file mode 100644 index 4fd3fcf44..000000000 --- a/phonelibs/zmq/x64/include/zproc.h +++ /dev/null @@ -1,168 +0,0 @@ -/* ========================================================================= - zproc - process configuration and status - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZPROC_H_INCLUDED -#define ZPROC_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zproc.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Returns CZMQ version as a single 6-digit integer encoding the major -// version (x 10000), the minor version (x 100) and the patch. -CZMQ_EXPORT int - zproc_czmq_version (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the process received a SIGINT or SIGTERM signal. -// It is good practice to use this method to exit any infinite loop -// processing messages. -CZMQ_EXPORT bool - zproc_interrupted (void); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the underlying libzmq supports CURVE security. -CZMQ_EXPORT bool - zproc_has_curve (void); - -// *** Draft method, for development use, may change without warning *** -// Return current host name, for use in public tcp:// endpoints. -// If the host name is not resolvable, returns NULL. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zproc_hostname (void); - -// *** Draft method, for development use, may change without warning *** -// Move the current process into the background. The precise effect -// depends on the operating system. On POSIX boxes, moves to a specified -// working directory (if specified), closes all file handles, reopens -// stdin, stdout, and stderr to the null device, and sets the process to -// ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there -// was an error. -CZMQ_EXPORT void - zproc_daemonize (const char *workdir); - -// *** Draft method, for development use, may change without warning *** -// Drop the process ID into the lockfile, with exclusive lock, and -// switch the process to the specified group and/or user. Any of the -// arguments may be null, indicating a no-op. Returns 0 on success, -// -1 on failure. Note if you combine this with zsys_daemonize, run -// after, not before that method, or the lockfile will hold the wrong -// process ID. -CZMQ_EXPORT void - zproc_run_as (const char *lockfile, const char *group, const char *user); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_io_threads (size_t io_threads); - -// *** Draft method, for development use, may change without warning *** -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zproc_set_max_sockets (size_t max_sockets); - -// *** Draft method, for development use, may change without warning *** -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zproc_set_biface (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zproc_biface (void); - -// *** Draft method, for development use, may change without warning *** -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zproc_set_log_ident (const char *value); - -// *** Draft method, for development use, may change without warning *** -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zproc_set_log_sender (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zproc_set_log_system (bool logsystem); - -// *** Draft method, for development use, may change without warning *** -// Log error condition - highest priority -CZMQ_EXPORT void - zproc_log_error (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log warning condition - high priority -CZMQ_EXPORT void - zproc_log_warning (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zproc_log_notice (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log informational message - low priority -CZMQ_EXPORT void - zproc_log_info (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zproc_log_debug (const char *format, ...) CHECK_PRINTF (1); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - zproc_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zproxy.h b/phonelibs/zmq/x64/include/zproxy.h deleted file mode 100644 index f672c5e72..000000000 --- a/phonelibs/zmq/x64/include/zproxy.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ========================================================================= - zproxy - run a steerable proxy in the background - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZPROXY_H_INCLUDED__ -#define __ZPROXY_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Create new zproxy actor instance. The proxy switches messages between -// a frontend socket and a backend socket; use the FRONTEND and BACKEND -// commands to configure these: -// -// zactor_t *proxy = zactor_new (zproxy, NULL); -// -// Destroy zproxy instance. This destroys the two sockets and stops any -// message flow between them: -// -// zactor_destroy (&proxy); -// -// Note that all zproxy commands are synchronous, so your application always -// waits for a signal from the actor after each command. -// -// Enable verbose logging of commands and activity: -// -// zstr_send (proxy, "VERBOSE"); -// zsock_wait (proxy); -// -// Specify frontend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Specify backend socket type -- see zsock_type_str () -- and attach to -// endpoints, see zsock_attach (). Note that a proxy socket is always -// serverish: -// -// zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL); -// zsock_wait (proxy); -// -// Capture all proxied messages; these are delivered to the application -// via an inproc PULL socket that you have already bound to the specified -// endpoint: -// -// zstr_sendx (proxy, "CAPTURE", endpoint, NULL); -// zsock_wait (proxy); -// -// Pause the proxy. A paused proxy will cease processing messages, causing -// them to be queued up and potentially hit the high-water mark on the -// frontend or backend socket, causing messages to be dropped, or writing -// applications to block: -// -// zstr_sendx (proxy, "PAUSE", NULL); -// zsock_wait (proxy); -// -// Resume the proxy. Note that the proxy starts automatically as soon as it -// has a properly attached frontend and backend socket: -// -// zstr_sendx (proxy, "RESUME", NULL); -// zsock_wait (proxy); -// -// Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_zap_domain (). Call before binding socket: -// -// zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL); -// zsock_wait (proxy); -// -// Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_plain_server (). Call before binding socket: -// -// zstr_sendx (proxy, "PLAIN", "BACKEND", NULL); -// zsock_wait (proxy); -// -// Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy -// socket -- see zsock_set_curve_server () -- specifying both the public and -// secret keys of a certificate as Z85 armored strings -- see -// zcert_public_txt () and zcert_secret_txt (). Call before binding socket: -// -// zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL); -// zsock_wait (proxy); -// -// This is the zproxy constructor as a zactor_fn; the argument is a -// character string specifying frontend and backend socket types as two -// uppercase strings separated by a hyphen: -CZMQ_EXPORT void - zproxy (zsock_t *pipe, void *unused); - -// Selftest -CZMQ_EXPORT void - zproxy_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zrex.h b/phonelibs/zmq/x64/include/zrex.h deleted file mode 100644 index 8b50618a3..000000000 --- a/phonelibs/zmq/x64/include/zrex.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ========================================================================= - zrex - work with regular expressions - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZREX_H_INCLUDED__ -#define __ZREX_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -// Constructor. Optionally, sets an expression against which we can match -// text and capture hits. If there is an error in the expression, reports -// zrex_valid() as false and provides the error in zrex_strerror(). If you -// set a pattern, you can call zrex_matches() to test it against text. -CZMQ_EXPORT zrex_t * - zrex_new (const char *expression); - -// Destructor -CZMQ_EXPORT void - zrex_destroy (zrex_t **self_p); - -// Return true if the expression was valid and compiled without errors. -CZMQ_EXPORT bool - zrex_valid (zrex_t *self); - -// Return the error message generated during compilation of the expression. -CZMQ_EXPORT const char * - zrex_strerror (zrex_t *self); - -// Returns true if the text matches the previously compiled expression. -// Use this method to compare one expression against many strings. -CZMQ_EXPORT bool - zrex_matches (zrex_t *self, const char *text); - -// Returns true if the text matches the supplied expression. Use this -// method to compare one string against several expressions. -CZMQ_EXPORT bool - zrex_eq (zrex_t *self, const char *text, const char *expression); - -// Returns number of hits from last zrex_matches or zrex_eq. If the text -// matched, returns 1 plus the number of capture groups. If the text did -// not match, returns zero. To retrieve individual capture groups, call -// zrex_hit (). -CZMQ_EXPORT int - zrex_hits (zrex_t *self); - -// Returns the Nth capture group from the last expression match, where -// N is 0 to the value returned by zrex_hits(). Capture group 0 is the -// whole matching string. Sequence 1 is the first capture group, if any, -// and so on. -CZMQ_EXPORT const char * - zrex_hit (zrex_t *self, uint index); - -// Fetches hits into string variables provided by caller; this makes for -// nicer code than accessing hits by index. Caller should not modify nor -// free the returned values. Returns number of strings returned. This -// method starts at hit 1, i.e. first capture group, as hit 0 is always -// the original matched string. -CZMQ_EXPORT int - zrex_fetch (zrex_t *self, const char **string_p, ...); - -// Self test of this class -CZMQ_EXPORT void - zrex_test (bool verbose); -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zsock.h b/phonelibs/zmq/x64/include/zsock.h deleted file mode 100644 index 9ab060d6a..000000000 --- a/phonelibs/zmq/x64/include/zsock.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* ========================================================================= - zsock - high-level socket API that hides libzmq contexts and sockets - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSOCK_H_INCLUDED__ -#define __ZSOCK_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// This interface includes some smart constructors, which create sockets with -// additional set-up. In all of these, the endpoint is NULL, or starts with -// '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by -// commas. If endpoint does not start with '@' or '>', default action depends -// on socket type. - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zsock.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Create a new socket. Returns the new socket, or NULL if the new socket -// could not be created. Note that the symbol zsock_new (and other -// constructors/destructors for zsock) are redirected to the *_checked -// variant, enabling intelligent socket leak detection. This can have -// performance implications if you use a LOT of sockets. To turn off this -// redirection behaviour, define ZSOCK_NOCHECK. -CZMQ_EXPORT zsock_t * - zsock_new (int type); - -// Create a PUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pub (const char *endpoint); - -// Create a SUB socket, and optionally subscribe to some prefix string. Default -// action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_sub (const char *endpoint, const char *subscribe); - -// Create a REQ socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_req (const char *endpoint); - -// Create a REP socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_rep (const char *endpoint); - -// Create a DEALER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dealer (const char *endpoint); - -// Create a ROUTER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_router (const char *endpoint); - -// Create a PUSH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_push (const char *endpoint); - -// Create a PULL socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_pull (const char *endpoint); - -// Create an XPUB socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_xpub (const char *endpoint); - -// Create an XSUB socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_xsub (const char *endpoint); - -// Create a PAIR socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_pair (const char *endpoint); - -// Create a STREAM socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_stream (const char *endpoint); - -// Destroy the socket. You must use this for any socket created via the -// zsock_new method. -CZMQ_EXPORT void - zsock_destroy (zsock_t **self_p); - -// Bind a socket to a formatted endpoint. For tcp:// endpoints, supports -// ephemeral ports, if you specify the port number as "*". By default -// zsock uses the IANA designated range from C000 (49152) to FFFF (65535). -// To override this range, follow the "*" with "[first-last]". Either or -// both first and last may be empty. To bind to a random port within the -// range, use "!" in place of "*". -// -// Examples: -// tcp://127.0.0.1:* bind to first free port from C000 up -// tcp://127.0.0.1:! bind to random port from C000 to FFFF -// tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up -// tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000 -// tcp://127.0.0.1:![55000-55999] -// bind to random port from 55000 to 55999 -// -// On success, returns the actual port number used, for tcp:// endpoints, -// and 0 for other transports. On failure, returns -1. Note that when using -// ephemeral ports, a port may be reused by different services without -// clients being aware. Protocols that run on ephemeral ports should take -// this into account. -CZMQ_EXPORT int - zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Returns last bound endpoint, if any. -CZMQ_EXPORT const char * - zsock_endpoint (zsock_t *self); - -// Unbind a socket from a formatted endpoint. -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Connect a socket to a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid. -CZMQ_EXPORT int - zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Disconnect a socket from a formatted endpoint -// Returns 0 if OK, -1 if the endpoint was invalid or the function -// isn't supported. -CZMQ_EXPORT int - zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2); - -// Attach a socket to zero or more endpoints. If endpoints is not null, -// parses as list of ZeroMQ endpoints, separated by commas, and prefixed by -// '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all -// endpoints were valid, or -1 if there was a syntax error. If the endpoint -// does not start with '@' or '>', the serverish argument defines whether -// it is used to bind (serverish = true) or connect (serverish = false). -CZMQ_EXPORT int - zsock_attach (zsock_t *self, const char *endpoints, bool serverish); - -// Returns socket type as printable constant string. -CZMQ_EXPORT const char * - zsock_type_str (zsock_t *self); - -// Send a 'picture' message to the socket (or actor). The picture is a -// string that defines the type of each frame. This makes it easy to send -// a complex multiframe message in one call. The picture can contain any -// of these characters, each corresponding to one or two arguments: -// -// i = int (signed) -// 1 = uint8_t -// 2 = uint16_t -// 4 = uint32_t -// 8 = uint64_t -// s = char * -// b = byte *, size_t (2 arguments) -// c = zchunk_t * -// f = zframe_t * -// h = zhashx_t * -// U = zuuid_t * -// p = void * (sends the pointer value, only meaningful over inproc) -// m = zmsg_t * (sends all frames in the zmsg) -// z = sends zero-sized frame (0 arguments) -// u = uint (deprecated) -// -// Note that s, b, c, and f are encoded the same way and the choice is -// offered as a convenience to the sender, which may or may not already -// have data in a zchunk or zframe. Does not change or take ownership of -// any arguments. Returns 0 if successful, -1 if sending failed for any -// reason. -CZMQ_EXPORT int - zsock_send (void *self, const char *picture, ...); - -// Send a 'picture' message to the socket (or actor). This is a va_list -// version of zsock_send (), so please consult its documentation for the -// details. -CZMQ_EXPORT int - zsock_vsend (void *self, const char *picture, va_list argptr); - -// Receive a 'picture' message to the socket (or actor). See zsock_send for -// the format and meaning of the picture. Returns the picture elements into -// a series of pointers as provided by the caller: -// -// i = int * (stores signed integer) -// 4 = uint32_t * (stores 32-bit unsigned integer) -// 8 = uint64_t * (stores 64-bit unsigned integer) -// s = char ** (allocates new string) -// b = byte **, size_t * (2 arguments) (allocates memory) -// c = zchunk_t ** (creates zchunk) -// f = zframe_t ** (creates zframe) -// U = zuuid_t * (creates a zuuid with the data) -// h = zhashx_t ** (creates zhashx) -// p = void ** (stores pointer) -// m = zmsg_t ** (creates a zmsg with the remaing frames) -// z = null, asserts empty frame (0 arguments) -// u = uint * (stores unsigned integer, deprecated) -// -// Note that zsock_recv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to recv -// a message, in which case the pointers are not modified. When message -// frames are truncated (a short message), sets return values to zero/null. -// If an argument pointer is NULL, does not store any value (skips it). -// An 'n' picture matches an empty frame; if the message does not match, -// the method will return -1. -CZMQ_EXPORT int - zsock_recv (void *self, const char *picture, ...); - -// Receive a 'picture' message from the socket (or actor). This is a -// va_list version of zsock_recv (), so please consult its documentation -// for the details. -CZMQ_EXPORT int - zsock_vrecv (void *self, const char *picture, va_list argptr); - -// Send a binary encoded 'picture' message to the socket (or actor). This -// method is similar to zsock_send, except the arguments are encoded in a -// binary format that is compatible with zproto, and is designed to reduce -// memory allocations. The pattern argument is a string that defines the -// type of each argument. Supports these argument types: -// -// pattern C type zproto type: -// 1 uint8_t type = "number" size = "1" -// 2 uint16_t type = "number" size = "2" -// 4 uint32_t type = "number" size = "3" -// 8 uint64_t type = "number" size = "4" -// s char *, 0-255 chars type = "string" -// S char *, 0-2^32-1 chars type = "longstr" -// c zchunk_t * type = "chunk" -// f zframe_t * type = "frame" -// u zuuid_t * type = "uuid" -// m zmsg_t * type = "msg" -// p void *, sends pointer value, only over inproc -// -// Does not change or take ownership of any arguments. Returns 0 if -// successful, -1 if sending failed for any reason. -CZMQ_EXPORT int - zsock_bsend (void *self, const char *picture, ...); - -// Receive a binary encoded 'picture' message from the socket (or actor). -// This method is similar to zsock_recv, except the arguments are encoded -// in a binary format that is compatible with zproto, and is designed to -// reduce memory allocations. The pattern argument is a string that defines -// the type of each argument. See zsock_bsend for the supported argument -// types. All arguments must be pointers; this call sets them to point to -// values held on a per-socket basis. -// Note that zsock_brecv creates the returned objects, and the caller must -// destroy them when finished with them. The supplied pointers do not need -// to be initialized. Returns 0 if successful, or -1 if it failed to read -// a message. -CZMQ_EXPORT int - zsock_brecv (void *self, const char *picture, ...); - -// Set socket to use unbounded pipes (HWM=0); use this in cases when you are -// totally certain the message volume can fit in memory. This method works -// across all versions of ZeroMQ. Takes a polymorphic socket reference. -CZMQ_EXPORT void - zsock_set_unbounded (void *self); - -// Send a signal over a socket. A signal is a short message carrying a -// success/failure code (by convention, 0 means OK). Signals are encoded -// to be distinguishable from "normal" messages. Accepts a zsock_t or a -// zactor_t argument, and returns 0 if successful, -1 if the signal could -// not be sent. Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_signal (void *self, byte status); - -// Wait on a signal. Use this to coordinate between threads, over pipe -// pairs. Blocks until the signal is received. Returns -1 on error, 0 or -// greater on success. Accepts a zsock_t or a zactor_t as argument. -// Takes a polymorphic socket reference. -CZMQ_EXPORT int - zsock_wait (void *self); - -// If there is a partial message still waiting on the socket, remove and -// discard it. This is useful when reading partial messages, to get specific -// message types. -CZMQ_EXPORT void - zsock_flush (void *self); - -// Probe the supplied object, and report if it looks like a zsock_t. -// Takes a polymorphic socket reference. -CZMQ_EXPORT bool - zsock_is (void *self); - -// Probe the supplied reference. If it looks like a zsock_t instance, return -// the underlying libzmq socket handle; else if it looks like a file -// descriptor, return NULL; else if it looks like a libzmq socket handle, -// return the supplied value. Takes a polymorphic socket reference. -CZMQ_EXPORT void * - zsock_resolve (void *self); - -// Get socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ivl (void *self); - -// Set socket option `heartbeat_ivl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl); - -// Get socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_ttl (void *self); - -// Set socket option `heartbeat_ttl`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl); - -// Get socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_heartbeat_timeout (void *self); - -// Set socket option `heartbeat_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout); - -// Get socket option `use_fd`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_use_fd (void *self); - -// Set socket option `use_fd`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_use_fd (void *self, int use_fd); - -// Set socket option `xpub_manual`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_manual (void *self, int xpub_manual); - -// Set socket option `xpub_welcome_msg`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_welcome_msg (void *self, const char *xpub_welcome_msg); - -// Set socket option `stream_notify`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_stream_notify (void *self, int stream_notify); - -// Get socket option `invert_matching`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_invert_matching (void *self); - -// Set socket option `invert_matching`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_invert_matching (void *self, int invert_matching); - -// Set socket option `xpub_verboser`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_xpub_verboser (void *self, int xpub_verboser); - -// Get socket option `connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_connect_timeout (void *self); - -// Set socket option `connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_connect_timeout (void *self, int connect_timeout); - -// Get socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_maxrt (void *self); - -// Set socket option `tcp_maxrt`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_tcp_maxrt (void *self, int tcp_maxrt); - -// Get socket option `thread_safe`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_thread_safe (void *self); - -// Get socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_maxtpdu (void *self); - -// Set socket option `multicast_maxtpdu`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu); - -// Get socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_size (void *self); - -// Set socket option `vmci_buffer_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size); - -// Get socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_min_size (void *self); - -// Set socket option `vmci_buffer_min_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size); - -// Get socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_buffer_max_size (void *self); - -// Set socket option `vmci_buffer_max_size`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size); - -// Get socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_vmci_connect_timeout (void *self); - -// Set socket option `vmci_connect_timeout`. -// Available from libzmq 4.2.0. -CZMQ_EXPORT void - zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout); - -// Get socket option `tos`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tos (void *self); - -// Set socket option `tos`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_tos (void *self, int tos); - -// Set socket option `router_handover`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_router_handover (void *self, int router_handover); - -// Set socket option `connect_rid`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid (void *self, const char *connect_rid); - -// Set socket option `connect_rid` from 32-octet binary -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_connect_rid_bin (void *self, const byte *connect_rid); - -// Get socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_handshake_ivl (void *self); - -// Set socket option `handshake_ivl`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_handshake_ivl (void *self, int handshake_ivl); - -// Get socket option `socks_proxy`. -// Available from libzmq 4.1.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_socks_proxy (void *self); - -// Set socket option `socks_proxy`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_socks_proxy (void *self, const char *socks_proxy); - -// Set socket option `xpub_nodrop`. -// Available from libzmq 4.1.0. -CZMQ_EXPORT void - zsock_set_xpub_nodrop (void *self, int xpub_nodrop); - -// Set socket option `router_mandatory`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_router_mandatory (void *self, int router_mandatory); - -// Set socket option `probe_router`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_probe_router (void *self, int probe_router); - -// Set socket option `req_relaxed`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_relaxed (void *self, int req_relaxed); - -// Set socket option `req_correlate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_req_correlate (void *self, int req_correlate); - -// Set socket option `conflate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_conflate (void *self, int conflate); - -// Get socket option `zap_domain`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_zap_domain (void *self); - -// Set socket option `zap_domain`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_zap_domain (void *self, const char *zap_domain); - -// Get socket option `mechanism`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_mechanism (void *self); - -// Get socket option `plain_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_plain_server (void *self); - -// Set socket option `plain_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_server (void *self, int plain_server); - -// Get socket option `plain_username`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_username (void *self); - -// Set socket option `plain_username`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_username (void *self, const char *plain_username); - -// Get socket option `plain_password`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_plain_password (void *self); - -// Set socket option `plain_password`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_plain_password (void *self, const char *plain_password); - -// Get socket option `curve_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_curve_server (void *self); - -// Set socket option `curve_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_server (void *self, int curve_server); - -// Get socket option `curve_publickey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_publickey (void *self); - -// Set socket option `curve_publickey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey (void *self, const char *curve_publickey); - -// Set socket option `curve_publickey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey); - -// Get socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_secretkey (void *self); - -// Set socket option `curve_secretkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey (void *self, const char *curve_secretkey); - -// Set socket option `curve_secretkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey); - -// Get socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_curve_serverkey (void *self); - -// Set socket option `curve_serverkey`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey (void *self, const char *curve_serverkey); - -// Set socket option `curve_serverkey` from 32-octet binary -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey); - -// Get socket option `gssapi_server`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_server (void *self); - -// Set socket option `gssapi_server`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_server (void *self, int gssapi_server); - -// Get socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_gssapi_plaintext (void *self); - -// Set socket option `gssapi_plaintext`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext); - -// Get socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_principal (void *self); - -// Set socket option `gssapi_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_principal (void *self, const char *gssapi_principal); - -// Get socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_gssapi_service_principal (void *self); - -// Set socket option `gssapi_service_principal`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal); - -// Get socket option `ipv6`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv6 (void *self); - -// Set socket option `ipv6`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_ipv6 (void *self, int ipv6); - -// Get socket option `immediate`. -// Available from libzmq 4.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_immediate (void *self); - -// Set socket option `immediate`. -// Available from libzmq 4.0.0. -CZMQ_EXPORT void - zsock_set_immediate (void *self, int immediate); - -// Get socket option `type`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_type (void *self); - -// Get socket option `sndhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndhwm (void *self); - -// Set socket option `sndhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndhwm (void *self, int sndhwm); - -// Get socket option `rcvhwm`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvhwm (void *self); - -// Set socket option `rcvhwm`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvhwm (void *self, int rcvhwm); - -// Get socket option `affinity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_affinity (void *self); - -// Set socket option `affinity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_affinity (void *self, int affinity); - -// Set socket option `subscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_subscribe (void *self, const char *subscribe); - -// Set socket option `unsubscribe`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_unsubscribe (void *self, const char *unsubscribe); - -// Get socket option `identity`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_identity (void *self); - -// Set socket option `identity`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_identity (void *self, const char *identity); - -// Get socket option `rate`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rate (void *self); - -// Set socket option `rate`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rate (void *self, int rate); - -// Get socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_recovery_ivl (void *self); - -// Set socket option `recovery_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_recovery_ivl (void *self, int recovery_ivl); - -// Get socket option `sndbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndbuf (void *self); - -// Set socket option `sndbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndbuf (void *self, int sndbuf); - -// Get socket option `rcvbuf`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvbuf (void *self); - -// Set socket option `rcvbuf`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvbuf (void *self, int rcvbuf); - -// Get socket option `linger`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_linger (void *self); - -// Set socket option `linger`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_linger (void *self, int linger); - -// Get socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl (void *self); - -// Set socket option `reconnect_ivl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl (void *self, int reconnect_ivl); - -// Get socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_reconnect_ivl_max (void *self); - -// Set socket option `reconnect_ivl_max`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max); - -// Get socket option `backlog`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_backlog (void *self); - -// Set socket option `backlog`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_backlog (void *self, int backlog); - -// Get socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_maxmsgsize (void *self); - -// Set socket option `maxmsgsize`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_maxmsgsize (void *self, int maxmsgsize); - -// Get socket option `multicast_hops`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_multicast_hops (void *self); - -// Set socket option `multicast_hops`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_multicast_hops (void *self, int multicast_hops); - -// Get socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvtimeo (void *self); - -// Set socket option `rcvtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_rcvtimeo (void *self, int rcvtimeo); - -// Get socket option `sndtimeo`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_sndtimeo (void *self); - -// Set socket option `sndtimeo`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_sndtimeo (void *self, int sndtimeo); - -// Set socket option `xpub_verbose`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_xpub_verbose (void *self, int xpub_verbose); - -// Get socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive (void *self); - -// Set socket option `tcp_keepalive`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive (void *self, int tcp_keepalive); - -// Get socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_idle (void *self); - -// Set socket option `tcp_keepalive_idle`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle); - -// Get socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_cnt (void *self); - -// Set socket option `tcp_keepalive_cnt`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt); - -// Get socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_tcp_keepalive_intvl (void *self); - -// Set socket option `tcp_keepalive_intvl`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl); - -// Get socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_tcp_accept_filter (void *self); - -// Set socket option `tcp_accept_filter`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter); - -// Get socket option `rcvmore`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_rcvmore (void *self); - -// Get socket option `fd`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT SOCKET - zsock_fd (void *self); - -// Get socket option `events`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_events (void *self); - -// Get socket option `last_endpoint`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zsock_last_endpoint (void *self); - -// Set socket option `router_raw`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_router_raw (void *self, int router_raw); - -// Get socket option `ipv4only`. -// Available from libzmq 3.0.0. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT int - zsock_ipv4only (void *self); - -// Set socket option `ipv4only`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_ipv4only (void *self, int ipv4only); - -// Set socket option `delay_attach_on_connect`. -// Available from libzmq 3.0.0. -CZMQ_EXPORT void - zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect); - -// Self test of this class. -CZMQ_EXPORT void - zsock_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Create a SERVER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_server (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a CLIENT socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_client (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a RADIO socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_radio (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a DISH socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_dish (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a GATHER socket. Default action is bind. -CZMQ_EXPORT zsock_t * - zsock_new_gather (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Create a SCATTER socket. Default action is connect. -CZMQ_EXPORT zsock_t * - zsock_new_scatter (const char *endpoint); - -// *** Draft method, for development use, may change without warning *** -// Return socket routing ID if any. This returns 0 if the socket is not -// of type ZMQ_SERVER or if no request was already received on it. -CZMQ_EXPORT uint32_t - zsock_routing_id (zsock_t *self); - -// *** Draft method, for development use, may change without warning *** -// Set routing ID on socket. The socket MUST be of type ZMQ_SERVER. -// This will be used when sending messages on the socket via the zsock API. -CZMQ_EXPORT void - zsock_set_routing_id (zsock_t *self, uint32_t routing_id); - -// *** Draft method, for development use, may change without warning *** -// Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_join (void *self, const char *group); - -// *** Draft method, for development use, may change without warning *** -// Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH. -// Returns 0 if OK, -1 if failed. -CZMQ_EXPORT int - zsock_leave (void *self, const char *group); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// zsock leak detection - not a part of the official interface to zsock. This -// enables CZMQ to report socket leaks intelligently. -#if defined ZSOCK_NOCHECK - // no checking active - use the above interface methods directly. -#else -# define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__) -# define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__) -# define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__) -# define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__) -# define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__) -# define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__) -# define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__) -# define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__) -# define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__) -# define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__) -# define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__) -# define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__) -# define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__) -# define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__) -#endif - -CZMQ_EXPORT zsock_t * - zsock_new_checked (int type, const char *filename, size_t line_nbr); - -CZMQ_EXPORT void - zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr); - -#ifdef CZMQ_BUILD_DRAFT_API -CZMQ_EXPORT zsock_t * - zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr); - -CZMQ_EXPORT zsock_t * - zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr); -#endif // CZMQ_BUILD_DRAFT_API - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zstr.h b/phonelibs/zmq/x64/include/zstr.h deleted file mode 100644 index 67f2f852b..000000000 --- a/phonelibs/zmq/x64/include/zstr.h +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================================================= - zstr - sending and receiving strings - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSTR_H_INCLUDED__ -#define __ZSTR_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zstr.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// This class has draft methods, which may change over time. They are not -// in stable releases, by default. Use --enable-drafts to enable. -// Receive C string from socket. Caller must free returned string using -// zstr_free(). Returns NULL if the context is being terminated or the -// process was interrupted. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_recv (void *source); - -// Receive a series of strings (until NULL) from multipart data. -// Each string is allocated and filled with string data; if there -// are not enough frames, unallocated strings are set to NULL. -// Returns -1 if the message could not be read, else returns the -// number of strings filled, zero or more. Free each returned string -// using zstr_free(). If not enough strings are provided, remaining -// multipart frames in the message are dropped. -CZMQ_EXPORT int - zstr_recvx (void *source, char **string_p, ...); - -// Send a C string to a socket, as a frame. The string is sent without -// trailing null byte; to read this you can use zstr_recv, or a similar -// method that adds a null terminator on the received string. String -// may be NULL, which is sent as "". -CZMQ_EXPORT int - zstr_send (void *dest, const char *string); - -// Send a C string to a socket, as zstr_send(), with a MORE flag, so that -// you can send further strings in the same multi-part message. -CZMQ_EXPORT int - zstr_sendm (void *dest, const char *string); - -// Send a formatted string to a socket. Note that you should NOT use -// user-supplied strings in the format (they may contain '%' which -// will create security holes). -CZMQ_EXPORT int - zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a formatted string to a socket, as for zstr_sendf(), with a -// MORE flag, so that you can send further strings in the same multi-part -// message. -CZMQ_EXPORT int - zstr_sendfm (void *dest, const char *format, ...) CHECK_PRINTF (2); - -// Send a series of strings (until NULL) as multipart data -// Returns 0 if the strings could be sent OK, or -1 on error. -CZMQ_EXPORT int - zstr_sendx (void *dest, const char *string, ...); - -// Free a provided string, and nullify the parent pointer. Safe to call on -// a null pointer. -CZMQ_EXPORT void - zstr_free (char **string_p); - -// Self test of this class. -CZMQ_EXPORT void - zstr_test (bool verbose); - -#ifdef CZMQ_BUILD_DRAFT_API -// *** Draft method, for development use, may change without warning *** -// Accepts a void pointer and returns a fresh character string. If source -// is null, returns an empty string. -// Caller owns return value and must destroy it when done. -CZMQ_EXPORT char * - zstr_str (void *source); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -// DEPRECATED as poor style -- callers should use zloop or zpoller -// Receive C string from socket, if socket had input ready. Caller must -// free returned string using zstr_free. Returns NULL if there was no input -// waiting, or if the context was terminated. Use zctx_interrupted to exit -// any loop that relies on this method. -CZMQ_EXPORT char * - zstr_recv_nowait (void *source); - -// Compiler hints -CZMQ_EXPORT int zstr_sendf (void *dest, const char *format, ...) CHECK_PRINTF (2); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zsys.h b/phonelibs/zmq/x64/include/zsys.h deleted file mode 100644 index 200271d92..000000000 --- a/phonelibs/zmq/x64/include/zsys.h +++ /dev/null @@ -1,395 +0,0 @@ -/* ========================================================================= - zsys - system-level methods - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZSYS_H_INCLUDED__ -#define __ZSYS_H_INCLUDED__ - -#ifdef __cplusplus -extern "C" { -#endif - -// @interface -#define UDP_FRAME_MAX 255 // Max size of UDP frame - -// Callback for interrupt signal handler -typedef void (zsys_handler_fn) (int signal_value); - -// Initialize CZMQ zsys layer; this happens automatically when you create -// a socket or an actor; however this call lets you force initialization -// earlier, so e.g. logging is properly set-up before you start working. -// Not threadsafe, so call only from main thread. Safe to call multiple -// times. Returns global CZMQ context. -CZMQ_EXPORT void * - zsys_init (void); - -// Optionally shut down the CZMQ zsys layer; this normally happens automatically -// when the process exits; however this call lets you force a shutdown -// earlier, avoiding any potential problems with atexit() ordering, especially -// with Windows dlls. -CZMQ_EXPORT void - zsys_shutdown (void); - -// Get a new ZMQ socket, automagically creating a ZMQ context if this is -// the first time. Caller is responsible for destroying the ZMQ socket -// before process exits, to avoid a ZMQ deadlock. Note: you should not use -// this method in CZMQ apps, use zsock_new() instead. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void * - zsys_socket (int type, const char *filename, size_t line_nbr); - -// Destroy/close a ZMQ socket. You should call this for every socket you -// create using zsys_socket(). -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_close (void *handle, const char *filename, size_t line_nbr); - -// Return ZMQ socket name for socket type -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT char * - zsys_sockname (int socktype); - -// Create a pipe, which consists of two PAIR sockets connected over inproc. -// The pipe is configured to use the zsys_pipehwm setting. Returns the -// frontend socket successful, NULL if failed. -CZMQ_EXPORT zsock_t * - zsys_create_pipe (zsock_t **backend_p); - -// Set interrupt handler; this saves the default handlers so that a -// zsys_handler_reset () can restore them. If you call this multiple times -// then the last handler will take affect. If handler_fn is NULL, disables -// default SIGINT/SIGTERM handling in CZMQ. -CZMQ_EXPORT void - zsys_handler_set (zsys_handler_fn *handler_fn); - -// Reset interrupt handler, call this at exit if needed -CZMQ_EXPORT void - zsys_handler_reset (void); - -// Set default interrupt handler, so Ctrl-C or SIGTERM will set -// zsys_interrupted. Idempotent; safe to call multiple times. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_catch_interrupts (void); - -// Return 1 if file exists, else zero -CZMQ_EXPORT bool - zsys_file_exists (const char *filename); - -// Return size of file, or -1 if not found -CZMQ_EXPORT ssize_t - zsys_file_size (const char *filename); - -// Return file modification time. Returns 0 if the file does not exist. -CZMQ_EXPORT time_t - zsys_file_modified (const char *filename); - -// Return file mode; provides at least support for the POSIX S_ISREG(m) -// and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. -// Returns a mode_t cast to int, or -1 in case of error. -CZMQ_EXPORT int - zsys_file_mode (const char *filename); - -// Delete file. Does not complain if the file is absent -CZMQ_EXPORT int - zsys_file_delete (const char *filename); - -// Check if file is 'stable' -CZMQ_EXPORT bool - zsys_file_stable (const char *filename); - -// Create a file path if it doesn't exist. The file path is treated as a -// printf format. -CZMQ_EXPORT int - zsys_dir_create (const char *pathname, ...); - -// Remove a file path if empty; the pathname is treated as printf format. -CZMQ_EXPORT int - zsys_dir_delete (const char *pathname, ...); - -// Move to a specified working directory. Returns 0 if OK, -1 if this failed. -CZMQ_EXPORT int - zsys_dir_change (const char *pathname); - -// Set private file creation mode; all files created from here will be -// readable/writable by the owner only. -CZMQ_EXPORT void - zsys_file_mode_private (void); - -// Reset default file creation mode; all files created from here will use -// process file mode defaults. -CZMQ_EXPORT void - zsys_file_mode_default (void); - -// Return the CZMQ version for run-time API detection; returns version -// number into provided fields, providing reference isn't null in each case. -CZMQ_EXPORT void - zsys_version (int *major, int *minor, int *patch); - -// Format a string using printf formatting, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_sprintf (const char *format, ...); - -// Format a string with a va_list argument, returning a freshly allocated -// buffer. If there was insufficient memory, returns NULL. Free the returned -// string using zstr_free(). -CZMQ_EXPORT char * - zsys_vprintf (const char *format, va_list argptr); - -// Create UDP beacon socket; if the routable option is true, uses -// multicast (not yet implemented), else uses broadcast. This method -// and related ones might _eventually_ be moved to a zudp class. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT SOCKET - zsys_udp_new (bool routable); - -// Close a UDP socket -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_close (SOCKET handle); - -// Send zframe to UDP socket, return -1 if sending failed due to -// interface having disappeared (happens easily with WiFi) -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT int - zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen); - -// Receive zframe from UDP socket, and set address of peer that sent it -// The peername must be a char [INET_ADDRSTRLEN] array. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT zframe_t * - zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen); - -// Handle an I/O error on some socket operation; will report and die on -// fatal errors, and continue silently on "try again" errors. -// *** This is for CZMQ internal use only and may change arbitrarily *** -CZMQ_EXPORT void - zsys_socket_error (const char *reason); - -// Return current host name, for use in public tcp:// endpoints. Caller gets -// a freshly allocated string, should free it using zstr_free(). If the host -// name is not resolvable, returns NULL. -CZMQ_EXPORT char * - zsys_hostname (void); - -// Move the current process into the background. The precise effect depends -// on the operating system. On POSIX boxes, moves to a specified working -// directory (if specified), closes all file handles, reopens stdin, stdout, -// and stderr to the null device, and sets the process to ignore SIGHUP. On -// Windows, does nothing. Returns 0 if OK, -1 if there was an error. -CZMQ_EXPORT int - zsys_daemonize (const char *workdir); - -// Drop the process ID into the lockfile, with exclusive lock, and switch -// the process to the specified group and/or user. Any of the arguments -// may be null, indicating a no-op. Returns 0 on success, -1 on failure. -// Note if you combine this with zsys_daemonize, run after, not before -// that method, or the lockfile will hold the wrong process ID. -CZMQ_EXPORT int - zsys_run_as (const char *lockfile, const char *group, const char *user); - -// Returns true if the underlying libzmq supports CURVE security. -// Uses a heuristic probe according to the version of libzmq being used. -CZMQ_EXPORT bool - zsys_has_curve (void); - -// Configure the number of I/O threads that ZeroMQ will use. A good -// rule of thumb is one thread per gigabit of traffic in or out. The -// default is 1, sufficient for most applications. If the environment -// variable ZSYS_IO_THREADS is defined, that provides the default. -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_io_threads (size_t io_threads); - -// Configure the number of sockets that ZeroMQ will allow. The default -// is 1024. The actual limit depends on the system, and you can query it -// by using zsys_socket_limit (). A value of zero means "maximum". -// Note that this method is valid only before any socket is created. -CZMQ_EXPORT void - zsys_set_max_sockets (size_t max_sockets); - -// Return maximum number of ZeroMQ sockets that the system will support. -CZMQ_EXPORT size_t - zsys_socket_limit (void); - -// Configure the maximum allowed size of a message sent. -// The default is INT_MAX. -CZMQ_EXPORT void - zsys_set_max_msgsz (int max_msgsz); - -// Return maximum message size. -CZMQ_EXPORT int - zsys_max_msgsz (void); - -// Configure the default linger timeout in msecs for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// linger time is zero, i.e. any pending messages will be dropped. If the -// environment variable ZSYS_LINGER is defined, that provides the default. -// Note that process exit will typically be delayed by the linger time. -CZMQ_EXPORT void - zsys_set_linger (size_t linger); - -// Configure the default outgoing pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_SNDHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_sndhwm (size_t sndhwm); - -// Configure the default incoming pipe limit (HWM) for new zsock instances. -// You can also set this separately on each zsock_t instance. The default -// HWM is 1,000, on all versions of ZeroMQ. If the environment variable -// ZSYS_RCVHWM is defined, that provides the default. Note that a value of -// zero means no limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_rcvhwm (size_t rcvhwm); - -// Configure the default HWM for zactor internal pipes; this is set on both -// ends of the pipe, for outgoing messages only (sndhwm). The default HWM is -// 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is -// defined, that provides the default. Note that a value of zero means no -// limit, i.e. infinite memory consumption. -CZMQ_EXPORT void - zsys_set_pipehwm (size_t pipehwm); - -// Return the HWM for zactor internal pipes. -CZMQ_EXPORT size_t - zsys_pipehwm (void); - -// Configure use of IPv6 for new zsock instances. By default sockets accept -// and make only IPv4 connections. When you enable IPv6, sockets will accept -// and connect to both IPv4 and IPv6 peers. You can override the setting on -// each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the -// environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the -// default. Note: has no effect on ZMQ v2. -CZMQ_EXPORT void - zsys_set_ipv6 (int ipv6); - -// Return use of IPv6 for zsock instances. -CZMQ_EXPORT int - zsys_ipv6 (void); - -// Set network interface name to use for broadcasts, particularly zbeacon. -// This lets the interface be configured for test environments where required. -// For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is -// the default when there is no specified interface. If the environment -// variable ZSYS_INTERFACE is set, use that as the default interface name. -// Setting the interface to "*" means "use all available interfaces". -CZMQ_EXPORT void - zsys_set_interface (const char *value); - -// Return network interface to use for broadcasts, or "" if none was set. -CZMQ_EXPORT const char * - zsys_interface (void); - -// Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. -// This needs to be set IPv6 is enabled as IPv6 can have multiple addresses -// on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, -// use that as the default IPv6 address. -CZMQ_EXPORT void - zsys_set_ipv6_address (const char *value); - -// Return IPv6 address to use for zbeacon reception, or "" if none was set. -CZMQ_EXPORT const char * - zsys_ipv6_address (void); - -// Set IPv6 milticast address to use for sending zbeacon messages. This needs -// to be set if IPv6 is enabled. If the environment variable -// ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast -// address. -CZMQ_EXPORT void - zsys_set_ipv6_mcast_address (const char *value); - -// Return IPv6 multicast address to use for sending zbeacon, or "" if none was -// set. -CZMQ_EXPORT const char * - zsys_ipv6_mcast_address (void); - -// Configure the automatic use of pre-allocated FDs when creating new sockets. -// If 0 (default), nothing will happen. Else, when a new socket is bound, the -// system API will be used to check if an existing pre-allocated FD with a -// matching port (if TCP) or path (if IPC) exists, and if it does it will be -// set via the ZMQ_USE_FD socket option so that the library will use it -// instead of creating a new socket. -CZMQ_EXPORT void - zsys_set_auto_use_fd (int auto_use_fd); - -// Return use of automatic pre-allocated FDs for zsock instances. -CZMQ_EXPORT int - zsys_auto_use_fd (void); - -// Set log identity, which is a string that prefixes all log messages sent -// by this process. The log identity defaults to the environment variable -// ZSYS_LOGIDENT, if that is set. -CZMQ_EXPORT void - zsys_set_logident (const char *value); - -// Set stream to receive log traffic. By default, log traffic is sent to -// stdout. If you set the stream to NULL, no stream will receive the log -// traffic (it may still be sent to the system facility). -CZMQ_EXPORT void - zsys_set_logstream (FILE *stream); - -// Sends log output to a PUB socket bound to the specified endpoint. To -// collect such log output, create a SUB socket, subscribe to the traffic -// you care about, and connect to the endpoint. Log traffic is sent as a -// single string frame, in the same format as when sent to stdout. The -// log system supports a single sender; multiple calls to this method will -// bind the same sender to multiple endpoints. To disable the sender, call -// this method with a null argument. -CZMQ_EXPORT void - zsys_set_logsender (const char *endpoint); - -// Enable or disable logging to the system facility (syslog on POSIX boxes, -// event log on Windows). By default this is disabled. -CZMQ_EXPORT void - zsys_set_logsystem (bool logsystem); - -// Log error condition - highest priority -CZMQ_EXPORT void - zsys_error (const char *format, ...); - -// Log warning condition - high priority -CZMQ_EXPORT void - zsys_warning (const char *format, ...); - -// Log normal, but significant, condition - normal priority -CZMQ_EXPORT void - zsys_notice (const char *format, ...); - -// Log informational message - low priority -CZMQ_EXPORT void - zsys_info (const char *format, ...); - -// Log debug-level message - lowest priority -CZMQ_EXPORT void - zsys_debug (const char *format, ...); - -// Self test of this class -CZMQ_EXPORT void - zsys_test (bool verbose); - -// Global signal indicator, TRUE when user presses Ctrl-C or the process -// gets a SIGTERM signal. -CZMQ_EXPORT extern volatile int zsys_interrupted; -// Deprecated name for this variable -CZMQ_EXPORT extern volatile int zctx_interrupted; -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ztimerset.h b/phonelibs/zmq/x64/include/ztimerset.h deleted file mode 100644 index 29633fafd..000000000 --- a/phonelibs/zmq/x64/include/ztimerset.h +++ /dev/null @@ -1,90 +0,0 @@ -/* ========================================================================= - ztimerset - timer set - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTIMERSET_H_INCLUDED -#define ZTIMERSET_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztimerset.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for timer event. -typedef void (ztimerset_fn) ( - int timer_id, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Create new timer set. -CZMQ_EXPORT ztimerset_t * - ztimerset_new (void); - -// *** Draft method, for development use, may change without warning *** -// Destroy a timer set -CZMQ_EXPORT void - ztimerset_destroy (ztimerset_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Add a timer to the set. Returns timer id if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg); - -// *** Draft method, for development use, may change without warning *** -// Cancel a timer. Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_cancel (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Set timer interval. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval); - -// *** Draft method, for development use, may change without warning *** -// Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure. -// This method is slow, canceling the timer and adding a new one yield better performance. -CZMQ_EXPORT int - ztimerset_reset (ztimerset_t *self, int timer_id); - -// *** Draft method, for development use, may change without warning *** -// Return the time until the next interval. -// Should be used as timeout parameter for the zpoller wait method. -// The timeout is in msec. -CZMQ_EXPORT int - ztimerset_timeout (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Invoke callback function of all timers which their interval has elapsed. -// Should be call after zpoller wait method. -// Returns 0 if OK, -1 on failure. -CZMQ_EXPORT int - ztimerset_execute (ztimerset_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztimerset_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/ztrie.h b/phonelibs/zmq/x64/include/ztrie.h deleted file mode 100644 index 6fd53234b..000000000 --- a/phonelibs/zmq/x64/include/ztrie.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ========================================================================= - ztrie - simple trie for tokenizable strings - - Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com - Copyright other contributors as noted in the AUTHORS file. - - This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef ZTRIE_H_INCLUDED -#define ZTRIE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/ztrie.api" to make changes. -// @interface -// This is a draft class, and may change without notice. It is disabled in -// stable builds by default. If you use this in applications, please ask -// for it to be pushed to stable state. Use --enable-drafts to enable. -#ifdef CZMQ_BUILD_DRAFT_API -// Callback function for ztrie_node to destroy node data. -typedef void (ztrie_destroy_data_fn) ( - void **data); - -// *** Draft method, for development use, may change without warning *** -// Creates a new ztrie. -CZMQ_EXPORT ztrie_t * - ztrie_new (char delimiter); - -// *** Draft method, for development use, may change without warning *** -// Destroy the ztrie. -CZMQ_EXPORT void - ztrie_destroy (ztrie_t **self_p); - -// *** Draft method, for development use, may change without warning *** -// Inserts a new route into the tree and attaches the data. Returns -1 -// if the route already exists, otherwise 0. This method takes ownership of -// the provided data if a destroy_data_fn is provided. -CZMQ_EXPORT int - ztrie_insert_route (ztrie_t *self, const char *path, void *data, ztrie_destroy_data_fn destroy_data_fn); - -// *** Draft method, for development use, may change without warning *** -// Removes a route from the trie and destroys its data. Returns -1 if the -// route does not exists, otherwise 0. -// the start of the list call zlist_first (). Advances the cursor. -CZMQ_EXPORT int - ztrie_remove_route (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns true if the path matches a route in the tree, otherwise false. -CZMQ_EXPORT bool - ztrie_matches (ztrie_t *self, const char *path); - -// *** Draft method, for development use, may change without warning *** -// Returns the data of a matched route from last ztrie_matches. If the path -// did not match, returns NULL. Do not delete the data as it's owned by -// ztrie. -CZMQ_EXPORT void * - ztrie_hit_data (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the count of parameters that a matched route has. -CZMQ_EXPORT size_t - ztrie_hit_parameter_count (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the parameters of a matched route with named regexes from last -// ztrie_matches. If the path did not match or the route did not contain any -// named regexes, returns NULL. -CZMQ_EXPORT zhashx_t * - ztrie_hit_parameters (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Returns the asterisk matched part of a route, if there has been no match -// or no asterisk match, returns NULL. -CZMQ_EXPORT const char * - ztrie_hit_asterisk_match (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Print the trie -CZMQ_EXPORT void - ztrie_print (ztrie_t *self); - -// *** Draft method, for development use, may change without warning *** -// Self test of this class. -CZMQ_EXPORT void - ztrie_test (bool verbose); - -#endif // CZMQ_BUILD_DRAFT_API -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/include/zuuid.h b/phonelibs/zmq/x64/include/zuuid.h deleted file mode 100644 index afc1104fe..000000000 --- a/phonelibs/zmq/x64/include/zuuid.h +++ /dev/null @@ -1,96 +0,0 @@ -/* ========================================================================= - zuuid - UUID support class - - Copyright (c) the Contributors as noted in the AUTHORS file. - This file is part of CZMQ, the high-level C binding for 0MQ: - http://czmq.zeromq.org. - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - ========================================================================= -*/ - -#ifndef __ZUUID_H_INCLUDED__ -#define __ZUUID_H_INCLUDED__ - -#define ZUUID_LEN 16 -#define ZUUID_STR_LEN (ZUUID_LEN * 2) - -#ifdef __cplusplus -extern "C" { -#endif - -// @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT -// @warning Please edit the model at "api/zuuid.api" to make changes. -// @interface -// This is a stable class, and may not change except for emergencies. It -// is provided in stable builds. -// Create a new UUID object. -CZMQ_EXPORT zuuid_t * - zuuid_new (void); - -// Create UUID object from supplied ZUUID_LEN-octet value. -CZMQ_EXPORT zuuid_t * - zuuid_new_from (const byte *source); - -// Destroy a specified UUID object. -CZMQ_EXPORT void - zuuid_destroy (zuuid_t **self_p); - -// Set UUID to new supplied ZUUID_LEN-octet value. -CZMQ_EXPORT void - zuuid_set (zuuid_t *self, const byte *source); - -// Set UUID to new supplied string value skipping '-' and '{' '}' -// optional delimiters. Return 0 if OK, else returns -1. -CZMQ_EXPORT int - zuuid_set_str (zuuid_t *self, const char *source); - -// Return UUID binary data. -CZMQ_EXPORT const byte * - zuuid_data (zuuid_t *self); - -// Return UUID binary size -CZMQ_EXPORT size_t - zuuid_size (zuuid_t *self); - -// Returns UUID as string -CZMQ_EXPORT const char * - zuuid_str (zuuid_t *self); - -// Return UUID in the canonical string format: 8-4-4-4-12, in lower -// case. Caller does not modify or free returned value. See -// http://en.wikipedia.org/wiki/Universally_unique_identifier -CZMQ_EXPORT const char * - zuuid_str_canonical (zuuid_t *self); - -// Store UUID blob in target array -CZMQ_EXPORT void - zuuid_export (zuuid_t *self, byte *target); - -// Check if UUID is same as supplied value -CZMQ_EXPORT bool - zuuid_eq (zuuid_t *self, const byte *compare); - -// Check if UUID is different from supplied value -CZMQ_EXPORT bool - zuuid_neq (zuuid_t *self, const byte *compare); - -// Make copy of UUID object; if uuid is null, or memory was exhausted, -// returns null. -CZMQ_EXPORT zuuid_t * - zuuid_dup (zuuid_t *self); - -// Self test of this class. -CZMQ_EXPORT void - zuuid_test (bool verbose); - -// @end - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/phonelibs/zmq/x64/lib/libczmq.a b/phonelibs/zmq/x64/lib/libczmq.a deleted file mode 100644 index 9045eb980..000000000 Binary files a/phonelibs/zmq/x64/lib/libczmq.a and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libczmq.la b/phonelibs/zmq/x64/lib/libczmq.la deleted file mode 100755 index 8e4a9ee36..000000000 --- a/phonelibs/zmq/x64/lib/libczmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libczmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libczmq.so.4' - -# Names of this library. -library_names='libczmq.so.4.0.2 libczmq.so.4 libczmq.so' - -# The name of the static archive. -old_library='libczmq.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags=' -pthread' - -# Libraries that this one depends upon. -dependency_libs=' -L/home/batman/one/external/zmq/lib -L/usr/local/lib /home/batman/one/external/zmq/lib/libzmq.la -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libczmq. -current=4 -age=0 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/phonelibs/zmq/x64/lib/libczmq.so b/phonelibs/zmq/x64/lib/libczmq.so deleted file mode 120000 index db9aa60f9..000000000 --- a/phonelibs/zmq/x64/lib/libczmq.so +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libczmq.so.4 b/phonelibs/zmq/x64/lib/libczmq.so.4 deleted file mode 120000 index db9aa60f9..000000000 --- a/phonelibs/zmq/x64/lib/libczmq.so.4 +++ /dev/null @@ -1 +0,0 @@ -libczmq.so.4.0.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 b/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 deleted file mode 100755 index eaf4cce8b..000000000 Binary files a/phonelibs/zmq/x64/lib/libczmq.so.4.0.2 and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libzmq.a b/phonelibs/zmq/x64/lib/libzmq.a deleted file mode 100644 index 28c77cc36..000000000 Binary files a/phonelibs/zmq/x64/lib/libzmq.a and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/libzmq.la b/phonelibs/zmq/x64/lib/libzmq.la deleted file mode 100644 index 69652b346..000000000 --- a/phonelibs/zmq/x64/lib/libzmq.la +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/batman/one/external/zmq/lib' diff --git a/phonelibs/zmq/x64/lib/libzmq.lai b/phonelibs/zmq/x64/lib/libzmq.lai deleted file mode 100644 index 93c1a83dc..000000000 --- a/phonelibs/zmq/x64/lib/libzmq.lai +++ /dev/null @@ -1,41 +0,0 @@ -# libzmq.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libzmq.so.5' - -# Names of this library. -library_names='libzmq.so.5.1.2 libzmq.so.5 libzmq.so' - -# The name of the static archive. -old_library='libzmq.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libzmq. -current=6 -age=1 -revision=2 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib' diff --git a/phonelibs/zmq/x64/lib/libzmq.so b/phonelibs/zmq/x64/lib/libzmq.so deleted file mode 120000 index ef44cafc6..000000000 --- a/phonelibs/zmq/x64/lib/libzmq.so +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libzmq.so.5 b/phonelibs/zmq/x64/lib/libzmq.so.5 deleted file mode 120000 index ef44cafc6..000000000 --- a/phonelibs/zmq/x64/lib/libzmq.so.5 +++ /dev/null @@ -1 +0,0 @@ -libzmq.so.5.1.2 \ No newline at end of file diff --git a/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 b/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 deleted file mode 100755 index e08e8c2df..000000000 Binary files a/phonelibs/zmq/x64/lib/libzmq.so.5.1.2 and /dev/null differ diff --git a/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc b/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc deleted file mode 100644 index b6fb3dc13..000000000 --- a/phonelibs/zmq/x64/lib/pkgconfig/libczmq.pc +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ - -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libczmq -Description: The high-level C binding for 0MQ -Version: 4.0.2 - -Requires:libzmq - -Libs: -L${libdir} -lczmq -Cflags: -I${includedir} -Libs.private: -L/usr/local/lib -lzmq - -################################################################################ -# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # -# Read the zproject/README.md for information about making permanent changes. # -################################################################################ diff --git a/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc b/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc deleted file mode 100644 index aba3d3a75..000000000 --- a/phonelibs/zmq/x64/lib/pkgconfig/libzmq.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/home/batman/one/external/zmq -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libzmq -Description: 0MQ c++ library -Version: 4.2.2 -Libs: -L${libdir} -lzmq -Cflags: -I${includedir} diff --git a/run_docker_tests.sh b/run_docker_tests.sh deleted file mode 100755 index 512c5161f..000000000 --- a/run_docker_tests.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -set -e - -SETUP="cd /tmp/openpilot && " -RUN="docker run --shm-size 1G --rm tmppilot /bin/sh -c" - -docker build -t tmppilot -f Dockerfile.openpilot . - -$RUN "$SETUP cd /tmp/openpilot/selfdrive/test/ && ./test_fingerprints.py" -$RUN 'cd /tmp/openpilot/ && flake8 --select=F $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda" | grep -vi "^\./tools")' -$RUN 'cd /tmp/openpilot/ && pylint --disable=R,C,W $(find . -iname "*.py" | grep -vi "^\./pyextra.*" | grep -vi "^\./panda" | grep -vi "^\./tools"); exit $(($? & 3))' -$RUN "$SETUP python -m unittest discover common" -$RUN "$SETUP python -m unittest discover opendbc/can" -$RUN "$SETUP python -m unittest discover selfdrive/boardd" -$RUN "$SETUP python -m unittest discover selfdrive/controls" -$RUN "$SETUP python -m unittest discover selfdrive/loggerd" -$RUN "$SETUP cd /tmp/openpilot/selfdrive/test/longitudinal_maneuvers && OPTEST=1 ./test_longitudinal.py" -$RUN "$SETUP cd /tmp/openpilot/selfdrive/test/process_replay/ && ./test_processes.py" -$RUN "$SETUP mkdir -p /data/params && cd /tmp/openpilot/selfdrive/test/ && ./test_car_models.py" diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py index bf3836d07..e3a1bf2f1 100755 --- a/selfdrive/athena/athenad.py +++ b/selfdrive/athena/athenad.py @@ -19,6 +19,7 @@ from selfdrive.loggerd.config import ROOT import cereal.messaging as messaging from common import android +from common.basedir import PERSIST from common.api import Api from common.params import Params from cereal.services import service_list @@ -188,10 +189,10 @@ def startLocalProxy(global_end_event, remote_ws_uri, local_port): @dispatcher.add_method def getPublicKey(): - if not os.path.isfile('/persist/comma/id_rsa.pub'): + if not os.path.isfile(PERSIST+'/comma/id_rsa.pub'): return None - with open('/persist/comma/id_rsa.pub', 'r') as f: + with open(PERSIST+'/comma/id_rsa.pub', 'r') as f: return f.read() @dispatcher.add_method diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 37ee22e70..ef5faeb36 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -654,7 +654,9 @@ void *hardware_control_thread(void *crap) { if (hw_type != cereal::HealthData::HwType::UNO) return NULL; + uint64_t last_front_frame_t = 0; uint16_t prev_fan_speed = 999; + uint16_t ir_pwr = 0; uint16_t prev_ir_pwr = 999; unsigned int cnt = 0; @@ -684,24 +686,31 @@ void *hardware_control_thread(void *crap) { } } else if (type == cereal::Event::FRONT_FRAME){ float cur_front_gain = event.getFrontFrame().getGainFrac(); - uint16_t ir_pwr; - if (cur_front_gain <= CUTOFF_GAIN) { - ir_pwr = 100.0 * MIN_IR_POWER; - } else if (cur_front_gain > SATURATE_GAIN) { - ir_pwr = 100.0 * MAX_IR_POWER; - } else { - ir_pwr = 100.0 * (MIN_IR_POWER + ((cur_front_gain - CUTOFF_GAIN) * (MAX_IR_POWER - MIN_IR_POWER) / (SATURATE_GAIN - CUTOFF_GAIN))); - } + last_front_frame_t = event.getLogMonoTime(); - if (ir_pwr != prev_ir_pwr || cnt % 100 == 0 || ir_pwr >= 50.0){ - pthread_mutex_lock(&usb_lock); - libusb_control_transfer(dev_handle, 0x40, 0xb0, ir_pwr, 0, NULL, 0, TIMEOUT); - pthread_mutex_unlock(&usb_lock); - - prev_ir_pwr = ir_pwr; + if (cur_front_gain <= CUTOFF_GAIN) { + ir_pwr = 100.0 * MIN_IR_POWER; + } else if (cur_front_gain > SATURATE_GAIN) { + ir_pwr = 100.0 * MAX_IR_POWER; + } else { + ir_pwr = 100.0 * (MIN_IR_POWER + ((cur_front_gain - CUTOFF_GAIN) * (MAX_IR_POWER - MIN_IR_POWER) / (SATURATE_GAIN - CUTOFF_GAIN))); } } } + + // Disable ir_pwr on front frame timeout + uint64_t cur_t = nanos_since_boot(); + if (cur_t - last_front_frame_t > 1e9){ + ir_pwr = 0; + } + + if (ir_pwr != prev_ir_pwr || cnt % 100 == 0 || ir_pwr >= 50.0){ + pthread_mutex_lock(&usb_lock); + libusb_control_transfer(dev_handle, 0x40, 0xb0, ir_pwr, 0, NULL, 0, TIMEOUT); + pthread_mutex_unlock(&usb_lock); + prev_ir_pwr = ir_pwr; + } + } delete poller; @@ -780,6 +789,7 @@ void pigeon_init() { usleep(100*1000); // init from ubloxd + // To generate this data, run test/ubloxd.py with the print statements enabled in the write function in panda/python/serial.py pigeon_send("\xB5\x62\x06\x00\x14\x00\x03\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x00\x00\x00\x00\x00\x1E\x7F"); pigeon_send("\xB5\x62\x06\x3E\x00\x00\x44\xD2"); pigeon_send("\xB5\x62\x06\x00\x14\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x35"); @@ -798,6 +808,7 @@ void pigeon_init() { pigeon_send("\xB5\x62\x06\x01\x03\x00\x01\x07\x01\x13\x51"); pigeon_send("\xB5\x62\x06\x01\x03\x00\x02\x15\x01\x22\x70"); pigeon_send("\xB5\x62\x06\x01\x03\x00\x02\x13\x01\x20\x6C"); + pigeon_send("\xB5\x62\x06\x01\x03\x00\x0A\x09\x01\x1E\x70"); LOGW("panda GPS on"); } diff --git a/selfdrive/boardd/boardd_setup.py b/selfdrive/boardd/boardd_setup.py index f987c7aa2..1da81997c 100644 --- a/selfdrive/boardd/boardd_setup.py +++ b/selfdrive/boardd/boardd_setup.py @@ -1,4 +1,5 @@ import subprocess +import platform from distutils.core import Extension, setup from Cython.Build import cythonize @@ -10,14 +11,24 @@ import os PHONELIBS = os.path.join(BASEDIR, 'phonelibs') ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() -ARCH_DIR = 'x64' if ARCH == "x86_64" else 'aarch64' + +if ARCH == "x86_64": + if platform.system() == "Darwin": + libraries = ['can_list_to_can_capnp', 'capnp', 'kj'] + ARCH_DIR = 'mac' + else: + libraries = [':libcan_list_to_can_capnp.a', ':libcapnp.a', ':libkj.a'] + ARCH_DIR = 'x64' +else: + libraries = [':libcan_list_to_can_capnp.a', 'capnp', 'kj'] + ARCH_DIR = 'aarch64' setup(name='Boardd API Implementation', cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, ext_modules=cythonize( Extension( "boardd_api_impl", - libraries=[':libcan_list_to_can_capnp.a', ':libcapnp.a', ':libkj.a'] if ARCH == "x86_64" else [':libcan_list_to_can_capnp.a', 'capnp', 'kj'], + libraries=libraries, library_dirs=[ './', PHONELIBS + '/capnp-cpp/' + ARCH_DIR + '/lib/', diff --git a/selfdrive/camerad/main.cc b/selfdrive/camerad/main.cc index 896a4cac6..7c65f7555 100644 --- a/selfdrive/camerad/main.cc +++ b/selfdrive/camerad/main.cc @@ -147,7 +147,7 @@ void* frontview_thread(void *arg) { // we subscribe to this for placement of the AE metering box // TODO: the loop is bad, ideally models shouldn't affect sensors Context *msg_context = Context::create(); - SubSocket *monitoring_sock = SubSocket::create(msg_context, "driverMonitoring", "127.0.0.1", true); + SubSocket *monitoring_sock = SubSocket::create(msg_context, "driverState", "127.0.0.1", true); assert(monitoring_sock != NULL); cl_command_queue q = clCreateCommandQueue(s->context, s->device_id, 0, &err); @@ -194,10 +194,10 @@ void* frontview_thread(void *arg) { capnp::FlatArrayMessageReader cmsg(amsg); cereal::Event::Reader event = cmsg.getRoot(); - float face_prob = event.getDriverMonitoring().getFaceProb(); + float face_prob = event.getDriverState().getFaceProb(); float face_position[2]; - face_position[0] = event.getDriverMonitoring().getFacePosition()[0]; - face_position[1] = event.getDriverMonitoring().getFacePosition()[1]; + face_position[0] = event.getDriverState().getFacePosition()[0]; + face_position[1] = event.getDriverState().getFacePosition()[1]; // set front camera metering target if (face_prob > 0.4) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 446778861..2d0445004 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -3,13 +3,18 @@ from common.params import Params from common.basedir import BASEDIR from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_known_cars from selfdrive.car.vin import get_vin, VIN_UNKNOWN -from selfdrive.car.fw_versions import get_fw_versions +from selfdrive.car.fw_versions import get_fw_versions, match_fw_to_car from selfdrive.swaglog import cloudlog import cereal.messaging as messaging from selfdrive.car import gen_empty_fingerprint +from cereal import car + def get_startup_alert(car_recognized, controller_available): alert = 'startup' + if Params().get("GitRemote", encoding="utf8") in ['git@github.com:commaai/openpilot.git', 'https://github.com/commaai/openpilot.git']: + if Params().get("GitBranch", encoding="utf8") not in ['devel', 'release2-staging', 'dashcam-staging', 'release2', 'dashcam']: + alert = 'startupMaster' if not car_recognized: alert = 'startupNoCar' elif car_recognized and not controller_available: @@ -51,20 +56,31 @@ def _get_interface_names(): # imports from directory selfdrive/car// interfaces = load_interfaces(_get_interface_names()) + def only_toyota_left(candidate_cars): return all(("TOYOTA" in c or "LEXUS" in c) for c in candidate_cars) and len(candidate_cars) > 0 -# BOUNTY: every added fingerprint in selfdrive/car/*/values.py is a $100 coupon code on shop.comma.ai + # **** for use live only **** def fingerprint(logcan, sendcan, has_relay): if has_relay: # Vin query only reliably works thorugh OBDII bus = 1 - addr, vin = get_vin(logcan, sendcan, bus) - _, car_fw = get_fw_versions(logcan, sendcan, bus) + + cached_params = Params().get("CarParamsCache") + if cached_params is not None: + cloudlog.warning("Using cached CarParams") + CP = car.CarParams.from_bytes(cached_params) + vin = CP.carVin + car_fw = list(CP.carFw) + else: + _, vin = get_vin(logcan, sendcan, bus) + car_fw = get_fw_versions(logcan, sendcan, bus) + + fw_candidates = match_fw_to_car(car_fw) else: vin = VIN_UNKNOWN - _, car_fw = set(), [] + fw_candidates, car_fw = set(), [] cloudlog.warning("VIN %s", vin) Params().put("CarVin", vin) @@ -110,12 +126,19 @@ def fingerprint(logcan, sendcan, has_relay): frame += 1 + source = car.CarParams.FingerprintSource.can + + # If FW query returns exactly 1 candidate, use it + if len(fw_candidates) == 1: + car_fingerprint = list(fw_candidates)[0] + source = car.CarParams.FingerprintSource.fw + cloudlog.warning("fingerprinted %s", car_fingerprint) - return car_fingerprint, finger, vin, car_fw + return car_fingerprint, finger, vin, car_fw, source def get_car(logcan, sendcan, has_relay=False): - candidate, fingerprints, vin, car_fw = fingerprint(logcan, sendcan, has_relay) + candidate, fingerprints, vin, car_fw, source = fingerprint(logcan, sendcan, has_relay) if candidate is None: cloudlog.warning("car doesn't match any fingerprints: %r", fingerprints) @@ -125,5 +148,6 @@ def get_car(logcan, sendcan, has_relay=False): car_params = CarInterface.get_params(candidate, fingerprints, has_relay, car_fw) car_params.carVin = vin car_params.carFw = car_fw + car_params.fingerprintSource = source return CarInterface(car_params, CarController), car_params diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py index 4b8919d2d..2bc4e9680 100644 --- a/selfdrive/car/chrysler/carcontroller.py +++ b/selfdrive/car/chrysler/carcontroller.py @@ -1,7 +1,7 @@ from selfdrive.car import apply_toyota_steer_torque_limits from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, \ create_wheel_buttons -from selfdrive.car.chrysler.values import ECU, CAR, SteerLimitParams +from selfdrive.car.chrysler.values import Ecu, CAR, SteerLimitParams from opendbc.can.packer import CANPacker class CarController(): @@ -20,7 +20,7 @@ class CarController(): self.fake_ecus = set() if enable_camera: - self.fake_ecus.add(ECU.CAM) + self.fake_ecus.add(Ecu.fwdCamera) self.packer = CANPacker(dbc_name) @@ -41,7 +41,7 @@ class CarController(): moving_fast = CS.v_ego > CS.CP.minSteerSpeed # for status message if CS.v_ego > (CS.CP.minSteerSpeed - 0.5): # for command high bit self.gone_fast_yet = True - elif self.car_fingerprint in (CAR.PACIFICA_2019_HYBRID, CAR.JEEP_CHEROKEE_2019): + elif self.car_fingerprint in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020_HYBRID, CAR.JEEP_CHEROKEE_2019): if CS.v_ego < (CS.CP.minSteerSpeed - 3.0): self.gone_fast_yet = False # < 14.5m/s stock turns off this bit, but fine down to 13.5 lkas_active = moving_fast and enabled diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py index 54b4a5f4c..93b84cf7d 100644 --- a/selfdrive/car/chrysler/carstate.py +++ b/selfdrive/car/chrysler/carstate.py @@ -6,17 +6,8 @@ from common.kalman.simple_kalman import KF1D GearShifter = car.CarState.GearShifter def parse_gear_shifter(can_gear): - if can_gear == 0x1: - return GearShifter.park - elif can_gear == 0x2: - return GearShifter.reverse - elif can_gear == 0x3: - return GearShifter.neutral - elif can_gear == 0x4: - return GearShifter.drive - elif can_gear == 0x5: - return GearShifter.low - return GearShifter.unknown + return {0x1: GearShifter.park, 0x2: GearShifter.reverse, 0x3: GearShifter.neutral, + 0x4: GearShifter.drive, 0x5: GearShifter.low}.get(can_gear, GearShifter.unknown) def get_can_parser(CP): diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py index f96d95ae9..f01ad5a09 100755 --- a/selfdrive/car/chrysler/interface.py +++ b/selfdrive/car/chrysler/interface.py @@ -4,7 +4,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.chrysler.carstate import CarState, get_can_parser, get_camera_parser -from selfdrive.car.chrysler.values import ECU, ECU_FINGERPRINT, CAR, FINGERPRINTS +from selfdrive.car.chrysler.values import Ecu, ECU_FINGERPRINT, CAR, FINGERPRINTS from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.car.interfaces import CarInterfaceBase @@ -68,7 +68,7 @@ class CarInterface(CarInterfaceBase): ret.minSteerSpeed = 3.8 # m/s ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this - if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.JEEP_CHEROKEE_2019): + if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020_HYBRID, CAR.JEEP_CHEROKEE_2019): ret.minSteerSpeed = 17.5 # m/s 17 on the way up, 13 on the way down once engaged. # TODO allow 2019 cars to steer down to 13 m/s if already engaged. @@ -91,7 +91,7 @@ class CarInterface(CarInterfaceBase): ret.brakeMaxBP = [5., 20.] ret.brakeMaxV = [1., 0.8] - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay print("ECU Camera Simulated: {0}".format(ret.enableCamera)) ret.openpilotLongitudinalControl = False diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py index ebd7cad87..68af182d4 100644 --- a/selfdrive/car/chrysler/values.py +++ b/selfdrive/car/chrysler/values.py @@ -1,4 +1,7 @@ from selfdrive.car import dbc_dict +from cereal import car +Ecu = car.CarParams.Ecu + class SteerLimitParams: STEER_MAX = 261 # 262 faults @@ -12,6 +15,7 @@ class CAR: PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017" PACIFICA_2018_HYBRID = "CHRYSLER PACIFICA HYBRID 2018" PACIFICA_2019_HYBRID = "CHRYSLER PACIFICA HYBRID 2019" + PACIFICA_2020_HYBRID = "CHRYSLER PACIFICA HYBRID 2020" PACIFICA_2018 = "CHRYSLER PACIFICA 2018" # Also covers Pacifica 2017. JEEP_CHEROKEE = "JEEP GRAND CHEROKEE V6 2018" # Also covers Tailhawk 2017. JEEP_CHEROKEE_2019 = "JEEP GRAND CHEROKEE 2019" @@ -51,6 +55,9 @@ FINGERPRINTS = { 168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 528: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 653: 8, 654: 8, 655: 8, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 701: 8, 703: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 746: 5, 752: 2, 754: 8, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 906: 8, 908: 8, 924: 8, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 958: 8, 959: 8, 962: 8, 969: 4, 973: 8, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 1562: 8, 1570: 8 } ], + CAR.PACIFICA_2020_HYBRID: [ + {168: 8, 257: 5, 258: 8, 264: 8, 268: 8, 270: 8, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 291: 8, 292: 8, 294: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 368: 8, 376: 3, 384: 8, 388: 4, 448: 6, 456: 4, 464: 8, 469: 8, 480: 8, 500: 8, 501: 8, 512: 8, 514: 8, 515: 7, 516: 7, 517: 7, 518: 7, 520: 8, 524: 8, 526: 6, 528: 8, 532: 8, 542: 8, 544: 8, 557: 8, 559: 8, 560: 8, 564: 8, 571: 3, 579: 8, 584: 8, 608: 8, 624: 8, 625: 8, 632: 8, 639: 8, 650: 8, 653: 8, 654: 8, 655: 8, 656: 4, 658: 6, 660: 8, 669: 3, 671: 8, 672: 8, 678: 8, 680: 8, 683: 8, 701: 8, 703: 8, 704: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 764: 8, 766: 8, 770: 8, 773: 8, 779: 8, 782: 8, 784: 8, 792: 8, 799: 8, 800: 8, 804: 8, 808: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 832: 8, 838: 2, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 878: 8, 882: 8, 897: 8, 906: 8, 908: 8, 924: 8, 926: 3, 929: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 958: 8, 959: 8, 962: 8, 969: 4, 973: 8, 974: 5, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1082: 8, 1083: 8, 1098: 8, 1100: 8, 2015: 8, 2016: 8, 2024: 8}, + ], CAR.JEEP_CHEROKEE: [ # JEEP GRAND CHEROKEE V6 2018 {55: 8, 168: 8, 181: 8, 256: 4, 257: 5, 258: 8, 264: 8, 268: 8, 272: 6, 273: 6, 274: 2, 280: 8, 284: 8, 288: 7, 290: 6, 292: 8, 300: 8, 308: 8, 320: 8, 324: 8, 331: 8, 332: 8, 344: 8, 352: 8, 362: 8, 368: 8, 376: 3, 384: 8, 388: 4, 416: 7, 448: 6, 456: 4, 464: 8, 500: 8, 501: 8, 512: 8, 514: 8, 520: 8, 532: 8, 544: 8, 557: 8, 559: 8, 560: 4, 564: 4, 571: 3, 579: 8, 584: 8, 608: 8, 618: 8, 624: 8, 625: 8, 632: 8, 639: 8, 656: 4, 658: 6, 660: 8, 671: 8, 672: 8, 676: 8, 678: 8, 680: 8, 683: 8, 684: 8, 703: 8, 705: 8, 706: 8, 709: 8, 710: 8, 719: 8, 720: 6, 729: 5, 736: 8, 737: 8, 738: 8, 746: 5, 752: 2, 754: 8, 760: 8, 761: 8, 764: 8, 766: 8, 773: 8, 776: 8, 779: 8, 782: 8, 783: 8, 784: 8, 785: 8, 788: 3, 792: 8, 799: 8, 800: 8, 804: 8, 806: 2, 808: 8, 810: 8, 816: 8, 817: 8, 820: 8, 825: 2, 826: 8, 831: 6, 832: 8, 838: 2, 844: 5, 848: 8, 853: 8, 856: 4, 860: 6, 863: 8, 882: 8, 897: 8, 906: 8, 924: 8, 937: 8, 938: 8, 939: 8, 940: 8, 941: 8, 942: 8, 943: 8, 947: 8, 948: 8, 956: 8, 968: 8, 969: 4, 970: 8, 973: 8, 974: 5, 976: 8, 977: 4, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 992: 8, 993: 7, 995: 8, 996: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1024: 8, 1025: 8, 1026: 8, 1031: 8, 1033: 8, 1050: 8, 1059: 8, 1062: 8, 1098: 8, 1100: 8}, @@ -78,6 +85,9 @@ DBC = { CAR.PACIFICA_2019_HYBRID: dbc_dict( # Same DBC file works. 'chrysler_pacifica_2017_hybrid', # 'pt' 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' + CAR.PACIFICA_2020_HYBRID: dbc_dict( # Same DBC file works. + 'chrysler_pacifica_2017_hybrid', # 'pt' + 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' CAR.JEEP_CHEROKEE: dbc_dict( # Same DBC file works. 'chrysler_pacifica_2017_hybrid', # 'pt' 'chrysler_pacifica_2017_hybrid_private_fusion'), # 'radar' @@ -89,10 +99,6 @@ DBC = { STEER_THRESHOLD = 120 -class ECU: - CAM = 0 # LKAS camera - - ECU_FINGERPRINT = { - ECU.CAM: [0x292], # lkas cmd + Ecu.fwdCamera: [0x292], # lkas cmd } diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index 70df1cf95..d9fad4bb5 100755 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -5,7 +5,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.ford.carstate import CarState, get_can_parser -from selfdrive.car.ford.values import MAX_ANGLE, ECU, ECU_FINGERPRINT, FINGERPRINTS +from selfdrive.car.ford.values import MAX_ANGLE, Ecu, ECU_FINGERPRINT, FINGERPRINTS from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.car.interfaces import CarInterfaceBase @@ -85,7 +85,7 @@ class CarInterface(CarInterfaceBase): ret.brakeMaxBP = [5., 20.] ret.brakeMaxV = [1., 0.8] - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay ret.openpilotLongitudinalControl = False cloudlog.warning("ECU Camera Simulated: %r", ret.enableCamera) diff --git a/selfdrive/car/ford/values.py b/selfdrive/car/ford/values.py index a3fb576a3..191f06cbc 100644 --- a/selfdrive/car/ford/values.py +++ b/selfdrive/car/ford/values.py @@ -1,4 +1,6 @@ from selfdrive.car import dbc_dict +from cereal import car +Ecu = car.CarParams.Ecu MAX_ANGLE = 87. # make sure we never command the extremes (0xfff) which cause latching fault @@ -11,11 +13,8 @@ FINGERPRINTS = { }], } -class ECU: - CAM = 0 - ECU_FINGERPRINT = { - ECU.CAM: [970, 973, 984] + Ecu.fwdCamera: [970, 973, 984] } DBC = { diff --git a/selfdrive/car/fw_versions.py b/selfdrive/car/fw_versions.py index 1175c5978..5a3dacf32 100755 --- a/selfdrive/car/fw_versions.py +++ b/selfdrive/car/fw_versions.py @@ -6,6 +6,7 @@ from tqdm import tqdm from selfdrive.car.isotp_parallel_query import IsoTpParallelQuery from selfdrive.swaglog import cloudlog from selfdrive.car.fingerprints import FW_VERSIONS +from selfdrive.car.toyota.values import CAR as TOYOTA import panda.python.uds as uds from cereal import car @@ -63,20 +64,34 @@ REQUESTS = [ ) ] + def chunks(l, n=128): for i in range(0, len(l), n): yield l[i:i + n] + def match_fw_to_car(fw_versions): candidates = FW_VERSIONS invalid = [] + fw_versions_dict = {} + for fw in fw_versions: + addr = fw.address + sub_addr = fw.subAddress if fw.subAddress != 0 else None + fw_versions_dict[(addr, sub_addr)] = fw.fwVersion + for candidate, fws in candidates.items(): for ecu, expected_versions in fws.items(): ecu_type = ecu[0] addr = ecu[1:] + found_version = fw_versions_dict.get(addr, None) - found_version = fw_versions.get(addr, None) + if ecu_type == Ecu.esp and candidate in [TOYOTA.RAV4, TOYOTA.COROLLA, TOYOTA.HIGHLANDER] and found_version is None: + continue + + # TODO: COROLLA_TSS2 engine can show on two different addresses + if ecu_type == Ecu.engine and candidate == TOYOTA.COROLLA_TSS2 and found_version is None: + continue # Allow DSU not being present if ecu_type in [Ecu.unknown, Ecu.dsu] and found_version is None: @@ -138,8 +153,7 @@ def get_fw_versions(logcan, sendcan, bus, extra=None, timeout=0.1, debug=False, car_fw.append(f) - candidates = match_fw_to_car(fw_versions) - return candidates, car_fw + return car_fw if __name__ == "__main__": @@ -148,7 +162,6 @@ if __name__ == "__main__": import cereal.messaging as messaging from selfdrive.car.vin import get_vin - parser = argparse.ArgumentParser(description='Get firmware version of ECUs') parser.add_argument('--scan', action='store_true') parser.add_argument('--debug', action='store_true') @@ -176,7 +189,8 @@ if __name__ == "__main__": print() t = time.time() - candidates, fw_vers = get_fw_versions(logcan, sendcan, 1, extra=extra, debug=args.debug, progress=True) + fw_vers = get_fw_versions(logcan, sendcan, 1, extra=extra, debug=args.debug, progress=True) + candidates = match_fw_to_car(fw_vers) print() print("Found FW versions") @@ -186,7 +200,6 @@ if __name__ == "__main__": print(f" (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}]") print("}") - print() print("Possible matches:", candidates) print("Getting fw took %.3f s" % (time.time() - t)) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index b58a1a997..93ee18ff2 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -3,7 +3,7 @@ from cereal import car from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET from selfdrive.controls.lib.vehicle_model import VehicleModel -from selfdrive.car.gm.values import DBC, CAR, ECU, ECU_FINGERPRINT, \ +from selfdrive.car.gm.values import DBC, CAR, Ecu, ECU_FINGERPRINT, \ SUPERCRUISE_CARS, AccState, FINGERPRINTS from selfdrive.car.gm.carstate import CarState, CruiseButtons, get_powertrain_can_parser from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint @@ -58,7 +58,7 @@ class CarInterface(CarInterfaceBase): # Presence of a camera on the object bus is ok. # Have to go to read_only if ASCM is online (ACC-enabled cars), # or camera is on powertrain bus (LKA cars without ACC). - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or \ + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or \ has_relay or \ candidate == CAR.CADILLAC_CT6 ret.openpilotLongitudinalControl = ret.enableCamera diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index 126ae9e40..468deb01d 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -1,5 +1,6 @@ from cereal import car from selfdrive.car import dbc_dict +Ecu = car.CarParams.Ecu class CAR: HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017" @@ -86,11 +87,8 @@ FINGERPRINTS = { STEER_THRESHOLD = 1.0 -class ECU: - CAM = 0 - ECU_FINGERPRINT = { - ECU.CAM: [384, 715] # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" + Ecu.fwdCamera: [384, 715] # 384 = "ASCMLKASteeringCmd", 715 = "ASCMGasRegenCmd" } DBC = { diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 39b91c866..52bea3d7d 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -9,14 +9,9 @@ from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, SPEED_FACTOR, GearShifter = car.CarState.GearShifter -def parse_gear_shifter(gear, vals): - - val_to_capnp = {'P': GearShifter.park, 'R': GearShifter.reverse, 'N': GearShifter.neutral, - 'D': GearShifter.drive, 'S': GearShifter.sport, 'L': GearShifter.low} - try: - return val_to_capnp[vals[gear]] - except KeyError: - return "unknown" +def parse_gear_shifter(gear): + return {'P': GearShifter.park, 'R': GearShifter.reverse, 'N': GearShifter.neutral, + 'D': GearShifter.drive, 'S': GearShifter.sport, 'L': GearShifter.low}.get(gear, GearShifter.unknown) def calc_cruise_offset(offset, speed): @@ -315,7 +310,7 @@ class CarState(): self.main_on = cp.vl["SCM_BUTTONS"]['MAIN_ON'] can_gear_shifter = int(cp.vl["GEARBOX"]['GEAR_SHIFTER']) - self.gear_shifter = parse_gear_shifter(can_gear_shifter, self.shifter_values) + self.gear_shifter = parse_gear_shifter(self.shifter_values.get(can_gear_shifter, None)) self.pedal_gas = cp.vl["POWERTRAIN_DATA"]['PEDAL_GAS'] # crv doesn't include cruise control diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index b1abeed3d..b055bc559 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -8,7 +8,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET, get_events from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.honda.carstate import CarState, get_can_parser, get_cam_can_parser -from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, ECU, ECU_FINGERPRINT, FINGERPRINTS +from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, Ecu, ECU_FINGERPRINT, FINGERPRINTS from selfdrive.car import STD_CARGO_KG, CivicParams, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.controls.lib.planner import _A_CRUISE_MAX_V_FOLLOWING from selfdrive.car.interfaces import CarInterfaceBase @@ -141,12 +141,12 @@ class CarInterface(CarInterfaceBase): if candidate in HONDA_BOSCH: ret.safetyModel = car.CarParams.SafetyModel.hondaBoschHarness if has_relay else car.CarParams.SafetyModel.hondaBoschGiraffe rdr_bus = 0 if has_relay else 2 - ret.enableCamera = is_ecu_disconnected(fingerprint[rdr_bus], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[rdr_bus], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay ret.radarOffCan = True ret.openpilotLongitudinalControl = False else: ret.safetyModel = car.CarParams.SafetyModel.hondaNidec - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay ret.enableGasInterceptor = 0x201 in fingerprint[0] ret.openpilotLongitudinalControl = ret.enableCamera diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 4301128bc..124e44ccd 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -21,9 +21,6 @@ VISUAL_HUD = { VisualAlert.seatbeltUnbuckled: 5, VisualAlert.speedTooHigh: 8} -class ECU: - CAM = Ecu.fwdCamera - class CAR: ACCORD = "HONDA ACCORD 2018 SPORT 2T" ACCORD_15 = "HONDA ACCORD 2018 LX 1.5T" @@ -68,6 +65,14 @@ FINGERPRINTS = { CAR.CIVIC_BOSCH: [{ # 2017 Civic Hatchback EX, 2019 Civic Sedan Touring Canadian, and 2018 Civic Hatchback Executive Premium 1.0L CVT European 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 460: 3, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1625: 5, 1629: 5, 1633: 8, + }, + # 2017 Civic Hatchback LX + { + 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 423: 2, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 815: 8, 825: 4, 829: 5, 846: 8, 862: 8, 881: 8, 882: 4, 884: 8, 888: 8, 891: 8, 892: 8, 918: 7, 927: 8, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1092: 1, 1108: 8, 1125: 8, 1127: 2, 1296: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1633: 8 + }, + # 2019 Civic Hatchback EX + { + 57: 3, 148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 892: 8, 927: 8, 929: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1108: 8, 1302: 8, 1322: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8, 1633: 8 }], CAR.CRV: [{ 57: 3, 145: 8, 316: 8, 340: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 6, 401: 8, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 493: 3, 506: 8, 507: 1, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 661: 4, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 829: 5, 882: 2, 884: 7, 888: 8, 891: 8, 892: 8, 923: 2, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, @@ -122,32 +127,354 @@ for c in FINGERPRINTS: # TODO: Figure out what is relevant FW_VERSIONS = { - CAR.CIVIC: { - (Ecu.unknown, 0x18da10f1, None): [b'37805-5AA-L660\x00\x00'], - (Ecu.unknown, 0x18da1ef1, None): [b'28101-5CG-A050\x00\x00'], - (Ecu.unknown, 0x18da28f1, None): [b'57114-TBA-A550\x00\x00'], - (Ecu.eps, 0x18da30f1, None): [b'39990-TBA-A030\x00\x00', b'39990-TBA,A030\x00\x00'], - (Ecu.unknown, 0x18da53f1, None): [b'77959-TBA-A030\x00\x00'], - (Ecu.unknown, 0x18da60f1, None): [b'78109-TBC-A310\x00\x00'], - (Ecu.unknown, 0x18dab0f1, None): [b'36161-TBC-A030\x00\x00'], - (Ecu.unknown, 0x18daeff1, None): [b'38897-TBA-A020\x00\x00'], - - }, CAR.ACCORD: { - (Ecu.unknown, 0x18da10f1, None): [b'37805-6B2-A650\x00\x00'], + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-6A0-A640\x00\x00', + b'37805-6B2-A550\x00\x00', + b'37805-6B2-A650\x00\x00', + b'37805-6B2-M520\x00\x00', + ], (Ecu.unknown, 0x18da0bf1, None): [b'54008-TVC-A910\x00\x00'], - (Ecu.unknown, 0x18da1ef1, None): [b'28102-6B8-A560\x00\x00'], + (Ecu.unknown, 0x18da1ef1, None): [b'28102-6B8-A560\x00\x00', b'28102-6B8-M520\x00\x00'], (Ecu.unknown, 0x18da2bf1, None): [b'46114-TVA-A060\x00\x00'], (Ecu.unknown, 0x18da28f1, None): [b'57114-TVA-C050\x00\x00'], - (Ecu.eps, 0x18da30f1, None): [b'39990-TVA-A150\x00\x00'], + (Ecu.eps, 0x18da30f1, None): [ + b'39990-TVA-A150\x00\x00', + b'39990-TVA-A160\x00\x00', + b'39990-TVA-X030\x00\x00', + ], (Ecu.unknown, 0x18da3af1, None): [b'39390-TVA-A020\x00\x00'], - (Ecu.unknown, 0x18da53f1, None): [b'77959-TVA-A460\x00\x00'], - (Ecu.unknown, 0x18da60f1, None): [b'78109-TVC-A210\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-TVA-A460\x00\x00', b'77959-TVA-X330\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TVA-A210\x00\x00', + b'78109-TVC-A010\x00\x00', + b'78109-TVC-A110\x00\x00', + b'78109-TVC-A210\x00\x00', + b'78109-TVC-M510\x00\x00', + ], (Ecu.unknown, 0x18da61f1, None): [b'78209-TVA-A010\x00\x00'], - (Ecu.unknown, 0x18dab0f1, None): [b'36802-TVA-A160\x00\x00'], - (Ecu.unknown, 0x18dab5f1, None): [b'36161-TVA-A060\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [b'36802-TVA-A160\x00\x00', b'36802-TWA-A070\x00\x00'], + (Ecu.unknown, 0x18dab5f1, None): [b'36161-TVA-A060\x00\x00', b'36161-TWA-A070\x00\x00'], (Ecu.unknown, 0x18daeff1, None): [b'38897-TVA-A010\x00\x00'], - } + }, + CAR.ACCORD_15: { + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-6A0-9620\x00\x00', + b'37805-6A0-A640\x00\x00', + b'37805-6A0-A740\x00\x00', + b'37805-6A0-A840\x00\x00', + b'37805-6A0-A850\x00\x00', + ], + (Ecu.unknown, 0x18da1ef1, None): [ + b'28101-6A7-A220\x00\x00', + b'28101-6A7-A320\x00\x00', + b'28101-6A7-A510\x00\x00', + ], + (Ecu.unknown, 0x18daeff1, None): [b'38897-TVA-A230\x00\x00'], + (Ecu.unknown, 0x18da2bf1, None): [ + b'46114-TVA-A050\x00\x00', + b'46114-TVA-A060\x00\x00', + b'46114-TVA-A120\x00\x00', + ], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TVA-A010\x00\x00', + b'78109-TVA-A210\x00\x00', + b'78109-TVA-A220\x00\x00', + b'78109-TVA-A310\x00\x00', + b'78109-TWA-A210\x00\x00', + ], + (Ecu.unknown, 0x18da61f1, None): [b'78209-TVA-A010\x00\x00'], + (Ecu.unknown, 0x18dab5f1, None): [b'36161-TVA-A060\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-TVA-A460\x00\x00'], + (Ecu.unknown, 0x18da28f1, None): [ + b'57114-TVA-B050\x00\x00', + b'57114-TVA-B040\x00\x00', + ], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36802-TVA-A150\x00\x00', + b'36802-TVA-A160\x00\x00', + b'36802-TVA-A170\x00\x00', + ], + (Ecu.eps, 0x18da30f1, None): [ + b'39990-TVA-A140\x00\x00', + b'39990-TVA-A150\x00\x00', # Are these two different steerRatio? + b'39990-TVA-A160\x00\x00', # Sport, Sport 2.0T and Touring 2.0T have different ratios + ], + }, + CAR.ACCORDH: { + (Ecu.unknown, 0x18daeff1, None): [b'38897-TWA-A120\x00\x00'], + (Ecu.unknown, 0x18da28f1, None): [b'57114-TWA-A040\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-TWA-A440\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TWA-A010\x00\x00', + b'78109-TWA-A120\x00\x00', + b'78109-TWA-A210\x00\x00', + b'78109-TWA-A110\x00\x00', + ], + (Ecu.unknown, 0x18da0bf1, None): [b'54008-TWA-A910\x00\x00'], + (Ecu.unknown, 0x18da61f1, None): [b'78209-TVA-A010\x00\x00'], + (Ecu.unknown, 0x18dab5f1, None): [b'36161-TWA-A070\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [b'36802-TWA-A080\x00\x00', b'36802-TWA-A070\x00\x00'], + (Ecu.eps, 0x18da30f1, None): [b'39990-TVA-A160\x00\x00', b'39990-TVA-A150\x00\x00'], + }, + CAR.CIVIC: { + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-5AA-A640\x00\x00', + b'37805-5AA-A650\x00\x00', + b'37805-5AA-A670\x00\x00', + b'37805-5AA-A680\x00\x00', + b'37805-5AA-A810\x00\x00', + b'37805-5AA-L660\x00\x00', + b'37805-5AJ-A610\x00\x00', + b'37805-5BA-A510\x00\x00', + b'37805-5BA-L940\x00\x00', + b'37805-5BA-L960\x00\x00', + ], + (Ecu.unknown, 0x18da1ef1, None): [ + b'28101-5CG-A040\x00\x00', + b'28101-5CG-A050\x00\x00', + b'28101-5CG-A070\x00\x00', + b'28101-5CG-A080\x00\x00', + b'28101-5CG-A810\x00\x00', + b'28101-5DJ-A040\x00\x00', + b'28101-5DJ-A060\x00\x00', + b'28101-5DJ-A510\x00\x00', + ], + (Ecu.unknown, 0x18da28f1, None): [ + b'57114-TBA-A550\x00\x00', + b'57114-TBA-A560\x00\x00', + b'57114-TBA-A570\x00\x00' + ], + (Ecu.eps, 0x18da30f1, None): [ + b'39990-TBA,A030\x00\x00', + b'39990-TBA-A030\x00\x00', + b'39990-TBG-A030\x00\x00', + b'39990-TEG-A010\x00\x00', + ], + (Ecu.unknown, 0x18da53f1, None): [ + b'77959-TBA-A030\x00\x00', + b'77959-TBA-A040\x00\x00', + b'77959-TBG-A030\x00\x00', + ], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TBC-A310\x00\x00', + b'78109-TBC-A320\x00\x00', + b'78109-TBC-A510\x00\x00', + b'78109-TBC-A520\x00\x00', + b'78109-TBC-A530\x00\x00', + b'78109-TBH-A530\x00\x00', + b'78109-TEG-A310\x00\x00', + ], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36161-TBA-A030\x00\x00', + b'36161-TBC-A020\x00\x00', + b'36161-TBC-A030\x00\x00', + b'36161-TEG-A010\x00\x00', + ], + (Ecu.unknown, 0x18daeff1, None): [ + b'36161-TBA-A030\x00\x00', + b'38897-TBA-A010\x00\x00', + b'38897-TBA-A020\x00\x00', + ], + }, + CAR.CIVIC_BOSCH: { + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-5AA-A950\x00\x00', + b'37805-5AA-L950\x00\x00', + b'37805-5AN-A750\x00\x00', + b'37805-5AN-A830\x00\x00', + b'37805-5AN-A930\x00\x00', + b'37805-5AN-L940\x00\x00', + b'37805-5AZ-E850\x00\x00', + b'37805-5BB-L640\x00\x00', + ], + (Ecu.unknown, 0x18da1ef1, None): [ + b'28101-5CG-A920\x00\x00', + b'28101-5CK-A130\x00\x00', + b'28101-5CK-A140\x00\x00', + b'28101-5CK-A150\x00\x00', + b'28101-5CK-C130\x00\x00', + b'28101-5DJ-A710\x00\x00', + b'28101-5DV-E330\x00\x00', + ], + (Ecu.unknown, 0x18da28f1, None): [ + b'57114-TBG-A340\x00\x00', + b'57114-TGG-A340\x00\x00', + b'57114-TGL-G330\x00\x00', + ], + (Ecu.eps, 0x18da30f1, None): [ + b'39990-TBA-C020\x00\x00', + b'39990-TBA-C120\x00\x00', + b'39990-TGG-A020\x00\x00', + b'39990-TGG-A120\x00\x00', + b'39990-TGL-E130\x00\x00', + ], + (Ecu.unknown, 0x18da53f1, None): [ + b'77959-TBA-A060\x00\x00', + b'77959-TGG-A020\x00\x00', + b'77959-TGG-G010\x00\x00', + ], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TBA-A910\x00\x00', + b'78109-TBC-A740\x00\x00', + b'78109-TGG-A210\x00\x00', + b'78109-TGG-A310\x00\x00', + b'78109-TGG-A810\x00\x00', + b'78109-TGL-G120\x00\x00', + ], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36802-TBA-A150\x00\x00', + b'36802-TGG-A050\x00\x00', + b'36802-TGL-G040\x00\x00', + ], + (Ecu.unknown, 0x18dab5f1, None): [ + b'36161-TBA-A130\x00\x00', + b'36161-TGG-A060\x00\x00', + b'36161-TGL-G050\x00\x00', + ], + (Ecu.unknown, 0x18daeff1, None): [b'38897-TBA-A110\x00\x00', b'38897-TBA-A020\x00\x00'], + }, + CAR.CRV_5G: { + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-5PA-3080\x00\x00', + b'37805-5PA-4050\x00\x00', + b'37805-5PA-6530\x00\x00', + b'37805-5PA-6630\x00\x00', + b'37805-5PA-A670\x00\x00', + b'37805-5PA-A680\x00\x00', + b'37805-5PA-A850\x00\x00', + b'37805-5PA-A870\x00\x00', + b'37805-5PA-A890\x00\x00', + ], + (Ecu.unknown, 0x18da1ef1, None): [ + b'28101-5RG-A020\x00\x00', + b'28101-5RG-A030\x00\x00', + b'28101-5RG-A040\x00\x00', + b'28101-5RG-A120\x00\x00', + b'28101-5RH-A030\x00\x00', + b'28101-5RH-A040\x00\x00', + b'28101-5RH-A120\x00\x00', + ], + (Ecu.unknown, 0x18da28f1, None): [ + b'57114-TLA-A040\x00\x00', + b'57114-TLA-A050\x00\x00', + b'57114-TLA-A060\x00\x00', + ], + (Ecu.eps, 0x18da30f1, None): [b'39990-TLA-A040\x00\x00', b'39990-TLA,A040\x00\x00'], + (Ecu.unknown, 0x18da2bf1, None): [b'46114-TLA-A040\x00\x00', b'46114-TLA-A050\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TLA-A110\x00\x00', + b'78109-TLA-A210\x00\x00', + b'78109-TLA-C210\x00\x00', + b'78109-TLB-A110\x00\x00', + b'78109-TLB-A210\x00\x00', + ], + (Ecu.unknown, 0x18daeff1, None): [b'38897-TLA-A010\x00\x00', b'38897-TNY-G010\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36802-TLA-A040\x00\x00', + b'36802-TLA-A050\x00\x00', + b'36802-TLA-A060\x00\x00', + ], + (Ecu.unknown, 0x18dab5f1, None): [ + b'36161-TLA-A060\x00\x00', + b'36161-TLA-A070\x00\x00', + b'36161-TLA-A080\x00\x00', + ], + (Ecu.unknown, 0x18da53f1, None): [ + b'77959-TLA-A240\x00\x00', + b'77959-TLA-A250\x00\x00', + b'77959-TLA-A320\x00\x00', + ], + }, + CAR.CRV_HYBRID: { + (Ecu.unknown, 0x18da28f1, None): [b'57114-TPA-G020\x00\x00'], + (Ecu.eps, 0x18da30f1, None): [b'39990-TPA-G030\x00\x00'], + (Ecu.unknown, 0x18daeff1, None): [b'38897-TMA-H110\x00\x00'], + (Ecu.unknown, 0x18da0bf1, None): [b'54008-TMB-H510\x00\x00'], + (Ecu.unknown, 0x18dab5f1, None): [b'36161-TPA-E050\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [b'78109-TPA-G520\x00\x00'], + (Ecu.unknown, 0x18da61f1, None): [b'78209-TLA-X010\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [b'36802-TPA-E040\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-TLA-G220\x00\x00'], + }, + CAR.ODYSSEY: { + (Ecu.unknown, 0x18daeff1, None): [b'38897-THR-A010\x00\x00', b'38897-THR-A020\x00\x00'], + (Ecu.unknown, 0x18da10f1, None): [ + b'37805-5MR-A250\x00\x00', + b'37805-5MR-A310\x00\x00', + b'37805-5MR-A750\x00\x00', + b'37805-5MR-A840\x00\x00', + b'37805-5MR-C620\x00\x00', + ], + (Ecu.eps, 0x18da30f1, None): [b'39990-THR-A020\x00\x00', b'39990-THR-A030\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-THR-A010\x00\x00', b'77959-THR-A110\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36161-THR-A030\x00\x00', + b'36161-THR-A110\x00\x00', + b'36161-THR-A720\x00\x00', + b'36161-THR-A810\x00\x00', + b'36161-THR-C010\x00\x00', + ], + (Ecu.unknown, 0x18da1ef1, None): [ + b'28101-5NZ-A310\x00\x00', + b'28101-5NZ-C310\x00\x00', + b'28102-5MX-A001\x00\x00', + b'28102-5MX-A610\x00\x00', + b'28102-5MX-A710\x00\x00', + b'28102-5MX-A910\x00\x00', + b'28103-5NZ-A300\x00\x00', + ], + (Ecu.unknown, 0x18da28f1, None): [b'57114-THR-A040\x00\x00', b'57114-THR-A110\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-THR-A230\x00\x00', + b'78109-THR-A430\x00\x00', + b'78109-THR-A820\x00\x00', + b'78109-THR-AB20\x00\x00', + b'78109-THR-AB20\x00\x00', + b'78109-THR-AB40\x00\x00', + b'78109-THR-AC40\x00\x00', + b'78109-THR-AE40\x00\x00', + b'78109-THR-AL10\x00\x00', + b'78109-THR-C330\x00\x00', + ], + (Ecu.unknown, 0x18da0bf1, None): [b'54008-THR-A020\x00\x00'], + }, + CAR.PILOT_2019: { + (Ecu.eps, 0x18da30f1, None): [b'39990-TG7-A060\x00\x00', b'39990-TGS-A230\x00\x00'], + (Ecu.unknown, 0x18daeff1, None): [b'38897-TG7-A110\x00\x00', b'38897-TG7-A030\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [ + b'36161-TG7-A630\x00\x00', + b'36161-TG7-A930\x00\x00', + b'36161-TG8-A630\x00\x00', + b'36161-TGS-A130\x00\x00', + b'36161-TGT-A030\x00\x00', + ], + (Ecu.unknown, 0x18da53f1, None): [b'77959-TG7-A210\x00\x00', b'77959-TGS-A010\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [ + b'78109-TG7-AJ20\x00\x00', + b'78109-TG7-AP10\x00\x00', + b'78109-TG7-AP20\x00\x00', + b'78109-TG8-AJ20\x00\x00', + b'78109-TGS-AK20\x00\x00', + b'78109-TGS-AP20\x00\x00', + b'78109-TGT-AJ20\x00\x00', + ], + (Ecu.unknown, 0x18da28f1, None): [ + b'57114-TG7-A630\x00\x00', + b'57114-TG7-A730\x00\x00', + b'57114-TG8-A630\x00\x00', + b'57114-TGS-A530\x00\x00', + b'57114-TGT-A530\x00\x00', + ], + }, + CAR.RIDGELINE: { + (Ecu.eps, 0x18da30f1, None): [b'39990-T6Z-A020\x00\x00'], + (Ecu.unknown, 0x18dab0f1, None): [b'36161-T6Z-A310\x00\x00'], + (Ecu.unknown, 0x18daeff1, None): [b'38897-T6Z-A010\x00\x00'], + (Ecu.unknown, 0x18da60f1, None): [b'78109-T6Z-A420\x00\x00'], + (Ecu.unknown, 0x18da53f1, None): [b'77959-T6Z-A020\x00\x00'], + (Ecu.unknown, 0x18da28f1, None): [b'57114-T6Z-A130\x00\x00'], + }, } DBC = { @@ -210,7 +537,7 @@ SPEED_FACTOR = { # msgs sent for steering controller by camera module on can 0. # those messages are mutually exclusive on CRV and non-CRV cars ECU_FINGERPRINT = { - ECU.CAM: [0xE4, 0x194], # steer torque cmd + Ecu.fwdCamera: [0xE4, 0x194], # steer torque cmd } HONDA_BOSCH = [CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CRV_5G, CAR.CRV_HYBRID] diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 50c31af3d..2db3cd45e 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -4,7 +4,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.hyundai.carstate import CarState, get_can_parser, get_camera_parser -from selfdrive.car.hyundai.values import ECU, ECU_FINGERPRINT, CAR, get_hud_alerts, FEATURES, FINGERPRINTS +from selfdrive.car.hyundai.values import Ecu, ECU_FINGERPRINT, CAR, get_hud_alerts, FEATURES, FINGERPRINTS from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.car.interfaces import CarInterfaceBase @@ -140,7 +140,7 @@ class CarInterface(CarInterfaceBase): ret.brakeMaxBP = [0.] ret.brakeMaxV = [1.] - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay ret.openpilotLongitudinalControl = False ret.stoppingControl = False diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index f2a800a9d..d29aba44e 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1,5 +1,6 @@ from cereal import car from selfdrive.car import dbc_dict +Ecu = car.CarParams.Ecu VisualAlert = car.CarControl.HUDControl.VisualAlert @@ -61,11 +62,8 @@ FINGERPRINTS = { ], } -class ECU: - CAM = 0 - ECU_FINGERPRINT = { - ECU.CAM: [832, 1156, 1191, 1342] + Ecu.fwdCamera: [832, 1156, 1191, 1342] } CHECKSUM = { diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py index 57bd1bee7..3f0447432 100644 --- a/selfdrive/car/subaru/carstate.py +++ b/selfdrive/car/subaru/carstate.py @@ -89,8 +89,10 @@ class CarState(): self.car_fingerprint = CP.carFingerprint self.left_blinker_on = False + self.left_blinker_cnt = 0 self.prev_left_blinker_on = False self.right_blinker_on = False + self.right_blinker_cnt = 0 self.prev_right_blinker_on = False self.steer_torque_driver = 0 self.steer_not_allowed = False @@ -136,8 +138,14 @@ class CarState(): self.prev_left_blinker_on = self.left_blinker_on self.prev_right_blinker_on = self.right_blinker_on - self.left_blinker_on = cp.vl["Dashlights"]['LEFT_BLINKER'] == 1 - self.right_blinker_on = cp.vl["Dashlights"]['RIGHT_BLINKER'] == 1 + + # continuous blinker signals for assisted lane change + self.left_blinker_cnt = 50 if cp.vl["Dashlights"]['LEFT_BLINKER'] else max(self.left_blinker_cnt - 1, 0) + self.left_blinker_on = self.left_blinker_cnt > 0 + + self.right_blinker_cnt = 50 if cp.vl["Dashlights"]['RIGHT_BLINKER'] else max(self.right_blinker_cnt - 1, 0) + self.right_blinker_on = self.right_blinker_cnt > 0 + self.seatbelt_unlatched = cp.vl["Dashlights"]['SEATBELT_FL'] == 1 self.steer_torque_driver = cp.vl["Steering_Torque"]['Steer_Torque_Sensor'] self.acc_active = cp.vl["CruiseControl"]['Cruise_Activated'] diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py index 7292a135c..b75fa9c38 100644 --- a/selfdrive/car/subaru/values.py +++ b/selfdrive/car/subaru/values.py @@ -1,4 +1,6 @@ from selfdrive.car import dbc_dict +from cereal import car +Ecu = car.CarParams.Ecu class CAR: IMPREZA = "SUBARU IMPREZA LIMITED 2019" @@ -17,11 +19,8 @@ STEER_THRESHOLD = { CAR.IMPREZA: 80, } -class ECU: - CAM = 0 - ECU_FINGERPRINT = { - ECU.CAM: [290, 356], # steer torque cmd + Ecu.fwdCamera: [290, 356], # steer torque cmd } DBC = { diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 0a8f7979d..c2349784b 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -4,7 +4,7 @@ from selfdrive.car import apply_toyota_steer_torque_limits, create_gas_command, from selfdrive.car.toyota.toyotacan import create_steer_command, create_ui_command, \ create_ipas_steer_command, create_accel_command, \ create_acc_cancel_command, create_fcw_command -from selfdrive.car.toyota.values import CAR, ECU, STATIC_MSGS, SteerLimitParams +from selfdrive.car.toyota.values import Ecu, CAR, STATIC_MSGS, SteerLimitParams from opendbc.can.packer import CANPacker VisualAlert = car.CarControl.HUDControl.VisualAlert @@ -101,9 +101,9 @@ class CarController(): self.steer_rate_limited = False self.fake_ecus = set() - if enable_camera: self.fake_ecus.add(ECU.CAM) - if enable_dsu: self.fake_ecus.add(ECU.DSU) - if enable_apg: self.fake_ecus.add(ECU.APGS) + if enable_camera: self.fake_ecus.add(Ecu.fwdCamera) + if enable_dsu: self.fake_ecus.add(Ecu.dsu) + if enable_apg: self.fake_ecus.add(Ecu.apgs) self.packer = CANPacker(dbc_name) @@ -186,7 +186,7 @@ class CarController(): # toyota can trace shows this message at 42Hz, with counter adding alternatively 1 and 2; # sending it at 100Hz seem to allow a higher rate limit, as the rate limit seems imposed # on consecutive messages - if ECU.CAM in self.fake_ecus: + if Ecu.fwdCamera in self.fake_ecus: if self.angle_control: can_sends.append(create_steer_command(self.packer, 0., 0, frame)) else: @@ -194,12 +194,12 @@ class CarController(): if self.angle_control: can_sends.append(create_ipas_steer_command(self.packer, apply_angle, self.steer_angle_enabled, - ECU.APGS in self.fake_ecus)) - elif ECU.APGS in self.fake_ecus: + Ecu.apgs in self.fake_ecus)) + elif Ecu.apgs in self.fake_ecus: can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True)) # we can spam can to cancel the system even if we are using lat only control - if (frame % 3 == 0 and CS.CP.openpilotLongitudinalControl) or (pcm_cancel_cmd and ECU.CAM in self.fake_ecus): + if (frame % 3 == 0 and CS.CP.openpilotLongitudinalControl) or (pcm_cancel_cmd and Ecu.fwdCamera in self.fake_ecus): lead = lead or CS.v_ego < 12. # at low speed we always assume the lead is present do ACC can be engaged # Lexus IS uses a different cancellation message @@ -232,10 +232,10 @@ class CarController(): if pcm_cancel_cmd: send_ui = True - if (frame % 100 == 0 or send_ui) and ECU.CAM in self.fake_ecus: + if (frame % 100 == 0 or send_ui) and Ecu.fwdCamera in self.fake_ecus: can_sends.append(create_ui_command(self.packer, steer, pcm_cancel_cmd, left_line, right_line, left_lane_depart, right_lane_depart)) - if frame % 100 == 0 and ECU.DSU in self.fake_ecus: + if frame % 100 == 0 and Ecu.dsu in self.fake_ecus: can_sends.append(create_fcw_command(self.packer, fcw)) #*** static msgs *** diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 0fbf7a797..9ed0fec3f 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -8,14 +8,9 @@ from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, TSS2_CAR, NO_ GearShifter = car.CarState.GearShifter -def parse_gear_shifter(gear, vals): - - val_to_capnp = {'P': GearShifter.park, 'R': GearShifter.reverse, 'N': GearShifter.neutral, - 'D': GearShifter.drive, 'B': GearShifter.brake} - try: - return val_to_capnp[vals[gear]] - except KeyError: - return GearShifter.unknown +def parse_gear_shifter(gear): + return {'P': GearShifter.park, 'R': GearShifter.reverse, 'N': GearShifter.neutral, + 'D': GearShifter.drive, 'B': GearShifter.brake}.get(gear, GearShifter.unknown) def get_can_parser(CP): @@ -166,7 +161,7 @@ class CarState(): self.angle_steers = cp.vl["STEER_ANGLE_SENSOR"]['STEER_ANGLE'] + cp.vl["STEER_ANGLE_SENSOR"]['STEER_FRACTION'] self.angle_steers_rate = cp.vl["STEER_ANGLE_SENSOR"]['STEER_RATE'] can_gear = int(cp.vl["GEAR_PACKET"]['GEAR']) - self.gear_shifter = parse_gear_shifter(can_gear, self.shifter_values) + self.gear_shifter = parse_gear_shifter(self.shifter_values.get(can_gear, None)) if self.CP.carFingerprint == CAR.LEXUS_IS: self.main_on = cp.vl["DSU_CRUISE"]['MAIN_ON'] else: diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 83f499f45..c17782c3f 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -4,7 +4,7 @@ from selfdrive.config import Conversions as CV from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.toyota.carstate import CarState, get_can_parser, get_cam_can_parser -from selfdrive.car.toyota.values import ECU, ECU_FINGERPRINT, CAR, NO_STOP_TIMER_CAR, TSS2_CAR, FINGERPRINTS +from selfdrive.car.toyota.values import Ecu, ECU_FINGERPRINT, CAR, NO_STOP_TIMER_CAR, TSS2_CAR, FINGERPRINTS from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.swaglog import cloudlog from selfdrive.car.interfaces import CarInterfaceBase @@ -113,6 +113,16 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.05]] ret.lateralTuning.pid.kf = 0.00003 # full torque for 20 deg at 80mph means 0.00007818594 + elif candidate == CAR.LEXUS_RX: + stop_and_go = True + ret.safetyParam = 73 + ret.wheelbase = 2.79 + ret.steerRatio = 14.8 + tire_stiffness_factor = 0.5533 + ret.mass = 4387. * CV.LB_TO_KG + STD_CARGO_KG + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.05]] + ret.lateralTuning.pid.kf = 0.00006 + elif candidate == CAR.LEXUS_RXH: stop_and_go = True ret.safetyParam = 73 @@ -123,6 +133,16 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] ret.lateralTuning.pid.kf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 + elif candidate == CAR.LEXUS_RX_TSS2: + stop_and_go = True + ret.safetyParam = 73 + ret.wheelbase = 2.79 + ret.steerRatio = 14.8 + tire_stiffness_factor = 0.5533 # not optimized yet + ret.mass = 4387. * CV.LB_TO_KG + STD_CARGO_KG + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] + ret.lateralTuning.pid.kf = 0.00007818594 + elif candidate in [CAR.CHR, CAR.CHRH]: stop_and_go = True ret.safetyParam = 73 @@ -172,6 +192,16 @@ class CarInterface(CarInterfaceBase): ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] ret.mass = 3370. * CV.LB_TO_KG + STD_CARGO_KG ret.lateralTuning.pid.kf = 0.00007818594 + + elif candidate == CAR.RAV4H_TSS2: + stop_and_go = True + ret.safetyParam = 73 + ret.wheelbase = 2.68986 + ret.steerRatio = 14.3 + tire_stiffness_factor = 0.7933 + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.1]] + ret.mass = 3800. * CV.LB_TO_KG + STD_CARGO_KG + ret.lateralTuning.pid.kf = 0.00007818594 elif candidate in [CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2]: stop_and_go = True @@ -245,10 +275,10 @@ class CarInterface(CarInterfaceBase): ret.brakeMaxBP = [0.] ret.brakeMaxV = [1.] - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.CAM) or has_relay + ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay # In TSS2 cars the camera does long control - ret.enableDsu = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.DSU) and candidate not in TSS2_CAR - ret.enableApgs = False # is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, ECU.APGS) + ret.enableDsu = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.dsu) and candidate not in TSS2_CAR + ret.enableApgs = False # is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.apgs) ret.enableGasInterceptor = 0x201 in fingerprint[0] ret.openpilotLongitudinalControl = ret.enableCamera and (ret.enableDsu or candidate in TSS2_CAR) cloudlog.warning("ECU Camera Simulated: %r", ret.enableCamera) diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index f8edbf48b..9114dd595 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -14,7 +14,9 @@ class CAR: RAV4H = "TOYOTA RAV4 HYBRID 2017" RAV4 = "TOYOTA RAV4 2017" COROLLA = "TOYOTA COROLLA 2017" + LEXUS_RX = "LEXUS RX 350 2016" LEXUS_RXH = "LEXUS RX HYBRID 2017" + LEXUS_RX_TSS2 = "LEXUS RX350 2020" CHR = "TOYOTA C-HR 2018" CHRH = "TOYOTA C-HR HYBRID 2018" CAMRY = "TOYOTA CAMRY 2018" @@ -30,48 +32,43 @@ class CAR: SIENNA = "TOYOTA SIENNA XLE 2018" LEXUS_IS = "LEXUS IS300 2018" LEXUS_CTH = "LEXUS CT 200H 2018" - - -class ECU: - CAM = Ecu.fwdCamera # camera - DSU = Ecu.dsu # driving support unit - APGS = Ecu.apgs # advanced parking guidance system + RAV4H_TSS2 = "TOYOTA RAV4 HYBRID 2019" # addr: (ecu, cars, bus, 1/freq*100, vl) STATIC_MSGS = [ - (0x128, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.AVALON), 1, 3, b'\xf4\x01\x90\x83\x00\x37'), - (0x128, ECU.DSU, (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.SIENNA, CAR.LEXUS_CTH), 1, 3, b'\x03\x00\x20\x00\x00\x52'), - (0x141, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 1, 2, b'\x00\x00\x00\x46'), - (0x160, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 1, 7, b'\x00\x00\x08\x12\x01\x31\x9c\x51'), - (0x161, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.AVALON), 1, 7, b'\x00\x1e\x00\x00\x00\x80\x07'), - (0X161, ECU.DSU, (CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.SIENNA, CAR.LEXUS_CTH), 1, 7, b'\x00\x1e\x00\xd4\x00\x00\x5b'), - (0x283, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 0, 3, b'\x00\x00\x00\x00\x00\x00\x8c'), - (0x2E6, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, b'\xff\xf8\x00\x08\x7f\xe0\x00\x4e'), - (0x2E7, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, b'\xa8\x9c\x31\x9c\x00\x00\x00\x02'), - (0x33E, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, b'\x0f\xff\x26\x40\x00\x1f\x00'), - (0x344, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 0, 5, b'\x00\x00\x01\x00\x00\x00\x00\x50'), - (0x365, ECU.DSU, (CAR.PRIUS, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, b'\x00\x00\x00\x80\x03\x00\x08'), - (0x365, ECU.DSU, (CAR.RAV4, CAR.RAV4H, CAR.COROLLA, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 0, 20, b'\x00\x00\x00\x80\xfc\x00\x08'), - (0x366, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, b'\x00\x00\x4d\x82\x40\x02\x00'), - (0x366, ECU.DSU, (CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 0, 20, b'\x00\x72\x07\xff\x09\xfe\x00'), - (0x470, ECU.DSU, (CAR.PRIUS, CAR.LEXUS_RXH), 1, 100, b'\x00\x00\x02\x7a'), - (0x470, ECU.DSU, (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.RAV4H, CAR.SIENNA, CAR.LEXUS_CTH), 1, 100, b'\x00\x00\x01\x79'), - (0x4CB, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH), 0, 100, b'\x0c\x00\x00\x00\x00\x00\x00\x00'), + (0x128, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.AVALON), 1, 3, b'\xf4\x01\x90\x83\x00\x37'), + (0x128, Ecu.dsu, (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.SIENNA, CAR.LEXUS_CTH), 1, 3, b'\x03\x00\x20\x00\x00\x52'), + (0x141, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 1, 2, b'\x00\x00\x00\x46'), + (0x160, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 1, 7, b'\x00\x00\x08\x12\x01\x31\x9c\x51'), + (0x161, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.AVALON, CAR.LEXUS_RX), 1, 7, b'\x00\x1e\x00\x00\x00\x80\x07'), + (0X161, Ecu.dsu, (CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.SIENNA, CAR.LEXUS_CTH), 1, 7, b'\x00\x1e\x00\xd4\x00\x00\x5b'), + (0x283, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 0, 3, b'\x00\x00\x00\x00\x00\x00\x8c'), + (0x2E6, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, b'\xff\xf8\x00\x08\x7f\xe0\x00\x4e'), + (0x2E7, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, b'\xa8\x9c\x31\x9c\x00\x00\x00\x02'), + (0x33E, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, b'\x0f\xff\x26\x40\x00\x1f\x00'), + (0x344, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 0, 5, b'\x00\x00\x01\x00\x00\x00\x00\x50'), + (0x365, Ecu.dsu, (CAR.PRIUS, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, b'\x00\x00\x00\x80\x03\x00\x08'), + (0x365, Ecu.dsu, (CAR.RAV4, CAR.RAV4H, CAR.COROLLA, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 0, 20, b'\x00\x00\x00\x80\xfc\x00\x08'), + (0x366, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.HIGHLANDERH), 0, 20, b'\x00\x00\x4d\x82\x40\x02\x00'), + (0x366, Ecu.dsu, (CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 0, 20, b'\x00\x72\x07\xff\x09\xfe\x00'), + (0x470, Ecu.dsu, (CAR.PRIUS, CAR.LEXUS_RXH), 1, 100, b'\x00\x00\x02\x7a'), + (0x470, Ecu.dsu, (CAR.HIGHLANDER, CAR.HIGHLANDERH, CAR.RAV4H, CAR.SIENNA, CAR.LEXUS_CTH), 1, 100, b'\x00\x00\x01\x79'), + (0x4CB, Ecu.dsu, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.AVALON, CAR.SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_RX), 0, 100, b'\x0c\x00\x00\x00\x00\x00\x00\x00'), - (0x292, ECU.APGS, (CAR.PRIUS), 0, 3, b'\x00\x00\x00\x00\x00\x00\x00\x9e'), - (0x32E, ECU.APGS, (CAR.PRIUS), 0, 20, b'\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x396, ECU.APGS, (CAR.PRIUS), 0, 100, b'\xBD\x00\x00\x00\x60\x0F\x02\x00'), - (0x43A, ECU.APGS, (CAR.PRIUS), 0, 100, b'\x84\x00\x00\x00\x00\x00\x00\x00'), - (0x43B, ECU.APGS, (CAR.PRIUS), 0, 100, b'\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x497, ECU.APGS, (CAR.PRIUS), 0, 100, b'\x00\x00\x00\x00\x00\x00\x00\x00'), - (0x4CC, ECU.APGS, (CAR.PRIUS), 0, 100, b'\x0D\x00\x00\x00\x00\x00\x00\x00'), + (0x292, Ecu.apgs, (CAR.PRIUS), 0, 3, b'\x00\x00\x00\x00\x00\x00\x00\x9e'), + (0x32E, Ecu.apgs, (CAR.PRIUS), 0, 20, b'\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x396, Ecu.apgs, (CAR.PRIUS), 0, 100, b'\xBD\x00\x00\x00\x60\x0F\x02\x00'), + (0x43A, Ecu.apgs, (CAR.PRIUS), 0, 100, b'\x84\x00\x00\x00\x00\x00\x00\x00'), + (0x43B, Ecu.apgs, (CAR.PRIUS), 0, 100, b'\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x497, Ecu.apgs, (CAR.PRIUS), 0, 100, b'\x00\x00\x00\x00\x00\x00\x00\x00'), + (0x4CC, Ecu.apgs, (CAR.PRIUS), 0, 100, b'\x0D\x00\x00\x00\x00\x00\x00\x00'), ] ECU_FINGERPRINT = { - ECU.CAM: [0x2e4], # steer torque cmd - ECU.DSU: [0x343], # accel cmd - ECU.APGS: [0x835], # angle cmd + Ecu.fwdCamera: [0x2e4], # steer torque cmd + Ecu.dsu: [0x343], # accel cmd + Ecu.apgs: [0x835], # angle cmd } @@ -94,14 +91,30 @@ FINGERPRINTS = { { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }, + # 2020 Prius Prime LE + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 740: 5, 742: 8, 743: 8, 764: 8, 800: 8, 810: 2, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1235: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1649: 8, 1777: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, #2020 Prius Prime Limited { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 824: 2, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1649: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2024: 8, 2026: 8, 2027: 8, 2029: 8, 2030: 8, 2031: 8 + }, + #2020 Central Europe Prime + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 740: 5, 742: 8, 743: 8, 764: 8, 800: 8, 810: 2, 818: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 889: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 8, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1777: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8 }], #Corolla w/ added Pedal Support (512L and 513L) CAR.COROLLA: [{ 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 512: 6, 513: 6, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2016: 8, 2017: 8, 2018: 8, 2019: 8, 2020: 8, 2021: 8, 2022: 8, 2023: 8, 2024: 8 }], + CAR.LEXUS_RX: [{ + # 2016 Lexus RX 350 + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 818: 8, 819: 8, 820: 8, 821: 8, 822: 8, 830: 7, 835: 8, 836: 8, 845: 5, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1077: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1349: 8, 1350: 8, 1351: 8, 1413: 8, 1414: 8, 1415: 8, 1416: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 + }, + # 2017 Lexus RX 350 + { + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 5, 643: 7, 658: 8, 705: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 818: 8, 819: 8, 820: 8, 821: 8, 822: 8, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1349: 8, 1350: 8, 1351: 8, 1413: 8, 1414: 8, 1415: 8, 1416: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }], CAR.LEXUS_RXH: [{ 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 512: 6, 513:6, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8 }, @@ -113,6 +126,15 @@ FINGERPRINTS = { # RX540H 2019 with color hud { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 512: 6, 513: 6, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 818: 8, 819: 8, 820: 8, 821: 8, 822: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1349: 8, 1350: 8, 1351: 8, 1413: 8, 1414: 8, 1415: 8, 1416: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1904: 8, 1912: 8, 1952: 8, 1960: 8, 1990: 8, 1998: 8 + }, + # 2017 RX 450h + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 744: 8, 800: 8, 810: 2, 812: 3, 814: 8, 818: 8, 819: 8, 820: 8, 821: 8, 822: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1349: 8, 1350: 8, 1351: 8, 1413: 8, 1414: 8, 1415: 8, 1416: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1745: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 + }], + CAR.LEXUS_RX_TSS2: [ + # 2020 Lexus RX 350 + { + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 401: 8, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 658: 8, 705: 8, 740: 5, 742: 8, 743: 8, 764: 8, 765: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 824: 8, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 987: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1076: 8, 1077: 8,1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1592: 8, 1594:8, 1595: 8, 1600: 8, 1649: 8, 1775: 8, 1777: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1816: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 }], CAR.CHR: [{ 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 705: 8, 740: 5, 800: 8, 810: 2, 812: 8, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 869: 7, 870: 7, 871: 2, 898: 8, 913: 8, 918: 8, 921: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 1014: 8, 1017: 8, 1020: 8, 1021: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1082: 8, 1083: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8 @@ -129,6 +151,10 @@ FINGERPRINTS = { # TODO: get proper fingerprint in stock mode { 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 658: 8, 705: 8, 728: 8, 740: 5, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 888: 8, 889: 8, 891: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 983: 8, 984: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1056: 8, 1059: 1, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1228: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1412: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1816: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, + { + # 2019 XSE + 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 550: 8, 552: 4, 562: 6, 608: 8, 610: 8, 643: 7, 658: 8, 705: 8, 728: 8, 740: 5, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 888: 8, 889: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 942: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 976: 1, 983: 8, 984: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1412: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1792: 8, 1800: 8, 1808: 8, 1816: 8, 1872: 8, 1880: 8, 1904: 8, 1912: 8, 1937: 8, 1945: 8, 1953: 8, 1961: 8, 1968: 8, 1976: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 }], CAR.CAMRYH: [ #SE, LE and LE with Blindspot Monitor @@ -153,6 +179,10 @@ FINGERPRINTS = { # 2017 Highlander Limited { 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 238: 4, 355: 5, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 545: 5, 550: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 922: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1008: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1182: 8, 1183: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1207: 8, 1212: 8, 1227: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, + # 2018 Highlander Limited Platinum + { + 36: 8, 37: 8, 114: 5, 119: 6, 120: 4, 170: 8, 180: 8, 186: 4, 238: 4, 355: 5, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 544: 4, 545: 5, 550: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 725: 2, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 922: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1008: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1182: 8, 1183: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1207: 8, 1212: 8, 1227: 8, 1235: 8, 1237: 8, 1263: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1585: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1728: 8, 1745: 8, 1779: 8, 1872: 8, 1880: 8, 1904: 8, 1912: 8, 1988: 8, 1990: 8, 1996: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 }], CAR.HIGHLANDERH: [{ 36: 8, 37: 8, 170: 8, 180: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 581: 5, 608: 8, 610: 5, 643: 7, 713: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 3, 918: 7, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 3, 955: 8, 956: 8, 979: 2, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1212: 8, 1227: 8, 1232: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1554: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1656: 8, 1728: 8, 1745: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 @@ -212,35 +242,492 @@ FINGERPRINTS = { { 36: 8, 37: 8, 170: 8, 180: 8, 295: 8, 296: 8, 400: 6, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 581: 5, 608: 8, 610: 5, 643: 7, 713: 8, 740: 5, 800: 8, 836: 8, 845: 5, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 913: 8, 916: 3, 918: 7, 921: 7, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 3, 955: 8, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1009: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1168: 1, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1187: 8, 1189: 8, 1190: 8, 1191: 8, 1192: 8, 1196: 8, 1197: 8, 1198: 8, 1199: 8, 1206: 8, 1208: 8, 1212: 8, 1227: 8, 1232: 8, 1235: 8, 1279: 8, 1408: 8, 1409: 8, 1410: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1561: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1599: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }], + CAR.RAV4H_TSS2: [ + #Hybrid Limited + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 658: 8, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 764: 8, 765: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 882: 8, 885: 8, 889: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913:8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1696: 8, 1745: 8, 1775: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, + # German Lounge + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 658: 8, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 764: 8, 765: 8, 800: 8, 810: 2, 812: 8, 814: 8, 818: 8, 822: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 882: 8, 885: 8, 889: 8, 891: 8, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1063: 8, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1172: 8, 1228: 8, 1235: 8, 1237: 8, 1263: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1649: 8, 1696: 8, 1745: 8, 1775: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1792: 8, 1800: 8, 1872: 8, 1880: 8, 1904: 8, 1912: 8, 1937: 8, 1945: 8, 1953: 8, 1961: 8, 1968: 8, 1976: 8, 1990: 8, 1998: 8, 2015: 8, 2016: 8, 2024: 8 + }], CAR.LEXUS_CTH: [{ 36: 8, 37: 8, 170: 8, 180: 8, 288: 8, 426: 6, 452: 8, 466: 8, 467: 8, 548: 8, 552: 4, 560: 7, 581: 5, 608: 8, 610: 5, 643: 7, 713: 8, 740: 5, 800: 8, 810: 2, 832: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 1, 921: 8, 933: 8, 944: 6, 945: 8, 950: 8, 951: 8, 953: 3, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1056: 8, 1057: 8, 1059: 1, 1076: 8, 1077: 8, 1114: 8, 1116: 8, 1160: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1176: 8, 1177: 8, 1178: 8, 1179: 8, 1180: 8, 1181: 8, 1184: 8, 1185: 8, 1186: 8, 1190: 8, 1191: 8, 1192: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1554: 8, 1555: 8, 1556: 8, 1557: 8, 1558: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1584: 8, 1589: 8, 1592: 8, 1593: 8, 1595: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 }] } FW_VERSIONS = { + CAR.AVALON: { + (Ecu.esp, 0x7b0, None): [b'F152607060\x00\x00\x00\x00\x00\x00'], + (Ecu.dsu, 0x791, None): [b'881510705200\x00\x00\x00\x00'], + (Ecu.eps, 0x7a1, None): [b'8965B41051\x00\x00\x00\x00\x00\x00'], + (Ecu.engine, 0x7e0, None): [b'\x0230721200\x00\x00\x00\x00\x00\x00\x00\x00A0C01000\x00\x00\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702100\x00\x00\x00\x00'], + (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F0703000\x00\x00\x00\x00'], + }, + CAR.CAMRY: { + (Ecu.engine, 0x700, None): [ + b'\x018966333P4200\x00\x00\x00\x00', + b'\x018966333P4300\x00\x00\x00\x00', + b'\x018966333P4400\x00\x00\x00\x00', + b'\x018966333P4500\x00\x00\x00\x00', + b'\x018966333P4700\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'8821F0607200 ', + b'8821F0601300 ', + b'8821F0603300 ', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152606210\x00\x00\x00\x00\x00\x00', + b'F152606230\x00\x00\x00\x00\x00\x00', + b'F152606290\x00\x00\x00\x00\x00\x00', + b'F152633540\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [b'8965B33540\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [ # Same as 0x791 + b'8821F0601300 ', + b'8821F0603300 ', + b'8821F0607200 ', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F0601200 ', + b'8646F0601300 ', + b'8646F0603400 ', + ], + }, + CAR.CAMRYH: { + (Ecu.engine, 0x700, None): [ + b'\x028966306B2100\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00', + b'\x028966306N8200\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00', + b'\x028966306R5000\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152633712\x00\x00\x00\x00\x00\x00', + b'F152633713\x00\x00\x00\x00\x00\x00', + b'F152633B51\x00\x00\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'8821F0601200 ', + b'8821F0601300 ', + b'8821F0607200 ', + ], + (Ecu.eps, 0x7a1, None): [b'8965B33540\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [ # Same as 0x791 + b'8821F0601200 ', + b'8821F0601300 ', + b'8821F0607200 ', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F0601200 ', + b'8646F0601300 ', + b'8646F0605000 ', + ], + }, + CAR.COROLLA: { + (Ecu.engine, 0x7e0, None): [ + b'\x01896630E88000\x00\x00\x00\x00', + b'\x0230ZC2100\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0230ZC2200\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0230ZC2300\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0230ZC3000\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0230ZC3200\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0230ZC3300\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0330ZC1200\x00\x00\x00\x00\x00\x00\x00\x0050212000\x00\x00\x00\x00\x00\x00\x00\x00895231203202\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'881510201100\x00\x00\x00\x00', + b'881510201200\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152602190\x00\x00\x00\x00\x00\x00', + b'F152602191\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B02181\x00\x00\x00\x00\x00\x00', + b'8965B02191\x00\x00\x00\x00\x00\x00', + b'8965B48150\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4702100\x00\x00\x00\x00', + b'8821F4702300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F0201101\x00\x00\x00\x00', + b'8646F0201200\x00\x00\x00\x00', + b'8646F0E01300\x00\x00\x00\x00', + ], + }, CAR.COROLLA_TSS2: { - (Ecu.engine, 0x700, None): [b'\x01896630ZG5000\x00\x00\x00\x00'], - (Ecu.eps, 0x7a1, None): [b'\x018965B12350\x00\x00\x00\x00\x00\x00'], - (Ecu.esp, 0x7b0, None): [b'\x01F152602280\x00\x00\x00\x00\x00\x00'], - (Ecu.fwdRadar, 0x750, 0xf): [b'\x018821F3301100\x00\x00\x00\x00'], - (Ecu.fwdCamera, 0x750, 0x6d): [b'\x028646F1201200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00'], + (Ecu.engine, 0x700, None): [ + b'\x01896630ZG5000\x00\x00\x00\x00', + b'\x01896630ZG5100\x00\x00\x00\x00', + b'\x01896630ZG5200\x00\x00\x00\x00', + b'\x01896630ZQ5000\x00\x00\x00\x00', + b'\x018966312L8000\x00\x00\x00\x00', + b'\x018966312P9000\x00\x00\x00\x00', + b'\x018966312P9100\x00\x00\x00\x00', + b'\x018966312P9200\x00\x00\x00\x00', + b'\x018966312R1000\x00\x00\x00\x00', + b'\x018966312R1100\x00\x00\x00\x00', + b'\x018966312R3100\x00\x00\x00\x00', + ], + (Ecu.engine, 0x7e0, None): [ + b'\x03312N6000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203202\x00\x00\x00\x00', + b'\x03312N6000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203302\x00\x00\x00\x00', + b'\x03312N6100\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203302\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B12361\x00\x00\x00\x00\x00\x00', + b'\x018965B12350\x00\x00\x00\x00\x00\x00', + b'\x018965B12500\x00\x00\x00\x00\x00\x00', + b'\x018965B12530\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152602191\x00\x00\x00\x00\x00\x00', + b'\x01F152602280\x00\x00\x00\x00\x00\x00', + b'\x01F152602560\x00\x00\x00\x00\x00\x00', + b'\x01F152612641\x00\x00\x00\x00\x00\x00', + b'\x01F152612B10\x00\x00\x00\x00\x00\x00', + b'\x01F152612B60\x00\x00\x00\x00\x00\x00', + b'\x01F152612B90\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'\x018821F3301100\x00\x00\x00\x00', + b'\x018821F3301200\x00\x00\x00\x00', + b'\x018821F3301300\x00\x00\x00\x00', + b'\x018821F3301400\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646F12010D0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F1201100\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F1201200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F1202000\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + ], + }, + CAR.COROLLAH_TSS2: { + (Ecu.engine, 0x700, None): [ + b'\x018966342M5000\x00\x00\x00\x00', + b'\x02896630ZQ3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896630ZR2000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x028966312Q4000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x038966312N1000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF1203001\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B12361\x00\x00\x00\x00\x00\x00', + b'8965B12451\x00\x00\x00\x00\x00\x00', + b'8965B42170\x00\x00\x00\x00\x00\x00', + b'\x018965B12350\x00\x00\x00\x00\x00\x00', + b'\x018965B12470\x00\x00\x00\x00\x00\x00', + b'\x018965B12500\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152612590\x00\x00\x00\x00\x00\x00', + b'F152612691\x00\x00\x00\x00\x00\x00', + b'F152612700\x00\x00\x00\x00\x00\x00', + b'F152612800\x00\x00\x00\x00\x00\x00', + b'F152612840\x00\x00\x00\x00\x00\x00', + b'F152642540\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'\x018821F3301200\x00\x00\x00\x00', + b'\x018821F3301300\x00\x00\x00\x00', + b'\x018821F3301400\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646F1201100\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F1202000\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + b'\x028646F4203400\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + ], + }, + CAR.HIGHLANDER: { + (Ecu.engine, 0x700, None): [ + b'\x01896630E43100\x00\x00\x00\x00', + b'\x01896630E45200\x00\x00\x00\x00', + b'\x01896630E83000\x00\x00\x00\x00', + b'\x01896630E84000\x00\x00\x00\x00', + b'\x01896630E85000\x00\x00\x00\x00', + b'\x01896630E88000\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B48140\x00\x00\x00\x00\x00\x00', + b'8965B48150\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [b'F15260E011\x00\x00\x00\x00\x00\x00'], + (Ecu.dsu, 0x791, None): [ + b'881510E01100\x00\x00\x00\x00', + b'881510E01200\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4702100\x00\x00\x00\x00', + b'8821F4702300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F0E01200\x00\x00\x00\x00', + b'8646F0E01300\x00\x00\x00\x00', + ], + }, + CAR.HIGHLANDERH: { + (Ecu.eps, 0x7a1, None): [b'8965B48160\x00\x00\x00\x00\x00\x00'], + (Ecu.esp, 0x7b0, None): [b'F152648541\x00\x00\x00\x00\x00\x00'], + (Ecu.engine, 0x7e0, None): [b'\x0230E40000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702100\x00\x00\x00\x00'], + (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F0E01200\x00\x00\x00\x00'], + }, + CAR.LEXUS_IS: { + (Ecu.engine, 0x700, None): [b'\x018966353Q2300\x00\x00\x00\x00'], + (Ecu.esp, 0x7b0, None): [b'F152653330\x00\x00\x00\x00\x00\x00'], + (Ecu.dsu, 0x791, None): [b'881515306400\x00\x00\x00\x00'], + (Ecu.eps, 0x7a1, None): [b'8965B53271\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702300\x00\x00\x00\x00'], + (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F5301400\x00\x00\x00\x00'], }, CAR.PRIUS: { - (Ecu.engine, 0x700, None): [b'\x03896634759200\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701003\x00\x00\x00\x00'], - (Ecu.eps, 0x7a1, None): [b'8965B47023\x00\x00\x00\x00\x00\x00'], - (Ecu.esp, 0x7b0, None): [b'F152647416\x00\x00\x00\x00\x00\x00'], - (Ecu.dsu, 0x791, None): [b'881514703100\x00\x00\x00\x00'], - (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702100\x00\x00\x00\x00'], - (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F4702100\x00\x00\x00\x00'], + (Ecu.engine, 0x700, None): [ + b'\x02896634761000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634761100\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634763000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634769100\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634774000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634774100\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634774200\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x02896634782000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00', + b'\x03896634759200\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701003\x00\x00\x00\x00', + b'\x03896634759300\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701004\x00\x00\x00\x00', + b'\x03896634760000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701002\x00\x00\x00\x00', + b'\x03896634760200\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701003\x00\x00\x00\x00', + b'\x03896634760200\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701004\x00\x00\x00\x00', + b'\x03896634768000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4703001\x00\x00\x00\x00', + b'\x03896634768000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4703002\x00\x00\x00\x00', + b'\x03896634768100\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4703002\x00\x00\x00\x00', + b'\x03896634785000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4705001\x00\x00\x00\x00', + b'\x03896634786000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4710001\x00\x00\x00\x00', + b'\x03896634789000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4703002\x00\x00\x00\x00', + b'\x038966347A3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4707001\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B47021\x00\x00\x00\x00\x00\x00', + b'8965B47022\x00\x00\x00\x00\x00\x00', + b'8965B47023\x00\x00\x00\x00\x00\x00', + b'8965B47050\x00\x00\x00\x00\x00\x00', + b'8965B47060\x00\x00\x00\x00\x00\x00', # Think this the EPS with good angle sensor + ], + (Ecu.esp, 0x7b0, None): [ + b'F152647290\x00\x00\x00\x00\x00\x00', + b'F152647310\x00\x00\x00\x00\x00\x00', + b'F152647414\x00\x00\x00\x00\x00\x00', + b'F152647415\x00\x00\x00\x00\x00\x00', + b'F152647416\x00\x00\x00\x00\x00\x00', + b'F152647417\x00\x00\x00\x00\x00\x00', + b'F152647490\x00\x00\x00\x00\x00\x00', + b'F152647684\x00\x00\x00\x00\x00\x00', + b'F152647862\x00\x00\x00\x00\x00\x00', + b'F152647863\x00\x00\x00\x00\x00\x00', + b'F152647864\x00\x00\x00\x00\x00\x00', + b'F152647865\x00\x00\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'881514702300\x00\x00\x00\x00', + b'881514703100\x00\x00\x00\x00', + b'881514704100\x00\x00\x00\x00', + b'881514706000\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4702000\x00\x00\x00\x00', + b'8821F4702100\x00\x00\x00\x00', + b'8821F4702300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F4201200\x00\x00\x00\x00', + b'8646F4701300\x00\x00\x00\x00', + b'8646F4702001\x00\x00\x00\x00', + b'8646F4702100\x00\x00\x00\x00', + b'8646F4702200\x00\x00\x00\x00', + b'8646F4705000\x00\x00\x00\x00', + b'8646F4705200\x00\x00\x00\x00', + ], }, CAR.RAV4: { - (Ecu.engine, 0x7e0, None): [b'\x02342Q2100\x00\x00\x00\x00\x00\x00\x00\x0054213000\x00\x00\x00\x00\x00\x00\x00\x00'], - (Ecu.eps, 0x7a1, None): [b'8965B42083\x00\x00\x00\x00\x00\x00'], - (Ecu.esp, 0x7b0, None): [b'F15260R103\x00\x00\x00\x00\x00\x00'], - (Ecu.dsu, 0x791, None): [b'881514201400\x00\x00\x00\x00'], + (Ecu.engine, 0x7e0, None): [ + b'\x02342Q1100\x00\x00\x00\x00\x00\x00\x00\x0054212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342Q1300\x00\x00\x00\x00\x00\x00\x00\x0054212000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342Q2000\x00\x00\x00\x00\x00\x00\x00\x0054213000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342Q2100\x00\x00\x00\x00\x00\x00\x00\x0054213000\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B42082\x00\x00\x00\x00\x00\x00', + b'8965B42083\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F15260R103\x00\x00\x00\x00\x00\x00', + b'F152642493\x00\x00\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'881514201300\x00\x00\x00\x00', + b'881514201400\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4702000\x00\x00\x00\x00', + b'8821F4702100\x00\x00\x00\x00', + b'8821F4702300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F4201200\x00\x00\x00\x00', + b'8646F4202001\x00\x00\x00\x00', + b'8646F4202100\x00\x00\x00\x00', + ], + }, + CAR.RAV4H: { + (Ecu.engine, 0x7e0, None): [ + b'\x02342N9000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342N9100\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342P0000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02342Q2000\x00\x00\x00\x00\x00\x00\x00\x0054213000\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B42103\x00\x00\x00\x00\x00\x00', + b'8965B42162\x00\x00\x00\x00\x00\x00', + b'8965B42163\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152642090\x00\x00\x00\x00\x00\x00', + b'F152642120\x00\x00\x00\x00\x00\x00', + b'F152642400\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4702000\x00\x00\x00\x00', + b'8821F4702100\x00\x00\x00\x00', + b'8821F4702300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F4201100\x00\x00\x00\x00', + b'8646F4201200\x00\x00\x00\x00', + b'8646F4202001\x00\x00\x00\x00', + b'8646F4202100\x00\x00\x00\x00', + b'8646F4204000\x00\x00\x00\x00', + ], + }, + CAR.RAV4_TSS2: { + (Ecu.engine, 0x700, None): [ + b'\x018966333Q6200\x00\x00\x00\x00', + b'\x018966342E2000\x00\x00\x00\x00', + b'\x018966342M8000\x00\x00\x00\x00', + b'\x018966342T1000\x00\x00\x00\x00', + b'\x018966342T6000\x00\x00\x00\x00', + b'\x018966342V3100\x00\x00\x00\x00', + b'\x018966342X5000\x00\x00\x00\x00', + b'\x01896634A05000\x00\x00\x00\x00', + b'\x01896634A22000\x00\x00\x00\x00', + b'\x01F152642551\x00\x00\x00\x00\x00\x00', + b'\x028966342Y8000\x00\x00\x00\x00897CF1201001\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152606230\x00\x00\x00\x00\x00\x00', + b'F152642520\x00\x00\x00\x00\x00\x00', + b'\x01F15260R210\x00\x00\x00\x00\x00\x00', + b'\x01F15260R220\x00\x00\x00\x00\x00\x00', + b'\x01F152642551\x00\x00\x00\x00\x00\x00', + b'\x01F152642561\x00\x00\x00\x00\x00\x00', + b'\x01F152642710\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B33540\x00\x00\x00\x00\x00\x00', + b'8965B42170\x00\x00\x00\x00\x00\x00', + b'8965B42171\x00\x00\x00\x00\x00\x00', + b'\x028965B0R01200\x00\x00\x00\x008965B0R02200\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F0607200 ', + b'\x018821F3301100\x00\x00\x00\x00', + b'\x018821F3301200\x00\x00\x00\x00', + b'\x018821F3301300\x00\x00\x00\x00', + b'\x018821F3301400\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F0605000 ', + b'\x028646F4203200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F4203300\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F4203400\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + b'\x028646F4203500\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + ], + }, + CAR.RAV4H_TSS2: { + (Ecu.engine, 0x700, None): [ + b'\x018966342X6000\x00\x00\x00\x00', + b'\x028966342W4001\x00\x00\x00\x00897CF1203001\x00\x00\x00\x00', + b'\x02896634A23001\x00\x00\x00\x00897CF1203001\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152642291\x00\x00\x00\x00\x00\x00', + b'F152642531\x00\x00\x00\x00\x00\x00', + b'F152642532\x00\x00\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B42170\x00\x00\x00\x00\x00\x00', + b'8965B42171\x00\x00\x00\x00\x00\x00', + b'8965B42181\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'\x018821F3301200\x00\x00\x00\x00', + b'\x018821F3301300\x00\x00\x00\x00', + b'\x018821F3301400\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'\x028646F4203300\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', + b'\x028646F4203400\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + b'\x028646F4203500\x00\x00\x00\x008646G2601200\x00\x00\x00\x00', + ], + }, + CAR.LEXUS_ES_TSS2: { + (Ecu.engine, 0x700, None): [b'\x018966333T5100\x00\x00\x00\x00'], + (Ecu.esp, 0x7b0, None): [b'\x01F152606281\x00\x00\x00\x00\x00\x00'], + (Ecu.eps, 0x7a1, None): [b'8965B33252\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [b'\x018821F3301200\x00\x00\x00\x00'], + (Ecu.fwdCamera, 0x750, 0x6d): [b'\x028646F3303200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00'], + }, + CAR.LEXUS_IS: { + (Ecu.engine, 0x700, None): [b'\x018966353Q2300\x00\x00\x00\x00'], + (Ecu.dsu, 0x791, None): [b'881515306400\x00\x00\x00\x00'], + (Ecu.eps, 0x7a1, None): [b'8965B53271\x00\x00\x00\x00\x00\x00'], + (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702300\x00\x00\x00\x00'], + (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F5301400\x00\x00\x00\x00'], + }, + CAR.SIENNA: { + (Ecu.engine, 0x700, None): [b'\x01896630832100\x00\x00\x00\x00'], + (Ecu.eps, 0x7a1, None): [b'8965B45070\x00\x00\x00\x00\x00\x00'], (Ecu.fwdRadar, 0x750, 0xf): [b'8821F4702100\x00\x00\x00\x00'], - (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F4202100\x00\x00\x00\x00'], - } + (Ecu.fwdCamera, 0x750, 0x6d): [b'8646F0801100\x00\x00\x00\x00'], + }, + CAR.LEXUS_RXH: { + (Ecu.engine, 0x7e0, None): [ + b'\x02348Q4000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02348T1100\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x02348Z3000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', + ], + (Ecu.esp, 0x7b0, None): [ + b'F152648501\x00\x00\x00\x00\x00\x00', + b'F152648A30\x00\x00\x00\x00\x00\x00', + b'F152648361\x00\x00\x00\x00\x00\x00', + ], + (Ecu.dsu, 0x791, None): [ + b'881514811300\x00\x00\x00\x00', + b'881514811700\x00\x00\x00\x00', + ], + (Ecu.eps, 0x7a1, None): [ + b'8965B0E011\x00\x00\x00\x00\x00\x00', + b'8965B0E012\x00\x00\x00\x00\x00\x00', + b'8965B48112\x00\x00\x00\x00\x00\x00', + ], + (Ecu.fwdRadar, 0x750, 0xf): [ + b'8821F4701000\x00\x00\x00\x00', + b'8821F4701300\x00\x00\x00\x00', + ], + (Ecu.fwdCamera, 0x750, 0x6d): [ + b'8646F4801200\x00\x00\x00\x00', + b'8646F4802200\x00\x00\x00\x00', + b'8646F4809000\x00\x00\x00\x00', + ], + }, } STEER_THRESHOLD = 100 @@ -250,7 +737,9 @@ DBC = { CAR.RAV4: dbc_dict('toyota_rav4_2017_pt_generated', 'toyota_adas'), CAR.PRIUS: dbc_dict('toyota_prius_2017_pt_generated', 'toyota_adas'), CAR.COROLLA: dbc_dict('toyota_corolla_2017_pt_generated', 'toyota_adas'), + CAR.LEXUS_RX: dbc_dict('lexus_rx_350_2016_pt_generated', 'toyota_adas'), CAR.LEXUS_RXH: dbc_dict('lexus_rx_hybrid_2017_pt_generated', 'toyota_adas'), + CAR.LEXUS_RX_TSS2: dbc_dict('toyota_nodsu_pt_generated', 'toyota_tss2_adas'), CAR.CHR: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), CAR.CHRH: dbc_dict('toyota_nodsu_hybrid_pt_generated', 'toyota_adas'), CAR.CAMRY: dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'), @@ -266,8 +755,9 @@ DBC = { CAR.SIENNA: dbc_dict('toyota_sienna_xle_2018_pt_generated', 'toyota_adas'), CAR.LEXUS_IS: dbc_dict('lexus_is_2018_pt_generated', 'toyota_adas'), CAR.LEXUS_CTH: dbc_dict('lexus_ct200h_2018_pt_generated', 'toyota_adas'), + CAR.RAV4H_TSS2: dbc_dict('toyota_nodsu_hybrid_pt_generated', 'toyota_tss2_adas'), } -NO_DSU_CAR = [CAR.CHR, CAR.CHRH, CAR.CAMRY, CAR.CAMRYH, CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2] -TSS2_CAR = [CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2] -NO_STOP_TIMER_CAR = [CAR.RAV4H, CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.SIENNA] # no resume button press required +NO_DSU_CAR = [CAR.CHR, CAR.CHRH, CAR.CAMRY, CAR.CAMRYH, CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.RAV4H_TSS2, CAR.LEXUS_RX_TSS2] +TSS2_CAR = [CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.RAV4H_TSS2, CAR.LEXUS_RX_TSS2] +NO_STOP_TIMER_CAR = [CAR.RAV4H, CAR.HIGHLANDERH, CAR.HIGHLANDER, CAR.RAV4_TSS2, CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2, CAR.LEXUS_ES_TSS2, CAR.LEXUS_ESH_TSS2, CAR.SIENNA, CAR.RAV4H_TSS2, CAR.LEXUS_RX_TSS2] # no resume button press required diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py index 58a19274d..59357edbe 100644 --- a/selfdrive/car/volkswagen/carstate.py +++ b/selfdrive/car/volkswagen/carstate.py @@ -99,15 +99,10 @@ def get_mqb_cam_can_parser(CP, canbus): return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, canbus.cam) -def parse_gear_shifter(gear, vals): +def parse_gear_shifter(gear): # Return mapping of gearshift position to selected gear. - - val_to_capnp = {'P': GEAR.park, 'R': GEAR.reverse, 'N': GEAR.neutral, - 'D': GEAR.drive, 'E': GEAR.eco, 'S': GEAR.sport, 'T': GEAR.manumatic} - try: - return val_to_capnp[vals[gear]] - except KeyError: - return "unknown" + return {'P': GEAR.park, 'R': GEAR.reverse, 'N': GEAR.neutral, + 'D': GEAR.drive, 'E': GEAR.eco, 'S': GEAR.sport, 'T': GEAR.manumatic}.get(gear, GEAR.unknown) class CarState(): def __init__(self, CP, canbus): @@ -157,7 +152,7 @@ class CarState(): # Update gear and/or clutch position data. can_gear_shifter = int(pt_cp.vl["Getriebe_11"]['GE_Fahrstufe']) - self.gearShifter = parse_gear_shifter(can_gear_shifter, self.shifter_values) + self.gearShifter = parse_gear_shifter(self.shifter_values.get(can_gear_shifter, None)) # Update door and trunk/hatch lid open status. self.doorOpen = any([pt_cp.vl["Gateway_72"]['ZV_FT_offen'], diff --git a/selfdrive/common/framebuffer.h b/selfdrive/common/framebuffer.h index 52c60d8ec..45920b8e4 100644 --- a/selfdrive/common/framebuffer.h +++ b/selfdrive/common/framebuffer.h @@ -1,8 +1,6 @@ #ifndef FRAMEBUFFER_H #define FRAMEBUFFER_H -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/selfdrive/common/glutil.c b/selfdrive/common/glutil.c index d118dd8af..e208891e2 100644 --- a/selfdrive/common/glutil.c +++ b/selfdrive/common/glutil.c @@ -1,8 +1,6 @@ #include #include -#include - #include "glutil.h" GLuint load_shader(GLenum shaderType, const char *src) { diff --git a/selfdrive/common/glutil.h b/selfdrive/common/glutil.h index 68d6cfa63..d907b09e7 100644 --- a/selfdrive/common/glutil.h +++ b/selfdrive/common/glutil.h @@ -1,8 +1,21 @@ #ifndef COMMON_GLUTIL_H #define COMMON_GLUTIL_H -#include +#ifdef __APPLE__ + #include +#else + #include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + GLuint load_shader(GLenum shaderType, const char *src); GLuint load_program(const char *vert_src, const char *frag_src); +#ifdef __cplusplus +} +#endif + #endif diff --git a/selfdrive/common/ipc.c b/selfdrive/common/ipc.c index 8d3910747..41b0cc0ea 100644 --- a/selfdrive/common/ipc.c +++ b/selfdrive/common/ipc.c @@ -16,7 +16,7 @@ int ipc_connect(const char* socket_path) { int err; int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); - assert(sock >= 0); + if (sock < 0) return -1; struct sockaddr_un addr = { .sun_family = AF_UNIX, }; diff --git a/selfdrive/common/spinner.c b/selfdrive/common/spinner.c index abae7cc13..99e0ed422 100644 --- a/selfdrive/common/spinner.c +++ b/selfdrive/common/spinner.c @@ -58,10 +58,8 @@ int spin(int argc, char** argv) { // spinner int fb_w, fb_h; - EGLDisplay display; - EGLSurface surface; FramebufferState *fb = framebuffer_init("spinner", 0x00001000, false, - &display, &surface, &fb_w, &fb_h); + &fb_w, &fb_h); assert(fb); NVGcontext *vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); @@ -176,7 +174,7 @@ int spin(int argc, char** argv) { } nvgEndFrame(vg); - eglSwapBuffers(display, surface); + framebuffer_swap(fb); assert(glGetError() == GL_NO_ERROR); } diff --git a/selfdrive/common/util.h b/selfdrive/common/util.h index b3ca91694..ed0c88f2c 100644 --- a/selfdrive/common/util.h +++ b/selfdrive/common/util.h @@ -3,6 +3,10 @@ #include +#ifndef sighandler_t +typedef void (*sighandler_t)(int sig); +#endif + #ifndef __cplusplus #define min(a,b) \ diff --git a/selfdrive/common/version.h b/selfdrive/common/version.h index d61e42c49..86fe8c7c0 100644 --- a/selfdrive/common/version.h +++ b/selfdrive/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "0.7.1-release" +#define COMMA_VERSION "0.7.2-release" diff --git a/selfdrive/common/visionimg.h b/selfdrive/common/visionimg.h index 1cc0cb0ac..e5eb78766 100644 --- a/selfdrive/common/visionimg.h +++ b/selfdrive/common/visionimg.h @@ -2,11 +2,16 @@ #define VISIONIMG_H #include "common/visionbuf.h" +#include "common/glutil.h" -#include +#ifdef QCOM #include #include #undef Status +#else +typedef int EGLImageKHR; +typedef void *EGLClientBuffer; +#endif #ifdef __cplusplus extern "C" { diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 3cc1de90e..680e511e0 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -6,7 +6,7 @@ from cereal import car, log from common.numpy_fast import clip from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper, DT_CTRL from common.profiler import Profiler -from common.params import Params, put_nonblocking +from common.params import Params import cereal.messaging as messaging from selfdrive.config import Conversions as CV from selfdrive.boardd.boardd import can_list_to_can_capnp @@ -23,9 +23,7 @@ from selfdrive.controls.lib.latcontrol_indi import LatControlINDI from selfdrive.controls.lib.latcontrol_lqr import LatControlLQR from selfdrive.controls.lib.alertmanager import AlertManager from selfdrive.controls.lib.vehicle_model import VehicleModel -from selfdrive.controls.lib.driver_monitor import DriverStatus, MAX_TERMINAL_ALERTS, MAX_TERMINAL_DURATION from selfdrive.controls.lib.planner import LON_MPC_STEP -from selfdrive.controls.lib.gps_helpers import is_rhd_region from selfdrive.locationd.calibration_helpers import Calibration, Filter LANE_DEPARTURE_THRESHOLD = 0.1 @@ -67,7 +65,7 @@ def events_to_bytes(events): return ret -def data_sample(CI, CC, sm, can_sock, driver_status, state, mismatch_counter, can_error_counter, params): +def data_sample(CI, CC, sm, can_sock, state, mismatch_counter, can_error_counter, params): """Receive data from sockets and create events for battery, temperature and disk space""" # Update carstate from CAN and create events @@ -77,6 +75,7 @@ def data_sample(CI, CC, sm, can_sock, driver_status, state, mismatch_counter, ca sm.update(0) events = list(CS.events) + events += list(sm['dMonitoringState'].events) add_lane_change_event(events, sm['pathPlan']) enabled = isEnabled(state) @@ -103,27 +102,15 @@ def data_sample(CI, CC, sm, can_sock, driver_status, state, mismatch_counter, ca if CS.stockAeb: events.append(create_event('stockAeb', [])) - # GPS coords RHD parsing, once every restart - if sm.updated['gpsLocation'] and not driver_status.is_rhd_region_checked: - is_rhd = is_rhd_region(sm['gpsLocation'].latitude, sm['gpsLocation'].longitude) - driver_status.is_rhd_region = is_rhd - driver_status.is_rhd_region_checked = True - put_nonblocking("IsRHD", "1" if is_rhd else "0") - # Handle calibration cal_status = sm['liveCalibration'].calStatus cal_perc = sm['liveCalibration'].calPerc - cal_rpy = [0,0,0] if cal_status != Calibration.CALIBRATED: if cal_status == Calibration.UNCALIBRATED: events.append(create_event('calibrationIncomplete', [ET.NO_ENTRY, ET.SOFT_DISABLE, ET.PERMANENT])) else: events.append(create_event('calibrationInvalid', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - else: - rpy = sm['liveCalibration'].rpyCalib - if len(rpy) == 3: - cal_rpy = rpy # When the panda and controlsd do not agree on controls_allowed # we want to disengage openpilot. However the status from the panda goes through @@ -138,16 +125,6 @@ def data_sample(CI, CC, sm, can_sock, driver_status, state, mismatch_counter, ca if mismatch_counter >= 200: events.append(create_event('controlsMismatch', [ET.IMMEDIATE_DISABLE])) - # Driver monitoring - if sm.updated['model']: - driver_status.set_policy(sm['model']) - - if sm.updated['driverMonitoring']: - driver_status.get_pose(sm['driverMonitoring'], cal_rpy, CS.vEgo, enabled) - - if driver_status.terminal_alert_cnt >= MAX_TERMINAL_ALERTS or driver_status.terminal_time >= MAX_TERMINAL_DURATION: - events.append(create_event("tooDistracted", [ET.NO_ENTRY])) - return CS, events, cal_perc, mismatch_counter, can_error_counter @@ -239,7 +216,7 @@ def state_transition(frame, CS, CP, state, events, soft_disable_timer, v_cruise_ def state_control(frame, rcv_frame, plan, path_plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, - AM, rk, driver_status, LaC, LoC, read_only, is_metric, cal_perc, last_blinker_frame): + AM, rk, LaC, LoC, read_only, is_metric, cal_perc, last_blinker_frame): """Given the state, this function returns an actuators packet""" actuators = car.CarControl.Actuators.new_message() @@ -247,17 +224,9 @@ def state_control(frame, rcv_frame, plan, path_plan, CS, CP, state, events, v_cr enabled = isEnabled(state) active = isActive(state) - # check if user has interacted with the car - driver_engaged = len(CS.buttonEvents) > 0 or \ - v_cruise_kph != v_cruise_kph_last or \ - CS.steeringPressed - if CS.leftBlinker or CS.rightBlinker: last_blinker_frame = frame - # add eventual driver distracted events - events = driver_status.update(events, driver_engaged, isActive(state), CS.standstill) - if plan.fcw: # send FCW alert if triggered by planner AM.add(frame, "fcw", enabled) @@ -315,11 +284,11 @@ def state_control(frame, rcv_frame, plan, path_plan, CS, CP, state, events, v_cr extra_text_2 = str(int(round(Filter.MIN_SPEED * CV.MS_TO_MPH))) + " mph" AM.add(frame, str(e) + "Permanent", enabled, extra_text_1=extra_text_1, extra_text_2=extra_text_2) - return actuators, v_cruise_kph, driver_status, v_acc_sol, a_acc_sol, lac_log, last_blinker_frame + return actuators, v_cruise_kph, v_acc_sol, a_acc_sol, lac_log, last_blinker_frame def data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, AM, - driver_status, LaC, LoC, read_only, start_time, v_acc, a_acc, lac_log, events_prev, + LaC, LoC, read_only, start_time, v_acc, a_acc, lac_log, events_prev, last_blinker_frame, is_ldw_enabled, can_error_counter): """Send actuators and hud commands to the car, send controlsstate and MPC logging""" @@ -346,7 +315,8 @@ def data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk CC.hudControl.leftLaneVisible = bool(left_lane_visible) recent_blinker = (sm.frame - last_blinker_frame) * DT_CTRL < 5.0 # 5s blinker cooldown - ldw_allowed = CS.vEgo > 31 * CV.MPH_TO_MS and not recent_blinker and is_ldw_enabled and not isActive(state) + calibrated = sm['liveCalibration'].calStatus == Calibration.CALIBRATED + ldw_allowed = CS.vEgo > 31 * CV.MPH_TO_MS and not recent_blinker and is_ldw_enabled and not isActive(state) and calibrated md = sm['model'] if len(md.meta.desirePrediction): @@ -372,7 +342,7 @@ def data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk can_sends = CI.apply(CC) pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid)) - force_decel = driver_status.awareness < 0. + force_decel = sm['dMonitoringState'].awarenessStatus < 0. # controlsState dat = messaging.new_message() @@ -386,8 +356,7 @@ def data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk "alertBlinkingRate": AM.alert_rate, "alertType": AM.alert_type, "alertSound": AM.audible_alert, - "awarenessStatus": max(driver_status.awareness, -0.1) if isEnabled(state) else 1.0, - "driverMonitoringOn": bool(driver_status.face_detected), + "driverMonitoringOn": sm['dMonitoringState'].faceDetected, "canMonoTimes": list(CS.canMonoTimes), "planMonoTime": sm.logMonoTime['plan'], "pathPlanMonoTime": sm.logMonoTime['pathPlan'], @@ -482,8 +451,8 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): pm = messaging.PubMaster(['sendcan', 'controlsState', 'carState', 'carControl', 'carEvents', 'carParams']) if sm is None: - sm = messaging.SubMaster(['thermal', 'health', 'liveCalibration', 'driverMonitoring', 'plan', 'pathPlan', \ - 'model', 'gpsLocation'], ignore_alive=['gpsLocation']) + sm = messaging.SubMaster(['thermal', 'health', 'liveCalibration', 'dMonitoringState', 'plan', 'pathPlan', \ + 'model']) if can_sock is None: @@ -507,7 +476,9 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): CP.safetyModel = car.CarParams.SafetyModel.noOutput # Write CarParams for radard and boardd safety mode - params.put("CarParams", CP.to_bytes()) + cp_bytes = CP.to_bytes() + params.put("CarParams", cp_bytes) + params.put("CarParamsCache", cp_bytes) params.put("LongitudinalControl", "1" if CP.openpilotLongitudinalControl else "0") CC = car.CarControl.new_message() @@ -526,11 +497,6 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): elif CP.lateralTuning.which() == 'lqr': LaC = LatControlLQR(CP) - driver_status = DriverStatus() - is_rhd = params.get("IsRHD") - if is_rhd is not None: - driver_status.is_rhd = bool(int(is_rhd)) - state = State.disabled soft_disable_timer = 0 v_cruise_kph = 255 @@ -544,6 +510,9 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): sm['pathPlan'].sensorValid = True sm['pathPlan'].posenetValid = True sm['thermal'].freeSpace = 1. + sm['dMonitoringState'].events = [] + sm['dMonitoringState'].awarenessStatus = 1. + sm['dMonitoringState'].faceDetected = False # detect sound card presence sounds_available = not os.path.isfile('/EON') or (os.path.isdir('/proc/asound/card0') and open('/proc/asound/card0/state').read().strip() == 'ONLINE') @@ -560,7 +529,7 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): prof.checkpoint("Ratekeeper", ignore=True) # Sample data and compute car events - CS, events, cal_perc, mismatch_counter, can_error_counter = data_sample(CI, CC, sm, can_sock, driver_status, state, mismatch_counter, can_error_counter, params) + CS, events, cal_perc, mismatch_counter, can_error_counter = data_sample(CI, CC, sm, can_sock, state, mismatch_counter, can_error_counter, params) prof.checkpoint("Sample") # Create alerts @@ -602,14 +571,14 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): prof.checkpoint("State transition") # Compute actuators (runs PID loops and lateral MPC) - actuators, v_cruise_kph, driver_status, v_acc, a_acc, lac_log, last_blinker_frame = \ + actuators, v_cruise_kph, v_acc, a_acc, lac_log, last_blinker_frame = \ state_control(sm.frame, sm.rcv_frame, sm['plan'], sm['pathPlan'], CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk, - driver_status, LaC, LoC, read_only, is_metric, cal_perc, last_blinker_frame) + LaC, LoC, read_only, is_metric, cal_perc, last_blinker_frame) prof.checkpoint("State Control") # Publish data - CC, events_prev = data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, AM, driver_status, LaC, + CC, events_prev = data_send(sm, pm, CS, CI, CP, VM, state, events, actuators, v_cruise_kph, rk, AM, LaC, LoC, read_only, start_time, v_acc, a_acc, lac_log, events_prev, last_blinker_frame, is_ldw_enabled, can_error_counter) prof.checkpoint("Sent") diff --git a/selfdrive/controls/dmonitoringd.py b/selfdrive/controls/dmonitoringd.py new file mode 100755 index 000000000..09108a62f --- /dev/null +++ b/selfdrive/controls/dmonitoringd.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +import gc +from common.realtime import set_realtime_priority +from common.params import Params, put_nonblocking +import cereal.messaging as messaging +from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET +from selfdrive.controls.lib.driver_monitor import DriverStatus, MAX_TERMINAL_ALERTS, MAX_TERMINAL_DURATION +from selfdrive.locationd.calibration_helpers import Calibration +from selfdrive.controls.lib.gps_helpers import is_rhd_region + +def dmonitoringd_thread(sm=None, pm=None): + gc.disable() + + # start the loop + set_realtime_priority(3) + + params = Params() + + # Pub/Sub Sockets + if pm is None: + pm = messaging.PubMaster(['dMonitoringState']) + + if sm is None: + sm = messaging.SubMaster(['driverState', 'liveCalibration', 'carState', 'model', 'gpsLocation'], ignore_alive=['gpsLocation']) + + driver_status = DriverStatus() + is_rhd = params.get("IsRHD") + if is_rhd is not None: + driver_status.is_rhd_region = bool(int(is_rhd)) + + sm['liveCalibration'].calStatus = Calibration.INVALID + sm['carState'].vEgo = 0. + sm['carState'].cruiseState.enabled = False + sm['carState'].cruiseState.speed = 0. + sm['carState'].buttonEvents = [] + sm['carState'].steeringPressed = False + sm['carState'].standstill = True + + cal_rpy = [0,0,0] + v_cruise_last = 0 + driver_engaged = False + + # 10Hz <- dmonitoringmodeld + while True: + sm.update() + + # GPS coords RHD parsing, once every restart + if not driver_status.is_rhd_region_checked and sm.updated['gpsLocation']: + is_rhd = is_rhd_region(sm['gpsLocation'].latitude, sm['gpsLocation'].longitude) + driver_status.is_rhd_region = is_rhd + driver_status.is_rhd_region_checked = True + put_nonblocking("IsRHD", "1" if is_rhd else "0") + + # Handle calibration + if sm.updated['liveCalibration']: + if sm['liveCalibration'].calStatus == Calibration.CALIBRATED: + if len(sm['liveCalibration'].rpyCalib) == 3: + cal_rpy = sm['liveCalibration'].rpyCalib + + # Get interaction + if sm.updated['carState']: + v_cruise = sm['carState'].cruiseState.speed + driver_engaged = len(sm['carState'].buttonEvents) > 0 or \ + v_cruise != v_cruise_last or \ + sm['carState'].steeringPressed + v_cruise_last = v_cruise + + # Get model meta + if sm.updated['model']: + driver_status.set_policy(sm['model']) + + # Get data from dmonitoringmodeld + if sm.updated['driverState']: + events = [] + driver_status.get_pose(sm['driverState'], cal_rpy, sm['carState'].vEgo, sm['carState'].cruiseState.enabled) + # Block any engage after certain distrations + if driver_status.terminal_alert_cnt >= MAX_TERMINAL_ALERTS or driver_status.terminal_time >= MAX_TERMINAL_DURATION: + events.append(create_event("tooDistracted", [ET.NO_ENTRY])) + # Update events from driver state + events = driver_status.update(events, driver_engaged, sm['carState'].cruiseState.enabled, sm['carState'].standstill) + + # dMonitoringState packet + dat = messaging.new_message() + dat.init('dMonitoringState') + dat.dMonitoringState = { + "events": events, + "faceDetected": driver_status.face_detected, + "isDistracted": driver_status.driver_distracted, + "awarenessStatus": driver_status.awareness, + "isRHD": driver_status.is_rhd_region, + "rhdChecked": driver_status.is_rhd_region_checked, + "posePitchOffset": driver_status.pose.pitch_offseter.filtered_stat.mean(), + "posePitchValidCount": driver_status.pose.pitch_offseter.filtered_stat.n, + "poseYawOffset": driver_status.pose.yaw_offseter.filtered_stat.mean(), + "poseYawValidCount": driver_status.pose.yaw_offseter.filtered_stat.n, + "stepChange": driver_status.step_change, + "awarenessActive": driver_status.awareness_active, + "awarenessPassive": driver_status.awareness_passive, + "isLowStd": driver_status.pose.low_std, + "hiStdCount": driver_status.hi_stds, + } + pm.send('dMonitoringState', dat) + +def main(sm=None, pm=None): + dmonitoringd_thread(sm, pm) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/selfdrive/controls/lib/alerts.py b/selfdrive/controls/lib/alerts.py index 83d430f07..e6a64f1ea 100644 --- a/selfdrive/controls/lib/alerts.py +++ b/selfdrive/controls/lib/alerts.py @@ -110,7 +110,7 @@ ALERTS = [ Alert( "preDriverDistracted", - "KEEP EYES ON ROAD: User Appears Distracted", + "KEEP EYES ON ROAD: Driver Appears Distracted", "", AlertStatus.normal, AlertSize.small, Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75), @@ -118,14 +118,14 @@ ALERTS = [ Alert( "promptDriverDistracted", "KEEP EYES ON ROAD", - "User Appears Distracted", + "Driver Appears Distracted", AlertStatus.userPrompt, AlertSize.mid, Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), Alert( "driverDistracted", "DISENGAGE IMMEDIATELY", - "User Was Distracted", + "Driver Was Distracted", AlertStatus.critical, AlertSize.full, Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), @@ -139,30 +139,23 @@ ALERTS = [ Alert( "promptDriverUnresponsive", "TOUCH STEERING WHEEL", - "User Is Unresponsive", + "Driver Is Unresponsive", AlertStatus.userPrompt, AlertSize.mid, Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), Alert( "driverUnresponsive", "DISENGAGE IMMEDIATELY", - "User Was Unresponsive", + "Driver Was Unresponsive", AlertStatus.critical, AlertSize.full, Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), Alert( - "driverMonitorOff", - "DRIVER MONITOR IS UNAVAILABLE", - "Accuracy Is Low", + "driverMonitorLowAcc", + "CHECK DRIVER FACE VISIBILITY", + "Driver Monitor Model Output Uncertain", AlertStatus.normal, AlertSize.mid, - Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), - - Alert( - "driverMonitorOn", - "DRIVER MONITOR IS AVAILABLE", - "Accuracy Is High", - AlertStatus.normal, AlertSize.mid, - Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .4, 0., 1.), Alert( "geofence", @@ -178,6 +171,13 @@ ALERTS = [ AlertStatus.normal, AlertSize.mid, Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., 15.), + Alert( + "startupMaster", + "WARNING: This branch is not tested", + "Always keep hands on wheel and eyes on road", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., 15.), + Alert( "startupNoControl", "Dashcam mode", @@ -328,7 +328,7 @@ ALERTS = [ Alert( "sensorDataInvalidNoEntry", "openpilot Unavailable", - "No Data from EON Sensors", + "No Data from Device Sensors", AlertStatus.normal, AlertSize.mid, Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), @@ -364,7 +364,7 @@ ALERTS = [ Alert( "calibrationInvalid", "TAKE CONTROL IMMEDIATELY", - "Calibration Invalid: Reposition EON and Recalibrate", + "Calibration Invalid: Reposition Device and Recalibrate", AlertStatus.critical, AlertSize.full, Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, 2., 2.), @@ -435,7 +435,7 @@ ALERTS = [ Alert( "lowMemory", "TAKE CONTROL IMMEDIATELY", - "Low Memory: Reboot Your EON", + "Low Memory: Reboot Your Device", AlertStatus.critical, AlertSize.full, Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, 2., 2.), @@ -536,7 +536,7 @@ ALERTS = [ Alert( "calibrationInvalidNoEntry", "openpilot Unavailable", - "Calibration Invalid: Reposition EON and Recalibrate", + "Calibration Invalid: Reposition Device and Recalibrate", AlertStatus.normal, AlertSize.mid, Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), @@ -683,7 +683,7 @@ ALERTS = [ Alert( "lowMemoryNoEntry", "openpilot Unavailable", - "Low Memory: Reboot Your EON", + "Low Memory: Reboot Your Device", AlertStatus.normal, AlertSize.mid, Priority.LOW, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), @@ -739,22 +739,22 @@ ALERTS = [ Alert( "sensorDataInvalidPermanent", - "No Data from EON Sensors", - "Reboot your EON", + "No Data from Device Sensors", + "Reboot your Device", AlertStatus.normal, AlertSize.mid, Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), Alert( "soundsUnavailablePermanent", "Speaker not found", - "Reboot your EON", + "Reboot your Device", AlertStatus.normal, AlertSize.mid, Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), Alert( "lowMemoryPermanent", "RAM Critically Low", - "Reboot your EON", + "Reboot your Device", AlertStatus.normal, AlertSize.mid, Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), diff --git a/selfdrive/controls/lib/alerts_offroad.json b/selfdrive/controls/lib/alerts_offroad.json index 9713ff71a..cebb1a2c2 100644 --- a/selfdrive/controls/lib/alerts_offroad.json +++ b/selfdrive/controls/lib/alerts_offroad.json @@ -4,7 +4,7 @@ "severity": 0 }, "Offroad_TemperatureTooHigh": { - "text": "EON temperature too high. System won't start.", + "text": "Device temperature too high. System won't start.", "severity": 1 }, "Offroad_ConnectivityNeededPrompt": { @@ -17,7 +17,7 @@ "severity": 1 }, "Offroad_PandaFirmwareMismatch": { - "text": "Unexpected panda firmware version. System won't start. Reboot your EON to reflash panda.", + "text": "Unexpected panda firmware version. System won't start. Reboot your device to reflash panda.", "severity": 1 }, "Offroad_InvalidTime": { diff --git a/selfdrive/controls/lib/cluster/fastcluster_py.py b/selfdrive/controls/lib/cluster/fastcluster_py.py index 12419a48e..1c9ecee36 100644 --- a/selfdrive/controls/lib/cluster/fastcluster_py.py +++ b/selfdrive/controls/lib/cluster/fastcluster_py.py @@ -2,9 +2,10 @@ import os import numpy as np from cffi import FFI +from common.ffi_wrapper import suffix cluster_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) -cluster_fn = os.path.join(cluster_dir, "libfastcluster.so") +cluster_fn = os.path.join(cluster_dir, "libfastcluster"+suffix()) ffi = FFI() ffi.cdef(""" diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index 753955975..8f0dbda70 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -1,12 +1,13 @@ -import numpy as np -from common.realtime import DT_CTRL, DT_DMON +from common.numpy_fast import interp +from math import atan2, sqrt +from common.realtime import DT_DMON from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET from common.filter_simple import FirstOrderFilter from common.stat_live import RunningStatFilter -_AWARENESS_TIME = 100. # 1.6 minutes limit without user touching steering wheels make the car enter a terminal status -_AWARENESS_PRE_TIME_TILL_TERMINAL = 25. # a first alert is issued 25s before expiration -_AWARENESS_PROMPT_TIME_TILL_TERMINAL = 15. # a second alert is issued 15s before start decelerating the car +_AWARENESS_TIME = 70. # one minute limit without user touching steering wheels make the car enter a terminal status +_AWARENESS_PRE_TIME_TILL_TERMINAL = 15. # a first alert is issued 25s before expiration +_AWARENESS_PROMPT_TIME_TILL_TERMINAL = 6. # a second alert is issued 15s before start decelerating the car _DISTRACTED_TIME = 11. _DISTRACTED_PRE_TIME_TILL_TERMINAL = 8. _DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 6. @@ -17,6 +18,7 @@ _BLINK_THRESHOLD = 0.5 # 0.225 _BLINK_THRESHOLD_SLACK = 0.65 _BLINK_THRESHOLD_STRICT = 0.5 _PITCH_WEIGHT = 1.35 # 1.5 # pitch matters a lot more +_POSESTD_THRESHOLD = 0.14 _METRIC_THRESHOLD = 0.4 _METRIC_THRESHOLD_SLACK = 0.55 _METRIC_THRESHOLD_STRICT = 0.4 @@ -24,17 +26,19 @@ _PITCH_POS_ALLOWANCE = 0.12 # rad, to not be too sensitive on positive pitch _PITCH_NATURAL_OFFSET = 0.02 # people don't seem to look straight when they drive relaxed, rather a bit up _YAW_NATURAL_OFFSET = 0.08 # people don't seem to look straight when they drive relaxed, rather a bit to the right (center of car) +_HI_STD_TIMEOUT = 5 +_HI_STD_FALLBACK_TIME = 10 # fall back to wheel touch if model is uncertain for a long time _DISTRACTED_FILTER_TS = 0.25 # 0.6Hz _POSE_CALIB_MIN_SPEED = 13 # 30 mph -_POSE_OFFSET_MIN_COUNT = 600 # valid data counts before calibration completes, 1 seg is 600 counts -_POSE_OFFSET_MAX_COUNT = 3600 # stop deweighting new data after 6 min, aka "short term memory" +_POSE_OFFSET_MIN_COUNT = 60 # valid data counts before calibration completes, 1 seg is 600 counts +_POSE_OFFSET_MAX_COUNT = 360 # stop deweighting new data after 6 min, aka "short term memory" _RECOVERY_FACTOR_MAX = 5. # relative to minus step change _RECOVERY_FACTOR_MIN = 1.25 # relative to minus step change MAX_TERMINAL_ALERTS = 3 # not allowed to engage after 3 terminal alerts -MAX_TERMINAL_DURATION = 3000 # 30s +MAX_TERMINAL_DURATION = 300 # 30s # model output refers to center of cropped image, so need to apply the x displacement offset RESIZED_FOCAL = 320.0 @@ -54,8 +58,8 @@ def face_orientation_from_net(angles_desc, pos_desc, rpy_calib): roll_net = angles_desc[2] face_pixel_position = ((pos_desc[0] + .5)*W - W + FULL_W, (pos_desc[1]+.5)*H) - yaw_focal_angle = np.arctan2(face_pixel_position[0] - FULL_W//2, RESIZED_FOCAL) - pitch_focal_angle = np.arctan2(face_pixel_position[1] - H//2, RESIZED_FOCAL) + yaw_focal_angle = atan2(face_pixel_position[0] - FULL_W//2, RESIZED_FOCAL) + pitch_focal_angle = atan2(face_pixel_position[1] - H//2, RESIZED_FOCAL) roll = roll_net pitch = pitch_net + pitch_focal_angle @@ -64,15 +68,19 @@ def face_orientation_from_net(angles_desc, pos_desc, rpy_calib): # no calib for roll pitch -= rpy_calib[1] yaw -= rpy_calib[2] - return np.array([roll, pitch, yaw]) + return roll, pitch, yaw class DriverPose(): def __init__(self): self.yaw = 0. self.pitch = 0. self.roll = 0. + self.yaw_std = 0. + self.pitch_std = 0. + self.roll_std = 0. self.pitch_offseter = RunningStatFilter(max_trackable=_POSE_OFFSET_MAX_COUNT) self.yaw_offseter = RunningStatFilter(max_trackable=_POSE_OFFSET_MAX_COUNT) + self.low_std = True self.cfactor = 1. class DriverBlink(): @@ -97,6 +105,7 @@ class DriverStatus(): self.terminal_time = 0 self.step_change = 0. self.active_monitoring_mode = True + self.hi_stds = 0 self.threshold_prompt = _DISTRACTED_PROMPT_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.is_rhd_region = False @@ -107,7 +116,7 @@ class DriverStatus(): def _set_timers(self, active_monitoring): if self.active_monitoring_mode and self.awareness <= self.threshold_prompt: if active_monitoring: - self.step_change = DT_CTRL / _DISTRACTED_TIME + self.step_change = DT_DMON / _DISTRACTED_TIME else: self.step_change = 0. return # no exploit after orange alert @@ -122,7 +131,7 @@ class DriverStatus(): self.threshold_pre = _DISTRACTED_PRE_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.threshold_prompt = _DISTRACTED_PROMPT_TIME_TILL_TERMINAL / _DISTRACTED_TIME - self.step_change = DT_CTRL / _DISTRACTED_TIME + self.step_change = DT_DMON / _DISTRACTED_TIME self.active_monitoring_mode = True else: if self.active_monitoring_mode: @@ -131,7 +140,7 @@ class DriverStatus(): self.threshold_pre = _AWARENESS_PRE_TIME_TILL_TERMINAL / _AWARENESS_TIME self.threshold_prompt = _AWARENESS_PROMPT_TIME_TILL_TERMINAL / _AWARENESS_TIME - self.step_change = DT_CTRL / _AWARENESS_TIME + self.step_change = DT_DMON / _AWARENESS_TIME self.active_monitoring_mode = False def _is_driver_distracted(self, pose, blink): @@ -146,7 +155,7 @@ class DriverStatus(): if pitch_error > 0.: pitch_error = max(pitch_error - _PITCH_POS_ALLOWANCE, 0.) pitch_error *= _PITCH_WEIGHT - pose_metric = np.sqrt(yaw_error**2 + pitch_error**2) + pose_metric = sqrt(yaw_error**2 + pitch_error**2) if pose_metric > _METRIC_THRESHOLD*pose.cfactor: return DistractedType.BAD_POSE @@ -157,35 +166,47 @@ class DriverStatus(): def set_policy(self, model_data): ep = min(model_data.meta.engagedProb, 0.8) / 0.8 - self.pose.cfactor = np.interp(ep, [0, 0.5, 1], [_METRIC_THRESHOLD_STRICT, _METRIC_THRESHOLD, _METRIC_THRESHOLD_SLACK])/_METRIC_THRESHOLD - self.blink.cfactor = np.interp(ep, [0, 0.5, 1], [_BLINK_THRESHOLD_STRICT, _BLINK_THRESHOLD, _BLINK_THRESHOLD_SLACK])/_BLINK_THRESHOLD + self.pose.cfactor = interp(ep, [0, 0.5, 1], [_METRIC_THRESHOLD_STRICT, _METRIC_THRESHOLD, _METRIC_THRESHOLD_SLACK])/_METRIC_THRESHOLD + self.blink.cfactor = interp(ep, [0, 0.5, 1], [_BLINK_THRESHOLD_STRICT, _BLINK_THRESHOLD, _BLINK_THRESHOLD_SLACK])/_BLINK_THRESHOLD - def get_pose(self, driver_monitoring, cal_rpy, car_speed, op_engaged): + def get_pose(self, driver_state, cal_rpy, car_speed, op_engaged): # 10 Hz - if len(driver_monitoring.faceOrientation) == 0 or len(driver_monitoring.facePosition) == 0: + if len(driver_state.faceOrientation) == 0 or len(driver_state.facePosition) == 0 or len(driver_state.faceOrientationStd) == 0 or len(driver_state.facePositionStd) == 0: return - self.pose.roll, self.pose.pitch, self.pose.yaw = face_orientation_from_net(driver_monitoring.faceOrientation, driver_monitoring.facePosition, cal_rpy) - self.blink.left_blink = driver_monitoring.leftBlinkProb * (driver_monitoring.leftEyeProb>_EYE_THRESHOLD) - self.blink.right_blink = driver_monitoring.rightBlinkProb * (driver_monitoring.rightEyeProb>_EYE_THRESHOLD) - self.face_detected = driver_monitoring.faceProb > _FACE_THRESHOLD and \ - abs(driver_monitoring.facePosition[0]) <= 0.4 and abs(driver_monitoring.facePosition[1]) <= 0.45 and \ + self.pose.roll, self.pose.pitch, self.pose.yaw = face_orientation_from_net(driver_state.faceOrientation, driver_state.facePosition, cal_rpy) + self.pose.pitch_std = driver_state.faceOrientationStd[0] + self.pose.yaw_std = driver_state.faceOrientationStd[1] + # self.pose.roll_std = driver_state.faceOrientationStd[2] + model_std_max = max(self.pose.pitch_std, self.pose.yaw_std) + self.pose.low_std = model_std_max < _POSESTD_THRESHOLD + self.blink.left_blink = driver_state.leftBlinkProb * (driver_state.leftEyeProb>_EYE_THRESHOLD) + self.blink.right_blink = driver_state.rightBlinkProb * (driver_state.rightEyeProb>_EYE_THRESHOLD) + self.face_detected = driver_state.faceProb > _FACE_THRESHOLD and \ + abs(driver_state.facePosition[0]) <= 0.4 and abs(driver_state.facePosition[1]) <= 0.45 and \ not self.is_rhd_region - self.driver_distracted = self._is_driver_distracted(self.pose, self.blink)>0 + self.driver_distracted = self._is_driver_distracted(self.pose, self.blink) > 0 # first order filters self.driver_distraction_filter.update(self.driver_distracted) # update offseter # only update when driver is actively driving the car above a certain speed - if self.face_detected and car_speed>_POSE_CALIB_MIN_SPEED and (not op_engaged or not self.driver_distracted): + if self.face_detected and car_speed>_POSE_CALIB_MIN_SPEED and self.pose.low_std and (not op_engaged or not self.driver_distracted): self.pose.pitch_offseter.push_and_update(self.pose.pitch) self.pose.yaw_offseter.push_and_update(self.pose.yaw) self.pose_calibrated = self.pose.pitch_offseter.filtered_stat.n > _POSE_OFFSET_MIN_COUNT and \ self.pose.yaw_offseter.filtered_stat.n > _POSE_OFFSET_MIN_COUNT - self._set_timers(self.face_detected) + is_model_uncertain = self.hi_stds * DT_DMON > _HI_STD_FALLBACK_TIME + self._set_timers(self.face_detected and not is_model_uncertain) + if self.face_detected and not self.pose.low_std: + if not is_model_uncertain: + self.step_change *= max(0, (model_std_max-0.5)*(model_std_max-2)) + self.hi_stds += 1 + elif self.face_detected and self.pose.low_std: + self.hi_stds = 0 def update(self, events, driver_engaged, ctrl_active, standstill): if (driver_engaged and self.awareness > 0) or not ctrl_active: @@ -198,7 +219,10 @@ class DriverStatus(): driver_attentive = self.driver_distraction_filter.x < 0.37 awareness_prev = self.awareness - if (driver_attentive and self.face_detected and self.awareness > 0): + if self.face_detected and self.hi_stds * DT_DMON > _HI_STD_TIMEOUT: + events.append(create_event('driverMonitorLowAcc', [ET.WARNING])) + + if (driver_attentive and self.face_detected and self.pose.low_std and self.awareness > 0): # only restore awareness when paying attention and alert is not red self.awareness = min(self.awareness + ((_RECOVERY_FACTOR_MAX-_RECOVERY_FACTOR_MIN)*(1.-self.awareness)+_RECOVERY_FACTOR_MIN)*self.step_change, 1.) if self.awareness == 1.: @@ -208,7 +232,7 @@ class DriverStatus(): return events # should always be counting if distracted unless at standstill and reaching orange - if (not self.face_detected or (self.driver_distraction_filter.x > 0.63 and self.driver_distracted and self.face_detected)) and \ + if (not (self.face_detected and self.hi_stds * DT_DMON <= _HI_STD_FALLBACK_TIME) or (self.driver_distraction_filter.x > 0.63 and self.driver_distracted and self.face_detected)) and \ not (standstill and self.awareness - self.step_change <= self.threshold_prompt): self.awareness = max(self.awareness - self.step_change, -0.1) diff --git a/selfdrive/controls/lib/gps_helpers.py b/selfdrive/controls/lib/gps_helpers.py index 984a450f8..e9e7d6c9e 100755 --- a/selfdrive/controls/lib/gps_helpers.py +++ b/selfdrive/controls/lib/gps_helpers.py @@ -1,14 +1,15 @@ -_RHD_REGION_MAP = [ ['AUS', -54.76, -9.23, 112.91, 159.11], \ +_RHD_REGION_MAP = [ ['AU', -54.76, -9.23, 112.91, 159.11], \ ['IN1', 6.75, 28.10, 68.17, 97.4], \ ['IN2', 28.09, 35.99, 72.18, 80.87], \ - ['IRL', 51.42, 55.38, -10.58, -5.99], \ + ['IE', 51.42, 55.38, -10.58, -5.99], \ ['JP1', 32.66, 45.52, 137.27, 146.02], \ ['JP2', 32.79, 37.60, 131.41, 137.28], \ ['JP3', 24.04, 34.78, 122.93, 131.42], \ + ['MU', -20.53, -19.98, 57.30, 57.81], \ ['MY', 0.86, 7.36, 99.64, 119.27], \ ['NZ', -52.61, -29.24, 166, 178.84], \ - ['SF', -35.14, -22.13, 16.07, 33.21], \ - ['UK', 49.9, 60.84, -8.62, 1.77] ] + ['UK', 49.9, 60.84, -8.62, 1.77], \ + ['ZA', -34.83, -22.13, 16.47, 32.88] ] def is_rhd_region(latitude, longitude): for region in _RHD_REGION_MAP: diff --git a/selfdrive/controls/lib/lateral_mpc/libmpc_py.py b/selfdrive/controls/lib/lateral_mpc/libmpc_py.py index d85eaecf8..9fc3a6c40 100644 --- a/selfdrive/controls/lib/lateral_mpc/libmpc_py.py +++ b/selfdrive/controls/lib/lateral_mpc/libmpc_py.py @@ -1,9 +1,10 @@ import os from cffi import FFI +from common.ffi_wrapper import suffix mpc_dir = os.path.dirname(os.path.abspath(__file__)) -libmpc_fn = os.path.join(mpc_dir, "libmpc.so") +libmpc_fn = os.path.join(mpc_dir, "libmpc"+suffix()) ffi = FFI() ffi.cdef(""" diff --git a/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py b/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py index b43773593..c40b4e071 100644 --- a/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py +++ b/selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py @@ -1,11 +1,12 @@ import os from cffi import FFI +from common.ffi_wrapper import suffix mpc_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) def _get_libmpc(mpc_id): - libmpc_fn = os.path.join(mpc_dir, "libmpc%d.so" % mpc_id) + libmpc_fn = os.path.join(mpc_dir, "libmpc%d%s" % (mpc_id, suffix())) ffi = FFI() ffi.cdef(""" diff --git a/selfdrive/controls/lib/pathplanner.py b/selfdrive/controls/lib/pathplanner.py index 8a6e5286f..de43c0418 100644 --- a/selfdrive/controls/lib/pathplanner.py +++ b/selfdrive/controls/lib/pathplanner.py @@ -53,8 +53,8 @@ class PathPlanner(): self.setup_mpc() self.solution_invalid_cnt = 0 - self.path_offset_i = 0.0 self.lane_change_state = LaneChangeState.off + self.lane_change_direction = LaneChangeDirection.none self.lane_change_timer = 0.0 self.prev_one_blinker = False @@ -89,21 +89,21 @@ class PathPlanner(): self.LP.parse_model(sm['model']) # Lane change logic - lane_change_direction = LaneChangeDirection.none one_blinker = sm['carState'].leftBlinker != sm['carState'].rightBlinker below_lane_change_speed = v_ego < LANE_CHANGE_SPEED_MIN - if not active or self.lane_change_timer > LANE_CHANGE_TIME_MAX: - self.lane_change_state = LaneChangeState.off - else: - if sm['carState'].leftBlinker: - lane_change_direction = LaneChangeDirection.left - elif sm['carState'].rightBlinker: - lane_change_direction = LaneChangeDirection.right + if sm['carState'].leftBlinker: + self.lane_change_direction = LaneChangeDirection.left + elif sm['carState'].rightBlinker: + self.lane_change_direction = LaneChangeDirection.right + if (not active) or (self.lane_change_timer > LANE_CHANGE_TIME_MAX) or (not one_blinker): + self.lane_change_state = LaneChangeState.off + self.lane_change_direction = LaneChangeDirection.none + else: torque_applied = sm['carState'].steeringPressed and \ - ((sm['carState'].steeringTorque > 0 and lane_change_direction == LaneChangeDirection.left) or \ - (sm['carState'].steeringTorque < 0 and lane_change_direction == LaneChangeDirection.right)) + ((sm['carState'].steeringTorque > 0 and self.lane_change_direction == LaneChangeDirection.left) or \ + (sm['carState'].steeringTorque < 0 and self.lane_change_direction == LaneChangeDirection.right)) lane_change_prob = self.LP.l_lane_change_prob + self.LP.r_lane_change_prob @@ -137,7 +137,7 @@ class PathPlanner(): self.prev_one_blinker = one_blinker - desire = DESIRES[lane_change_direction][self.lane_change_state] + desire = DESIRES[self.lane_change_direction][self.lane_change_state] # Turn off lanes during lane change if desire == log.PathPlan.Desire.laneChangeRight or desire == log.PathPlan.Desire.laneChangeLeft: @@ -149,15 +149,6 @@ class PathPlanner(): self.LP.update_d_poly(v_ego) - - # TODO: Check for active, override, and saturation - # if active: - # self.path_offset_i += self.LP.d_poly[3] / (60.0 * 20.0) - # self.path_offset_i = clip(self.path_offset_i, -0.5, 0.5) - # self.LP.d_poly[3] += self.path_offset_i - # else: - # self.path_offset_i = 0.0 - # account for actuation delay self.cur_state = calc_states_after_delay(self.cur_state, v_ego, angle_steers - angle_offset, curvature_factor, VM.sR, CP.steerActuatorDelay) @@ -215,7 +206,7 @@ class PathPlanner(): plan_send.pathPlan.desire = desire plan_send.pathPlan.laneChangeState = self.lane_change_state - plan_send.pathPlan.laneChangeDirection = lane_change_direction + plan_send.pathPlan.laneChangeDirection = self.lane_change_direction pm.send('pathPlan', plan_send) diff --git a/selfdrive/controls/tests/test_monitoring.py b/selfdrive/controls/tests/test_monitoring.py index d5c14d663..af44dc332 100644 --- a/selfdrive/controls/tests/test_monitoring.py +++ b/selfdrive/controls/tests/test_monitoring.py @@ -1,10 +1,11 @@ import unittest import numpy as np -from common.realtime import DT_CTRL, DT_DMON +from common.realtime import DT_DMON from selfdrive.controls.lib.driver_monitor import DriverStatus, MAX_TERMINAL_ALERTS, \ _AWARENESS_TIME, _AWARENESS_PRE_TIME_TILL_TERMINAL, \ _AWARENESS_PROMPT_TIME_TILL_TERMINAL, _DISTRACTED_TIME, \ - _DISTRACTED_PRE_TIME_TILL_TERMINAL, _DISTRACTED_PROMPT_TIME_TILL_TERMINAL + _DISTRACTED_PRE_TIME_TILL_TERMINAL, _DISTRACTED_PROMPT_TIME_TILL_TERMINAL, \ + _POSESTD_THRESHOLD, _HI_STD_TIMEOUT from selfdrive.controls.lib.gps_helpers import is_rhd_region _TEST_TIMESPAN = 120 # seconds @@ -12,9 +13,10 @@ _DISTRACTED_SECONDS_TO_ORANGE = _DISTRACTED_TIME - _DISTRACTED_PROMPT_TIME_TILL_ _DISTRACTED_SECONDS_TO_RED = _DISTRACTED_TIME + 1 _INVISIBLE_SECONDS_TO_ORANGE = _AWARENESS_TIME - _AWARENESS_PROMPT_TIME_TILL_TERMINAL + 1 _INVISIBLE_SECONDS_TO_RED = _AWARENESS_TIME + 1 +_UNCERTAIN_SECONDS_TO_GREEN = _HI_STD_TIMEOUT + 0.5 class fake_DM_msg(): - def __init__(self, is_face_detected, is_distracted=False): + def __init__(self, is_face_detected, is_distracted=False, is_model_uncertain=False): self.faceOrientation = [0.,0.,0.] self.facePosition = [0.,0.] self.faceProb = 1. * is_face_detected @@ -22,12 +24,17 @@ class fake_DM_msg(): self.rightEyeProb = 1. self.leftBlinkProb = 1. * is_distracted self.rightBlinkProb = 1. * is_distracted + self.faceOrientationStd = [1.*is_model_uncertain,1.*is_model_uncertain,1.*is_model_uncertain] + self.facePositionStd = [1.*is_model_uncertain,1.*is_model_uncertain] # driver state from neural net, 10Hz msg_NO_FACE_DETECTED = fake_DM_msg(is_face_detected=False) msg_ATTENTIVE = fake_DM_msg(is_face_detected=True) msg_DISTRACTED = fake_DM_msg(is_face_detected=True, is_distracted=True) +msg_ATTENTIVE_UNCERTAIN = fake_DM_msg(is_face_detected=True, is_model_uncertain=True) +msg_DISTRACTED_UNCERTAIN = fake_DM_msg(is_face_detected=True, is_distracted=True, is_model_uncertain=True) +msg_DISTRACTED_BUT_SOMEHOW_UNCERTAIN = fake_DM_msg(is_face_detected=True, is_distracted=True, is_model_uncertain=_POSESTD_THRESHOLD*1.5) # driver interaction with car car_interaction_DETECTED = True @@ -56,13 +63,11 @@ def run_DState_seq(driver_state_msgs, driver_car_interaction, openpilot_status, DS.get_pose(driver_state_msgs[idx], [0,0,0], 0, openpilot_status[idx]) # cal_rpy and car_speed don't matter here - # to match frequency of controlsd (100Hz) - for _ in range(int(DT_DMON/DT_CTRL)): - event_per_state = DS.update([], driver_car_interaction[idx], openpilot_status[idx], car_standstill_status[idx]) + event_per_state = DS.update([], driver_car_interaction[idx], openpilot_status[idx], car_standstill_status[idx]) events_from_DM.append(event_per_state) # evaluate events at 10Hz for tests assert len(events_from_DM)==len(driver_state_msgs), 'somethings wrong' - return events_from_DM + return events_from_DM, DS class TestMonitoring(unittest.TestCase): # -1. rhd parser sanity check @@ -80,12 +85,12 @@ class TestMonitoring(unittest.TestCase): # 0. op engaged, driver is doing fine all the time def test_fully_aware_driver(self): - events_output = run_DState_seq(always_attentive, always_false, always_true, always_false) + events_output = run_DState_seq(always_attentive, always_false, always_true, always_false)[0] self.assertTrue(np.sum([len(event) for event in events_output])==0) # 1. op engaged, driver is distracted and does nothing def test_fully_distracted_driver(self): - events_output = run_DState_seq(always_distracted, always_false, always_true, always_false) + events_output, d_status = run_DState_seq(always_distracted, always_false, always_true, always_false) self.assertTrue(len(events_output[int((_DISTRACTED_TIME-_DISTRACTED_PRE_TIME_TILL_TERMINAL)/2/DT_DMON)])==0) self.assertEqual(events_output[int((_DISTRACTED_TIME-_DISTRACTED_PRE_TIME_TILL_TERMINAL+\ ((_DISTRACTED_PRE_TIME_TILL_TERMINAL-_DISTRACTED_PROMPT_TIME_TILL_TERMINAL)/2))/DT_DMON)][0].name, 'preDriverDistracted') @@ -93,10 +98,11 @@ class TestMonitoring(unittest.TestCase): ((_DISTRACTED_PROMPT_TIME_TILL_TERMINAL)/2))/DT_DMON)][0].name, 'promptDriverDistracted') self.assertEqual(events_output[int((_DISTRACTED_TIME+\ ((_TEST_TIMESPAN-10-_DISTRACTED_TIME)/2))/DT_DMON)][0].name, 'driverDistracted') + self.assertIs(type(d_status.awareness), float) # 2. op engaged, no face detected the whole time, no action def test_fully_invisible_driver(self): - events_output = run_DState_seq(always_no_face, always_false, always_true, always_false) + events_output = run_DState_seq(always_no_face, always_false, always_true, always_false)[0] self.assertTrue(len(events_output[int((_AWARENESS_TIME-_AWARENESS_PRE_TIME_TILL_TERMINAL)/2/DT_DMON)])==0) self.assertEqual(events_output[int((_AWARENESS_TIME-_AWARENESS_PRE_TIME_TILL_TERMINAL+\ ((_AWARENESS_PRE_TIME_TILL_TERMINAL-_AWARENESS_PROMPT_TIME_TILL_TERMINAL)/2))/DT_DMON)][0].name, 'preDriverUnresponsive') @@ -113,7 +119,7 @@ class TestMonitoring(unittest.TestCase): [msg_DISTRACTED] * (int(_TEST_TIMESPAN/DT_DMON)-int(_DISTRACTED_SECONDS_TO_ORANGE*2/DT_DMON)) interaction_vector = [car_interaction_NOT_DETECTED] * int(_DISTRACTED_SECONDS_TO_ORANGE*3/DT_DMON) + \ [car_interaction_DETECTED] * (int(_TEST_TIMESPAN/DT_DMON)-int(_DISTRACTED_SECONDS_TO_ORANGE*3/DT_DMON)) - events_output = run_DState_seq(ds_vector, interaction_vector, always_true, always_false) + events_output = run_DState_seq(ds_vector, interaction_vector, always_true, always_false)[0] self.assertTrue(len(events_output[int(_DISTRACTED_SECONDS_TO_ORANGE*0.5/DT_DMON)])==0) self.assertEqual(events_output[int((_DISTRACTED_SECONDS_TO_ORANGE-0.1)/DT_DMON)][0].name, 'promptDriverDistracted') self.assertTrue(len(events_output[int(_DISTRACTED_SECONDS_TO_ORANGE*1.5/DT_DMON)])==0) @@ -132,7 +138,7 @@ class TestMonitoring(unittest.TestCase): ds_vector[int((_DISTRACTED_SECONDS_TO_RED+_invisible_time)/DT_DMON):int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time)/DT_DMON)] = [msg_NO_FACE_DETECTED] * int(_invisible_time/DT_DMON) interaction_vector[int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time+0.5)/DT_DMON):int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time+1.5)/DT_DMON)] = [True] * int(1/DT_DMON) op_vector[int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time+2.5)/DT_DMON):int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time+3)/DT_DMON)] = [False] * int(0.5/DT_DMON) - events_output = run_DState_seq(ds_vector, interaction_vector, op_vector, always_false) + events_output = run_DState_seq(ds_vector, interaction_vector, op_vector, always_false)[0] self.assertEqual(events_output[int((_DISTRACTED_SECONDS_TO_ORANGE+0.5*_invisible_time)/DT_DMON)][0].name, 'promptDriverDistracted') self.assertEqual(events_output[int((_DISTRACTED_SECONDS_TO_RED+1.5*_invisible_time)/DT_DMON)][0].name, 'driverDistracted') self.assertEqual(events_output[int((_DISTRACTED_SECONDS_TO_RED+2*_invisible_time+1.5)/DT_DMON)][0].name, 'driverDistracted') @@ -147,7 +153,7 @@ class TestMonitoring(unittest.TestCase): interaction_vector = always_false[:]*2 ds_vector[int((2*_INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON):int((2*_INVISIBLE_SECONDS_TO_ORANGE+1+_visible_time)/DT_DMON)] = [msg_ATTENTIVE] * int(_visible_time/DT_DMON) interaction_vector[int((_INVISIBLE_SECONDS_TO_ORANGE)/DT_DMON):int((_INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON)] = [True] * int(1/DT_DMON) - events_output = run_DState_seq(ds_vector, interaction_vector, 2*always_true, 2*always_false) + events_output = run_DState_seq(ds_vector, interaction_vector, 2*always_true, 2*always_false)[0] self.assertTrue(len(events_output[int(_INVISIBLE_SECONDS_TO_ORANGE*0.5/DT_DMON)])==0) self.assertEqual(events_output[int((_INVISIBLE_SECONDS_TO_ORANGE-0.1)/DT_DMON)][0].name, 'promptDriverUnresponsive') self.assertTrue(len(events_output[int((_INVISIBLE_SECONDS_TO_ORANGE+0.1)/DT_DMON)])==0) @@ -170,7 +176,7 @@ class TestMonitoring(unittest.TestCase): ds_vector[int(_INVISIBLE_SECONDS_TO_RED/DT_DMON):int((_INVISIBLE_SECONDS_TO_RED+_visible_time)/DT_DMON)] = [msg_ATTENTIVE] * int(_visible_time/DT_DMON) interaction_vector[int((_INVISIBLE_SECONDS_TO_RED+_visible_time)/DT_DMON):int((_INVISIBLE_SECONDS_TO_RED+_visible_time+1)/DT_DMON)] = [True] * int(1/DT_DMON) op_vector[int((_INVISIBLE_SECONDS_TO_RED+_visible_time+1)/DT_DMON):int((_INVISIBLE_SECONDS_TO_RED+_visible_time+0.5)/DT_DMON)] = [False] * int(0.5/DT_DMON) - events_output = run_DState_seq(ds_vector, interaction_vector, op_vector, always_false) + events_output = run_DState_seq(ds_vector, interaction_vector, op_vector, always_false)[0] self.assertTrue(len(events_output[int(_INVISIBLE_SECONDS_TO_ORANGE*0.5/DT_DMON)])==0) self.assertEqual(events_output[int((_INVISIBLE_SECONDS_TO_ORANGE-0.1)/DT_DMON)][0].name, 'promptDriverUnresponsive') self.assertEqual(events_output[int((_INVISIBLE_SECONDS_TO_RED-0.1)/DT_DMON)][0].name, 'driverUnresponsive') @@ -181,7 +187,7 @@ class TestMonitoring(unittest.TestCase): # 7. op not engaged, always distracted driver # - dm should stay quiet when not engaged def test_pure_dashcam_user(self): - events_output = run_DState_seq(always_distracted, always_false, always_false, always_false) + events_output = run_DState_seq(always_distracted, always_false, always_false, always_false)[0] self.assertTrue(np.sum([len(event) for event in events_output])==0) # 8. op engaged, car stops at traffic light, down to orange, no action, then car starts moving @@ -190,11 +196,38 @@ class TestMonitoring(unittest.TestCase): _redlight_time = 60 # seconds standstill_vector = always_true[:] standstill_vector[int(_redlight_time/DT_DMON):] = [False] * int((_TEST_TIMESPAN-_redlight_time)/DT_DMON) - events_output = run_DState_seq(always_distracted, always_false, always_true, standstill_vector) + events_output = run_DState_seq(always_distracted, always_false, always_true, standstill_vector)[0] self.assertEqual(events_output[int((_DISTRACTED_TIME-_DISTRACTED_PRE_TIME_TILL_TERMINAL+1)/DT_DMON)][0].name, 'preDriverDistracted') self.assertEqual(events_output[int((_redlight_time-0.1)/DT_DMON)][0].name, 'preDriverDistracted') self.assertEqual(events_output[int((_redlight_time+0.5)/DT_DMON)][0].name, 'promptDriverDistracted') + # 9. op engaged, model is extremely uncertain. driver first attentive, then distracted + # - should only pop the green alert about model uncertainty + # - (note: this's just for sanity check, std output should never be this high) + def test_one_indecisive_model(self): + ds_vector = [msg_ATTENTIVE_UNCERTAIN] * int(_UNCERTAIN_SECONDS_TO_GREEN/DT_DMON) + \ + [msg_ATTENTIVE] * int(_DISTRACTED_SECONDS_TO_ORANGE/DT_DMON) + \ + [msg_DISTRACTED_UNCERTAIN] * (int(_TEST_TIMESPAN/DT_DMON)-int((_DISTRACTED_SECONDS_TO_ORANGE+_UNCERTAIN_SECONDS_TO_GREEN)/DT_DMON)) + interaction_vector = always_false[:] + events_output = run_DState_seq(ds_vector, interaction_vector, always_true, always_false)[0] + self.assertTrue(len(events_output[int(_UNCERTAIN_SECONDS_TO_GREEN*0.5/DT_DMON)])==0) + self.assertEqual(events_output[int((_UNCERTAIN_SECONDS_TO_GREEN-0.1)/DT_DMON)][0].name, 'driverMonitorLowAcc') + self.assertTrue(len(events_output[int((_UNCERTAIN_SECONDS_TO_GREEN+_DISTRACTED_SECONDS_TO_ORANGE-0.5)/DT_DMON)])==0) + self.assertEqual(events_output[int((_TEST_TIMESPAN-5.)/DT_DMON)][0].name, 'driverMonitorLowAcc') + + # 10. op engaged, model is somehow uncertain and driver is distracted + # - should slow down the alert countdown but it still gets there + def test_somehow_indecisive_model(self): + ds_vector = [msg_DISTRACTED_BUT_SOMEHOW_UNCERTAIN] * int(_TEST_TIMESPAN/DT_DMON) + interaction_vector = always_false[:] + events_output = run_DState_seq(ds_vector, interaction_vector, always_true, always_false)[0] + self.assertTrue(len(events_output[int(_UNCERTAIN_SECONDS_TO_GREEN*0.5/DT_DMON)])==0) + self.assertEqual(events_output[int((_UNCERTAIN_SECONDS_TO_GREEN)/DT_DMON)][0].name, 'driverMonitorLowAcc') + self.assertEqual(events_output[int((2.5*(_DISTRACTED_TIME-_DISTRACTED_PRE_TIME_TILL_TERMINAL))/DT_DMON)][1].name, 'preDriverDistracted') + self.assertEqual(events_output[int((2.5*(_DISTRACTED_TIME-_DISTRACTED_PROMPT_TIME_TILL_TERMINAL))/DT_DMON)][1].name, 'promptDriverDistracted') + self.assertEqual(events_output[int((_DISTRACTED_TIME+1)/DT_DMON)][1].name, 'promptDriverDistracted') + self.assertEqual(events_output[int((_DISTRACTED_TIME*2.5)/DT_DMON)][1].name, 'promptDriverDistracted') # set_timer blocked + if __name__ == "__main__": print('MAX_TERMINAL_ALERTS', MAX_TERMINAL_ALERTS) unittest.main() diff --git a/selfdrive/debug/cpu_usage_stat.py b/selfdrive/debug/cpu_usage_stat.py index 160f4f9d5..d59a14855 100755 --- a/selfdrive/debug/cpu_usage_stat.py +++ b/selfdrive/debug/cpu_usage_stat.py @@ -30,7 +30,7 @@ SLEEP_INTERVAL = 0.2 monitored_proc_names = [ 'ubloxd', 'thermald', 'uploader', 'deleter', 'controlsd', 'plannerd', 'radard', 'mapd', 'loggerd' , 'logmessaged', 'tombstoned', - 'logcatd', 'proclogd', 'boardd', 'pandad', './ui', 'ui', 'calibrationd', 'params_learner', 'modeld', 'monitoringd', 'camerad', 'sensord', 'updated', 'gpsd', 'athena'] + 'logcatd', 'proclogd', 'boardd', 'pandad', './ui', 'ui', 'calibrationd', 'params_learner', 'modeld', 'dmonitoringmodeld', 'camerad', 'sensord', 'updated', 'gpsd', 'athena'] cpu_time_names = ['user', 'system', 'children_user', 'children_system'] timer = getattr(time, 'monotonic', time.time) diff --git a/selfdrive/debug/filter_log_message.py b/selfdrive/debug/filter_log_message.py new file mode 100755 index 000000000..8ddb12e2d --- /dev/null +++ b/selfdrive/debug/filter_log_message.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +import os +import argparse +import json + +import cereal.messaging as messaging + + +LEVELS = { + "DEBUG": 10, + "INFO": 20, + "WARNING": 30, + "ERROR": 40, + "CRITICAL": 50, +} + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser() + parser.add_argument('--level', default='DEBUG') + parser.add_argument('--addr', default='127.0.0.1') + parser.add_argument("socket", type=str, nargs='*', help="socket name") + args = parser.parse_args() + + if args.addr != "127.0.0.1": + os.environ["ZMQ"] = "1" + messaging.context = messaging.Context() + + poller = messaging.Poller() + sock = messaging.sub_sock("logMessage", poller, addr=args.addr) + + min_level = LEVELS[args.level] + + while True: + polld = poller.poll(1000) + for sock in polld: + evt = messaging.recv_one(sock) + log = json.loads(evt.logMessage) + + if log['levelnum'] >= min_level: + print(f"{log['filename']}:{log.get('lineno', '')} - {log.get('funcname', '')}: {log['msg']}") diff --git a/selfdrive/debug/live_cpu_and_temp.py b/selfdrive/debug/live_cpu_and_temp.py index 7286841a8..1f4f2426e 100755 --- a/selfdrive/debug/live_cpu_and_temp.py +++ b/selfdrive/debug/live_cpu_and_temp.py @@ -15,6 +15,7 @@ def cputime_busy(ct): sm = SubMaster(['thermal', 'procLog']) last_temp = 0.0 +last_mem = 0.0 total_times = [0., 0., 0., 0.] busy_times = [0., 0., 0.0, 0.] @@ -25,10 +26,20 @@ while True: if sm.updated['thermal']: t = sm['thermal'] last_temp = np.mean([t.cpu0, t.cpu1, t.cpu2, t.cpu3]) / 10. + last_mem = t.memUsedPercent if sm.updated['procLog']: m = sm['procLog'] + mems = {} + for proc in m.procs: + name = proc.name + if len(proc.cmdline): + name = proc.cmdline[0] + if len(proc.exe): + name = proc.exe + " - " + name + mems[name] = float(proc.memRss) / 1e6 + cores = [0., 0., 0., 0.] total_times_new = [0., 0., 0., 0.] busy_times_new = [0., 0., 0.0, 0.] @@ -46,4 +57,8 @@ while True: total_times = total_times_new[:] busy_times = busy_times_new[:] - print("CPU %.2f%% - Temp %.2f" % (100. * np.mean(cores), last_temp )) + print() + print("CPU %.2f%% - RAM: %.2f - Temp %.2f" % (100. * np.mean(cores), last_mem, last_temp)) + print("Top memory usage:") + for k, v in sorted(mems.items(), key=lambda item: item[1], reverse=True)[:10]: + print(f"{k.rjust(70)} {v:.2f} MB") diff --git a/selfdrive/debug/test_fw_query_on_routes.py b/selfdrive/debug/test_fw_query_on_routes.py new file mode 100755 index 000000000..82bd8299c --- /dev/null +++ b/selfdrive/debug/test_fw_query_on_routes.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +import traceback +import sys +from tqdm import tqdm +from tools.lib.logreader import LogReader +from selfdrive.car.fw_versions import match_fw_to_car +from selfdrive.car.toyota.values import FW_VERSIONS as TOYOTA_FW_VERSIONS +from selfdrive.car.honda.values import FW_VERSIONS as HONDA_FW_VERSIONS + +from selfdrive.car.toyota.values import FINGERPRINTS as TOYOTA_FINGERPRINTS +from selfdrive.car.honda.values import FINGERPRINTS as HONDA_FINGERPRINTS + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: ./test_fw_query_on_routes.py ") + sys.exit(1) + + wrong = 0 + good = 0 + + dongles = [] + for route in tqdm(list(open(sys.argv[1]))): + route = route.rstrip() + dongle_id, time = route.split('|') + qlog_path = f"cd:/{dongle_id}/{time}/0/qlog.bz2" + + if dongle_id in dongles: + continue + + try: + lr = LogReader(qlog_path) + + for msg in lr: + if msg.which() == "health": + if msg.health.hwType not in ['uno', 'blackPanda']: + dongles.append(dongle_id) + break + + elif msg.which() == "carParams": + car_fw = msg.carParams.carFw + if len(car_fw) == 0: + break + + dongles.append(dongle_id) + live_fingerprint = msg.carParams.carFingerprint + + if live_fingerprint not in list(TOYOTA_FINGERPRINTS.keys()) + list(HONDA_FINGERPRINTS.keys()): + continue + + candidates = match_fw_to_car(car_fw) + if (len(candidates) == 1) and (list(candidates)[0] == live_fingerprint): + good += 1 + print("Correct", live_fingerprint, dongle_id) + break + + print(f"{dongle_id}|{time}") + print("Old style:", live_fingerprint, "Vin", msg.carParams.carVin) + print("New style:", candidates) + + for version in car_fw: + subaddr = None if version.subAddress == 0 else hex(version.subAddress) + print(f" (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}],") + + print("Mismatches") + for car_fws in [TOYOTA_FW_VERSIONS, HONDA_FW_VERSIONS]: + if live_fingerprint in car_fws: + + expected = car_fws[live_fingerprint] + for (_, expected_addr, expected_sub_addr), v in expected.items(): + for version in car_fw: + sub_addr = None if version.subAddress == 0 else version.subAddress + addr = version.address + + if (addr, sub_addr) == (expected_addr, expected_sub_addr): + if version.fwVersion not in v: + print(f"({hex(addr)}, {'None' if sub_addr is None else hex(sub_addr)}) - {version.fwVersion}") + + print() + wrong += 1 + break + except Exception: + traceback.print_exc() + + print(f"Fingerprinted: {good} - Not fingerprinted: {wrong}") + print(f"Number of dongle ids checked: {len(dongles)}") diff --git a/selfdrive/locationd/calibrationd.py b/selfdrive/locationd/calibrationd.py index cd92a5f63..b2b5c18a8 100755 --- a/selfdrive/locationd/calibrationd.py +++ b/selfdrive/locationd/calibrationd.py @@ -38,8 +38,8 @@ def is_calibration_valid(vp): def sanity_clip(vp): if np.isnan(vp).any(): vp = VP_INIT - return [np.clip(vp[0], VP_VALIDITY_CORNERS[0,0] - 20, VP_VALIDITY_CORNERS[1,0] + 20), - np.clip(vp[1], VP_VALIDITY_CORNERS[0,1] - 20, VP_VALIDITY_CORNERS[1,1] + 20)] + return np.array([np.clip(vp[0], VP_VALIDITY_CORNERS[0,0] - 20, VP_VALIDITY_CORNERS[1,0] + 20), + np.clip(vp[1], VP_VALIDITY_CORNERS[0,1] - 20, VP_VALIDITY_CORNERS[1,1] + 20)]) def intrinsics_from_vp(vp): @@ -96,6 +96,7 @@ class Calibrator(): intrinsics = intrinsics_from_vp(self.vp) new_vp = intrinsics.dot(view_frame_from_device_frame.dot(trans)) new_vp = new_vp[:2]/new_vp[2] + new_vp = sanity_clip(new_vp) self.vps[self.block_idx] = (self.idx*self.vps[self.block_idx] + (BLOCK_SIZE - self.idx) * new_vp) / float(BLOCK_SIZE) self.idx = (self.idx + 1) % BLOCK_SIZE @@ -103,8 +104,7 @@ class Calibrator(): self.block_idx += 1 self.valid_blocks = max(self.block_idx, self.valid_blocks) self.block_idx = self.block_idx % INPUTS_WANTED - raw_vp = np.mean(self.vps[:max(1, self.valid_blocks)], axis=0) - self.vp = sanity_clip(raw_vp) + self.vp = np.mean(self.vps[:max(1, self.valid_blocks)], axis=0) self.update_status() if self.param_put and ((self.idx == 0 and self.block_idx == 0) or self.just_calibrated): diff --git a/selfdrive/locationd/locationd_yawrate.cc b/selfdrive/locationd/locationd_yawrate.cc index b2b87557c..4b93b6801 100644 --- a/selfdrive/locationd/locationd_yawrate.cc +++ b/selfdrive/locationd/locationd_yawrate.cc @@ -10,7 +10,7 @@ #include "locationd_yawrate.h" -void Localizer::update_state(const Eigen::Matrix &C, const double R, double current_time, double meas) { +void Localizer::update_state(const Eigen::Matrix &C, const double R, double current_time, double meas) { double dt = current_time - prev_update_time; if (dt < 0) { @@ -24,7 +24,7 @@ void Localizer::update_state(const Eigen::Matrix &C, const double double y = meas - C * x; double S = R + C * P * C.transpose(); - Eigen::Vector4d K = P * C.transpose() * (1.0 / S); + Eigen::Vector2d K = P * C.transpose() * (1.0 / S); x = x + K * y; P = (I - K * C) * P; } @@ -40,7 +40,7 @@ void Localizer::handle_sensor_events(capnp::List::Reade } void Localizer::handle_camera_odometry(cereal::CameraOdometry::Reader camera_odometry, double current_time) { - double R = pow(30.0 *camera_odometry.getRotStd()[2], 2); + double R = pow(5 * camera_odometry.getRotStd()[2], 2); double meas = camera_odometry.getRot()[2]; update_state(C_posenet, R, current_time, meas); @@ -57,34 +57,27 @@ void Localizer::handle_controls_state(cereal::ControlsState::Reader controls_sta Localizer::Localizer() { - // States: [yaw rate, yaw rate diff, gyro bias, gyro bias diff] + // States: [yaw rate, gyro bias] A << - 1, 1, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 1, - 0, 0, 0, 1; - I << - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1; + 1, 0, + 0, 1; Q << - 0, 0, 0, 0, - 0, pow(0.1, 2.0), 0, 0, - 0, 0, 0, 0, - 0, 0, pow(0.005 / 100.0, 2.0), 0; + pow(.1, 2.0), 0, + 0, pow(0.05/ 100.0, 2.0), P << - pow(100.0, 2.0), 0, 0, 0, - 0, pow(100.0, 2.0), 0, 0, - 0, 0, pow(100.0, 2.0), 0, - 0, 0, 0, pow(100.0, 2.0); + pow(10000.0, 2.0), 0, + 0, pow(10000.0, 2.0); - C_posenet << 1, 0, 0, 0; - C_gyro << 1, 0, 1, 0; - x << 0, 0, 0, 0; + I << + 1, 0, + 0, 1; - R_gyro = pow(0.25, 2.0); + C_posenet << 1, 0; + C_gyro << 1, 1; + x << 0, 0; + + R_gyro = pow(0.025, 2.0); } void Localizer::handle_log(cereal::Event::Reader event) { @@ -133,7 +126,7 @@ extern "C" { } double localizer_get_bias(void * localizer) { Localizer * loc = (Localizer*) localizer; - return loc->x[2]; + return loc->x[1]; } double * localizer_get_state(void * localizer) { diff --git a/selfdrive/locationd/locationd_yawrate.h b/selfdrive/locationd/locationd_yawrate.h index 9c6885241..c59734aa6 100644 --- a/selfdrive/locationd/locationd_yawrate.h +++ b/selfdrive/locationd/locationd_yawrate.h @@ -7,22 +7,22 @@ class Localizer { - Eigen::Matrix4d A; - Eigen::Matrix4d I; - Eigen::Matrix4d Q; - Eigen::Matrix C_posenet; - Eigen::Matrix C_gyro; + Eigen::Matrix2d A; + Eigen::Matrix2d I; + Eigen::Matrix2d Q; + Eigen::Matrix C_posenet; + Eigen::Matrix C_gyro; double R_gyro; - void update_state(const Eigen::Matrix &C, const double R, double current_time, double meas); + void update_state(const Eigen::Matrix &C, const double R, double current_time, double meas); void handle_sensor_events(capnp::List::Reader sensor_events, double current_time); void handle_camera_odometry(cereal::CameraOdometry::Reader camera_odometry, double current_time); void handle_controls_state(cereal::ControlsState::Reader controls_state, double current_time); public: - Eigen::Vector4d x; - Eigen::Matrix4d P; + Eigen::Vector2d x; + Eigen::Matrix2d P; double steering_angle = 0; double car_speed = 0; double posenet_speed = 0; diff --git a/selfdrive/locationd/paramsd.cc b/selfdrive/locationd/paramsd.cc index 6109c271c..318a75982 100644 --- a/selfdrive/locationd/paramsd.cc +++ b/selfdrive/locationd/paramsd.cc @@ -20,6 +20,7 @@ #include "locationd_yawrate.h" #include "params_learner.h" +#include "common/util.h" void sigpipe_handler(int sig) { LOGE("SIGPIPE received"); @@ -141,7 +142,7 @@ int main(int argc, char *argv[]) { auto live_params = event.initLiveParameters(); live_params.setValid(valid); live_params.setYawRate(localizer.x[0]); - live_params.setGyroBias(localizer.x[2]); + live_params.setGyroBias(localizer.x[1]); live_params.setSensorValid(sensor_data_age < 5.0); live_params.setAngleOffset(angle_offset_degrees); live_params.setAngleOffsetAverage(angle_offset_average_degrees); diff --git a/selfdrive/locationd/test/ublox.py b/selfdrive/locationd/test/ublox.py index 496207d40..d99e71469 100644 --- a/selfdrive/locationd/test/ublox.py +++ b/selfdrive/locationd/test/ublox.py @@ -475,6 +475,8 @@ msg_types = { UBloxDescriptor('AID_ALM', ' UbloxMsgParser::gen_nav_data() { return kj::Array(); } +kj::Array UbloxMsgParser::gen_mon_hw() { + mon_hw_msg *msg = (mon_hw_msg *)&msg_parse_buf[UBLOX_HEADER_SIZE]; + + capnp::MallocMessageBuilder msg_builder; + cereal::Event::Builder event = msg_builder.initRoot(); + event.setLogMonoTime(nanos_since_boot()); + auto gnss = event.initUbloxGnss(); + auto hwStatus = gnss.initHwStatus(); + hwStatus.setNoisePerMS(msg->noisePerMS); + hwStatus.setAgcCnt(msg->agcCnt); + hwStatus.setAStatus((cereal::UbloxGnss::HwStatus::AntennaSupervisorState) msg->aStatus); + hwStatus.setAPower((cereal::UbloxGnss::HwStatus::AntennaPowerStatus) msg->aPower); + hwStatus.setJamInd(msg->jamInd); + return capnp::messageToFlatArray(msg_builder); +} + bool UbloxMsgParser::add_data(const uint8_t *incoming_data, uint32_t incoming_data_len, size_t &bytes_consumed) { int needed = needed_bytes(); if(needed > 0) { diff --git a/selfdrive/locationd/ublox_msg.h b/selfdrive/locationd/ublox_msg.h index eca6186d4..4bb103bb5 100644 --- a/selfdrive/locationd/ublox_msg.h +++ b/selfdrive/locationd/ublox_msg.h @@ -85,6 +85,27 @@ typedef struct __attribute__((packed)) { uint32_t dwrd; } rxm_sfrbx_msg_extra; +// MON_HW +typedef struct __attribute__((packed)) { + uint32_t pinSel; + uint32_t pinBank; + uint32_t pinDir; + uint32_t pinVal; + uint16_t noisePerMS; + uint16_t agcCnt; + uint8_t aStatus; + uint8_t aPower; + uint8_t flags; + uint8_t reserved1; + uint32_t usedMask; + uint8_t VP[17]; + uint8_t jamInd; + uint8_t reserved2[2]; + uint32_t pinIrq; + uint32_t pullH; + uint32_t pullL; +} mon_hw_msg; + namespace ublox { // protocol constants const uint8_t PREAMBLE1 = 0xb5; @@ -93,6 +114,7 @@ namespace ublox { // message classes const uint8_t CLASS_NAV = 0x01; const uint8_t CLASS_RXM = 0x02; + const uint8_t CLASS_MON = 0x0A; // NAV messages const uint8_t MSG_NAV_PVT = 0x7; @@ -101,6 +123,9 @@ namespace ublox { const uint8_t MSG_RXM_RAW = 0x15; const uint8_t MSG_RXM_SFRBX = 0x13; + // MON messages + const uint8_t MSG_MON_HW = 0x09; + const int UBLOX_HEADER_SIZE = 6; const int UBLOX_CHECKSUM_SIZE = 2; const int UBLOX_MAX_MSG_SIZE = 65536; @@ -113,6 +138,7 @@ namespace ublox { UbloxMsgParser(); kj::Array gen_solution(); kj::Array gen_raw(); + kj::Array gen_mon_hw(); kj::Array gen_nav_data(); bool add_data(const uint8_t *incoming_data, uint32_t incoming_data_len, size_t &bytes_consumed); diff --git a/selfdrive/locationd/ubloxd_main.cc b/selfdrive/locationd/ubloxd_main.cc index 497b69820..4e07932ff 100644 --- a/selfdrive/locationd/ubloxd_main.cc +++ b/selfdrive/locationd/ubloxd_main.cc @@ -19,6 +19,7 @@ #include #include "cereal/gen/cpp/log.capnp.h" +#include "common/util.h" #include "common/params.h" #include "common/swaglog.h" #include "common/timing.h" @@ -96,6 +97,17 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func) } } else LOGW("Unknown rxm msg id: 0x%02X", parser.msg_id()); + } else if(parser.msg_class() == CLASS_MON) { + if(parser.msg_id() == MSG_MON_HW) { + //LOGD("MSG_MON_HW"); + auto words = parser.gen_mon_hw(); + if(words.size() > 0) { + auto bytes = words.asBytes(); + send_func(ubloxGnss, bytes.begin(), bytes.size()); + } + } else { + LOGW("Unknown mon msg id: 0x%02X", parser.msg_id()); + } } else LOGW("Unknown msg class: 0x%02X", parser.msg_class()); parser.reset(); diff --git a/selfdrive/loggerd/SConscript b/selfdrive/loggerd/SConscript index b319c773c..dfc32fc83 100644 --- a/selfdrive/loggerd/SConscript +++ b/selfdrive/loggerd/SConscript @@ -1,7 +1,7 @@ Import('env', 'arch', 'messaging', 'common', 'visionipc') src = ['loggerd.cc', 'logger.c'] -libs = ['zmq', 'czmq', 'capnp', 'kj', 'yaml-cpp', 'z', +libs = ['zmq', 'czmq', 'capnp', 'kj', 'z', 'avformat', 'avcodec', 'swscale', 'avutil', 'yuv', 'bz2', common, 'json', messaging, visionipc] diff --git a/selfdrive/loggerd/loggerd.cc b/selfdrive/loggerd/loggerd.cc index 1b3a81d7a..7e744fa50 100644 --- a/selfdrive/loggerd/loggerd.cc +++ b/selfdrive/loggerd/loggerd.cc @@ -23,7 +23,6 @@ #include #include -#include #include #ifdef QCOM @@ -40,6 +39,7 @@ #include "logger.h" #include "messaging.hpp" +#include "services.h" #ifndef QCOM // no encoder on PC @@ -453,21 +453,22 @@ kj::Array gen_init_data() { } char* git_commit = NULL; - read_db_value(NULL, "GitCommit", &git_commit, NULL); + size_t size; + read_db_value(NULL, "GitCommit", &git_commit, &size); if (git_commit) { - init.setGitCommit(capnp::Text::Reader(git_commit)); + init.setGitCommit(capnp::Text::Reader(git_commit, size)); } char* git_branch = NULL; - read_db_value(NULL, "GitBranch", &git_branch, NULL); + read_db_value(NULL, "GitBranch", &git_branch, &size); if (git_branch) { - init.setGitBranch(capnp::Text::Reader(git_branch)); + init.setGitBranch(capnp::Text::Reader(git_branch, size)); } char* git_remote = NULL; - read_db_value(NULL, "GitRemote", &git_remote, NULL); + read_db_value(NULL, "GitRemote", &git_remote, &size); if (git_remote) { - init.setGitRemote(capnp::Text::Reader(git_remote)); + init.setGitRemote(capnp::Text::Reader(git_remote, size)); } char* passive = NULL; @@ -577,9 +578,6 @@ int main(int argc, char** argv) { s.ctx = Context::create(); Poller * poller = Poller::create(); - std::string exe_dir = util::dir_name(util::readlink("/proc/self/exe")); - std::string service_list_path = exe_dir + "/../../cereal/service_list.yaml"; - // subscribe to all services SubSocket *frame_sock = NULL; @@ -588,13 +586,11 @@ int main(int argc, char** argv) { std::map qlog_counter; std::map qlog_freqs; - YAML::Node service_list = YAML::LoadFile(service_list_path); - for (const auto& it : service_list) { - auto name = it.first.as(); - bool should_log = it.second[1].as(); - int qlog_freq = it.second[3] ? it.second[3].as() : 0; + for (const auto& it : services) { + std::string name = it.name; + int qlog_freq = it.decimation ? it.decimation : 0; - if (should_log) { + if (it.should_log) { SubSocket * sock = SubSocket::create(s.ctx, name); assert(sock != NULL); diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 358eb3893..4e6c52079 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -9,7 +9,7 @@ import shutil import subprocess import datetime -from common.basedir import BASEDIR +from common.basedir import BASEDIR, PARAMS from common.android import ANDROID sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR @@ -22,6 +22,8 @@ try: os.mkdir("/dev/shm") except FileExistsError: pass +except PermissionError: + print("WARNING: failed to make /dev/shm") if ANDROID: os.chmod("/dev/shm", 0o777) @@ -136,6 +138,7 @@ managed_processes = { "controlsd": "selfdrive.controls.controlsd", "plannerd": "selfdrive.controls.plannerd", "radard": "selfdrive.controls.radard", + "dmonitoringd": "selfdrive.controls.dmonitoringd", "ubloxd": ("selfdrive/locationd", ["./ubloxd"]), "loggerd": ("selfdrive/loggerd", ["./loggerd"]), "logmessaged": "selfdrive.logmessaged", @@ -152,7 +155,7 @@ managed_processes = { "clocksd": ("selfdrive/clocksd", ["./clocksd"]), "gpsd": ("selfdrive/sensord", ["./gpsd"]), "updated": "selfdrive.updated", - "monitoringd": ("selfdrive/modeld", ["./monitoringd"]), + "dmonitoringmodeld": ("selfdrive/modeld", ["./dmonitoringmodeld"]), "modeld": ("selfdrive/modeld", ["./modeld"]), } @@ -194,6 +197,7 @@ car_started_processes = [ 'plannerd', 'loggerd', 'radard', + 'dmonitoringd', 'calibrationd', 'paramsd', 'camerad', @@ -206,7 +210,7 @@ if ANDROID: 'sensord', 'clocksd', 'gpsd', - 'monitoringd', + 'dmonitoringmodeld', 'deleter', ] @@ -246,14 +250,16 @@ def start_managed_process(name): def start_daemon_process(name): params = Params() proc, pid_param = daemon_processes[name] - pid = params.get(pid_param) + pid = params.get(pid_param, encoding='utf-8') if pid is not None: try: os.kill(int(pid), 0) - # process is running (kill is a poorly-named system call) - return - except OSError: + with open(f'/proc/{pid}/cmdline') as f: + if proc in f.read(): + # daemon is running + return + except (OSError, FileNotFoundError): # process is dead pass @@ -363,9 +369,10 @@ def manager_init(should_register=True): pass # ensure shared libraries are readable by apks - os.chmod(BASEDIR, 0o755) - os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) - os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755) + if ANDROID: + os.chmod(BASEDIR, 0o755) + os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) + os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755) def manager_thread(): # now loop @@ -452,6 +459,8 @@ def uninstall(): android.reboot(reason="recovery") def main(): + os.environ['PARAMS_PATH'] = PARAMS + # the flippening! os.system('LD_LIBRARY_PATH="" content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1') diff --git a/selfdrive/modeld/SConscript b/selfdrive/modeld/SConscript index aa995fb3f..4c58e278f 100644 --- a/selfdrive/modeld/SConscript +++ b/selfdrive/modeld/SConscript @@ -14,19 +14,17 @@ if arch == "aarch64": else: libs += ['symphony-cpu', 'pthread'] - if FindFile('libtensorflow.so', env['LIBPATH']): - # for tensorflow support - common_src += ['runners/tfmodel.cc'] - libs += ['tensorflow'] - # tell runners to use it - lenv['CFLAGS'].append("-DUSE_TF_MODEL") - lenv['CXXFLAGS'].append("-DUSE_TF_MODEL") + # for tensorflow support + common_src += ['runners/tfmodel.cc'] + # tell runners to use it + lenv['CFLAGS'].append("-DUSE_TF_MODEL") + lenv['CXXFLAGS'].append("-DUSE_TF_MODEL") common = lenv.Object(common_src) -lenv.Program('_monitoringd', [ - "monitoringd.cc", - "models/monitoring.cc", +lenv.Program('_dmonitoringmodeld', [ + "dmonitoringmodeld.cc", + "models/dmonitoring.cc", ]+common, LIBS=libs) lenv.Program('_modeld', [ diff --git a/selfdrive/modeld/monitoringd b/selfdrive/modeld/dmonitoringmodeld similarity index 59% rename from selfdrive/modeld/monitoringd rename to selfdrive/modeld/dmonitoringmodeld index 419d82633..710e0e595 100755 --- a/selfdrive/modeld/monitoringd +++ b/selfdrive/modeld/dmonitoringmodeld @@ -1,5 +1,5 @@ #!/bin/sh -export LD_LIBRARY_PATH="/data/pythonpath/phonelibs/snpe/aarch64-android-clang3.8:/home/batman/one/phonelibs/snpe/x86_64-linux-clang:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="/data/pythonpath/phonelibs/snpe/aarch64-android-clang3.8:$HOME/openpilot/phonelibs/snpe/x86_64-linux-clang:$LD_LIBRARY_PATH" export ADSP_LIBRARY_PATH="/data/pythonpath/phonelibs/snpe/aarch64-android-clang3.8/" -exec ./_monitoringd +exec ./_dmonitoringmodeld diff --git a/selfdrive/modeld/monitoringd.cc b/selfdrive/modeld/dmonitoringmodeld.cc similarity index 71% rename from selfdrive/modeld/monitoringd.cc rename to selfdrive/modeld/dmonitoringmodeld.cc index 98863ec9f..9fb67b636 100644 --- a/selfdrive/modeld/monitoringd.cc +++ b/selfdrive/modeld/dmonitoringmodeld.cc @@ -8,7 +8,7 @@ #include "common/visionipc.h" #include "common/swaglog.h" -#include "models/monitoring.h" +#include "models/dmonitoring.h" #ifndef PATH_MAX #include @@ -27,11 +27,11 @@ int main(int argc, char **argv) { // messaging Context *msg_context = Context::create(); - PubSocket *monitoring_sock = PubSocket::create(msg_context, "driverMonitoring"); + PubSocket *dmonitoring_sock = PubSocket::create(msg_context, "driverState"); // init the models - MonitoringState monitoring; - monitoring_init(&monitoring); + DMonitoringModelState dmonitoringmodel; + dmonitoring_init(&dmonitoringmodel); // loop VisionStream stream; @@ -58,14 +58,14 @@ int main(int argc, char **argv) { double t1 = millis_since_boot(); - MonitoringResult res = monitoring_eval_frame(&monitoring, buf->addr, buf_info.width, buf_info.height); + DMonitoringResult res = dmonitoring_eval_frame(&dmonitoringmodel, buf->addr, buf_info.width, buf_info.height); double t2 = millis_since_boot(); // send dm packet - monitoring_publish(monitoring_sock, extra.frame_id, res); + dmonitoring_publish(dmonitoring_sock, extra.frame_id, res); - LOGD("monitoring process: %.2fms, from last %.2fms", t2-t1, t1-last); + LOGD("dmonitoring process: %.2fms, from last %.2fms", t2-t1, t1-last); last = t1; } @@ -73,8 +73,8 @@ int main(int argc, char **argv) { visionstream_destroy(&stream); - delete monitoring_sock; - monitoring_free(&monitoring); + delete dmonitoring_sock; + dmonitoring_free(&dmonitoringmodel); return 0; } diff --git a/selfdrive/modeld/modeld b/selfdrive/modeld/modeld index 3629f7a71..bbe7006af 100755 --- a/selfdrive/modeld/modeld +++ b/selfdrive/modeld/modeld @@ -1,4 +1,4 @@ #!/bin/sh -export LD_LIBRARY_PATH="/data/pythonpath/phonelibs/snpe/aarch64-android-clang3.8/:/home/batman/one/phonelibs/snpe/x86_64-linux-clang:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="/data/pythonpath/phonelibs/snpe/aarch64-android-clang3.8/:$HOME/openpilot/phonelibs/snpe/x86_64-linux-clang:$LD_LIBRARY_PATH" exec ./_modeld diff --git a/selfdrive/modeld/models/monitoring.cc b/selfdrive/modeld/models/dmonitoring.cc similarity index 82% rename from selfdrive/modeld/models/monitoring.cc rename to selfdrive/modeld/models/dmonitoring.cc index dad8fa04e..787608f91 100644 --- a/selfdrive/modeld/models/monitoring.cc +++ b/selfdrive/modeld/models/dmonitoring.cc @@ -1,5 +1,5 @@ #include -#include "monitoring.h" +#include "dmonitoring.h" #include "common/mat.h" #include "common/timing.h" @@ -10,11 +10,11 @@ #define MODEL_HEIGHT 320 #define FULL_W 426 -void monitoring_init(MonitoringState* s) { - s->m = new DefaultRunModel("../../models/monitoring_model_q.dlc", (float*)&s->output, OUTPUT_SIZE, USE_DSP_RUNTIME); +void dmonitoring_init(DMonitoringModelState* s) { + s->m = new DefaultRunModel("../../models/dmonitoring_model_q.dlc", (float*)&s->output, OUTPUT_SIZE, USE_DSP_RUNTIME); } -MonitoringResult monitoring_eval_frame(MonitoringState* s, void* stream_buf, int width, int height) { +DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height) { uint8_t *raw_buf = (uint8_t*) stream_buf; uint8_t *raw_y_buf = raw_buf; @@ -108,33 +108,44 @@ MonitoringResult monitoring_eval_frame(MonitoringState* s, void* stream_buf, int delete[] cropped_buf; delete[] resized_buf; - s->m->execute(net_input_buf); + s->m->execute(net_input_buf, yuv_buf_len); delete[] net_input_buf; - MonitoringResult ret = {0}; + DMonitoringResult ret = {0}; memcpy(&ret.face_orientation, &s->output[0], sizeof ret.face_orientation); + memcpy(&ret.face_orientation_meta, &s->output[6], sizeof ret.face_orientation_meta); memcpy(&ret.face_position, &s->output[3], sizeof ret.face_position); + memcpy(&ret.face_position_meta, &s->output[9], sizeof ret.face_position_meta); memcpy(&ret.face_prob, &s->output[12], sizeof ret.face_prob); memcpy(&ret.left_eye_prob, &s->output[21], sizeof ret.left_eye_prob); memcpy(&ret.right_eye_prob, &s->output[30], sizeof ret.right_eye_prob); memcpy(&ret.left_blink_prob, &s->output[31], sizeof ret.right_eye_prob); memcpy(&ret.right_blink_prob, &s->output[32], sizeof ret.right_eye_prob); + ret.face_orientation_meta[0] = softplus(ret.face_orientation_meta[0]); + ret.face_orientation_meta[1] = softplus(ret.face_orientation_meta[1]); + ret.face_orientation_meta[2] = softplus(ret.face_orientation_meta[2]); + ret.face_position_meta[0] = softplus(ret.face_position_meta[0]); + ret.face_position_meta[1] = softplus(ret.face_position_meta[1]); return ret; } -void monitoring_publish(PubSocket* sock, uint32_t frame_id, const MonitoringResult res) { +void dmonitoring_publish(PubSocket* sock, uint32_t frame_id, const DMonitoringResult res) { // make msg capnp::MallocMessageBuilder msg; cereal::Event::Builder event = msg.initRoot(); event.setLogMonoTime(nanos_since_boot()); - auto framed = event.initDriverMonitoring(); + auto framed = event.initDriverState(); framed.setFrameId(frame_id); kj::ArrayPtr face_orientation(&res.face_orientation[0], ARRAYSIZE(res.face_orientation)); + kj::ArrayPtr face_orientation_std(&res.face_orientation_meta[0], ARRAYSIZE(res.face_orientation_meta)); kj::ArrayPtr face_position(&res.face_position[0], ARRAYSIZE(res.face_position)); + kj::ArrayPtr face_position_std(&res.face_position_meta[0], ARRAYSIZE(res.face_position_meta)); framed.setFaceOrientation(face_orientation); + framed.setFaceOrientationStd(face_orientation_std); framed.setFacePosition(face_position); + framed.setFacePositionStd(face_position_std); framed.setFaceProb(res.face_prob); framed.setLeftEyeProb(res.left_eye_prob); framed.setRightEyeProb(res.right_eye_prob); @@ -147,6 +158,6 @@ void monitoring_publish(PubSocket* sock, uint32_t frame_id, const MonitoringResu sock->send((char*)bytes.begin(), bytes.size()); } -void monitoring_free(MonitoringState* s) { +void dmonitoring_free(DMonitoringModelState* s) { delete s->m; } diff --git a/selfdrive/modeld/models/dmonitoring.h b/selfdrive/modeld/models/dmonitoring.h new file mode 100644 index 000000000..80aae5cd9 --- /dev/null +++ b/selfdrive/modeld/models/dmonitoring.h @@ -0,0 +1,44 @@ +#ifndef DMONITORING_H +#define DMONITORING_H + +#include "common/util.h" +#include "commonmodel.h" +#include "runners/run.h" + +#include "cereal/gen/cpp/log.capnp.h" +#include +#include "messaging.hpp" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OUTPUT_SIZE 33 + +typedef struct DMonitoringResult { + float face_orientation[3]; + float face_orientation_meta[3]; + float face_position[2]; + float face_position_meta[2]; + float face_prob; + float left_eye_prob; + float right_eye_prob; + float left_blink_prob; + float right_blink_prob; +} DMonitoringResult; + +typedef struct DMonitoringModelState { + RunModel *m; + float output[OUTPUT_SIZE]; +} DMonitoringModelState; + +void dmonitoring_init(DMonitoringModelState* s); +DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height); +void dmonitoring_publish(PubSocket *sock, uint32_t frame_id, const DMonitoringResult res); +void dmonitoring_free(DMonitoringModelState* s); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/selfdrive/modeld/models/driving.cc b/selfdrive/modeld/models/driving.cc index 06c820ff7..b7d1c1ced 100644 --- a/selfdrive/modeld/models/driving.cc +++ b/selfdrive/modeld/models/driving.cc @@ -7,9 +7,9 @@ #define PATH_IDX 0 -#define LL_IDX PATH_IDX + MODEL_PATH_DISTANCE*2 -#define RL_IDX LL_IDX + MODEL_PATH_DISTANCE*2 + 1 -#define LEAD_IDX RL_IDX + MODEL_PATH_DISTANCE*2 + 1 +#define LL_IDX PATH_IDX + MODEL_PATH_DISTANCE*2 + 1 +#define RL_IDX LL_IDX + MODEL_PATH_DISTANCE*2 + 2 +#define LEAD_IDX RL_IDX + MODEL_PATH_DISTANCE*2 + 2 #define LONG_X_IDX LEAD_IDX + MDN_GROUP_SIZE*LEAD_MDN_N + SELECTION #define LONG_V_IDX LONG_X_IDX + TIME_DISTANCE*2 #define LONG_A_IDX LONG_V_IDX + TIME_DISTANCE*2 @@ -70,7 +70,7 @@ ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, float *new_frame_buf = frame_prepare(&s->frame, q, yuv_cl, width, height, transform); memmove(&s->input_frames[0], &s->input_frames[MODEL_FRAME_SIZE], sizeof(float)*MODEL_FRAME_SIZE); memmove(&s->input_frames[MODEL_FRAME_SIZE], new_frame_buf, sizeof(float)*MODEL_FRAME_SIZE); - s->m->execute(s->input_frames); + s->m->execute(s->input_frames, MODEL_FRAME_SIZE*2); #ifdef DUMP_YUV FILE *dump_yuv_file = fopen("/sdcard/dump.yuv", "wb"); @@ -133,13 +133,20 @@ void fill_path(cereal::ModelData::PathData::Builder path, const float * data, bo float poly_arr[POLYFIT_DEGREE]; float std; float prob; + float valid_len; + valid_len = data[MODEL_PATH_DISTANCE*2]; for (int i=0; i -#include "messaging.hpp" - -#ifdef __cplusplus -extern "C" { -#endif - -#define OUTPUT_SIZE 33 - -typedef struct MonitoringResult { - float face_orientation[3]; - float face_position[2]; - float face_prob; - float left_eye_prob; - float right_eye_prob; - float left_blink_prob; - float right_blink_prob; -} MonitoringResult; - -typedef struct MonitoringState { - RunModel *m; - float output[OUTPUT_SIZE]; -} MonitoringState; - -void monitoring_init(MonitoringState* s); -MonitoringResult monitoring_eval_frame(MonitoringState* s, void* stream_buf, int width, int height); -void monitoring_publish(PubSocket *sock, uint32_t frame_id, const MonitoringResult res); -void monitoring_free(MonitoringState* s); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/selfdrive/modeld/runners/runmodel.h b/selfdrive/modeld/runners/runmodel.h index d1563a61a..8ddc2503f 100644 --- a/selfdrive/modeld/runners/runmodel.h +++ b/selfdrive/modeld/runners/runmodel.h @@ -5,7 +5,7 @@ class RunModel { public: virtual void addRecurrent(float *state, int state_size) {} virtual void addDesire(float *state, int state_size) {} - virtual void execute(float *net_input_buf) {} + virtual void execute(float *net_input_buf, int buf_size) {} }; #endif diff --git a/selfdrive/modeld/runners/snpemodel.cc b/selfdrive/modeld/runners/snpemodel.cc index 257f203d7..c954f9b99 100644 --- a/selfdrive/modeld/runners/snpemodel.cc +++ b/selfdrive/modeld/runners/snpemodel.cc @@ -117,7 +117,7 @@ std::unique_ptr SNPEModel::addExtra(float *state, in return ret; } -void SNPEModel::execute(float *net_input_buf) { +void SNPEModel::execute(float *net_input_buf, int buf_size) { assert(inputBuffer->setBufferAddress(net_input_buf)); if (!snpe->execute(inputMap, outputMap)) { PrintErrorStringAndExit(); diff --git a/selfdrive/modeld/runners/snpemodel.h b/selfdrive/modeld/runners/snpemodel.h index f750baaf1..f99acd095 100644 --- a/selfdrive/modeld/runners/snpemodel.h +++ b/selfdrive/modeld/runners/snpemodel.h @@ -25,7 +25,7 @@ public: } void addRecurrent(float *state, int state_size); void addDesire(float *state, int state_size); - void execute(float *net_input_buf); + void execute(float *net_input_buf, int buf_size); private: uint8_t *model_data = NULL; diff --git a/selfdrive/registration.py b/selfdrive/registration.py index afa2771bc..bebe05492 100644 --- a/selfdrive/registration.py +++ b/selfdrive/registration.py @@ -8,6 +8,7 @@ from common.android import get_imei, get_serial, get_subscriber_info from common.api import api_get from common.params import Params from common.file_helpers import mkdirs_exists_ok +from common.basedir import PERSIST def register(): params = Params() @@ -22,24 +23,24 @@ def register(): # create a key for auth # your private key is kept on your device persist partition and never sent to our servers # do not erase your persist partition - if not os.path.isfile("/persist/comma/id_rsa.pub"): + if not os.path.isfile(PERSIST+"/comma/id_rsa.pub"): cloudlog.warning("generating your personal RSA key") - mkdirs_exists_ok("/persist/comma") - assert os.system("openssl genrsa -out /persist/comma/id_rsa.tmp 2048") == 0 - assert os.system("openssl rsa -in /persist/comma/id_rsa.tmp -pubout -out /persist/comma/id_rsa.tmp.pub") == 0 - os.rename("/persist/comma/id_rsa.tmp", "/persist/comma/id_rsa") - os.rename("/persist/comma/id_rsa.tmp.pub", "/persist/comma/id_rsa.pub") + mkdirs_exists_ok(PERSIST+"/comma") + assert os.system("openssl genrsa -out "+PERSIST+"/comma/id_rsa.tmp 2048") == 0 + assert os.system("openssl rsa -in "+PERSIST+"/comma/id_rsa.tmp -pubout -out "+PERSIST+"/comma/id_rsa.tmp.pub") == 0 + os.rename(PERSIST+"/comma/id_rsa.tmp", PERSIST+"/comma/id_rsa") + os.rename(PERSIST+"/comma/id_rsa.tmp.pub", PERSIST+"/comma/id_rsa.pub") # make key readable by app users (ai.comma.plus.offroad) - os.chmod('/persist/comma/', 0o755) - os.chmod('/persist/comma/id_rsa', 0o744) + os.chmod(PERSIST+'/comma/', 0o755) + os.chmod(PERSIST+'/comma/id_rsa', 0o744) dongle_id, access_token = params.get("DongleId", encoding='utf8'), params.get("AccessToken", encoding='utf8') - public_key = open("/persist/comma/id_rsa.pub").read() + public_key = open(PERSIST+"/comma/id_rsa.pub").read() # create registration token # in the future, this key will make JWTs directly - private_key = open("/persist/comma/id_rsa").read() + private_key = open(PERSIST+"/comma/id_rsa").read() # late import import jwt diff --git a/selfdrive/test/longitudinal_maneuvers/plant.py b/selfdrive/test/longitudinal_maneuvers/plant.py index 06b243769..2170cb71f 100755 --- a/selfdrive/test/longitudinal_maneuvers/plant.py +++ b/selfdrive/test/longitudinal_maneuvers/plant.py @@ -115,7 +115,7 @@ class Plant(): Plant.live_params = messaging.pub_sock('liveParameters') Plant.health = messaging.pub_sock('health') Plant.thermal = messaging.pub_sock('thermal') - Plant.driverMonitoring = messaging.pub_sock('driverMonitoring') + Plant.driverState = messaging.pub_sock('driverState') Plant.cal = messaging.pub_sock('liveCalibration') Plant.controls_state = messaging.sub_sock('controlsState') Plant.plan = messaging.sub_sock('plan') @@ -366,11 +366,11 @@ class Plant(): live_parameters.liveParameters.stiffnessFactor = 1.0 Plant.live_params.send(live_parameters.to_bytes()) - driver_monitoring = messaging.new_message() - driver_monitoring.init('driverMonitoring') - driver_monitoring.driverMonitoring.faceOrientation = [0.] * 3 - driver_monitoring.driverMonitoring.facePosition = [0.] * 2 - Plant.driverMonitoring.send(driver_monitoring.to_bytes()) + driver_state = messaging.new_message() + driver_state.init('driverState') + driver_state.driverState.faceOrientation = [0.] * 3 + driver_state.driverState.facePosition = [0.] * 2 + Plant.driverState.send(driver_state.to_bytes()) health = messaging.new_message() health.init('health') diff --git a/selfdrive/test/longitudinal_maneuvers/test_longitudinal.py b/selfdrive/test/longitudinal_maneuvers/test_longitudinal.py index 647eb3633..6cd689f17 100755 --- a/selfdrive/test/longitudinal_maneuvers/test_longitudinal.py +++ b/selfdrive/test/longitudinal_maneuvers/test_longitudinal.py @@ -3,9 +3,7 @@ import os os.environ['OLD_CAN'] = '1' os.environ['NOCRASH'] = '1' -import time import unittest -import shutil import matplotlib matplotlib.use('svg') @@ -329,8 +327,8 @@ class LongitudinalControl(unittest.TestCase): setup_output() - shutil.rmtree('/data/params', ignore_errors=True) params = Params() + params.clear_all() params.put("Passive", "1" if os.getenv("PASSIVE") else "0") params.put("OpenpilotEnabledToggle", "1") params.put("CommunityFeaturesToggle", "1") @@ -339,6 +337,7 @@ class LongitudinalControl(unittest.TestCase): manager.prepare_managed_process('radard') manager.prepare_managed_process('controlsd') manager.prepare_managed_process('plannerd') + manager.prepare_managed_process('dmonitoringd') @classmethod def tearDownClass(cls): @@ -348,30 +347,39 @@ class LongitudinalControl(unittest.TestCase): def test_longitudinal_setup(self): pass + def run_maneuver_worker(k): man = maneuvers[k] output_dir = os.path.join(os.getcwd(), 'out/longitudinal') def run(self): print(man.title) - manager.start_managed_process('radard') - manager.start_managed_process('controlsd') - manager.start_managed_process('plannerd') + valid = False - plot, valid = man.evaluate() - plot.write_plot(output_dir, "maneuver" + str(k+1).zfill(2)) + for retries in range(3): + manager.start_managed_process('radard') + manager.start_managed_process('controlsd') + manager.start_managed_process('plannerd') + manager.start_managed_process('dmonitoringd') - manager.kill_managed_process('radard') - manager.kill_managed_process('controlsd') - manager.kill_managed_process('plannerd') - time.sleep(5) + plot, valid = man.evaluate() + plot.write_plot(output_dir, "maneuver" + str(k + 1).zfill(2)) + + manager.kill_managed_process('radard') + manager.kill_managed_process('controlsd') + manager.kill_managed_process('plannerd') + manager.kill_managed_process('dmonitoringd') + + if valid: + break self.assertTrue(valid) return run + for k in range(len(maneuvers)): - setattr(LongitudinalControl, "test_longitudinal_maneuvers_%d" % (k+1), run_maneuver_worker(k)) + setattr(LongitudinalControl, "test_longitudinal_maneuvers_%d" % (k + 1), run_maneuver_worker(k)) if __name__ == "__main__": unittest.main(failfast=True) diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 14969954c..9b27308b2 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import os +import sys import threading import importlib -import shutil if "CI" in os.environ: tqdm = lambda x: x @@ -19,6 +19,15 @@ from collections import namedtuple ProcessConfig = namedtuple('ProcessConfig', ['proc_name', 'pub_sub', 'ignore', 'init_callback', 'should_recv_callback']) +def wait_for_event(evt): + if not evt.wait(15): + if threading.currentThread().getName() == "MainThread": + # tested process likely died. don't let test just hang + raise Exception("Timeout reached. Tested process likely crashed.") + else: + # done testing this process, let it die + sys.exit(0) + class FakeSocket: def __init__(self, wait=True): self.data = [] @@ -32,13 +41,13 @@ class FakeSocket: if self.wait: self.recv_called.set() - self.recv_ready.wait() + wait_for_event(self.recv_ready) self.recv_ready.clear() return self.data.pop() def send(self, data): if self.wait: - self.recv_called.wait() + wait_for_event(self.recv_called) self.recv_called.clear() self.data.append(data) @@ -47,7 +56,7 @@ class FakeSocket: self.recv_ready.set() def wait_for_recv(self): - self.recv_called.wait() + wait_for_event(self.recv_called) class DumbSocket: def __init__(self, s=None): @@ -75,23 +84,23 @@ class FakeSubMaster(messaging.SubMaster): # hack to know when fingerprinting is done if self.wait_on_getitem: self.update_called.set() - self.update_ready.wait() + wait_for_event(self.update_ready) self.update_ready.clear() return self.data[s] def update(self, timeout=-1): self.update_called.set() - self.update_ready.wait() + wait_for_event(self.update_ready) self.update_ready.clear() def update_msgs(self, cur_time, msgs): - self.update_called.wait() + wait_for_event(self.update_called) self.update_called.clear() super(FakeSubMaster, self).update_msgs(cur_time, msgs) self.update_ready.set() def wait_for_update(self): - self.update_called.wait() + wait_for_event(self.update_called) class FakePubMaster(messaging.PubMaster): def __init__(self, services): @@ -116,11 +125,11 @@ class FakePubMaster(messaging.PubMaster): else: self.data[s] = dat.as_reader() self.send_called.set() - self.get_called.wait() + wait_for_event(self.get_called) self.get_called.clear() def wait_for_msg(self): - self.send_called.wait() + wait_for_event(self.send_called) self.send_called.clear() dat = self.data[self.last_updated] self.get_called.set() @@ -132,14 +141,14 @@ def fingerprint(msgs, fsm, can_sock): # populate fake socket with data for fingerprinting canmsgs = [msg for msg in msgs if msg.which() == "can"] - can_sock.recv_called.wait() + wait_for_event(can_sock.recv_called) can_sock.recv_called.clear() can_sock.data = [msg.as_builder().to_bytes() for msg in canmsgs[:300]] can_sock.recv_ready.set() can_sock.wait = False # we know fingerprinting is done when controlsd sets sm['pathPlan'].sensorValid - fsm.update_called.wait() + wait_for_event(fsm.update_called) fsm.update_called.clear() fsm.wait_on_getitem = False @@ -188,7 +197,7 @@ CONFIGS = [ proc_name="controlsd", pub_sub={ "can": ["controlsState", "carState", "carControl", "sendcan", "carEvents", "carParams"], - "thermal": [], "health": [], "liveCalibration": [], "driverMonitoring": [], "plan": [], "pathPlan": [], "gpsLocation": [], + "thermal": [], "health": [], "liveCalibration": [], "dMonitoringState": [], "plan": [], "pathPlan": [], "gpsLocation": [], "model": [], }, ignore=[("logMonoTime", 0), ("valid", True), ("controlsState.startMonoTime", 0), ("controlsState.cumLagMs", 0)], @@ -224,6 +233,16 @@ CONFIGS = [ init_callback=get_car_params, should_recv_callback=calibration_rcv_callback, ), + ProcessConfig( + proc_name="dmonitoringd", + pub_sub={ + "driverState": ["dMonitoringState"], + "liveCalibration": [], "carState": [], "model": [], "gpsLocation": [], + }, + ignore=[("logMonoTime", 0), ("valid", True)], + init_callback=get_car_params, + should_recv_callback=None, + ), ] def replay_process(cfg, lr): @@ -240,8 +259,8 @@ def replay_process(cfg, lr): all_msgs = sorted(lr, key=lambda msg: msg.logMonoTime) pub_msgs = [msg for msg in all_msgs if msg.which() in list(cfg.pub_sub.keys())] - shutil.rmtree('/data/params', ignore_errors=True) params = Params() + params.clear_all() params.manager_start() params.put("OpenpilotEnabledToggle", "1") params.put("Passive", "0") diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 823608db0..7418267c7 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -b60841eb6cf09037200bc2daacf0c9cf69b358fe \ No newline at end of file +bc89e6f25e88a904ad905296d516aaebb77e2207 \ No newline at end of file diff --git a/selfdrive/test/test_car_models.py b/selfdrive/test/test_car_models.py index c1aa39a7f..b3ff2a9e5 100755 --- a/selfdrive/test/test_car_models.py +++ b/selfdrive/test/test_car_models.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -import shutil import time import os import sys @@ -27,34 +26,36 @@ from selfdrive.car.mock.values import CAR as MOCK os.environ['NOCRASH'] = '1' -def wait_for_socket(name, timeout=10.0): - socket = messaging.sub_sock(name) - cur_time = time.time() +def wait_for_sockets(socks, timeout=10.0): + sm = messaging.SubMaster(socks) + t = time.time() - r = None - while time.time() - cur_time < timeout: - print("waiting for %s" % name) - r = socket.receive(non_blocking=True) - if r is not None: - break - time.sleep(0.5) + recvd = [] + while time.time() - t < timeout and len(recvd) < len(socks): + sm.update() + for s in socks: + if s not in recvd and sm.updated[s]: + recvd.append(s) + return recvd - return r +def get_route_log(route_name): + log_path = os.path.join("/tmp", "%s--0--%s" % (route_name.replace("|", "_"), "rlog.bz2")) -def get_route_logs(route_name): - for log_f in ["rlog.bz2", "fcamera.hevc"]: - log_path = os.path.join("/tmp", "%s--0--%s" % (route_name.replace("|", "_"), log_f)) + if not os.path.isfile(log_path): + log_url = "https://commadataci.blob.core.windows.net/openpilotci/%s/0/%s" % (route_name.replace("|", "/"), "rlog.bz2") - if not os.path.isfile(log_path): - log_url = "https://commadataci.blob.core.windows.net/openpilotci/%s/0/%s" % (route_name.replace("|", "/"), log_f) - r = requests.get(log_url) + # if request fails, try again once and let it throw exception if fails again + try: + r = requests.get(log_url, timeout=15) + except: + r = requests.get(log_url, timeout=15) - if r.status_code == 200: - with open(log_path, "wb") as f: - f.write(r.content) - else: - print("failed to download test log %s" % route_name) - sys.exit(-1) + if r.status_code == 200: + with open(log_path, "wb") as f: + f.write(r.content) + else: + print("failed to download test log %s" % route_name) + sys.exit(-1) routes = { @@ -70,6 +71,10 @@ routes = { 'carFingerprint': CHRYSLER.PACIFICA_2019_HYBRID, 'enableCamera': True, }, + "8190c7275a24557b|2020-01-29--08-33-58": { + 'carFingerprint': CHRYSLER.PACIFICA_2020_HYBRID, + 'enableCamera': True, + }, # This pacifica was removed because the fingerprint seemed from a Volt #"9f7a7e50a51fb9db|2019-01-03--14-05-01": { # 'carFingerprint': CHRYSLER.PACIFICA_2018, @@ -281,6 +286,10 @@ routes = { 'carFingerprint': TOYOTA.RAV4_TSS2, 'enableCamera': True, 'enableDsu': False, + }, + "7e34a988419b5307|2019-12-18--19-13-30": { + 'carFingerprint': TOYOTA.RAV4H_TSS2, + 'enableCamera': True, }, "e6a24be49a6cd46e|2019-10-29--10-52-42": { 'carFingerprint': TOYOTA.LEXUS_ES_TSS2, @@ -297,10 +306,24 @@ routes = { 'enableCamera': True, 'enableDsu': False, }, + "886fcd8408d570e9|2020-01-29--05-11-22": { + 'carFingerprint': TOYOTA.LEXUS_RX, + 'enableCamera': True, + 'enableDsu': True, + }, + "886fcd8408d570e9|2020-01-29--02-18-55": { + 'carFingerprint': TOYOTA.LEXUS_RX, + 'enableCamera': True, + 'enableDsu': False, + }, "b0f5a01cf604185c|2018-02-01--21-12-28": { 'carFingerprint': TOYOTA.LEXUS_RXH, 'enableCamera': True, 'enableDsu': True, + }, + "01b22eb2ed121565|2020-02-02--11-25-51": { + 'carFingerprint': TOYOTA.LEXUS_RX_TSS2, + 'enableCamera': True, }, #FIXME: This works sometimes locally, but never in CI. Timing issue? #"b0f5a01cf604185c|2018-01-31--20-11-39": { @@ -410,7 +433,6 @@ forced_dashcam_routes = [ ] # TODO: replace all these with public routes -# TODO: add routes for untested cars: HONDA ACCORD 2018 HYBRID TOURING and CHRYSLER PACIFICA 2018 non_public_routes = [ "0607d2516fc2148f|2019-02-13--23-03-16", # CHRYSLER PACIFICA HYBRID 2019 "3e9592a1c78a3d63|2018-02-08--20-28-24", # HONDA PILOT 2017 TOURING @@ -447,99 +469,78 @@ non_public_routes = [ "fbd011384db5e669|2018-07-26--20-51-48", # TOYOTA CAMRY HYBRID 2018 ] +# TODO: add routes for these cars +non_tested_cars = [TOYOTA.LEXUS_CTH, CHRYSLER.PACIFICA_2018, HONDA.ACCORDH] + if __name__ == "__main__": - # TODO: add routes for untested cars and fail test if we have an untested car + tested_procs = ["controlsd", "radard", "plannerd"] + tested_socks = ["radarState", "controlsState", "carState", "plan"] + tested_cars = [keys["carFingerprint"] for route, keys in routes.items()] for car_model in all_known_cars(): if car_model not in tested_cars: print("***** WARNING: %s not tested *****" % car_model) + # TODO: skip these for now, but make sure any new ports get routes + if car_model not in non_tested_cars: + print("TEST FAILED: Missing route for car '%s'" % car_model) + sys.exit(1) + + print("Preparing processes") + for p in tested_procs: + manager.prepare_managed_process(p) + results = {} for route, checks in routes.items(): if route not in non_public_routes: - get_route_logs(route) + print("GETTING ROUTE LOGS") + get_route_log(route) + print("DONE GETTING ROUTE LOGS") elif "UNLOGGER_PATH" not in os.environ: continue - shutil.rmtree('/data/params') - manager.gctx = {} params = Params() + params.clear_all() params.manager_start() params.put("OpenpilotEnabledToggle", "1") params.put("CommunityFeaturesToggle", "1") - - if route in passive_routes: - params.put("Passive", "1") - else: - params.put("Passive", "0") + params.put("Passive", "1" if route in passive_routes else "0") print("testing ", route, " ", checks['carFingerprint']) - print("Preparing processes") - manager.prepare_managed_process("radard") - manager.prepare_managed_process("controlsd") - manager.prepare_managed_process("plannerd") print("Starting processes") - manager.start_managed_process("radard") - manager.start_managed_process("controlsd") - manager.start_managed_process("plannerd") - time.sleep(2) + for p in tested_procs: + manager.start_managed_process(p) # Start unlogger print("Start unlogger") if route in non_public_routes: - unlogger_cmd = [os.path.join(BASEDIR, os.environ['UNLOGGER_PATH']), '%s' % route, '--disable', 'frame,plan,pathPlan,liveLongitudinalMpc,radarState,controlsState,liveTracks,liveMpc,sendcan,carState,carControl,carEvents,carParams', '--no-interactive'] + unlogger_cmd = [os.path.join(BASEDIR, os.environ['UNLOGGER_PATH']), route] else: - unlogger_cmd = [os.path.join(BASEDIR, 'tools/replay/unlogger.py'), '%s' % route, '/tmp', '--disable', 'frame,plan,pathPlan,liveLongitudinalMpc,radarState,controlsState,liveTracks,liveMpc,sendcan,carState,carControl,carEvents,carParams', '--no-interactive'] - unlogger = subprocess.Popen(unlogger_cmd, preexec_fn=os.setsid) + unlogger_cmd = [os.path.join(BASEDIR, 'tools/replay/unlogger.py'), route, '/tmp'] + unlogger = subprocess.Popen(unlogger_cmd + ['--disable', 'frame,encodeIdx,plan,pathPlan,liveLongitudinalMpc,radarState,controlsState,liveTracks,liveMpc,sendcan,carState,carControl,carEvents,carParams', '--no-interactive'], preexec_fn=os.setsid) print("Check sockets") - controls_state_result = wait_for_socket('controlsState', timeout=30) - + extra_socks = [] has_camera = checks.get('enableCamera', False) if (route not in passive_routes) and (route not in forced_dashcam_routes) and has_camera: - controls_state_result = controls_state_result and wait_for_socket('sendcan', timeout=30) + extra_socks.append("sendcan") + if route not in passive_routes: + extra_socks.append("pathPlan") - radarstate_result = wait_for_socket('radarState', timeout=30) - plan_result = wait_for_socket('plan', timeout=30) - - if route not in passive_routes: # TODO The passive routes have very flaky models - path_plan_result = wait_for_socket('pathPlan', timeout=30) - else: - path_plan_result = True - - carstate_result = wait_for_socket('carState', timeout=30) + recvd_socks = wait_for_sockets(tested_socks + extra_socks, timeout=30) + failures = [s for s in tested_socks + extra_socks if s not in recvd_socks] print("Check if everything is running") running = manager.get_running() - controlsd_running = running['controlsd'].is_alive() - radard_running = running['radard'].is_alive() - plannerd_running = running['plannerd'].is_alive() - - manager.kill_managed_process("controlsd") - manager.kill_managed_process("radard") - manager.kill_managed_process("plannerd") + for p in tested_procs: + if not running[p].is_alive: + failures.append(p) + manager.kill_managed_process(p) os.killpg(os.getpgid(unlogger.pid), signal.SIGTERM) - sockets_ok = all([ - controls_state_result, radarstate_result, plan_result, path_plan_result, carstate_result, - controlsd_running, radard_running, plannerd_running - ]) + sockets_ok = len(failures) == 0 params_ok = True - failures = [] - - if not controlsd_running: - failures.append('controlsd') - if not radard_running: - failures.append('radard') - if not radarstate_result: - failures.append('radarState') - if not controls_state_result: - failures.append('controlsState') - if not plan_result: - failures.append('plan') - if not path_plan_result: - failures.append('pathPlan') try: car_params = car.CarParams.from_bytes(params.get("CarParams")) @@ -558,11 +559,12 @@ if __name__ == "__main__": results[route] = False, failures break - time.sleep(2) + # put back not passive to not leave the params in an unintended state + Params().put("Passive", "0") for route in results: print(results[route]) - Params().put("Passive", "0") # put back not passive to not leave the params in an unintended state + if not all(passed for passed, _ in results.values()): print("TEST FAILED") sys.exit(1) diff --git a/selfdrive/test/test_openpilot.py b/selfdrive/test/test_openpilot.py index 27b964c47..cbc43dd12 100644 --- a/selfdrive/test/test_openpilot.py +++ b/selfdrive/test/test_openpilot.py @@ -1,3 +1,4 @@ +# flake8: noqa import os os.environ['FAKEUPLOAD'] = "1" @@ -72,26 +73,6 @@ def with_apks(): return wrap return wrapper -#@phone_only -#@with_processes(['controlsd', 'radard']) -#def test_controls(): -# from selfdrive.test.longitudinal_maneuvers.plant import Plant -# -# # start the fake car for 2 seconds -# plant = Plant(100) -# for i in range(200): -# if plant.rk.frame >= 20 and plant.rk.frame <= 25: -# cruise_buttons = CruiseButtons.RES_ACCEL -# # rolling forward -# assert plant.speed > 0 -# else: -# cruise_buttons = 0 -# plant.step(cruise_buttons = cruise_buttons) -# plant.close() -# -# # assert that we stopped -# assert plant.speed == 0.0 - @phone_only @with_processes(['loggerd', 'logmessaged', 'tombstoned', 'proclogd', 'logcatd']) def test_logging(): @@ -99,7 +80,7 @@ def test_logging(): time.sleep(1.0) @phone_only -@with_processes(['camerad', 'modeld', 'monitoringd']) +@with_processes(['camerad', 'modeld', 'dmonitoringmodeld']) def test_visiond(): print("VISIOND IS SET UP") time.sleep(5.0) @@ -124,118 +105,118 @@ def test_uploader(): print("UPLOADER") time.sleep(10.0) -@phone_only -def test_athena(): - print("ATHENA") - start_daemon_process("manage_athenad") - params = Params() - manage_athenad_pid = params.get("AthenadPid") - assert manage_athenad_pid is not None - try: - os.kill(int(manage_athenad_pid), 0) - # process is running - except OSError: - assert False, "manage_athenad is dead" +# @phone_only +# def test_athena(): +# print("ATHENA") +# start_daemon_process("manage_athenad") +# params = Params() +# manage_athenad_pid = params.get("AthenadPid") +# assert manage_athenad_pid is not None +# try: +# os.kill(int(manage_athenad_pid), 0) +# # process is running +# except OSError: +# assert False, "manage_athenad is dead" - def expect_athena_starts(timeout=30): - now = time.time() - athenad_pid = None - while athenad_pid is None: - try: - athenad_pid = subprocess.check_output(["pgrep", "-P", manage_athenad_pid], encoding="utf-8").strip() - return athenad_pid - except subprocess.CalledProcessError: - if time.time() - now > timeout: - assert False, f"Athena did not start within {timeout} seconds" - time.sleep(0.5) +# def expect_athena_starts(timeout=30): +# now = time.time() +# athenad_pid = None +# while athenad_pid is None: +# try: +# athenad_pid = subprocess.check_output(["pgrep", "-P", manage_athenad_pid], encoding="utf-8").strip() +# return athenad_pid +# except subprocess.CalledProcessError: +# if time.time() - now > timeout: +# assert False, f"Athena did not start within {timeout} seconds" +# time.sleep(0.5) - def athena_post(payload, max_retries=5, wait=5): - tries = 0 - while 1: - try: - resp = requests.post( - "https://athena.comma.ai/" + params.get("DongleId", encoding="utf-8"), - headers={ - "Authorization": "JWT " + os.getenv("COMMA_JWT"), - "Content-Type": "application/json" - }, - data=json.dumps(payload), - timeout=30 - ) - resp_json = resp.json() - if resp_json.get('error'): - raise Exception(resp_json['error']) - return resp_json - except Exception as e: - time.sleep(wait) - tries += 1 - if tries == max_retries: - raise - else: - print(f'athena_post failed {e}. retrying...') +# def athena_post(payload, max_retries=5, wait=5): +# tries = 0 +# while 1: +# try: +# resp = requests.post( +# "https://athena.comma.ai/" + params.get("DongleId", encoding="utf-8"), +# headers={ +# "Authorization": "JWT " + os.getenv("COMMA_JWT"), +# "Content-Type": "application/json" +# }, +# data=json.dumps(payload), +# timeout=30 +# ) +# resp_json = resp.json() +# if resp_json.get('error'): +# raise Exception(resp_json['error']) +# return resp_json +# except Exception as e: +# time.sleep(wait) +# tries += 1 +# if tries == max_retries: +# raise +# else: +# print(f'athena_post failed {e}. retrying...') - def expect_athena_registers(): - resp = athena_post({ - "method": "echo", - "params": ["hello"], - "id": 0, - "jsonrpc": "2.0" - }, max_retries=12, wait=5) - assert resp.get('result') == "hello", f'Athena failed to register ({resp})' +# def expect_athena_registers(): +# resp = athena_post({ +# "method": "echo", +# "params": ["hello"], +# "id": 0, +# "jsonrpc": "2.0" +# }, max_retries=12, wait=5) +# assert resp.get('result') == "hello", f'Athena failed to register ({resp})' - try: - athenad_pid = expect_athena_starts() - # kill athenad and ensure it is restarted (check_output will throw if it is not) - os.kill(int(athenad_pid), signal.SIGINT) - expect_athena_starts() +# try: +# athenad_pid = expect_athena_starts() +# # kill athenad and ensure it is restarted (check_output will throw if it is not) +# os.kill(int(athenad_pid), signal.SIGINT) +# expect_athena_starts() - if not os.getenv('COMMA_JWT'): - print('WARNING: COMMA_JWT env not set, will not test requests to athena.comma.ai') - return +# if not os.getenv('COMMA_JWT'): +# print('WARNING: COMMA_JWT env not set, will not test requests to athena.comma.ai') +# return - expect_athena_registers() +# expect_athena_registers() - print("ATHENA: getSimInfo") - resp = athena_post({ - "method": "getSimInfo", - "id": 0, - "jsonrpc": "2.0" - }) - assert resp.get('result'), resp - assert 'sim_id' in resp['result'], resp['result'] +# print("ATHENA: getSimInfo") +# resp = athena_post({ +# "method": "getSimInfo", +# "id": 0, +# "jsonrpc": "2.0" +# }) +# assert resp.get('result'), resp +# assert 'sim_id' in resp['result'], resp['result'] - print("ATHENA: takeSnapshot") - resp = athena_post({ - "method": "takeSnapshot", - "id": 0, - "jsonrpc": "2.0" - }) - assert resp.get('result'), resp - assert resp['result']['jpegBack'], resp['result'] +# print("ATHENA: takeSnapshot") +# resp = athena_post({ +# "method": "takeSnapshot", +# "id": 0, +# "jsonrpc": "2.0" +# }) +# assert resp.get('result'), resp +# assert resp['result']['jpegBack'], resp['result'] - @with_processes(["thermald"]) - def test_athena_thermal(): - print("ATHENA: getMessage(thermal)") - resp = athena_post({ - "method": "getMessage", - "params": {"service": "thermal", "timeout": 5000}, - "id": 0, - "jsonrpc": "2.0" - }) - assert resp.get('result'), resp - assert resp['result']['thermal'], resp['result'] - test_athena_thermal() - finally: - try: - athenad_pid = subprocess.check_output(["pgrep", "-P", manage_athenad_pid], encoding="utf-8").strip() - except subprocess.CalledProcessError: - athenad_pid = None +# @with_processes(["thermald"]) +# def test_athena_thermal(): +# print("ATHENA: getMessage(thermal)") +# resp = athena_post({ +# "method": "getMessage", +# "params": {"service": "thermal", "timeout": 5000}, +# "id": 0, +# "jsonrpc": "2.0" +# }) +# assert resp.get('result'), resp +# assert resp['result']['thermal'], resp['result'] +# test_athena_thermal() +# finally: +# try: +# athenad_pid = subprocess.check_output(["pgrep", "-P", manage_athenad_pid], encoding="utf-8").strip() +# except subprocess.CalledProcessError: +# athenad_pid = None - try: - os.kill(int(manage_athenad_pid), signal.SIGINT) - os.kill(int(athenad_pid), signal.SIGINT) - except (OSError, TypeError): - pass +# try: +# os.kill(int(manage_athenad_pid), signal.SIGINT) +# os.kill(int(athenad_pid), signal.SIGINT) +# except (OSError, TypeError): +# pass # TODO: re-enable when jenkins test has /data/pythonpath -> /data/openpilot # @phone_only diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index aa4c47a6e..2fcd9685c 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -4,9 +4,10 @@ import json import copy import datetime import psutil +import subprocess from smbus2 import SMBus from cereal import log -from common.android import ANDROID +from common.android import ANDROID, get_network_type from common.basedir import BASEDIR from common.params import Params from common.realtime import sec_since_boot, DT_TRML @@ -21,6 +22,7 @@ from selfdrive.pandad import get_expected_signature FW_SIGNATURE = get_expected_signature() ThermalStatus = log.ThermalData.ThermalStatus +NetworkType = log.ThermalData.NetworkType CURRENT_TAU = 15. # 15s time constant DAYS_NO_CONNECTIVITY_MAX = 7 # do not allow to engage after a week without internet DAYS_NO_CONNECTIVITY_PROMPT = 4 # send an offroad prompt after 4 days with no internet @@ -107,7 +109,7 @@ _FAN_SPEEDS = [0, 16384, 32768, 65535] _BAT_TEMP_THERSHOLD = 45. -def handle_fan_eon(max_cpu_temp, bat_temp, fan_speed): +def handle_fan_eon(max_cpu_temp, bat_temp, fan_speed, ignition): new_speed_h = next(speed for speed, temp_h in zip(_FAN_SPEEDS, _TEMP_THRS_H) if temp_h > max_cpu_temp) new_speed_l = next(speed for speed, temp_l in zip(_FAN_SPEEDS, _TEMP_THRS_L) if temp_l > max_cpu_temp) @@ -126,9 +128,14 @@ def handle_fan_eon(max_cpu_temp, bat_temp, fan_speed): return fan_speed -def handle_fan_uno(max_cpu_temp, bat_temp, fan_speed): - # TODO: implement better fan control - return int(interp(max_cpu_temp, [40.0, 80.0], [0, 100])) + +def handle_fan_uno(max_cpu_temp, bat_temp, fan_speed, ignition): + new_speed = int(interp(max_cpu_temp, [40.0, 80.0], [0, 100])) + + if not ignition: + new_speed = min(30, new_speed) + + return new_speed def thermald_thread(): # prevent LEECO from undervoltage @@ -141,6 +148,7 @@ def thermald_thread(): health_sock = messaging.sub_sock('health', timeout=health_timeout) location_sock = messaging.sub_sock('gpsLocation') + ignition = False fan_speed = 0 count = 0 @@ -152,6 +160,8 @@ def thermald_thread(): usb_power = True usb_power_prev = True + network_type = NetworkType.none + current_filter = FirstOrderFilter(0., CURRENT_TAU, DT_TRML) health_prev = None fw_version_match_prev = True @@ -182,9 +192,15 @@ def thermald_thread(): if health is not None: usb_power = health.health.usbPowerMode != log.HealthData.UsbPowerMode.client + try: + network_type = get_network_type() + except subprocess.CalledProcessError: + pass + msg.thermal.freeSpace = get_available_percent(default=100.0) / 100.0 msg.thermal.memUsedPercent = int(round(psutil.virtual_memory().percent)) msg.thermal.cpuPerc = int(round(psutil.cpu_percent())) + msg.thermal.networkType = network_type try: with open("/sys/class/power_supply/battery/capacity") as f: @@ -213,7 +229,7 @@ def thermald_thread(): max_comp_temp = max(max_cpu_temp, msg.thermal.mem / 10., msg.thermal.gpu / 10.) bat_temp = msg.thermal.bat/1000. - fan_speed = handle_fan(max_cpu_temp, bat_temp, fan_speed) + fan_speed = handle_fan(max_cpu_temp, bat_temp, fan_speed, ignition) msg.thermal.fanSpeed = fan_speed # thermal logic with hysterisis diff --git a/selfdrive/ui/.gitignore b/selfdrive/ui/.gitignore deleted file mode 100644 index 2c850c209..000000000 --- a/selfdrive/ui/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ui diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index ad96cb0a4..5dbf8016d 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -1,15 +1,17 @@ Import('env', 'arch', 'common', 'messaging', 'gpucommon', 'visionipc', 'cereal') src = ['ui.cc', 'paint.cc', '#phonelibs/nanovg/nanovg.c'] -libs = [common, 'zmq', 'czmq', 'capnp', 'capnp_c', 'm', cereal, 'json', messaging, 'OpenCL', gpucommon, visionipc] +libs = [common, 'zmq', 'czmq', 'capnp', 'capnp_c', 'm', cereal, 'json', messaging, gpucommon, visionipc] if arch == "aarch64": src += ['sound.cc', 'slplay.c'] - libs += ['EGL', 'GLESv3', 'gnustl_shared', 'log', 'utils', 'gui', 'hardware', 'ui', 'CB', 'gsl', 'adreno_utils', 'OpenSLES', 'cutils', 'uuid'] + libs += ['EGL', 'GLESv3', 'gnustl_shared', 'log', 'utils', 'gui', 'hardware', 'ui', 'CB', 'gsl', 'adreno_utils', 'OpenSLES', 'cutils', 'uuid', 'OpenCL'] + linkflags = ['-Wl,-rpath=/system/lib64,-rpath=/system/comma/usr/lib'] else: src += ['linux.cc'] - libs += ['EGL', 'pthread', 'X11-xcb', 'xcb', 'X11', 'glfw'] + libs += ['pthread', 'glfw'] + linkflags = [] env.Program('_ui', src, - LINKFLAGS=['-Wl,-rpath=/system/lib64,-rpath=/system/comma/usr/lib'], + LINKFLAGS=linkflags, LIBS=libs) diff --git a/selfdrive/ui/linux.cc b/selfdrive/ui/linux.cc index 62531e356..8e4a8492d 100644 --- a/selfdrive/ui/linux.cc +++ b/selfdrive/ui/linux.cc @@ -6,19 +6,18 @@ #include "ui.hpp" +#ifndef __APPLE__ #define GLFW_INCLUDE_ES2 +#else +#define GLFW_INCLUDE_GLCOREARB +#endif + #define GLFW_INCLUDE_GLEXT #include typedef struct FramebufferState FramebufferState; typedef struct TouchState TouchState; -#define FALSE 0 -#define TRUE 1 - -#include -#include - extern "C" { FramebufferState* framebuffer_init( @@ -26,9 +25,16 @@ FramebufferState* framebuffer_init( int *out_w, int *out_h) { glfwInit(); +#ifndef __APPLE__ glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); +#else + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); +#endif glfwWindowHint(GLFW_RESIZABLE, 0); GLFWwindow* window; window = glfwCreateWindow(1920, 1080, "ui", NULL, NULL); @@ -40,7 +46,7 @@ FramebufferState* framebuffer_init( glfwSwapInterval(0); // clear screen - glClearColor(0.2f, 0.2f, 0.2f, 1.0f ); + glClearColor(0.2f, 0.2f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); framebuffer_swap((FramebufferState*)window); @@ -55,6 +61,7 @@ void framebuffer_set_power(FramebufferState *s, int mode) { void framebuffer_swap(FramebufferState *s) { glfwSwapBuffers((GLFWwindow*)s); + glfwPollEvents(); } void touch_init(TouchState *s) { @@ -90,7 +97,7 @@ GLuint visionimg_to_gl(const VisionImg *img, EGLImageKHR *pkhr, void **pph) { glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->width, img->height, 0, GL_RGB, GL_UNSIGNED_BYTE, *pph); glGenerateMipmap(GL_TEXTURE_2D); - *pkhr = (EGLImageKHR *)1; // not NULL + *pkhr = (EGLImageKHR)1; // not NULL return texture; } diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index 0728a5eab..6d7b24c34 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -890,6 +890,28 @@ void ui_draw(UIState *s) { } } +#ifdef NANOVG_GL3_IMPLEMENTATION +static const char frame_vertex_shader[] = + "#version 150 core\n" + "in vec4 aPosition;\n" + "in vec4 aTexCoord;\n" + "uniform mat4 uTransform;\n" + "out vec4 vTexCoord;\n" + "void main() {\n" + " gl_Position = uTransform * aPosition;\n" + " vTexCoord = aTexCoord;\n" + "}\n"; + +static const char frame_fragment_shader[] = + "#version 150 core\n" + "precision mediump float;\n" + "uniform sampler2D uTexture;\n" + "out vec4 vTexCoord;\n" + "out vec4 outColor;\n" + "void main() {\n" + " outColor = texture(uTexture, vTexCoord.xy);\n" + "}\n"; +#else static const char frame_vertex_shader[] = "attribute vec4 aPosition;\n" "attribute vec4 aTexCoord;\n" @@ -907,24 +929,7 @@ static const char frame_fragment_shader[] = "void main() {\n" " gl_FragColor = texture2D(uTexture, vTexCoord.xy);\n" "}\n"; - -static const char line_vertex_shader[] = - "attribute vec4 aPosition;\n" - "attribute vec4 aColor;\n" - "uniform mat4 uTransform;\n" - "varying vec4 vColor;\n" - "void main() {\n" - " gl_Position = uTransform * aPosition;\n" - " vColor = aColor;\n" - "}\n"; - -static const char line_fragment_shader[] = - "precision mediump float;\n" - "uniform sampler2D uTexture;\n" - "varying vec4 vColor;\n" - "void main() {\n" - " gl_FragColor = vColor;\n" - "}\n"; +#endif static const mat4 device_transform = {{ 1.0, 0.0, 0.0, 0.0, @@ -951,7 +956,7 @@ static const mat4 full_to_wide_frame_transform = {{ void ui_nvg_init(UIState *s) { // init drawing - s->vg = nvgCreateGLES3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG); + s->vg = nvgCreate(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG); assert(s->vg); s->font_courbd = nvgCreateFont(s->vg, "courbd", "../assets/fonts/courbd.ttf"); @@ -985,13 +990,6 @@ void ui_nvg_init(UIState *s) { s->frame_texture_loc = glGetUniformLocation(s->frame_program, "uTexture"); s->frame_transform_loc = glGetUniformLocation(s->frame_program, "uTransform"); - s->line_program = load_program(line_vertex_shader, line_fragment_shader); - assert(s->line_program); - - s->line_pos_loc = glGetAttribLocation(s->line_program, "aPosition"); - s->line_color_loc = glGetAttribLocation(s->line_program, "aColor"); - s->line_transform_loc = glGetUniformLocation(s->line_program, "uTransform"); - glViewport(0, 0, s->fb_w, s->fb_h); glDisable(GL_DEPTH_TEST); diff --git a/selfdrive/ui/spinner/spinner b/selfdrive/ui/spinner/spinner index 828b4b60a..c8f8e68ec 100755 Binary files a/selfdrive/ui/spinner/spinner and b/selfdrive/ui/spinner/spinner differ diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 6a36f4919..db28e373c 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -10,7 +10,6 @@ #include #include "common/util.h" -#include "common/messaging.h" #include "common/timing.h" #include "common/swaglog.h" #include "common/touch.h" @@ -128,9 +127,9 @@ static void ui_init(UIState *s) { }); #ifdef SHOW_SPEEDLIMIT - s->map_data_sock = SubSock::create(s->ctx, "liveMapData"); + s->map_data_sock = SubSocket::create(s->ctx, "liveMapData"); assert(s->map_data_sock != NULL); - s->poller.registerSocket(s->map_data_sock); + s->poller->registerSocket(s->map_data_sock); #endif s->ipc_fd = -1; diff --git a/selfdrive/ui/ui.hpp b/selfdrive/ui/ui.hpp index e520f6eae..65471c363 100644 --- a/selfdrive/ui/ui.hpp +++ b/selfdrive/ui/ui.hpp @@ -1,13 +1,24 @@ #ifndef _UI_H #define _UI_H +#ifdef __APPLE__ +#include +#define NANOVG_GL3_IMPLEMENTATION +#define nvgCreate nvgCreateGL3 +#else #include #include +#define NANOVG_GLES3_IMPLEMENTATION +#define nvgCreate nvgCreateGLES3 +#endif + +#include #include "nanovg.h" #include "common/mat.h" #include "common/visionipc.h" +#include "common/visionimg.h" #include "common/framebuffer.h" #include "common/modeldata.h" #include "messaging.hpp" @@ -141,8 +152,6 @@ typedef struct UIState { // framebuffer FramebufferState *fb; int fb_w, fb_h; - EGLDisplay display; - EGLSurface surface; // NVG NVGcontext *vg; @@ -190,10 +199,6 @@ typedef struct UIState { GLint frame_pos_loc, frame_texcoord_loc; GLint frame_texture_loc, frame_transform_loc; - GLuint line_program; - GLint line_pos_loc, line_color_loc; - GLint line_transform_loc; - int rgb_width, rgb_height, rgb_stride; size_t rgb_buf_len; mat4 rgb_transform; diff --git a/selfdrive/version.py b/selfdrive/version.py index d2f665196..77dc26668 100644 --- a/selfdrive/version.py +++ b/selfdrive/version.py @@ -5,15 +5,24 @@ from selfdrive.swaglog import cloudlog def get_git_commit(): - return subprocess.check_output(["git", "rev-parse", "HEAD"], encoding='utf8').strip() + try: + return subprocess.check_output(["git", "rev-parse", "HEAD"], encoding='utf8').strip() + except subprocess.CalledProcessError: + return None def get_git_branch(): - return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], encoding='utf8').strip() + try: + return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], encoding='utf8').strip() + except subprocess.CalledProcessError: + return None def get_git_full_branchname(): - return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"], encoding='utf8').strip() + try: + return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"], encoding='utf8').strip() + except subprocess.CalledProcessError: + return None def get_git_remote(): @@ -21,53 +30,52 @@ def get_git_remote(): local_branch = subprocess.check_output(["git", "name-rev", "--name-only", "HEAD"], encoding='utf8').strip() tracking_remote = subprocess.check_output(["git", "config", "branch." + local_branch + ".remote"], encoding='utf8').strip() return subprocess.check_output(["git", "config", "remote." + tracking_remote + ".url"], encoding='utf8').strip() + except subprocess.CalledProcessError: - # Not on a branch, fallback - return subprocess.check_output(["git", "config", "--get", "remote.origin.url"], encoding='utf8').strip() + try: + # Not on a branch, fallback + return subprocess.check_output(["git", "config", "--get", "remote.origin.url"], encoding='utf8').strip() + except subprocess.CalledProcessError: + return None with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "common", "version.h")) as _versionf: version = _versionf.read().split('"')[1] -try: - origin = get_git_remote() - if origin.startswith('git@github.com:commaai') or origin.startswith('https://github.com/commaai'): - if origin.endswith('/one.git'): - dirty = True - else: - branch = get_git_full_branchname() - - # This is needed otherwise touched files might show up as modified - try: - subprocess.check_call(["git", "update-index", "--refresh"]) - except subprocess.CalledProcessError: - pass - - dirty = subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0 - if dirty: - dirty_files = subprocess.check_output(["git", "diff-index", branch, "--"], encoding='utf8') - commit = subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"], encoding='utf8').rstrip() - origin_commit = subprocess.check_output(["git", "rev-parse", "--verify", branch], encoding='utf8').rstrip() - cloudlog.event("dirty comma branch", version=version, dirty=dirty, origin=origin, branch=branch, dirty_files=dirty_files, commit=commit, origin_commit=origin_commit) - - else: - dirty = True -except subprocess.CalledProcessError: - try: - cloudlog.exception("git subprocess failed while finding version") - except: - pass - dirty = True - training_version = b"0.2.0" terms_version = b"2" +dirty = True +origin = get_git_remote() +branch = get_git_full_branchname() + +try: + # This is needed otherwise touched files might show up as modified + try: + subprocess.check_call(["git", "update-index", "--refresh"]) + except subprocess.CalledProcessError: + pass + + if (origin is not None) and (branch is not None): + comma_remote = origin.startswith('git@github.com:commaai') or origin.startswith('https://github.com/commaai') + + dirty = not comma_remote + dirty = dirty or ('master' in branch) + dirty = dirty or (subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0) + + if dirty: + dirty_files = subprocess.check_output(["git", "diff-index", branch, "--"], encoding='utf8') + commit = subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"], encoding='utf8').rstrip() + origin_commit = subprocess.check_output(["git", "rev-parse", "--verify", branch], encoding='utf8').rstrip() + cloudlog.event("dirty comma branch", version=version, dirty=dirty, origin=origin, branch=branch, dirty_files=dirty_files, commit=commit, origin_commit=origin_commit) + +except subprocess.CalledProcessError: + dirty = True + cloudlog.exception("git subprocess failed while checking dirty") + + if __name__ == "__main__": print("Dirty: %s" % dirty) print("Version: %s" % version) print("Remote: %s" % origin) - - try: - print("Branch %s" % branch) - except NameError: - pass + print("Branch %s" % branch)