├── .gitlab-ci.yml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── docs ├── .gitignore ├── Makefile ├── OpenVX_Header_Files.adoc ├── OpenVX_Specification.adoc ├── OpenVX_Specification_1_3_1_Correction_1_changes.md ├── README.adoc ├── config │ ├── archive │ │ ├── khronos.css │ │ └── pdf-theme.yml │ ├── asciidoctor-mathematical-ext.rb │ ├── attribs.txt │ ├── change-font-size.py │ ├── check-missing-apis.py │ ├── extension-highlighter.rb │ ├── katex_replace.rb │ ├── katex_replace │ │ └── extension.rb │ ├── khronos.css │ ├── makeSubmit.py │ ├── optimize-pdf │ ├── spec-tags.py │ ├── themes │ │ └── pdf-theme.yml │ ├── tilde_open_block.rb │ ├── vulkan-macros.rb │ └── vulkan-macros │ │ └── extension.rb ├── copyright-spec.txt ├── example.xml ├── examples │ ├── vx_arrayrange.c │ ├── vx_callback.c │ ├── vx_convolution.c │ ├── vx_extensions.c │ ├── vx_factory_corners.c │ ├── vx_imagepatch.c │ ├── vx_imagepatch_u1.c │ ├── vx_independent.c │ ├── vx_kernels.c │ ├── vx_khr_pipelining_sample.c │ ├── vx_khr_pipelining_sample_vendor.h │ ├── vx_khr_streaming_sample.c │ ├── vx_lib_xyz.h │ ├── vx_matrix_access.c │ ├── vx_parameters.c │ ├── vx_tiling_add.c │ ├── vx_tiling_box.c │ ├── vx_tiling_ext.c │ ├── vx_tiling_gaussian.c │ └── vx_warps.c ├── images │ ├── Feature-set-Venn-diagram.svg │ ├── Fig1-Example-SOC.svg │ ├── Fig2-Non-pipelined.svg │ ├── Fig3-Frame-level-pipelined.svg │ ├── Fig4-Batch-processing.svg │ ├── Fig5-Source-sink.svg │ ├── Fig6-Phases-of-pipeline.svg │ ├── Graph_state_transition.svg │ ├── Khronos_RGB.svg │ ├── OpenVX_500px_June16.png │ ├── OpenVX_RGB.svg │ ├── Overlap_DataObj_Image.svg │ ├── Overlap_DataObj_Overlap.svg │ ├── Overlap_DataObj_Pyramid.svg │ ├── README.txt │ ├── bid.svg │ ├── cdf_execution.svg │ ├── cdf_installation.svg │ ├── cdf_verification.svg │ ├── conv_eps_png.sh │ ├── cyclic.svg │ ├── execution-order.svg │ ├── image.svg │ ├── log_callback.svg │ ├── move-fast.svg │ ├── nobid.svg │ ├── node_callback.svg │ ├── old │ │ ├── graph_batch_processing.png │ │ ├── pipe_nopipelining.eps │ │ ├── pipe_nopipelining.png │ │ ├── pipe_pipelining.eps │ │ ├── pipe_pipelining.png │ │ ├── pipe_soc.eps │ │ ├── pipe_soc.png │ │ ├── pipe_sourcesink.eps │ │ ├── pipe_sourcesink.png │ │ ├── pipe_updown.eps │ │ └── pipe_updown.png │ ├── one-writer-one-modifier.svg │ ├── overview.svg │ ├── phases.svg │ ├── samplingpatterns.svg │ ├── simple_independent.svg │ ├── system.svg │ ├── user_nodes.svg │ ├── virtual-bid.svg │ ├── vx_khr_tiling_img_1.8.1.1.svg │ ├── vx_khr_tiling_img_1.8.2.1.svg │ ├── vx_khr_tiling_img_1.8.3.1.svg │ ├── vx_khr_tiling_img_1.8.4.1.svg │ ├── vx_khr_tiling_img_1.8.4.2.svg │ ├── vx_khr_tiling_img_1.8.5.1.svg │ └── vx_khr_tiling_img_1.8.5.2.svg ├── katex │ ├── README.md │ ├── contrib │ │ └── auto-render.min.js │ ├── fonts │ │ ├── KaTeX_AMS-Regular.eot │ │ ├── KaTeX_AMS-Regular.ttf │ │ ├── KaTeX_AMS-Regular.woff │ │ ├── KaTeX_AMS-Regular.woff2 │ │ ├── KaTeX_Caligraphic-Bold.eot │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ ├── KaTeX_Caligraphic-Regular.eot │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ ├── KaTeX_Fraktur-Bold.eot │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ ├── KaTeX_Fraktur-Bold.woff │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ ├── KaTeX_Fraktur-Regular.eot │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ ├── KaTeX_Fraktur-Regular.woff │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ ├── KaTeX_Main-Bold.eot │ │ ├── KaTeX_Main-Bold.ttf │ │ ├── KaTeX_Main-Bold.woff │ │ ├── KaTeX_Main-Bold.woff2 │ │ ├── KaTeX_Main-Italic.eot │ │ ├── KaTeX_Main-Italic.ttf │ │ ├── KaTeX_Main-Italic.woff │ │ ├── KaTeX_Main-Italic.woff2 │ │ ├── KaTeX_Main-Regular.eot │ │ ├── KaTeX_Main-Regular.ttf │ │ ├── KaTeX_Main-Regular.woff │ │ ├── KaTeX_Main-Regular.woff2 │ │ ├── KaTeX_Math-BoldItalic.eot │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ ├── KaTeX_Math-BoldItalic.woff │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ ├── KaTeX_Math-Italic.eot │ │ ├── KaTeX_Math-Italic.ttf │ │ ├── KaTeX_Math-Italic.woff │ │ ├── KaTeX_Math-Italic.woff2 │ │ ├── KaTeX_Math-Regular.eot │ │ ├── KaTeX_Math-Regular.ttf │ │ ├── KaTeX_Math-Regular.woff │ │ ├── KaTeX_Math-Regular.woff2 │ │ ├── KaTeX_SansSerif-Bold.eot │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ ├── KaTeX_SansSerif-Bold.woff │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ ├── KaTeX_SansSerif-Italic.eot │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ ├── KaTeX_SansSerif-Italic.woff │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ ├── KaTeX_SansSerif-Regular.eot │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ ├── KaTeX_SansSerif-Regular.woff │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ ├── KaTeX_Script-Regular.eot │ │ ├── KaTeX_Script-Regular.ttf │ │ ├── KaTeX_Script-Regular.woff │ │ ├── KaTeX_Script-Regular.woff2 │ │ ├── KaTeX_Size1-Regular.eot │ │ ├── KaTeX_Size1-Regular.ttf │ │ ├── KaTeX_Size1-Regular.woff │ │ ├── KaTeX_Size1-Regular.woff2 │ │ ├── KaTeX_Size2-Regular.eot │ │ ├── KaTeX_Size2-Regular.ttf │ │ ├── KaTeX_Size2-Regular.woff │ │ ├── KaTeX_Size2-Regular.woff2 │ │ ├── KaTeX_Size3-Regular.eot │ │ ├── KaTeX_Size3-Regular.ttf │ │ ├── KaTeX_Size3-Regular.woff │ │ ├── KaTeX_Size3-Regular.woff2 │ │ ├── KaTeX_Size4-Regular.eot │ │ ├── KaTeX_Size4-Regular.ttf │ │ ├── KaTeX_Size4-Regular.woff │ │ ├── KaTeX_Size4-Regular.woff2 │ │ ├── KaTeX_Typewriter-Regular.eot │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ ├── KaTeX_Typewriter-Regular.woff │ │ └── KaTeX_Typewriter-Regular.woff2 │ ├── katex.css │ ├── katex.js │ ├── katex.min.css │ └── katex.min.js ├── openvx-1-1.xsd ├── vx_khr_bidirectional_parameters.adoc ├── vx_khr_buffer_aliasing.adoc ├── vx_khr_class.adoc ├── vx_khr_feature_sets.adoc ├── vx_khr_icd.adoc ├── vx_khr_import_kernel.adoc ├── vx_khr_ix.adoc ├── vx_khr_nn.adoc ├── vx_khr_opencl_interop.adoc ├── vx_khr_pipelining.adoc ├── vx_khr_raw_image.adoc ├── vx_khr_s16.adoc ├── vx_khr_swap_move.adoc ├── vx_khr_tiling.adoc ├── vx_khr_user_data_object.adoc ├── vx_khr_xml.adoc ├── vx_khr_xml_ug.adoc └── xml │ ├── Makefile │ ├── NOTES │ ├── cgenerator.py │ ├── docgenerator.py │ ├── extDependency.py │ ├── generator.py │ ├── genvx.py │ ├── indexExt.py │ ├── pygenerator.py │ ├── realign.py │ ├── reg.py │ ├── registry.rnc │ ├── sortreg.py │ └── vx.xml └── include └── VX ├── vx.h ├── vx_api.h ├── vx_compatibility.h ├── vx_import.h ├── vx_kernels.h ├── vx_khr_bidirectional_parameters.h ├── vx_khr_buffer_aliasing.h ├── vx_khr_class.h ├── vx_khr_icd.h ├── vx_khr_import_kernel.h ├── vx_khr_ix.h ├── vx_khr_nn.h ├── vx_khr_opencl_interop.h ├── vx_khr_pipelining.h ├── vx_khr_raw_image.h ├── vx_khr_swap_move.h ├── vx_khr_tiling.h ├── vx_khr_user_data_object.h ├── vx_khr_xml.h ├── vx_nodes.h ├── vx_types.h ├── vx_vendors.h └── vxu.h /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | Build OpenVX API Docs: 2 | stage: build 3 | 4 | image: ubuntu:20.04 5 | 6 | before_script: 7 | - uname -a 8 | - cat /etc/lsb-release 9 | - apt-get update -qq 10 | - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq wget unzip build-essential python3 git cmake bison flex libffi-dev zip fonts-lyx 11 | - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq libgmp-dev libxml2-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev 12 | - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq gtk-doc-tools ghostscript ruby-dev default-jre 13 | - gem install asciidoctor-diagram -v 1.5.18 14 | - gem install asciidoctor-pdf --pre -v 1.6.2 15 | - gem install asciidoctor-mathematical -v 0.3.5 16 | - gem install coderay --pre -v 1.1.3 17 | 18 | script: 19 | - cd docs 20 | - make all 21 | 22 | artifacts: 23 | name: "$CI_COMMIT_REF_NAME" 24 | paths: 25 | - docs/out/*/*.pdf 26 | - docs/out/*/*/*.html 27 | expire_in: 2 weeks 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | dist: bionic 4 | 5 | os: 6 | - linux 7 | 8 | compiler: 9 | - g++ 10 | 11 | addons: 12 | apt: 13 | sources: 14 | - ubuntu-toolchain-r-test 15 | packages: 16 | - lcov wget unzip build-essential python3 git cmake bison flex libffi-dev zip 17 | - libgmp-dev libxml2-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev 18 | - fonts-lyx gtk-doc-tools ghostscript ruby-dev default-jre 19 | 20 | branches: 21 | - openvx_1.3.1 22 | - openvx_1.3 23 | - openvx_1.2 24 | 25 | before_script: 26 | - uname -a 27 | - sudo apt-get update -qq 28 | - sudo gem install asciidoctor-diagram -v 1.5.18 29 | - sudo gem install asciidoctor-pdf --pre -v 1.6.2 30 | - sudo gem install asciidoctor-mathematical -v 0.3.5 31 | - sudo gem install coderay --pre -v 1.1.3 32 | 33 | script: 34 | - cd docs 35 | - make all 36 | 37 | after_success: 38 | 39 | notifications: 40 | email: 41 | - kiriti.nageshgowda@amd.com 42 | - jesse.villarreal@ti.com 43 | - radhakrishna.giduthuri@intel.com 44 | - brill@cadence.com 45 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct ([https://www.khronos.org/developers/code-of-conduct](https://www.khronos.org/developers/code-of-conduct)), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The files in, and generated output documents from this OpenVX-api-docs project are 2 | under a mix of copyright and license statements. Refer to the individual files 3 | for specific information. As a general guideline: 4 | 5 | * The asciidoctor sources for the OpenVX Specifications and other documention 6 | are under the Creative Commons Attribution 4.0 International (CC BY 4.0) 7 | license. Details of the license are at: 8 | https://creativecommons.org/licenses/by/4.0/ 9 | 10 | * Source files for building the specification that have a Khronos copyright 11 | header, such as Makefiles and some Asciidoctor scripts, are under the Apache 12 | 2.0 license. Details of the license are at: 13 | https://www.apache.org/licenses/LICENSE-2.0.html 14 | 15 | * Some additional Asciidoctor scripts included in the repository are under the 16 | MIT license. Detail of the license are at: 17 | http://opensource.org/licenses/MIT. 18 | 19 | * The official Specification HTML and PDF output documents are posted in the 20 | OpenVX Registry (https://www.khronos.org/registry/OpenVX). These 21 | Specifications are placed under the proprietary Khronos specification 22 | copyright and license. Details of the license are at: 23 | https://www.khronos.org/registry/speccopyright.html 24 | 25 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | api/ 2 | out/ 3 | xml/__pycache__/ 4 | .asciidoctor/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /docs/OpenVX_Header_Files.adoc: -------------------------------------------------------------------------------- 1 | = The OpenVX(TM) Header Files (Informative) 2 | :regtitle: pass:q,r[^®^] 3 | :doctype: book 4 | :data-uri: 5 | :title-logo-image: images/Khronos_RGB.svg 6 | :source-highlighter: highlight.js 7 | :encoding: utf-8 8 | :lang: en 9 | :toc: left 10 | :toclevels: 3 11 | :numbered: 12 | :icons: font 13 | :autofit-option: 14 | :halfimagewidth: width="200" 15 | :ubar: _ 16 | :star: * 17 | :chapter-label: 18 | 19 | <<< 20 | 21 | OpenVX is defined as an API in the C99 language. 22 | Khronos provides a corresponding set of header files for applications using the API, which may be used in either C or C++ code. 23 | The interface descriptions in the OpenVX specification are the same as the interfaces defined in these header files. 24 | 25 | OpenVX Combined API header file is `VX/vx.h`. 26 | 27 | .Header files included in `VX/vx.h` 28 | [cols=".^3,.^6",options="header"] 29 | |=== 30 | s| Header File s| Details 31 | | `VX/vx_types.h` | The type definitions required by OpenVX Library. 32 | | `VX/vx_api.h` | The API definition for OpenVX. 33 | | `VX/vx_kernels.h` | The list of supported kernels in the OpenVX standard. 34 | | `VX/vx_nodes.h` | The "Simple" API interface for OpenVX. These APIs are just wrappers around the more verbose functions defined in `VX/vx_api.h`. 35 | | `VX/vx_vendors.h` | The OpenVX Vendor ID list. As new vendors submit their implementations, this enumeration will grow. 36 | |=== 37 | 38 | Applications normally will include the header file `VX/vx.h`. 39 | 40 | OpenVX extensions are defined in separate header files allowing applications to decide whether or not to include them. 41 | The header files for OpenVX extensions are of the form `VX/.h`. 42 | 43 | .OpenVX KHR Extensions 44 | [cols=".^3,.^6",options="header"] 45 | |=== 46 | s| Header File s| Details 47 | | `VX/vx_khr_nn.h` | OpenVX KHR Neural Network Extension 48 | | `VX/vx_khr_pipelining.h` | OpenVX KHR Pipelining Extension 49 | | `VX/vx_khr_ix.h` | OpenVX KHR Export And Import Extension 50 | | `VX/vx_khr_user_data_object.h` | OpenVX KHR User Data Object Extension 51 | |=== 52 | 53 | .OpenVX KHR Provisional Extensions 54 | [cols=".^3,.^6",options="header"] 55 | |=== 56 | s| Header File s| Details 57 | | `VX/vx_khr_bidirectional_parameters.h` | OpenVX KHR Bidirectional Parameters Extension 58 | | `VX/vx_khr_raw_image.h` | OpenVX KHR Raw Image Extension 59 | | `VX/vx_khr_swap_move.h` | OpenVX KHR Swap And Move kernel Extension 60 | | `VX/vx_khr_import_kernel.h` | OpenVX KHR Import Kernel Extension 61 | | `VX/vx_khr_buffer_aliasing.h` | OpenVX KHR Buffer Aliasing Extension 62 | | `VX/vx_khr_class.h` | OpenVX KHR Classifier Extension 63 | | `VX/vx_khr_icd.h` | OpenVX KHR Installable Client Driver Extension 64 | | `VX/vx_khr_opencl_interop.h` | OpenVX KHR OpenCL Interop Extension 65 | | `VX/vx_khr_tiling.h` | OpenVX KHR Tiling Extension 66 | | `VX/vx_khr_xml.h` | OpenVX KHR XML Extension 67 | |=== 68 | -------------------------------------------------------------------------------- /docs/OpenVX_Specification_1_3_1_Correction_1_changes.md: -------------------------------------------------------------------------------- 1 | ## Correction to OpenVX Specification 1.3.1 Section 7.6.3: vxAddUserKernel API 2 | 3 | The data type of the `name` parameter changed from `const vx_char name[VX_MAX_KERNEL_NAME]` to `const vx_char * name`. Below is corrected `vxAddUserKernel` API declaration: 4 | 5 | ``` 6 | vx_kernel vxAddUserKernel( 7 | vx_context context, 8 | const vx_char * name, 9 | vx_enum enumeration, 10 | vx_kernel_f func_ptr, 11 | vx_uint32 numParams, 12 | vx_kernel_validate_f validate, 13 | vx_kernel_initialize_f init, 14 | vx_kernel_deinitialize_f deinit); 15 | ``` 16 | 17 | The above change is reflected in the latest header package on Khronos OpenVX registry dated Nov 2023. 18 | -------------------------------------------------------------------------------- /docs/config/asciidoctor-mathematical-ext.rb: -------------------------------------------------------------------------------- 1 | require 'asciidoctor/extensions' 2 | 3 | # This script makes [latexmath] blocks work within table cells. 4 | # See https://github.com/asciidoctor/asciidoctor-pdf/issues/740 5 | 6 | Asciidoctor::Extensions.register do 7 | treeprocessor do 8 | process do |doc| 9 | mathematicalProcessor = MathematicalTreeprocessor.new 10 | (table_blocks = doc.find_by context: :table).each do |table| 11 | (table.rows[:body] + table.rows[:foot]).each do |row| 12 | row.each do |cell| 13 | mathematicalProcessor.process cell.inner_document if cell.style == :asciidoc 14 | end 15 | end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /docs/config/attribs.txt: -------------------------------------------------------------------------------- 1 | // Various special / math symbols, matching LaTeX names. 2 | // The pass:[+ ] notation avoids asciidoctor EOL treatment of the attribute. 3 | 4 | // Special symbols - not used in [eq] spans 5 | :sym1: ✓ 6 | :sym2: † 7 | :reg: ® 8 | :trade: ™ 9 | 10 | // Math operators and logic symbols 11 | :times: × 12 | :cdot: ⋅ 13 | :plus: pass:[+ ] 14 | :geq: ≥ 15 | :leq: ≤ 16 | :neq: ≠ 17 | :leftarrow: ← 18 | :uparrow: ↑ 19 | :rightarrow: → 20 | :downarrow: ↓ 21 | :elem: ∈ 22 | :lnot: ¬ 23 | :land: ∧ 24 | :lor: ∨ 25 | :oplus: ⊕ 26 | :lceil: ⌈ 27 | :rceil: ⌉ 28 | :lfloor: ⌊ 29 | :rfloor: ⌋ 30 | :vert: | 31 | :partial: ∂ 32 | :onehalf: ½ 33 | :onequarter: ¼ 34 | :ldots: … 35 | :forall: ∀ 36 | :sqrt: √ 37 | :inf: ∞ 38 | :plusmn: ± 39 | 40 | // Greek letters 41 | :alpha: α 42 | :beta: β 43 | :gamma: γ 44 | :DeltaUpper: Δ 45 | :delta: δ 46 | :epsilon: ε 47 | :eta: η 48 | :theta: θ 49 | :lambda: λ 50 | :pi: π 51 | :rho: ρ 52 | :sigma: σ 53 | :tau: τ 54 | :phi: ϕ 55 | 56 | -------------------------------------------------------------------------------- /docs/config/change-font-size.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | fontsize = re.compile('.*font-size: ([0-9.]*)em;') 4 | with open('config/archive/khronos.css') as fp: 5 | lines = fp.readlines() 6 | text = '' 7 | for line in lines: 8 | result = fontsize.match(line) 9 | if result: 10 | oldsize = result.group(1) 11 | newsize = str(float(oldsize)*10.0/10.5) 12 | line = ('font-size: ' + newsize + 'em;').join(line.split('font-size: ' + oldsize + 'em;')) 13 | text = text + line 14 | with open('config/khronos.css','w') as fp: 15 | fp.write(text) 16 | -------------------------------------------------------------------------------- /docs/config/extension-highlighter.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 The Khronos Group Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | RUBY_ENGINE == 'opal' ? (require 'extension-highlighter/extension') : (require_relative 'extension-highlighter/extension') 16 | 17 | Extensions.register do 18 | preprocessor ExtensionHighlighterPreprocessor 19 | postprocessor AddHighlighterCSS 20 | end -------------------------------------------------------------------------------- /docs/config/katex_replace.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 The Khronos Group Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' 16 | RUBY_ENGINE == 'opal' ? (require 'katex_replace/extension') : (require_relative 'katex_replace/extension') 17 | 18 | # All the inline macros we need 19 | Asciidoctor::Extensions.register do 20 | postprocessor ReplaceMathjaxWithKatex 21 | end -------------------------------------------------------------------------------- /docs/config/katex_replace/extension.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 The Khronos Group Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' 16 | 17 | include ::Asciidoctor 18 | 19 | class ReplaceMathjaxWithKatex < Extensions::Postprocessor 20 | 21 | MathJaXScript = /' 23 | 24 | def process document, output 25 | 26 | if document.attr? 'stem' 27 | katexpath = document.attr 'katexpath' 28 | 29 | katexScript = ' 30 | 31 | 32 | 34 | ' 49 | 50 | output.sub! MathJaXScript, '' 51 | output.sub! MathJaXCDN, '' 52 | output.sub! /(?=<\/head>)/, katexScript 53 | end 54 | output 55 | end 56 | end -------------------------------------------------------------------------------- /docs/config/makeSubmit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright (c) 2016-2017 The Khronos Group Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Build Promoter submission package for a specified extension or extensions 18 | # This consists of one spec with the extension(s) and all dependencies, 19 | # one with just the dependencies, and an htmldiff of them. 20 | # 21 | # This script lives in doc/specs/vulkan/config, but is executed from the 22 | # parent directory. 23 | # 24 | # Usage: makeSubmit extension targets 25 | 26 | import argparse, copy, io, os, pdb, re, string, subprocess, sys 27 | 28 | # Ensure config/extDependency.py is up-to-date before we import it. 29 | subprocess.check_call(['make', 'config/extDependency.py']) 30 | 31 | from extDependency import * 32 | 33 | # Make a single submission target. Several are needed per document. 34 | # 35 | # outDir - where to generate intermediate and final documents 36 | # extensionList - list of extensions to include 37 | # submitName - base name of final HTML file 38 | # title - document title 39 | # target - default 'html' 40 | def makeTarget(outDir, extensionList, submitName, title, target): 41 | print('make clean_generated') 42 | print('make OUTDIR=' + outDir, 43 | 'EXTENSIONS="' + ' '.join(extensionList) + '"', 44 | 'APITITLE="' + title + '"', target) 45 | # Rename into submission directory 46 | outFile = outDir + '/html/' + submitName + '.html' 47 | print('mv', outDir + '/html/vkspec.html', outFile) 48 | # No longer needed 49 | # print('mv -n', outDir + '/katex', 'out/submit/') 50 | 51 | return outFile 52 | 53 | # Make submission for a list of required extension names 54 | def makeSubmit(submitName, required, target='html'): 55 | global extensions 56 | 57 | deps = [] 58 | for name in required: 59 | if name in extensions.keys(): 60 | for depname in extensions[name]: 61 | if (depname not in required and depname not in deps): 62 | deps.append(depname) 63 | 64 | print('echo Required extensions:', ' '.join(required)) 65 | print('echo Dependent extensions:', ' '.join(deps)) 66 | print('') 67 | 68 | # Generate shell commands to build the specs 69 | outDir = 'submit' 70 | print('mkdir -p', outDir) 71 | 72 | # Generate spec with required extensions + dependencies 73 | newSpec = makeTarget(outDir, required + deps, submitName, 74 | submitName, target) 75 | 76 | # Generate base spec with just dependencies 77 | baseSpec = makeTarget(outDir, deps, 'deps-' + submitName, 78 | '(with only dependencies of ' + submitName + ')', 79 | target) 80 | 81 | # # Reorganize and rename them, and generate the diff spec 82 | print('') 83 | print('cd scripts') 84 | print('./htmldiff', 85 | '../' + baseSpec, 86 | '../' + newSpec, 87 | '> ../submit/html/diff-' + submitName + '.html') 88 | print('cd ..') 89 | 90 | if __name__ == '__main__': 91 | parser = argparse.ArgumentParser() 92 | 93 | parser.add_argument('-title', action='store', 94 | default='vkspec', 95 | help='Set the document title') 96 | parser.add_argument('-extension', action='append', 97 | default=[], 98 | help='Specify a required extension or extensions to add to targets') 99 | 100 | results = parser.parse_args() 101 | 102 | makeSubmit(results.title, results.extension) 103 | -------------------------------------------------------------------------------- /docs/config/optimize-pdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (C) 2014-2016 OpenDevise Inc. and the Asciidoctor Project 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | # THE SOFTWARE. 22 | 23 | # Optimizes and compresses the specified PDF using Ghostscript (gs). 24 | # 25 | # [NOTE] 26 | # You need at least Ghostscript 9.10 in order for page labels defined in the 27 | # PDF to be preserved (e.g., front matter pages numbered using roman numerals). 28 | 29 | if [ -z $1 ]; then 30 | echo "Please supply a PDF file to optimize" 31 | exit 1 32 | fi 33 | 34 | if [ -z $GS ]; then 35 | GS=gs 36 | fi 37 | 38 | FILE=$1 39 | FILE_BASENAME=${FILE%.pdf} 40 | FILE_OPTIMIZED=$FILE_BASENAME-optimized.pdf 41 | FILE_PDFMARK= 42 | if [ -f "$FILE_BASENAME.pdfmark" ]; then 43 | FILE_PDFMARK="$FILE_BASENAME.pdfmark" 44 | fi 45 | DOWNSAMPLE_IMAGES=true 46 | if [ -z $IMAGE_DPI ]; then 47 | #IMAGE_DPI=150 48 | IMAGE_DPI=300 49 | fi 50 | 51 | # /prepress defaults (see http://ghostscript.com/doc/current/Ps2pdf.htm) 52 | # -d{Color,Gray,Mono}ImageDownsampleType=/Bicubic 53 | # -dAutoFilter{Color,Gray}Images=true 54 | # -dOptimize=true 55 | # -dEmbedAllFonts=true 56 | # -dSubsetFonts=true 57 | # -dColorConversionStrategy=/LeaveColorUnchanged 58 | # -dUCRandBGInfo=/Preserve 59 | # -dCompressPages=true 60 | # 61 | # other unused settings 62 | # -r72 63 | # 64 | # for info about pdfmarks, see http://milan.kupcevic.net/ghostscript-ps-pdf 65 | # 66 | # to convert to grayscale, add the following (though doesn't always work) 67 | # 68 | # -dProcessColorModel=/DeviceGray \ 69 | # -dColorConversionStrategy=/Gray \ 70 | 71 | "$GS" -q -dNOPAUSE -dBATCH -dSAFER -dNOOUTERSAVE \ 72 | -sDEVICE=pdfwrite \ 73 | -dPDFSETTINGS=/prepress \ 74 | -dCannotEmbedFontPolicy=/Warning \ 75 | -dDownsampleColorImages=$DOWNSAMPLE_IMAGES \ 76 | -dColorImageResolution=$IMAGE_DPI \ 77 | -dDownsampleGrayImages=$DOWNSAMPLE_IMAGES \ 78 | -dGrayImageResolution=$IMAGE_DPI \ 79 | -dDownsampleMonoImages=$DOWNSAMPLE_IMAGES \ 80 | -dMonoImageResolution=$IMAGE_DPI \ 81 | -sOutputFile="$FILE_OPTIMIZED" \ 82 | "$FILE" $FILE_PDFMARK 83 | 84 | exit 0 -------------------------------------------------------------------------------- /docs/config/tilde_open_block.rb: -------------------------------------------------------------------------------- 1 | require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' 2 | 3 | include ::Asciidoctor 4 | 5 | module Asciidoctor 6 | 7 | # This addition to the parser class overrides the "is_delimited_block?" 8 | # method of the core parser, adding a new block delimiter of "~~~~" for open 9 | # blocks, which can be extended to an arbitrary number of braces to allow 10 | # nesting them, which is a limitation of the existing "only two dashes" 11 | # delimiter: https://github.com/asciidoctor/asciidoctor/issues/1121 12 | # The choice of tildes is based on comments in that bug. 13 | 14 | class Parser 15 | # Storing the original method so we can still call it from the overriding 16 | # version 17 | @OLD_is_delimited_block = method(:is_delimited_block?) 18 | 19 | # Logic here matches the original Parser#is_delimited_block? method, see 20 | # there for details of base implementation. 21 | def self.is_delimited_block? line, return_match_data = false 22 | # Quick check for a single brace character before forwarding to the 23 | # original parser method. 24 | if line[0] != '~' 25 | return @OLD_is_delimited_block.(line, return_match_data) 26 | else 27 | line_len = line.length 28 | if line_len <= 4 29 | tip = line 30 | tl = line_len 31 | else 32 | tip = line[0..3] 33 | tl = 4 34 | end 35 | 36 | # Hardcoded tilde delimiter, since that's the only thing this 37 | # function deals with. 38 | if tip == '~~~~' 39 | # tip is the full line when delimiter is minimum length 40 | if tl < 4 || tl == line_len 41 | if return_match_data 42 | context = :open 43 | masq = ['comment', 'example', 'literal', 'listing', 'pass', 'quote', 'sidebar', 'source', 'verse', 'admonition', 'abstract', 'partintro'].to_set 44 | BlockMatchData.new(context, masq, tip, tip) 45 | else 46 | true 47 | end 48 | elsif %(#{tip}#{tip[-1..-1] * (line_len - tl)}) == line 49 | if return_match_data 50 | context = :open 51 | masq = ['comment', 'example', 'literal', 'listing', 'pass', 'quote', 'sidebar', 'source', 'verse', 'admonition', 'abstract', 'partintro'].to_set 52 | BlockMatchData.new(context, masq, tip, line) 53 | else 54 | true 55 | end 56 | else 57 | nil 58 | end 59 | else 60 | nil 61 | end 62 | end 63 | end 64 | end 65 | 66 | end -------------------------------------------------------------------------------- /docs/config/vulkan-macros.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 The Khronos Group Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' 16 | RUBY_ENGINE == 'opal' ? (require 'vulkan-macros/extension') : (require_relative 'vulkan-macros/extension') 17 | 18 | # All the inline macros we need 19 | Asciidoctor::Extensions.register do 20 | inline_macro CanInlineMacro 21 | inline_macro CannotInlineMacro 22 | inline_macro MayInlineMacro 23 | inline_macro MustInlineMacro 24 | inline_macro OptionalInlineMacro 25 | inline_macro RequiredInlineMacro 26 | inline_macro ShouldInlineMacro 27 | inline_macro FlinkInlineMacro 28 | inline_macro FnameInlineMacro 29 | inline_macro FtextInlineMacro 30 | inline_macro SnameInlineMacro 31 | inline_macro SlinkInlineMacro 32 | inline_macro StextInlineMacro 33 | inline_macro EnameInlineMacro 34 | inline_macro ElinkInlineMacro 35 | inline_macro EtextInlineMacro 36 | inline_macro PnameInlineMacro 37 | inline_macro PtextInlineMacro 38 | inline_macro DnameInlineMacro 39 | inline_macro DlinkInlineMacro 40 | inline_macro TnameInlineMacro 41 | inline_macro TlinkInlineMacro 42 | inline_macro BasetypeInlineMacro 43 | inline_macro CodeInlineMacro 44 | inline_macro AttrInlineMacro 45 | inline_macro TagInlineMacro 46 | end 47 | -------------------------------------------------------------------------------- /docs/config/vulkan-macros/extension.rb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 The Khronos Group Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' 16 | 17 | include ::Asciidoctor 18 | 19 | class VulkanInlineMacroBase < Extensions::InlineMacroProcessor 20 | use_dsl 21 | using_format :short 22 | end 23 | 24 | class NormativeInlineMacroBase < VulkanInlineMacroBase 25 | def text 26 | 'normative' 27 | end 28 | 29 | def process parent, target, attributes 30 | '' + text + '' 31 | end 32 | end 33 | 34 | class LinkInlineMacroBase < VulkanInlineMacroBase 35 | def process parent, target, attributes 36 | if parent.document.attributes['cross-file-links'] 37 | return Inline.new(parent, :anchor, target, :type => :link, :target => (target + '.html')).convert 38 | else 39 | return Inline.new(parent, :anchor, target, :type => :xref, :target => ('#' + target), :attributes => {'fragment' => target, 'refid' => target}).convert 40 | end 41 | end 42 | end 43 | 44 | class CodeInlineMacroBase < VulkanInlineMacroBase 45 | def process parent, target, attributes 46 | '' + target + '' 47 | end 48 | end 49 | 50 | class StrongInlineMacroBase < VulkanInlineMacroBase 51 | def process parent, target, attributes 52 | '' + target + '' 53 | end 54 | end 55 | 56 | class ParamInlineMacroBase < VulkanInlineMacroBase 57 | def process parent, target, attributes 58 | '' + target + '' 59 | end 60 | end 61 | 62 | class CanInlineMacro < NormativeInlineMacroBase 63 | named :can 64 | match /can:(\w*)/ 65 | 66 | def text 67 | 'can' 68 | end 69 | end 70 | 71 | class CannotInlineMacro < NormativeInlineMacroBase 72 | named :cannot 73 | match /cannot:(\w*)/ 74 | 75 | def text 76 | 'cannot' 77 | end 78 | end 79 | 80 | class MayInlineMacro < NormativeInlineMacroBase 81 | named :may 82 | match /may:(\w*)/ 83 | 84 | def text 85 | 'may' 86 | end 87 | end 88 | 89 | class MustInlineMacro < NormativeInlineMacroBase 90 | named :must 91 | match /must:(\w*)/ 92 | 93 | def text 94 | 'must' 95 | end 96 | end 97 | 98 | class OptionalInlineMacro < NormativeInlineMacroBase 99 | named :optional 100 | match /optional:(\w*)/ 101 | 102 | def text 103 | 'optional' 104 | end 105 | end 106 | 107 | class RequiredInlineMacro < NormativeInlineMacroBase 108 | named :required 109 | match /required:(\w*)/ 110 | 111 | def text 112 | 'required' 113 | end 114 | end 115 | 116 | class ShouldInlineMacro < NormativeInlineMacroBase 117 | named :should 118 | match /should:(\w*)/ 119 | 120 | def text 121 | 'should' 122 | end 123 | end 124 | 125 | class FlinkInlineMacro < LinkInlineMacroBase 126 | named :flink 127 | match /flink:(\w+)/ 128 | end 129 | 130 | class FnameInlineMacro < StrongInlineMacroBase 131 | named :fname 132 | match /fname:(\w+)/ 133 | end 134 | 135 | class FtextInlineMacro < StrongInlineMacroBase 136 | named :ftext 137 | match /ftext:([\w\*]+)/ 138 | end 139 | 140 | class SnameInlineMacro < CodeInlineMacroBase 141 | named :sname 142 | match /sname:(\w+)/ 143 | end 144 | 145 | class SlinkInlineMacro < LinkInlineMacroBase 146 | named :slink 147 | match /slink:(\w+)/ 148 | end 149 | 150 | class StextInlineMacro < CodeInlineMacroBase 151 | named :stext 152 | match /stext:([\w\*]+)/ 153 | end 154 | 155 | class EnameInlineMacro < CodeInlineMacroBase 156 | named :ename 157 | match /ename:(\w+)/ 158 | end 159 | 160 | class ElinkInlineMacro < LinkInlineMacroBase 161 | named :elink 162 | match /elink:(\w+)/ 163 | end 164 | 165 | class EtextInlineMacro < CodeInlineMacroBase 166 | named :etext 167 | match /etext:([\w\*]+)/ 168 | end 169 | 170 | class PnameInlineMacro < ParamInlineMacroBase 171 | named :pname 172 | match /pname:((\w[\w.]*)*\w+)/ 173 | end 174 | 175 | class PtextInlineMacro < ParamInlineMacroBase 176 | named :ptext 177 | match /ptext:((\w[\w.]*)*\w+)/ 178 | end 179 | 180 | class DnameInlineMacro < CodeInlineMacroBase 181 | named :dname 182 | match /dname:(\w+)/ 183 | end 184 | 185 | class DlinkInlineMacro < LinkInlineMacroBase 186 | named :dlink 187 | match /dlink:(\w+)/ 188 | end 189 | 190 | class TnameInlineMacro < CodeInlineMacroBase 191 | named :tname 192 | match /tname:(\w+)/ 193 | end 194 | 195 | class TlinkInlineMacro < LinkInlineMacroBase 196 | named :tlink 197 | match /tlink:(\w+)/ 198 | end 199 | 200 | class BasetypeInlineMacro < CodeInlineMacroBase 201 | named :basetype 202 | match /basetype:(\w+)/ 203 | end 204 | 205 | class CodeInlineMacro < StrongInlineMacroBase 206 | named :code 207 | match /code:(\w+)/ 208 | end 209 | 210 | # The tag: and attr: macros are only used in registry.txt 211 | 212 | class TagInlineMacro < StrongInlineMacroBase 213 | named :tag 214 | match /tag:(\w+)/ 215 | end 216 | 217 | class AttrInlineMacro < StrongInlineMacroBase 218 | named :attr 219 | match /attr:(\w+)/ 220 | end 221 | 222 | -------------------------------------------------------------------------------- /docs/copyright-spec.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013-2023 The Khronos Group Inc. 2 | 3 | This specification is protected by copyright laws and contains material 4 | proprietary to Khronos. 5 | Except as described by these terms, it or any components may not be 6 | reproduced, republished, distributed, transmitted, displayed, broadcast or 7 | otherwise exploited in any manner without the express prior written 8 | permission of Khronos. 9 | 10 | This specification has been created under the Khronos Intellectual Property 11 | Rights Policy, which is Attachment A of the Khronos Group Membership 12 | Agreement available at www.khronos.org/files/member_agreement.pdf. 13 | Khronos Group grants a conditional copyright license to use and reproduce 14 | the unmodified specification for any purpose, without fee or royalty, EXCEPT 15 | no licenses to any patent, trademark or other intellectual property rights 16 | are granted under these terms. 17 | Parties desiring to implement the specification and make use of Khronos 18 | trademarks in relation to that implementation, and receive reciprocal patent 19 | license protection under the Khronos IP Policy must become Adopters and 20 | confirm the implementation as conformant under the process defined by 21 | Khronos for this specification; see https://www.khronos.org/adopters. 22 | 23 | Khronos makes no, and expressly disclaims any, representations or 24 | warranties, express or implied, regarding this specification, including, 25 | without limitation: merchantability, fitness for a particular purpose, 26 | non-infringement of any intellectual property, correctness, accuracy, 27 | completeness, timeliness, and reliability. 28 | Under no circumstances will Khronos, or any of its Promoters, Contributors 29 | or Members, or their respective partners, officers, directors, employees, 30 | agents or representatives be liable for any damages, whether direct, 31 | indirect, special or consequential damages for lost revenues, lost profits, 32 | or otherwise, arising from or in connection with these materials. 33 | 34 | Khronos is a registered trademark, and OpenVX is a trademark of The Khronos 35 | Group Inc. 36 | OpenCL is a trademark of Apple Inc., used under license by Khronos. 37 | All other product names, trademarks, and/or company names are used solely 38 | for identification and belong to their respective owners. 39 | -------------------------------------------------------------------------------- /docs/examples/vx_arrayrange.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | vx_array example_array_of_custom_type_and_initialization(vx_context context) 21 | { 22 | // tag::array_define[] 23 | typedef struct _mystruct { 24 | vx_uint32 some_uint; 25 | vx_float64 some_double; 26 | } mystruct; 27 | #define MY_NUM_ITEMS (10) 28 | vx_enum mytype = vxRegisterUserStruct(context, sizeof(mystruct)); 29 | vx_array array = vxCreateArray(context, mytype, MY_NUM_ITEMS); 30 | // end::array_define[] 31 | // tag::array_query[] 32 | vx_size num_items = 0; 33 | vxQueryArray(array, VX_ARRAY_NUMITEMS, &num_items, sizeof(num_items)); 34 | // end::array_define[] 35 | { 36 | // tag::array_range[] 37 | vx_size i, stride = sizeof(vx_size); 38 | void *base = NULL; 39 | vx_map_id map_id; 40 | /* access entire array at once */ 41 | vxMapArrayRange(array, 0, num_items, &map_id, &stride, &base, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); 42 | for (i = 0; i < num_items; i++) 43 | { 44 | vxArrayItem(mystruct, base, i, stride).some_uint += i; 45 | vxArrayItem(mystruct, base, i, stride).some_double = 3.14f; 46 | } 47 | vxUnmapArrayRange(array, map_id); 48 | // end::array_range[] 49 | 50 | // tag::array_subaccess[] 51 | /* access each array item individually */ 52 | for (i = 0; i < num_items; i++) 53 | { 54 | mystruct *myptr = NULL; 55 | vxMapArrayRange(array, i, i+1, &map_id, &stride, (void **)&myptr, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); 56 | myptr->some_uint += 1; 57 | myptr->some_double = 3.14f; 58 | vxUnmapArrayRange(array, map_id); 59 | } 60 | // end::array_subaccess[] 61 | } 62 | return array; 63 | } 64 | -------------------------------------------------------------------------------- /docs/examples/vx_callback.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | // tag::callback[] 21 | #define MY_DESIRED_THRESHOLD (10) 22 | vx_action analyze_brightness(vx_node node) { 23 | // extract the max value 24 | vx_action action = VX_ACTION_ABANDON; 25 | vx_parameter pmax = vxGetParameterByIndex(node, 2); // Max Value 26 | if (pmax) { 27 | vx_scalar smax = 0; 28 | vxQueryParameter(pmax, VX_PARAMETER_REF, &smax, sizeof(smax)); 29 | if (smax) { 30 | vx_uint8 value = 0u; 31 | vxCopyScalar(smax, &value, VX_READ_ONLY, VX_MEMORY_TYPE_HOST); 32 | if (value >= MY_DESIRED_THRESHOLD) { 33 | action = VX_ACTION_CONTINUE; 34 | } 35 | vxReleaseScalar(&smax); 36 | } 37 | vxReleaseParameter(&pmax); 38 | } 39 | return action; 40 | } 41 | // end::callback[] 42 | 43 | vx_status vx_example_callback(vx_context context, vx_image input, vx_image output) { 44 | vx_status status = VX_SUCCESS; 45 | // tag::graph_setup[] 46 | vx_graph graph = vxCreateGraph(context); 47 | status = vxGetStatus((vx_reference)graph); 48 | if (status == VX_SUCCESS) { 49 | vx_uint8 lmin = 0, lmax = 0; 50 | vx_uint32 minCount = 0, maxCount = 0; 51 | vx_scalar scalars[] = { 52 | vxCreateScalar(context, VX_TYPE_UINT8, &lmin), 53 | vxCreateScalar(context, VX_TYPE_UINT8, &lmax), 54 | vxCreateScalar(context, VX_TYPE_UINT32, &minCount), 55 | vxCreateScalar(context, VX_TYPE_UINT32, &maxCount), 56 | }; 57 | vx_array arrays[] = { 58 | vxCreateArray(context, VX_TYPE_COORDINATES2D, 1), 59 | vxCreateArray(context, VX_TYPE_COORDINATES2D, 1) 60 | }; 61 | vx_node nodes[] = { 62 | vxMinMaxLocNode(graph, input, scalars[0], scalars[1], arrays[0], arrays[1], scalars[2], scalars[3]), 63 | /// other nodes 64 | }; 65 | status = vxAssignNodeCallback(nodes[0], &analyze_brightness); 66 | // do other 67 | } 68 | // end::graph_setup[] 69 | return status; 70 | } 71 | -------------------------------------------------------------------------------- /docs/examples/vx_convolution.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | vx_status example_conv(vx_context context) 21 | { 22 | // tag::assign[] 23 | // A horizontal Scharr gradient operator with different scale. 24 | vx_int16 gx[3][3] = { 25 | { 3, 0, -3}, 26 | { 10, 0,-10}, 27 | { 3, 0, -3}, 28 | }; 29 | vx_uint32 scale = 8; 30 | vx_convolution scharr_x = vxCreateConvolution(context, 3, 3); 31 | vxCopyConvolutionCoefficients(scharr_x, (vx_int16*)gx, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST); 32 | vxSetConvolutionAttribute(scharr_x, VX_CONVOLUTION_SCALE, &scale, sizeof(scale)); 33 | // end::assign[] 34 | vxReleaseConvolution(&scharr_x); 35 | return VX_SUCCESS; 36 | } 37 | -------------------------------------------------------------------------------- /docs/examples/vx_extensions.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | vx_status vx_example_extensions(vx_context context) { 24 | // tag::extensions[] 25 | vx_char *tmp, *extensions = NULL; 26 | vx_size size = 0; 27 | vxQueryContext(context,VX_CONTEXT_EXTENSIONS_SIZE,&size,sizeof(size)); 28 | extensions = malloc(size); 29 | vxQueryContext(context,VX_CONTEXT_EXTENSIONS, 30 | extensions, size); 31 | // end::extensions[] 32 | tmp = strtok(extensions, " "); 33 | do { 34 | if (tmp) 35 | printf("Extension: %s\n", tmp); 36 | tmp = strtok(NULL, " "); 37 | } while (tmp); 38 | free(extensions); 39 | return VX_SUCCESS; 40 | } 41 | -------------------------------------------------------------------------------- /docs/examples/vx_factory_corners.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /*! 19 | * \file vx_factory_corners.c 20 | * \example vx_factory_corners.c 21 | * \author Erik Rainey 22 | * \brief An example of a graph to pre-process image data for a Corner Registration Graph. 23 | */ 24 | 25 | #include 26 | 27 | // tag::factory[] 28 | /*! \brief An example of Corner Detection Graph Factory. 29 | * \ingroup group_example 30 | */ 31 | vx_graph vxCornersGraphFactory(vx_context context) 32 | { 33 | vx_status status = VX_SUCCESS; 34 | vx_uint32 i; 35 | vx_float32 strength_thresh = 10000.0f; 36 | vx_float32 r = 1.5f; 37 | vx_float32 sensitivity = 0.14f; 38 | vx_int32 window_size = 3; 39 | vx_int32 block_size = 3; 40 | vx_enum channel = VX_CHANNEL_Y; 41 | vx_graph graph = vxCreateGraph(context); 42 | if (vxGetStatus((vx_reference)graph) == VX_SUCCESS) 43 | { 44 | vx_image virts[] = { 45 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 46 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 47 | }; 48 | vx_kernel kernels[] = { 49 | vxGetKernelByEnum(context, VX_KERNEL_CHANNEL_EXTRACT), 50 | vxGetKernelByEnum(context, VX_KERNEL_MEDIAN_3x3), 51 | vxGetKernelByEnum(context, VX_KERNEL_HARRIS_CORNERS), 52 | }; 53 | vx_node nodes[dimof(kernels)] = { 54 | vxCreateGenericNode(graph, kernels[0]), 55 | vxCreateGenericNode(graph, kernels[1]), 56 | vxCreateGenericNode(graph, kernels[2]), 57 | }; 58 | vx_scalar scalars[] = { 59 | vxCreateScalar(context, VX_TYPE_ENUM, &channel), 60 | vxCreateScalar(context, VX_TYPE_FLOAT32, &strength_thresh), 61 | vxCreateScalar(context, VX_TYPE_FLOAT32, &r), 62 | vxCreateScalar(context, VX_TYPE_FLOAT32, &sensitivity), 63 | vxCreateScalar(context, VX_TYPE_INT32, &window_size), 64 | vxCreateScalar(context, VX_TYPE_INT32, &block_size), 65 | }; 66 | vx_parameter parameters[] = { 67 | vxGetParameterByIndex(nodes[0], 0), 68 | vxGetParameterByIndex(nodes[2], 6) 69 | }; 70 | // Channel Extract 71 | status |= vxAddParameterToGraph(graph, parameters[0]); 72 | status |= vxSetParameterByIndex(nodes[0], 1, (vx_reference)scalars[0]); 73 | status |= vxSetParameterByIndex(nodes[0], 2, (vx_reference)virts[0]); 74 | // Median Filter 75 | status |= vxSetParameterByIndex(nodes[1], 0, (vx_reference)virts[0]); 76 | status |= vxSetParameterByIndex(nodes[1], 1, (vx_reference)virts[1]); 77 | // Harris Corners 78 | status |= vxSetParameterByIndex(nodes[2], 0, (vx_reference)virts[1]); 79 | status |= vxSetParameterByIndex(nodes[2], 1, (vx_reference)scalars[1]); 80 | status |= vxSetParameterByIndex(nodes[2], 2, (vx_reference)scalars[2]); 81 | status |= vxSetParameterByIndex(nodes[2], 3, (vx_reference)scalars[3]); 82 | status |= vxSetParameterByIndex(nodes[2], 4, (vx_reference)scalars[4]); 83 | status |= vxSetParameterByIndex(nodes[2], 5, (vx_reference)scalars[5]); 84 | status |= vxAddParameterToGraph(graph, parameters[1]); 85 | 86 | for (i = 0; i < dimof(scalars); i++) 87 | { 88 | vxReleaseScalar(&scalars[i]); 89 | } 90 | for (i = 0; i < dimof(virts); i++) 91 | { 92 | vxReleaseImage(&virts[i]); 93 | } 94 | for (i = 0; i < dimof(kernels); i++) 95 | { 96 | vxReleaseKernel(&kernels[i]); 97 | } 98 | for (i = 0; i < dimof(nodes);i++) 99 | { 100 | vxReleaseNode(&nodes[i]); 101 | } 102 | for (i = 0; i < dimof(parameters); i++) 103 | { 104 | vxReleaseParameter(¶meters[i]); 105 | } 106 | } 107 | return graph; 108 | } 109 | // end::factory[] 110 | -------------------------------------------------------------------------------- /docs/examples/vx_imagepatch.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | #include 18 | 19 | #define PATCH_DIM 16 20 | 21 | vx_status example_imagepatch(vx_context context) 22 | { 23 | // tag::imagepatch[] 24 | vx_status status = VX_SUCCESS; 25 | void *base_ptr = NULL; 26 | vx_uint32 width = 640, height = 480, plane = 0; 27 | vx_image image = vxCreateImage(context, width, height, VX_DF_IMAGE_U8); 28 | vx_rectangle_t rect; 29 | vx_imagepatch_addressing_t addr; 30 | vx_map_id map_id; 31 | 32 | rect.start_x = rect.start_y = 0; 33 | rect.end_x = rect.end_y = PATCH_DIM; 34 | 35 | status = vxMapImagePatch(image, &rect, plane, &map_id, 36 | &addr, &base_ptr, 37 | VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); 38 | if (status == VX_SUCCESS) 39 | { 40 | vx_uint32 x,y,i,j; 41 | vx_uint8 pixel = 0; 42 | 43 | /* a couple addressing options */ 44 | 45 | /* use linear addressing function/macro */ 46 | for (i = 0; i < addr.dim_x*addr.dim_y; i++) { 47 | vx_uint8 *ptr2 = vxFormatImagePatchAddress1d(base_ptr, 48 | i, &addr); 49 | *ptr2 = pixel; 50 | } 51 | 52 | /* 2d addressing option */ 53 | for (y = 0; y < addr.dim_y; y+=addr.step_y) { 54 | for (x = 0; x < addr.dim_x; x+=addr.step_x) { 55 | vx_uint8 *ptr2 = vxFormatImagePatchAddress2d(base_ptr, 56 | x, y, &addr); 57 | *ptr2 = pixel; 58 | } 59 | } 60 | 61 | /* direct addressing by client 62 | * for subsampled planes, scale will change 63 | */ 64 | for (y = 0; y < addr.dim_y; y+=addr.step_y) { 65 | for (x = 0; x < addr.dim_x; x+=addr.step_x) { 66 | vx_uint8 *tmp = (vx_uint8 *)base_ptr; 67 | i = ((addr.stride_y*y*addr.scale_y) / 68 | VX_SCALE_UNITY) + 69 | ((addr.stride_x*x*addr.scale_x) / 70 | VX_SCALE_UNITY); 71 | tmp[i] = pixel; 72 | } 73 | } 74 | 75 | /* more efficient direct addressing by client. 76 | * for subsampled planes, scale will change. 77 | */ 78 | for (y = 0; y < addr.dim_y; y+=addr.step_y) { 79 | j = (addr.stride_y*y*addr.scale_y)/VX_SCALE_UNITY; 80 | for (x = 0; x < addr.dim_x; x+=addr.step_x) { 81 | vx_uint8 *tmp = (vx_uint8 *)base_ptr; 82 | i = j + (addr.stride_x*x*addr.scale_x) / 83 | VX_SCALE_UNITY; 84 | tmp[i] = pixel; 85 | } 86 | } 87 | 88 | /* this commits the data back to the image. 89 | */ 90 | status = vxUnmapImagePatch(image, map_id); 91 | } 92 | vxReleaseImage(&image); 93 | // end::imagepatch[] 94 | return status; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /docs/examples/vx_imagepatch_u1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #define PATCH_DIM 16 21 | 22 | vx_status example_imagepatch_u1(vx_context context) 23 | { 24 | // tag::imagepatch_u1[] 25 | vx_status status = VX_SUCCESS; 26 | void *base_ptr = NULL; 27 | vx_uint32 width = 640, height = 480, plane = 0; 28 | vx_image image = vxCreateImage(context, width, height, VX_DF_IMAGE_U1); 29 | vx_rectangle_t rect; 30 | vx_imagepatch_addressing_t addr; 31 | vx_map_id map_id; 32 | 33 | rect.start_x = rect.start_y = 0; 34 | rect.end_x = rect.end_y = PATCH_DIM; 35 | 36 | /* special restrictions when addressing image patches in U1 images */ 37 | assert(rect.start_x % 8 == 0); 38 | 39 | status = vxMapImagePatch(image, &rect, plane, &map_id, 40 | &addr, &base_ptr, 41 | VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST, 0); 42 | 43 | /* special restrictions on binary images */ 44 | assert(addr.stride_x == 0); 45 | assert(addr.stride_x_bits == 1); 46 | 47 | if (status == VX_SUCCESS) 48 | { 49 | vx_uint32 x, y, i, j, xb; 50 | vx_uint8 pixel = 0; 51 | vx_uint8 mask, value; 52 | 53 | /* a couple addressing options */ 54 | 55 | /* use linear addressing function/macro to address bytes */ 56 | for (i = 0; i < addr.dim_x*addr.dim_y; i += 8) { 57 | vx_uint8 *ptr2 = (vx_uint8*)vxFormatImagePatchAddress1d(base_ptr, i, &addr); 58 | 59 | /* address and set individual bits/pixels within the byte */ 60 | for (xb = 0; xb < 8; xb++) { 61 | mask = 1 << xb; 62 | value = pixel << xb; 63 | *ptr2 = (*ptr2 & ~mask) | value; 64 | } 65 | } 66 | 67 | /* 2d addressing option */ 68 | for (y = 0; y < addr.dim_y; y+=addr.step_y) { 69 | 70 | /* address bytes */ 71 | for (x = 0; x < addr.dim_x; x += 8) { 72 | vx_uint8 *ptr2 = (vx_uint8*)vxFormatImagePatchAddress2d(base_ptr, x, y, &addr); 73 | 74 | /* address and set individual bits/pixels within the byte */ 75 | for (xb = 0; xb < 8; xb++) { 76 | mask = 1 << xb; 77 | value = pixel << xb; 78 | *ptr2 = (*ptr2 & ~mask) | value; 79 | } 80 | } 81 | } 82 | 83 | /* direct addressing by client */ 84 | for (y = 0; y < addr.dim_y; y+=addr.step_y) { 85 | j = addr.stride_y*y; 86 | 87 | /* address bytes */ 88 | for (x = 0; x < addr.dim_x; x += 8) { 89 | vx_uint8 *tmp = (vx_uint8 *)base_ptr; 90 | i = j + x/8; 91 | vx_uint8 *ptr2 = &tmp[i]; 92 | 93 | /* address and set individual bits/pixels within the byte */ 94 | for (xb = 0; xb < 8; xb++) { 95 | mask = 1 << xb; 96 | value = pixel << xb; 97 | *ptr2 = (*ptr2 & ~mask) | value; 98 | } 99 | } 100 | } 101 | 102 | /* this commits the data back to the image */ 103 | status = vxUnmapImagePatch(image, map_id); 104 | } 105 | vxReleaseImage(&image); 106 | // end::imagepatch_u1[] 107 | return status; 108 | } 109 | -------------------------------------------------------------------------------- /docs/examples/vx_independent.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2013-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | #include 18 | 19 | vx_status run_example_parallel(void) 20 | { 21 | vx_status status = VX_SUCCESS; 22 | // tag::independent[] 23 | vx_context context = vxCreateContext(); 24 | vx_image images[] = { 25 | vxCreateImage(context, 640, 480, VX_DF_IMAGE_UYVY), 26 | vxCreateImage(context, 640, 480, VX_DF_IMAGE_S16), 27 | vxCreateImage(context, 640, 480, VX_DF_IMAGE_U8), 28 | }; 29 | vx_graph graph = vxCreateGraph(context); 30 | vx_image virts[] = { 31 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 32 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 33 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 34 | vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_VIRT), 35 | }; 36 | 37 | vxChannelExtractNode(graph, images[0], VX_CHANNEL_Y, virts[0]), 38 | vxGaussian3x3Node(graph, virts[0], virts[1]), 39 | vxSobel3x3Node(graph, virts[1], virts[2], virts[3]), 40 | vxMagnitudeNode(graph, virts[2], virts[3], images[1]), 41 | vxPhaseNode(graph, virts[2], virts[3], images[2]), 42 | 43 | status = vxVerifyGraph(graph); 44 | if (status == VX_SUCCESS) 45 | { 46 | status = vxProcessGraph(graph); 47 | } 48 | vxReleaseContext(&context); /* this will release everything */ 49 | // end::independent[] 50 | return status; 51 | } 52 | -------------------------------------------------------------------------------- /docs/examples/vx_kernels.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2013-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #if defined(EXPERIMENTAL_USE_VARIANTS) 21 | #include 22 | #endif 23 | #if defined(EXPERIMENTAL_USE_TARGET) 24 | #include 25 | #endif 26 | 27 | 28 | vx_node vx_create_specific_sobel(vx_context context, vx_graph graph, vx_bool easy) 29 | { 30 | vx_node n = 0; 31 | if (easy == vx_false_e) { 32 | // tag::firstmethod[] 33 | vx_kernel kernel = vxGetKernelByEnum(context, VX_KERNEL_SOBEL_3x3); 34 | vx_node node = vxCreateGenericNode(graph, kernel); 35 | // end::firstmethod[] 36 | #if defined(EXPERIMENTAL_USE_TARGET) 37 | vx_target target = vxGetTargetByName(context, "gpu"); 38 | vxAssignNodeAffinity(node, target); 39 | #endif 40 | #if defined(EXPERIMENTAL_USE_VARIANTS) 41 | // tag::variant-firstmethod[] 42 | vxChooseKernelVariant(node, "faster"); 43 | // end::variant-firstmethod[] 44 | #endif 45 | n = node; 46 | } else { 47 | #if defined(EXPERIMENTAL_USE_VARIANTS) 48 | // tag::variant-secondmethod[] 49 | #if defined(EXPERIMENTAL_USE_TARGET) 50 | vx_kernel kernel = vxGetKernelByName(context, "cpu:org.khronos.openvx.sobel3x3:faster"); 51 | #else 52 | vx_kernel kernel = vxGetKernelByName(context, "org.khronos.openvx.sobel3x3:faster"); 53 | #endif 54 | vx_node node = vxCreateGenericNode(graph, kernel); 55 | // end::variant-secondmethod[] 56 | #else /*defined(EXPERIMENTAL_USE_VARIANTS)*/ 57 | // tag::secondmethod[] 58 | vx_kernel kernel = vxGetKernelByName(context, "org.khronos.openvx.sobel_3x3"); 59 | vx_node node = vxCreateGenericNode(graph, kernel); 60 | // end::secondmethod[] 61 | #endif 62 | n = node; 63 | } 64 | return n; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /docs/examples/vx_khr_pipelining_sample_vendor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017 The Khronos Group Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and/or associated documentation files (the 6 | * "Materials"), to deal in the Materials without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Materials, and to 9 | * permit persons to whom the Materials are furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included 13 | * in all copies or substantial portions of the Materials. 14 | * 15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS 16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS 17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT 18 | * https://www.khronos.org/registry/ 19 | * 20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 27 | */ 28 | #ifndef _APP_H_ 29 | #define _APP_H_ 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /* This file has stub APIs and vendor specific API place holders 36 | * Actual implementation of these API will be vendor specific or 37 | * application specific 38 | */ 39 | 40 | 41 | /* Open and start Display device */ 42 | void DisplayDeviceOpen(int *fd, vx_uint32 width, vx_uint32 height, vx_enum df); 43 | /* Stop and close Display device */ 44 | void DisplayDeviceClose(int *fd); 45 | /* Swap buffer with a display device */ 46 | void DisplayDeviceSwapHandles(int fd, vx_reference new_buf, vx_reference *old_buf); 47 | 48 | /* Open capture device */ 49 | void CaptureDeviceOpen(int *fd, vx_uint32 width, vx_uint32 height, vx_enum df); 50 | /* Start capture device */ 51 | void CaptureDeviceStart(int fd); 52 | /* Stop capture device */ 53 | void CaptureDeviceStop(int fd); 54 | /* Close capture device */ 55 | void CaptureDeviceClose(int *fd); 56 | /* Swap buffer with capture device */ 57 | void CaptureDeviceSwapHandles(int fd, vx_reference empty_buf, vx_reference *full_buf); 58 | /* alloc buffers for capturing with capture device */ 59 | void CaptureDeviceAllocHandles(int fd, vx_reference bufs[], int num_bufs); 60 | /* free buffers previously allocated */ 61 | void CaptureDeviceFreeHandles(int fd, vx_reference bufs[], int num_bufs); 62 | 63 | /* API to check if application loop should exit or not */ 64 | vx_bool CheckExit(); 65 | /* API to wait/pend until user defined exit condition occurs */ 66 | void WaitExit(); 67 | 68 | /* get input and output buffers for next batch processing */ 69 | void get_input_output_batch(vx_image *in_refs, vx_image *out_refs, 70 | vx_uint32 max_batch_size, 71 | vx_uint32 *actual_batch_size); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /docs/examples/vx_lib_xyz.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | #ifndef _OPENVX_EXT_XYZ_H_ 20 | #define _OPENVX_EXT_XYZ_H_ 21 | 22 | /*! 23 | * \file 24 | * \brief An example of how to wrap a User Extension Kernel. 25 | * 26 | * \defgroup group_xyz_ext The Example User Kernel Extension 27 | * 28 | */ 29 | 30 | #include 31 | 32 | /*! 33 | * \file vx_ext_xyz.h 34 | * \brief The example header for how to write a user mode extension to OpenVX. 35 | */ 36 | 37 | /*! \brief The XYZ Data area in bytes 38 | * \ingroup group_xyz_ext 39 | */ 40 | #define XYZ_DATA_AREA (1024) 41 | 42 | /*! \brief The required number of items in the temp array 43 | * \ingroup group_xyz_ext 44 | */ 45 | #define XYZ_TEMP_NUMITEMS (374) 46 | 47 | /*! \brief The minimum value of the scalar for the XYZ Kernel. 48 | * \ingroup group_xyz_ext 49 | */ 50 | #define XYZ_VALUE_MIN (-10) 51 | 52 | /*! \brief The maximum value of the scalar for the XYZ Kernel. 53 | * \ingroup group_xyz_ext 54 | */ 55 | #define XYZ_VALUE_MAX (10) 56 | 57 | // tag::KERNEL_ENUM[] 58 | #define VX_KERNEL_NAME_KHR_XYZ "org.khronos.example.xyz" 59 | /*! \brief The XYZ Example Library Set 60 | * \ingroup group_xyz_ext 61 | */ 62 | #define VX_LIBRARY_XYZ (0x3) // assigned from Khronos, vendors control their own 63 | 64 | /*! \brief The list of XYZ Kernels. 65 | * \ingroup group_xyz_ext 66 | */ 67 | enum vx_kernel_xyz_ext_e { 68 | /*! \brief The Example User Defined Kernel */ 69 | VX_KERNEL_KHR_XYZ = VX_KERNEL_BASE(VX_ID_DEFAULT, VX_LIBRARY_XYZ) + 0x0, 70 | // up to 0xFFF kernel enums can be created. 71 | }; 72 | // end::KERNEL_ENUM[] 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | // tag::node[] 79 | /*! \brief [Graph] This is an example ISV or OEM provided node which executes 80 | * in the Graph to call the XYZ kernel. 81 | * \param [in] graph The handle to the graph in which to instantiate the node. 82 | * \param [in] input The input image. 83 | * \param [in] value The input scalar value 84 | * \param [out] output The output image. 85 | * \param [in,out] temp A temp array for some data which is needed for 86 | * every iteration. 87 | * \ingroup group_example_kernel 88 | */ 89 | vx_node vxXYZNode(vx_graph graph, vx_image input, vx_uint32 value, vx_image output, vx_array temp); 90 | // end::node[] 91 | 92 | // tag::vxu[] 93 | /*! \brief [Immediate] This is an example of an immediate mode version of the XYZ node. 94 | * \param [in] context The overall context of the implementation. 95 | * \param [in] input The input image. 96 | * \param [in] value The input scalar value 97 | * \param [out] output The output image. 98 | * \param [in,out] temp A temp array for some data which is needed for 99 | * every iteration. 100 | * \ingroup group_example_kernel 101 | */ 102 | vx_status vxuXYZ(vx_context context, vx_image input, vx_uint32 value, vx_image output, vx_array temp); 103 | // end::vxu[] 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /docs/examples/vx_matrix_access.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #if __STDC_VERSION__ >= 199901L 22 | #define OPENVX_USE_C99 23 | #endif 24 | 25 | vx_matrix example_random_matrix(vx_context context) 26 | { 27 | // tag::matrix[] 28 | const vx_size columns = 3; 29 | const vx_size rows = 4; 30 | vx_matrix matrix = vxCreateMatrix(context, VX_TYPE_FLOAT32, columns, rows); 31 | vx_status status = vxGetStatus((vx_reference)matrix); 32 | if (status == VX_SUCCESS) 33 | { 34 | vx_int32 j, i; 35 | #if defined(OPENVX_USE_C99) 36 | vx_float32 mat[rows][columns]; /* note: row major */ 37 | #else 38 | vx_float32 *mat = (vx_float32 *)malloc(rows*columns*sizeof(vx_float32)); 39 | #endif 40 | if (vxCopyMatrix(matrix, mat, VX_READ_ONLY, VX_MEMORY_TYPE_HOST) == VX_SUCCESS) { 41 | for (j = 0; j < (vx_int32)rows; j++) 42 | for (i = 0; i < (vx_int32)columns; i++) 43 | #if defined(OPENVX_USE_C99) 44 | mat[j][i] = (vx_float32)rand()/(vx_float32)RAND_MAX; 45 | #else 46 | mat[j*columns + i] = (vx_float32)rand()/(vx_float32)RAND_MAX; 47 | #endif 48 | vxCopyMatrix(matrix, mat, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST); 49 | } 50 | #if !defined(OPENVX_USE_C99) 51 | free(mat); 52 | #endif 53 | } 54 | // end::matrix[] 55 | return matrix; 56 | } 57 | -------------------------------------------------------------------------------- /docs/examples/vx_parameters.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | /*! 21 | * \file vx_parameters.c 22 | * \example vx_parameters.c 23 | * \author Erik Rainey 24 | */ 25 | 26 | void example_explore_parameters(vx_context context, vx_kernel kernel) 27 | { 28 | vx_uint32 p, numParams = 0; 29 | vx_graph graph = vxCreateGraph(context); 30 | vx_node node = vxCreateGenericNode(graph, kernel); 31 | vxQueryKernel(kernel, VX_KERNEL_PARAMETERS, &numParams, sizeof(numParams)); 32 | for (p = 0; p < numParams; p++) 33 | { 34 | // tag::getting_ref[] 35 | vx_parameter param = vxGetParameterByIndex(node, p); 36 | vx_reference ref; 37 | vxQueryParameter(param, VX_PARAMETER_REF, &ref, sizeof(ref)); 38 | // end::getting_ref[] 39 | if (ref) 40 | { 41 | // tag::getting_type[] 42 | vx_enum type; 43 | vxQueryParameter(param, VX_PARAMETER_TYPE, &type, sizeof(type)); 44 | /* cast the ref to the correct vx_. Atomics are now vx_scalar */ 45 | // end::getting_type[] 46 | } 47 | vxReleaseParameter(¶m); 48 | } 49 | vxReleaseNode(&node); 50 | vxReleaseGraph(&graph); 51 | } 52 | -------------------------------------------------------------------------------- /docs/examples/vx_tiling_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | /*! \file 21 | * \example vx_tiling_add.c 22 | */ 23 | 24 | /*! \brief A 1x1 to 1x1 image adding kernel. 25 | * \details This tiling kernel doesn't have an inner set of block loops as the 26 | * block size is 1x1. 27 | * This kernel uses this tiling definition. 28 | * \code 29 | * vx_block_size_t outSize = {1,1}; 30 | * vx_neighborhood_size_t inNbhd = {0,0,0,0}; 31 | * \endcode 32 | * \ingroup group_tiling 33 | */ 34 | // tag::add_tiling_function[] 35 | void add_image_tiling(void * parameters[], 36 | void * tile_memory, 37 | vx_size tile_memory_size) 38 | { 39 | vx_uint32 i,j; 40 | vx_tile_t *in0 = (vx_tile_t *)parameters[0]; 41 | vx_tile_t *in1 = (vx_tile_t *)parameters[1]; 42 | vx_tile_t *out = (vx_tile_t *)parameters[2]; 43 | 44 | for (j = 0u; j < vxTileHeight(out,0); j+=vxTileBlockHeight(out)) 45 | { 46 | for (i = 0u; i < vxTileWidth(out,0); i+=vxTileBlockWidth(out)) 47 | { 48 | /* this math covers a 1x1 block and has no neighborhood */ 49 | vx_uint16 pixel = vxImagePixel(vx_uint8, in0, 0, i, j, 0, 0) + 50 | vxImagePixel(vx_uint8, in1, 0, i, j, 0, 0); 51 | if (pixel > INT16_MAX) 52 | pixel = INT16_MAX; 53 | vxImagePixel(vx_int16, out, 0, i, j, 0, 0) = (vx_int16)pixel; 54 | } 55 | } 56 | } 57 | // end::add_tiling_function[] 58 | 59 | /*! \brief A 16x16 to 16x16 image adding fast kernel. 60 | * \details This tiling kernel needs an inner set of block loops as the 61 | * block size is 16x16. 62 | * This kernel uses this tiling definition. 63 | * \code 64 | * vx_block_size_t outSize = {16,16}; 65 | * vx_neighborhood_size_t inNbhd = {0,0,0,0}; 66 | * \endcode 67 | * \ingroup group_tiling 68 | */ 69 | // tag::add_fast_tiling_function[] 70 | void add_image_tiling_fast(void * parameters[], 71 | void * tile_memory, 72 | vx_size tile_memory_size) 73 | { 74 | vx_uint32 i,j,ii,jj; 75 | vx_tile_t *in0 = (vx_tile_t *)parameters[0]; 76 | vx_tile_t *in1 = (vx_tile_t *)parameters[1]; 77 | vx_tile_t *out = (vx_tile_t *)parameters[2]; 78 | 79 | for (j = 0u; j < vxTileHeight(out,0); j+=16) 80 | { 81 | for (jj = 0u; jj < 16u; ++jj) 82 | { 83 | for (i = 0u; i < vxTileWidth(out,0); i+=16) 84 | { 85 | for (ii = 0u; ii < 16u; ++ii) { 86 | /* this math covers a 1x1 block and has no neighborhood */ 87 | vx_uint16 pixel = 88 | vxImagePixel(vx_uint8, in0, 0, i+ii, j+jj, 0, 0) + 89 | vxImagePixel(vx_uint8, in1, 0, i+ii, j+jj, 0, 0); 90 | if (pixel > INT16_MAX) 91 | pixel = INT16_MAX; 92 | vxImagePixel(vx_int16, out, 0, i+ii, j+jj, 0, 0) = (vx_int16)pixel; 93 | } 94 | } 95 | } 96 | } 97 | } 98 | // end::add_fast_tiling_function[] 99 | 100 | /*! \brief A 1x1 to 1x1 image adding flexible kernel. 101 | * \details This tiling kernel doesn't have an inner set of block loops as the 102 | * block size is irrelevant. 103 | * This kernel uses this tiling definition. 104 | * \code 105 | * vx_neighborhood_size_t inNbhd = {0,0,0,0}; 106 | * \endcode 107 | * \ingroup group_tiling 108 | */ 109 | // tag::add_flexible_tiling_function[] 110 | void add_image_tiling_flexible(void * parameters[], 111 | void * tile_memory, 112 | vx_size tile_memory_size) 113 | { 114 | vx_uint32 i,j; 115 | vx_tile_t *in0 = (vx_tile_t *)parameters[0]; 116 | vx_tile_t *in1 = (vx_tile_t *)parameters[1]; 117 | vx_tile_t *out = (vx_tile_t *)parameters[2]; 118 | 119 | for (j = 0u; j < vxTileHeight(out,0); ++j) 120 | { 121 | for (i = 0u; i < vxTileWidth(out,0); ++i) 122 | { 123 | /* this math covers a 1x1 block and has no neighborhood */ 124 | vx_uint16 pixel = vxImagePixel(vx_uint8, in0, 0, i, j, 0, 0) + 125 | vxImagePixel(vx_uint8, in1, 0, i, j, 0, 0); 126 | if (pixel > INT16_MAX) 127 | pixel = INT16_MAX; 128 | vxImagePixel(vx_int16, out, 0, i, j, 0, 0) = (vx_int16)pixel; 129 | } 130 | } 131 | } 132 | // end::add_flexible_tiling_function[] 133 | 134 | -------------------------------------------------------------------------------- /docs/examples/vx_tiling_box.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | /*! \file 22 | * \example vx_tiling_box.c 23 | */ 24 | 25 | /*! \brief A 3x3 to 1x1 box filter 26 | * This kernel uses this tiling definition. 27 | * \code 28 | * vx_block_size_t outSize = {1,1}; 29 | * vx_neighborhood_size_t inNbhd = {-1,1,-1,1}; 30 | * \endcode 31 | * \ingroup group_tiling 32 | */ 33 | //! [box_tiling_function] 34 | void box_image_tiling(void * parameters[], 35 | void * tile_memory, 36 | vx_size tile_memory_size) 37 | { 38 | vx_uint32 x, y; 39 | vx_tile_t *in = (vx_tile_t *)parameters[0]; 40 | vx_tile_t *out = (vx_tile_t *)parameters[1]; 41 | 42 | for (y = 0; y < vxTileHeight(out, 0); y+=vxTileBlockHeight(out)) 43 | { 44 | for (x = 0; x < vxTileWidth(out, 0); x+=vxTileBlockWidth(out)) 45 | { 46 | vx_int32 j, i; 47 | vx_uint32 sum = 0; 48 | vx_uint32 count = 0; 49 | /* these loops can handle 3x3, 5x5, etc. since block size would be 1x1 */ 50 | for (j = vxNeighborhoodTop(in); j < vxNeighborhoodBottom(in); j++) 51 | { 52 | for (i = vxNeighborhoodLeft(in); i < vxNeighborhoodRight(in); i++) 53 | { 54 | sum += vxImagePixel(vx_uint8, in, 0, x, y, i, j); 55 | count++; 56 | } 57 | } 58 | sum /= count; 59 | if (sum > 255) 60 | sum = 255; 61 | vxImagePixel(vx_uint8, out, 0, x, y, 0, 0) = (vx_uint8)sum; 62 | } 63 | } 64 | } 65 | //! [box_tiling_function] 66 | 67 | -------------------------------------------------------------------------------- /docs/examples/vx_tiling_gaussian.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | /*! \file 21 | * \example vx_tiling_gaussian.c 22 | */ 23 | 24 | /*! \brief A 3x3 to 1x1 tiling Gaussian Blur. 25 | * This kernel uses this tiling definition. 26 | * \code 27 | * vx_block_size_t outSize = {1,1}; 28 | * vx_neighborhood_size_t inNhbd = {-1,1,-1,1}; 29 | * \endcode 30 | * \ingroup group_tiling 31 | */ 32 | // tag::gaussian_tiling_function[] 33 | void gaussian_image_tiling_fast(void * parameters[], 34 | void * tile_memory, 35 | vx_size tile_memory_size) 36 | { 37 | vx_uint32 x, y; 38 | vx_tile_t *in = (vx_tile_t *)parameters[0]; 39 | vx_tile_t *out = (vx_tile_t *)parameters[1]; 40 | 41 | for (y = 0; y < vxTileHeight(out, 0); y += vxTileBlockHeight(out)) 42 | { 43 | for (x = 0; x < vxTileWidth(out, 0); x += vxTileBlockWidth(out)) 44 | { 45 | vx_uint32 sum = 0; 46 | /* this math covers a {-1,1},{-1,1} neighborhood and a block of 1x1. 47 | * an internal set of for loops could have been placed here instead. 48 | */ 49 | sum += vxImagePixel(vx_uint8, in, 0, x, y, -1, -1); 50 | sum += vxImagePixel(vx_uint8, in, 0, x, y, 0, -1) << 1; 51 | sum += vxImagePixel(vx_uint8, in, 0, x, y, +1, -1); 52 | sum += vxImagePixel(vx_uint8, in, 0, x, y, -1, 0) << 1; 53 | sum += vxImagePixel(vx_uint8, in, 0, x, y, 0, 0) << 2; 54 | sum += vxImagePixel(vx_uint8, in, 0, x, y, +1, 0) << 1; 55 | sum += vxImagePixel(vx_uint8, in, 0, x, y, -1, +1); 56 | sum += vxImagePixel(vx_uint8, in, 0, x, y, 0, +1) << 1; 57 | sum += vxImagePixel(vx_uint8, in, 0, x, y, +1, +1); 58 | sum >>= 4; 59 | if (sum > 255) 60 | sum = 255; 61 | vxImagePixel(vx_uint8, out, 0, x, y, 0, 0) = (vx_uint8)sum; 62 | } 63 | } 64 | } 65 | // end::gaussian_tiling_function[] 66 | -------------------------------------------------------------------------------- /docs/examples/vx_warps.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * Copyright (c) 2012-2017 The Khronos Group Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | vx_status vx_example_warp_affine(vx_context context, vx_image src, vx_image dst) 22 | { 23 | vx_float32 a = 1.0f, b = 0.0f, c = 0.0f, d = 1.0f, e = 0.0f , f = 0.0f; 24 | // tag::warp_affine[] 25 | // x0 = a x + b y + c; 26 | // y0 = d x + e y + f; 27 | vx_float32 mat[3][2] = { 28 | {a, d}, // 'x' coefficients 29 | {b, e}, // 'y' coefficients 30 | {c, f}, // 'offsets' 31 | }; 32 | vx_matrix matrix = vxCreateMatrix(context, VX_TYPE_FLOAT32, 2, 3); 33 | vxCopyMatrix(matrix, mat, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST); 34 | // end::warp_affine[] 35 | return vxuWarpAffine(context, src, matrix, VX_INTERPOLATION_NEAREST_NEIGHBOR, dst); 36 | } 37 | 38 | vx_status vx_example_warp_perspective(vx_context context, vx_image src, vx_image dst) 39 | { 40 | vx_float32 a = 1.0f, b = 0.0f, c = 0.0f, d = 1.0f, e = 0.0f, f = 0.0f, g = 1.0f, h = 0.0f, i = 0.0f; 41 | // tag::warp_perspective[] 42 | // x0 = a x + b y + c; 43 | // y0 = d x + e y + f; 44 | // z0 = g x + h y + i; 45 | vx_float32 mat[3][3] = { 46 | {a, d, g}, // 'x' coefficients 47 | {b, e, h}, // 'y' coefficients 48 | {c, f, i}, // 'offsets' 49 | }; 50 | vx_matrix matrix = vxCreateMatrix(context, VX_TYPE_FLOAT32, 3, 3); 51 | vxCopyMatrix(matrix, mat, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST); 52 | // end::warp_perspective[] 53 | return vxuWarpPerspective(context, src, matrix, VX_INTERPOLATION_NEAREST_NEIGHBOR, dst); 54 | } 55 | -------------------------------------------------------------------------------- /docs/images/OpenVX_500px_June16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/OpenVX_500px_June16.png -------------------------------------------------------------------------------- /docs/images/OpenVX_RGB.svg: -------------------------------------------------------------------------------- 1 | OpenVX_RGB_May16 -------------------------------------------------------------------------------- /docs/images/Overlap_DataObj_Overlap.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 65 | 66 | -------------------------------------------------------------------------------- /docs/images/README.txt: -------------------------------------------------------------------------------- 1 | The Khronos and OpenVX logos come from the official logo packs at 2 | 3 | https://www.khronos.org/legal/trademarks/ 4 | 5 | Khronos_RGB.svg was most recently updated from 6 | "Khronos Family_June18/Khronos/Khronos for web/RGB/Khronos_RGB_June18.svg" 7 | in the Khronos Group logo pack. 8 | -------------------------------------------------------------------------------- /docs/images/bid.svg: -------------------------------------------------------------------------------- 1 | YUV ImageProcess YImage from channel Y -------------------------------------------------------------------------------- /docs/images/cdf_execution.svg: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | Client 12 | 13 | 14 | 15 | 16 | UserKernel Code 17 | 18 | 19 | 20 | 21 | OpenVX 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | UserKernel Installed 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Graph Verified 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | vxProcessGraph 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | vx_kernel_f(node, ...); 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | vx_status 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | vx_status 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | Graph Released 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /docs/images/conv_eps_png.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Convert pipelining extension images to SVG 3 | 4 | for eps in \ 5 | pipe_nopipelining \ 6 | pipe_pipelining \ 7 | pipe_soc \ 8 | pipe_sourcesink \ 9 | pipe_updown \ 10 | ; do 11 | input=old/${eps}.eps 12 | output=${eps}.svg 13 | inkscape --export-plain-svg $output $input 14 | done 15 | 16 | # Files only present in PNG form 17 | for png in graph_batch_processing \ 18 | ; do 19 | convert old/${png}.png ${png}.pnm 20 | potrace ${png}.pnm -s -o ${png}.svg 21 | rm ${png}.pnm 22 | done 23 | -------------------------------------------------------------------------------- /docs/images/execution-order.svg: -------------------------------------------------------------------------------- 1 | Non-VirtualObjectOptionalNodeNodeOptionalNodeOptionalNode1233Available for Dequeue(if Pipelining)4 -------------------------------------------------------------------------------- /docs/images/log_callback.svg: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | Client 12 | 13 | 14 | 15 | 16 | OpenVX 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | vxCreateContext 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | vx_context 33 | 34 | 35 | 36 | 37 | 38 | 39 | Calls to OpenVX occur 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | NULL(ref, string) 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | vxRegisterLogCallback(ctxt, &mycallback) 58 | 59 | 60 | 61 | 62 | 63 | 64 | Calls to OpenVX occur 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | mycallback(ref, string); 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | vxReleaseContext 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/images/move-fast.svg: -------------------------------------------------------------------------------- 1 | Move( <1ms)Process Image (8ms)Acquire image(10ms) -------------------------------------------------------------------------------- /docs/images/nobid.svg: -------------------------------------------------------------------------------- 1 | YUV InputProcess YCombine ChannelsImage from channel YImage from channel UImage from channel VProcessed imageOutput image -------------------------------------------------------------------------------- /docs/images/old/graph_batch_processing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/graph_batch_processing.png -------------------------------------------------------------------------------- /docs/images/old/pipe_nopipelining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/pipe_nopipelining.png -------------------------------------------------------------------------------- /docs/images/old/pipe_pipelining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/pipe_pipelining.png -------------------------------------------------------------------------------- /docs/images/old/pipe_soc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/pipe_soc.png -------------------------------------------------------------------------------- /docs/images/old/pipe_sourcesink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/pipe_sourcesink.png -------------------------------------------------------------------------------- /docs/images/old/pipe_updown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KhronosGroup/OpenVX-api-docs/db38e256467691ad5c8dc994babac47be4a0e696/docs/images/old/pipe_updown.png -------------------------------------------------------------------------------- /docs/images/one-writer-one-modifier.svg: -------------------------------------------------------------------------------- 1 | Non-VirtualObjectOptionalNodeNodeOptionalNodeOptionalNodeAt most 1 writerAt most 1 modifier -------------------------------------------------------------------------------- /docs/images/overview.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | overview 11 | 12 | 13 | CV_APP 14 | 15 | Computer Vision 16 | Applications 17 | 18 | 19 | CV_FW 20 | 21 | High-Level 22 | Vision Framework 23 | 24 | 25 | CV_APP->CV_FW 26 | 27 | 28 | 29 | 30 | ISV_VE 31 | 32 | ISV Vision 33 | Engines 34 | 35 | 36 | CV_APP->ISV_VE 37 | 38 | 39 | 40 | 41 | OPENVX 42 | 43 | 44 | OpenVX 45 | 46 | 47 | 48 | CV_APP->OPENVX 49 | 50 | 51 | 52 | 53 | CV_FW->OPENVX 54 | 55 | 56 | 57 | 58 | ISV_VE->OPENVX 59 | 60 | 61 | 62 | 63 | HW_ACCEL 64 | 65 | Vendor 66 | Hardware 67 | 68 | 69 | OPENVX->HW_ACCEL 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/images/phases.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | phases 11 | 12 | 13 | A 14 | 15 | 16 | Graph Construction 17 | 18 | 19 | 20 | B 21 | 22 | 23 | Graph Verification 24 | 25 | 26 | 27 | A->B 28 | 29 | 30 | 31 | 32 | C 33 | 34 | 35 | Graph Execution 36 | 37 | 38 | 39 | B->C 40 | 41 | 42 | 43 | 44 | C:e->B:e 45 | 46 | 47 | 48 | 49 | 50 | reference changes 51 | 52 | 53 | 54 | C:e->C:e 55 | 56 | 57 | 58 | 59 | 60 | data updates 61 | 62 | 63 | 64 | D 65 | 66 | 67 | Graph Deconstruction 68 | 69 | 70 | 71 | C->D 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /docs/images/system.svg: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | Client 12 | 13 | 14 | 15 | 16 | OpenVX 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | vxCreateContext() 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | vx_context 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | all calls to OpenVX 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | vxReleaseContext(&context) 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/images/virtual-bid.svg: -------------------------------------------------------------------------------- 1 | VirtualObjectRequiredNodeNodeRequiredNodeOptionalNodeAt most 1 writerAt most 1 modifier -------------------------------------------------------------------------------- /docs/images/vx_khr_tiling_img_1.8.1.1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/images/vx_khr_tiling_img_1.8.2.1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/images/vx_khr_tiling_img_1.8.3.1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/images/vx_khr_tiling_img_1.8.4.1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/katex/README.md: -------------------------------------------------------------------------------- 1 | # [KaTeX](https://khan.github.io/KaTeX/) [![Build Status](https://travis-ci.org/Khan/KaTeX.svg?branch=master)](https://travis-ci.org/Khan/KaTeX) 2 | 3 | [![Join the chat at https://gitter.im/Khan/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Khan/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. 6 | 7 | * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://jsperf.com/katex-vs-mathjax/). 8 | * **Print quality:** KaTeX’s layout is based on Donald Knuth’s TeX, the gold standard for math typesetting. 9 | * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources. 10 | * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML. 11 | 12 | KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, and IE 8 - IE 11. A list of supported commands can be on the [wiki](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX). 13 | 14 | ## Usage 15 | 16 | You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN: 17 | 18 | ```html 19 | 20 | 21 | ``` 22 | 23 | #### In-browser rendering 24 | 25 | Call `katex.render` with a TeX expression and a DOM element to render into: 26 | 27 | ```js 28 | katex.render("c = \\pm\\sqrt{a^2 + b^2}", element); 29 | ``` 30 | 31 | If KaTeX can't parse the expression, it throws a `katex.ParseError` error. 32 | 33 | #### Server side rendering or rendering to a string 34 | 35 | To generate HTML on the server or to generate an HTML string of the rendered math, you can use `katex.renderToString`: 36 | 37 | ```js 38 | var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}"); 39 | // '...' 40 | ``` 41 | 42 | Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like `render`, `renderToString` throws if it can't parse the expression. 43 | 44 | #### Rendering options 45 | 46 | You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are: 47 | 48 | - `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`) 49 | - `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`) 50 | - `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`) 51 | 52 | For example: 53 | 54 | ```js 55 | katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { displayMode: true }); 56 | ``` 57 | 58 | #### Automatic rendering of math on a page 59 | 60 | Math on the page can be automatically rendered using the auto-render extension. See [the Auto-render README](contrib/auto-render/README.md) for more information. 61 | 62 | ## Contributing 63 | 64 | See [CONTRIBUTING.md](CONTRIBUTING.md) 65 | 66 | ## License 67 | 68 | KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT). 69 | -------------------------------------------------------------------------------- /docs/katex/contrib/auto-render.min.js: -------------------------------------------------------------------------------- 1 | (function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,r;return function n(e,t,r){function a(o,l){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!l&&f)return f(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[o]={exports:{}};e[o][0].call(s.exports,function(t){var r=e[o][1][t];return a(r?r:t)},s,s.exports,n,e,t,r)}return t[o].exports}var i=typeof require=="function"&&require;for(var o=0;oa, 4 | // a 5 | // Stripped VX_API_ENTRY and VX_API_CALL from prototypes 6 | // Added NOAPI to commands not having VX_API_ENTRY / VX_API_CALL 7 | These defines have #ifndef surrounding them: 8 | #define VX_MAX_LOG_NUM_ENTRIES (1024) 9 | #define VX_SCALE_UNITY (1024) 10 | --> 11 | 12 | Validation errors: 13 | Doesn't yet support [length] in tags for function 14 | parameters. 15 | 16 | Doesn't have any syntax for varadic functions, e.g. ... 17 | doesn't validate and isn't understood. 18 | -------------------------------------------------------------------------------- /docs/xml/indexExt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright (c) 2017 The Khronos Group Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Construct an HTML fragment indexing extension appendices in vkspec.html. 18 | # This is run only when publishing an update spec, to update the Vulkan 19 | # registry. 20 | 21 | import argparse,io,os,re,string,sys,copy 22 | import xml.etree.ElementTree as etree 23 | 24 | def listExts(vendor, ext, tag): 25 | prefix = '
  • ' 26 | suffix = '
  • ' 27 | 28 | if vendor in tag: 29 | desc = vendor + ' Extensions (' + tag[vendor] + ')' 30 | else: 31 | desc = vendor + ' Extensions (full vendor description unavailable)' 32 | print(prefix, desc, suffix) 33 | 34 | fmtString = '
  • {0}
  • ' 35 | 36 | for name in sorted(ext[vendor]): 37 | print(fmtString.format(name)) 38 | 39 | # -extension name - may be a single extension name, a a space-separated list 40 | # of names, or a regular expression. 41 | if __name__ == '__main__': 42 | parser = argparse.ArgumentParser() 43 | 44 | parser.add_argument('-registry', action='store', 45 | default='vk.xml', 46 | help='Use specified registry file instead of vk.xml') 47 | parser.add_argument('-quiet', action='store_true', default=False, 48 | help='Suppress script output during normal execution.') 49 | 50 | args = parser.parse_args() 51 | 52 | tree = etree.parse(args.registry) 53 | 54 | # Dictionary of vendor tags -> author name mappings 55 | tag = {} 56 | 57 | # Loop over all vendor tags, tracking the full corresponding author name 58 | for elem in tree.findall('tags/tag'): 59 | vendor = elem.get('name') 60 | author = elem.get('author') 61 | 62 | tag[vendor] = author 63 | 64 | # Dictionary of supported extensions, indexed by vendor prefix 65 | ext = {} 66 | 67 | # Loop over all extensions, add supported names to the dictionary 68 | for elem in tree.findall('extensions/extension'): 69 | name = elem.get('name') 70 | supported = elem.get('supported') 71 | 72 | if (supported == 'vulkan'): 73 | # Relies on name being in the form VK__stuff 74 | (vk, vendor) = name.split('_')[0:2] 75 | 76 | if not vendor in ext: 77 | ext[vendor] = [] 78 | ext[vendor].append(name) 79 | 80 | # Emit HTML fragment indexing the extensions 81 | 82 | print('
      ') 83 | 84 | for vendor in ['KHR', 'EXT']: 85 | if vendor in ext: 86 | listExts(vendor, ext, tag) 87 | del ext[vendor] 88 | 89 | for vendor in sorted(ext.keys()): 90 | listExts(vendor, ext, tag) 91 | del ext[vendor] 92 | 93 | print('
    ') 94 | -------------------------------------------------------------------------------- /docs/xml/realign.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | # Copyright (c) 2013-2017 The Khronos Group Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Usage: realign [infile] > outfile 18 | # Used to realign XML tags in the Vulkan registry after it's operated on by 19 | # some other filter, since whitespace inside a tag isn't part of the 20 | # internal representation. 21 | 22 | import copy, sys, string, re 23 | 24 | def realignXML(fp): 25 | patterns = [ 26 | [ '(^ *\ 1): 56 | realignXML(open(sys.argv[1], 'r', encoding='utf-8')) 57 | else: 58 | realignXML(sys.stdin) 59 | -------------------------------------------------------------------------------- /docs/xml/sortreg.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # sortreg - sort a Registry XML file's and tags on 3 | # name, generating a new XML file on stdout. The new file will also 4 | # be canonicalized, 5 | 6 | import copy, sys, time, pdb, string, cProfile 7 | from reg import * 8 | 9 | # Return extension name attribute of an element 10 | def extensionSortKey(elem): 11 | return elem.get('name') 12 | 13 | # Return command name tag of a element 14 | def commandSortKey(elem): 15 | name = elem.find('proto/name') 16 | if (name == None): 17 | print('No key text for proto/name in element: ', elem.text, file=sys.stderr) 18 | return '' 19 | else: 20 | return name.text 21 | 22 | # root - Element for root tag 23 | # groupTag - name of group tag, '' or '' 24 | # sortKeyProc - procedure returning sort key for a child 25 | # or element being sorted 26 | def subsort(root, groupTag, sortKeyProc): 27 | # Find element to replace 28 | i = list(root).index(root.find(groupTag)) 29 | # Can't sort in place because the element isn't actually a list, 30 | # so replace it with a new, empty element. 31 | oldexts = root[i] 32 | newexts = etree.Element(groupTag) 33 | # Copy attributes from old element 34 | for key in oldexts.attrib: 35 | newexts.attrib[key] = oldexts.attrib[key] 36 | # Copy whitespace from old element 37 | newexts.text = copy.deepcopy(oldexts.text) 38 | newexts.tail = copy.deepcopy(oldexts.tail) 39 | # Replace old tag with new 40 | root[i] = newexts 41 | 42 | # Build list of child elements from old element 43 | extlist = [elem for elem in oldexts] 44 | 45 | extlist.sort(key = sortKeyProc) 46 | 47 | # If the last element in the original list has moved, swap its 48 | # white space with the new last element 49 | if (oldexts[-1] != extlist[-1]): 50 | # Text 51 | swap = copy.deepcopy(oldexts[-1].text) 52 | oldexts[-1].text = copy.deepcopy(extlist[-1].text) 53 | extlist[-1].text = swap 54 | # Tail 55 | swap = copy.deepcopy(oldexts[-1].tail) 56 | oldexts[-1].tail = copy.deepcopy(extlist[-1].tail) 57 | extlist[-1].tail = swap 58 | 59 | # Now add sorted list elements into the new element 60 | for elem in extlist: 61 | newexts.append(elem) 62 | 63 | # tree - lxml.etree Element 64 | # fp - file handle 65 | def printTree(tree, fp): 66 | print('', file=fp) 67 | print(etree.tostring(tree).decode('utf-8'), file=fp) 68 | 69 | # Sort XML file, writing to sys.stdout 70 | def sortXML(filename): 71 | # Load & parse registry 72 | tree = etree.parse(filename) 73 | #reg.loadElementTree(tree) 74 | root = tree.getroot() 75 | # Sort 76 | subsort(root,'extensions',extensionSortKey) 77 | subsort(root,'commands',commandSortKey) 78 | # Save 79 | printTree(root, sys.stdout) 80 | 81 | if __name__ == '__main__': 82 | if (len(sys.argv) > 1): 83 | sortXML(sys.argv[1]) 84 | else: 85 | print("No file to process", file=sys.stderr) 86 | 87 | 88 | -------------------------------------------------------------------------------- /include/VX/vx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2020 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * NOTE: Some safety-critical environments may enforce software development 19 | * guidelines (for example MISRA C:2012) to facilitate code quality, 20 | * safety, security, portability and reliability. In order to meet 21 | * such guidelines, developers may modify OpenVX standard header files 22 | * without deviating from the OpenVX specification. 23 | */ 24 | 25 | #ifndef _OPENVX_H_ 26 | #define _OPENVX_H_ 27 | 28 | /*! 29 | * \file 30 | * \brief The top level OpenVX Header. 31 | */ 32 | 33 | /*! \brief Defines the length of the implementation name string, including the trailing zero. 34 | * \ingroup group_context 35 | */ 36 | #define VX_MAX_IMPLEMENTATION_NAME (64) 37 | 38 | /*! \brief Defines the length of a kernel name string to be added to OpenVX, including the trailing zero. 39 | * \ingroup group_kernel 40 | */ 41 | #define VX_MAX_KERNEL_NAME (256) 42 | 43 | /*! \brief Defines the length of a message buffer to copy from the log, including the trailing zero. 44 | * \ingroup group_basic_features 45 | */ 46 | #define VX_MAX_LOG_MESSAGE_LEN (1024) 47 | 48 | /*! \brief Defines the length of the reference name string, including the trailing zero. 49 | * \ingroup group_reference 50 | * \see vxSetReferenceName 51 | */ 52 | #define VX_MAX_REFERENCE_NAME (64) 53 | 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | /*! \brief Defines the major version number macro. 61 | * \ingroup group_basic_features 62 | */ 63 | #define VX_VERSION_MAJOR(x) ((vx_uint32)((vx_uint32)(x) & 0xFFU) << 8) 64 | 65 | /*! \brief Defines the minor version number macro. 66 | * \ingroup group_basic_features 67 | */ 68 | #define VX_VERSION_MINOR(x) ((vx_uint32)((vx_uint32)(x) & 0xFFU) << 0) 69 | 70 | /*! \brief Defines the predefined version number for 1.0. 71 | * \ingroup group_basic_features 72 | */ 73 | #define VX_VERSION_1_0 (VX_VERSION_MAJOR(1) | VX_VERSION_MINOR(0)) 74 | 75 | /*! \brief Defines the predefined version number for 1.1. 76 | * \ingroup group_basic_features 77 | */ 78 | #define VX_VERSION_1_1 (VX_VERSION_MAJOR(1) | VX_VERSION_MINOR(1)) 79 | 80 | /*! \brief Defines the predefined version number for 1.2. 81 | * \ingroup group_basic_features 82 | */ 83 | #define VX_VERSION_1_2 (VX_VERSION_MAJOR(1) | VX_VERSION_MINOR(2)) 84 | 85 | /*! \brief Defines the predefined version number for 1.3. 86 | * \ingroup group_basic_features 87 | */ 88 | #define VX_VERSION_1_3 (VX_VERSION_MAJOR(1) | VX_VERSION_MINOR(3)) 89 | 90 | /*! \brief Defines the OpenVX Version Number. 91 | * \ingroup group_basic_features 92 | */ 93 | #define VX_VERSION (VX_VERSION_1_3) 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /include/VX/vx_khr_bidirectional_parameters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _OPENVX_BIDIRECTIONAL_H_ 18 | #define _OPENVX_BIDIRECTIONAL_H_ 19 | 20 | /*! 21 | * \file 22 | * \brief The OpenVX Bidirectional Parameters extension API. 23 | */ 24 | 25 | #define OPENVX_KHR_BIDIRECTIONAL_PARAMETERS "vx_khr_bidirectional_parameters" 26 | 27 | #define OPENVX_KHR_BIDIRECTIONAL_OPTIONAL_KERNELS /* Remove if optional kernels are not implemented */ 28 | 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /*! \brief Extra enums. 36 | * 37 | * \ingroup group_parameter 38 | */ 39 | 40 | enum vx_bidirectional_enum_e 41 | { 42 | VX_BIDIRECTIONAL = VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_DIRECTION) + 0x2 /* Additional parameter direction enumeration */ 43 | }; 44 | 45 | #ifdef OPENVX_KHR_BIDIRECTIONAL_OPTIONAL_KERNELS 46 | /*! \brief [Graph] Creates an accumulate node. 47 | * \param [in] graph The reference to the graph. 48 | * \param [in] input The input \ref VX_DF_IMAGE_U8 image. 49 | * \param [in,out] accum The accumulation image in \ref VX_DF_IMAGE_S16. 50 | * \ingroup group_vision_function_accumulate 51 | * \return \ref vx_node. 52 | * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus 53 | */ 54 | VX_API_ENTRY vx_node VX_API_CALL vxAccumulateImageNode(vx_graph graph, vx_image input, vx_image accum); 55 | 56 | /*! \brief [Graph] Creates a weighted accumulate node. 57 | * \param [in] graph The reference to the graph. 58 | * \param [in] input The input \ref VX_DF_IMAGE_U8 image. 59 | * \param [in] alpha The input \ref VX_TYPE_FLOAT32 scalar value with a value in the range of \f$ 0.0 \le \alpha \le 1.0 \f$. 60 | * \param [in,out] accum The \ref VX_DF_IMAGE_U8 accumulation image. 61 | * \ingroup group_vision_function_accumulate_weighted 62 | * \return \ref vx_node. 63 | * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus 64 | */ 65 | VX_API_ENTRY vx_node VX_API_CALL vxAccumulateWeightedImageNodeX(vx_graph graph, vx_image input, vx_float32 alpha, vx_image accum); 66 | 67 | /*! \brief [Graph] Creates an accumulate square node. 68 | * \param [in] graph The reference to the graph. 69 | * \param [in] input The input \ref VX_DF_IMAGE_U8 image. 70 | * \param [in] shift The input \ref VX_TYPE_UINT32 with a value in the range of \f$ 0 \le shift \le 15 \f$. 71 | * \param [in,out] accum The accumulation image in \ref VX_DF_IMAGE_S16. 72 | * \ingroup group_vision_function_accumulate_square 73 | * \return \ref vx_node. 74 | * \retval vx_node A node reference. Any possible errors preventing a successful creation should be checked using \ref vxGetStatus 75 | */ 76 | VX_API_ENTRY vx_node VX_API_CALL vxAccumulateSquareImageNodeX(vx_graph graph, vx_image input, vx_uint32 shift, vx_image accum); 77 | #endif 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /include/VX/vx_khr_icd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2020 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /*! \file 18 | * \defgroup group_icd OpenVX ICD Loader API 19 | * \brief The OpenVX Installable Client Driver (ICD) Loader API. 20 | * \details The vx_khr_icd extension provides a mechanism for vendors to implement Installable Client Driver (ICD) for OpenVX. The OpenVX ICD Loader API provides a mechanism for applications to access these vendor implementations. 21 | */ 22 | 23 | #ifndef _VX_KHR_ICD_H_ 24 | #define _VX_KHR_ICD_H_ 25 | 26 | #include 27 | #include 28 | 29 | /*! \brief Platform handle of an implementation. 30 | * \ingroup group_icd 31 | */ 32 | typedef struct _vx_platform * vx_platform; 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /*! \brief Queries list of available platforms. 39 | * \param [in] capacity Maximum number of items that platform[] can hold. 40 | * \param [out] platform[] List of platform handles. 41 | * \param [out] pNumItems Number of platform handles returned. 42 | * \return A \ref vx_status_e enumeration. 43 | * \retval VX_SUCCESS No errors. 44 | * \retval VX_FAILURE If no platforms are found. 45 | * \ingroup group_icd 46 | */ 47 | VX_API_ENTRY vx_status VX_API_CALL vxIcdGetPlatforms(vx_size capacity, vx_platform platform[], vx_size * pNumItems); 48 | 49 | /*! \brief Queries the platform for some specific information. 50 | * \param [in] platform The platform handle. 51 | * \param [in] attribute The attribute to query. Use one of the following: 52 | * \ref VX_CONTEXT_VENDOR_ID, 53 | * \ref VX_CONTEXT_VERSION, 54 | * \ref VX_CONTEXT_EXTENSIONS_SIZE, 55 | * \ref VX_CONTEXT_EXTENSIONS. 56 | * \param [out] ptr The location at which to store the resulting value. 57 | * \param [in] size The size in bytes of the container to which \a ptr points. 58 | * \return A \ref vx_status_e enumeration. 59 | * \retval VX_SUCCESS No errors. 60 | * \retval VX_ERROR_INVALID_REFERENCE If the platform is not a \ref vx_platform. 61 | * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect. 62 | * \retval VX_ERROR_NOT_SUPPORTED If the attribute is not supported on this implementation. 63 | * \ingroup group_icd 64 | */ 65 | VX_API_ENTRY vx_status VX_API_CALL vxQueryPlatform(vx_platform platform, vx_enum attribute, void *ptr, vx_size size); 66 | 67 | /*! \brief Creates a \ref vx_context from a \ref vx_platform. 68 | * \details This creates a top-level object context for OpenVX from a platform handle. 69 | * \returns The reference to the implementation context \ref vx_context. Any possible errors 70 | * preventing a successful creation should be checked using \ref vxGetStatus. 71 | * \ingroup group_icd 72 | */ 73 | VX_API_ENTRY vx_context VX_API_CALL vxCreateContextFromPlatform(vx_platform platform); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /include/VX/vx_khr_import_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2020 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _OPENVX_IMPORT_KERNEL_H_ 18 | #define _OPENVX_IMPORT_KERNEL_H_ 19 | 20 | #include 21 | 22 | /*! 23 | * \file 24 | * \brief The OpenVX import kernel extension API. 25 | */ 26 | #define OPENVX_KHR_IMPORT_KERNEL "vx_khr_import_kernel" 27 | 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /*! \brief Import a kernel from binary specified by URL. 34 | * 35 | * The name of kernel parameters can be queried using the vxQueryReference API 36 | * with vx_parameter as ref and VX_REFERENCE_NAME as attribute. 37 | * 38 | * \param context [in] The OpenVX context 39 | * \param type [in] Vendor-specific identifier that indicates to the implementation 40 | * how to interpret the url. For example, if an implementation can interpret the url 41 | * as a file, a folder a symbolic label, or a pointer, then a vendor may choose 42 | * to use "vx__file", "vx__folder", "vx__label", and 43 | * "vx__pointer", respectively for this field. Container types starting 44 | * with "vx_khr_" are reserved. Refer to vendor documentation for list of 45 | * container types supported 46 | * \param url [in] URL to binary container. 47 | * 48 | * \retval On success, a valid vx_kernel object. Calling vxGetStatus with the return value 49 | * as a parameter will return VX_SUCCESS if the function was successful. 50 | * 51 | * \ingroup group_import_kernel 52 | */ 53 | VX_API_ENTRY vx_kernel VX_API_CALL vxImportKernelFromURL( 54 | vx_context context, 55 | const vx_char * type, 56 | const vx_char * url 57 | ); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /include/VX/vx_khr_opencl_interop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2020 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _OPENVX_OPENCL_INTEROP_H_ 18 | #define _OPENVX_OPENCL_INTEROP_H_ 19 | 20 | #include 21 | #if __APPLE__ 22 | #include 23 | #else 24 | #include 25 | #endif 26 | 27 | /*! 28 | * \file 29 | * \brief The OpenVX OpenCL interop extension API. 30 | */ 31 | #define OPENVX_KHR_OPENCL_INTEROP "vx_khr_opencl_interop" 32 | 33 | /*! \brief The constants added by OpenCL interop extension. 34 | * \ingroup group_opencl_interop 35 | */ 36 | 37 | /* The vx_memory_type_e enum to import from the OpenCL buffer. 38 | */ 39 | #define VX_MEMORY_TYPE_OPENCL_BUFFER (VX_ENUM_BASE(VX_ID_KHRONOS, VX_ENUM_MEMORY_TYPE) + 0x2) 40 | 41 | /* vx_context attribute to query the OpenCL context associated with the OpenVX context. 42 | * Read-only. 43 | */ 44 | #define VX_CONTEXT_CL_CONTEXT (VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_CONTEXT) + 0xF) 45 | 46 | /* vx_context attribute to query the coordination command queue associated with the OpenVX context. 47 | * Read-only. 48 | */ 49 | #define VX_CONTEXT_CL_COMMAND_QUEUE (VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_CONTEXT) + 0x10) 50 | 51 | /* vx_node attribute to query the cl_command_queue associated with a user kernel node. 52 | * Read-only. 53 | */ 54 | #define VX_NODE_CL_COMMAND_QUEUE (VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_NODE) + 0x9) 55 | 56 | /* vx_kernel attribute to specify and query whether a user kernel is using the vx_khr_opencl_interop API. 57 | * Return value is vx_bool. The default value of this attribute is vx_false_e. 58 | * This attribute is read-only after the vxFinalizeKernel call. 59 | */ 60 | #define VX_KERNEL_USE_OPENCL (VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_KERNEL) + 0x4) 61 | 62 | 63 | #ifdef __cplusplus 64 | extern "C" { 65 | #endif 66 | 67 | /*! \brief Create an OpenVX context with specified OpenCL context and global coordination command queue. 68 | * 69 | * This function creates a top-level object context for OpenVX and uses the OpenCL context and 70 | * global coordination command queue created by the application for the interop. 71 | * 72 | * This OpenCL context and global coordination command queue can be queried using 73 | * the VX_CONTEXT_CL_CONTEXT and VX_CONTEXT_CL_COMMAND_QUEUE attributes of vx_context. 74 | * 75 | * If the OpenVX context is created using vxCreateContext or vxCreateContextFromCL with 76 | * opencl_context as NULL, the OpenCL context used by OpenVX is implementation dependent. 77 | * If the opencl_command_queue is NULL, the global coordination command queue used by 78 | * OpenVX is implementation dependent. 79 | * 80 | * The global coordination command queue must be created using the OpenCL context used by OpenVX. 81 | * 82 | * \param opencl_context [in] The OpenCL context 83 | * \param opencl_command_queue [in] The global coordination command queue 84 | * 85 | * \retval On success, a valid vx_context object. Calling vxGetStatus with the return value 86 | * as a parameter will return VX_SUCCESS if the function was successful. 87 | * 88 | * \ingroup group_opencl_interop 89 | */ 90 | VX_API_ENTRY vx_context VX_API_CALL vxCreateContextFromCL( 91 | cl_context opencl_context, 92 | cl_command_queue opencl_command_queue 93 | ); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /include/VX/vx_khr_swap_move.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | #ifndef _OPENVX_SWAP_MOVE_H_ 19 | #define _OPENVX_SWAP_MOVE_H_ 20 | 21 | #include 22 | 23 | /* NOTE: The bidirectional parameters extension is required for the swap_move extension */ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | 30 | /* NOTE: The list of kernels supported is added in vx_kernels.h 31 | */ 32 | 33 | /*! 34 | * \brief The name of the swap kernel 35 | */ 36 | #define VX_KERNEL_SWAP_NAME "org.khronos.openvx.swap" 37 | 38 | /*! 39 | * \brief The name of the move kernel 40 | */ 41 | 42 | #define VX_KERNEL_MOVE_NAME "org.khronos.openvx.move" 43 | 44 | /*! \brief Swap data from one object to another. 45 | * \note An implementation may optimize away the swap when virtual data objects are used. 46 | * \param [in] graph The reference to the graph. 47 | * \param [in, out] first The first data object. 48 | * \param [in, out] second The second data object with meta-data identical to the input data object. 49 | * \return \ref vx_node. 50 | * \retval vx_node A node reference. Any possible errors preventing a successful creation 51 | * should be checked using \ref vxGetStatus 52 | * \ingroup group_vision_function_swap 53 | */ 54 | VX_API_ENTRY vx_node VX_API_CALL vxSwapNode(vx_graph graph, vx_reference first, vx_reference second); 55 | 56 | /*! \brief Move data from one object to another. Same as Swap but second parameter is an output 57 | * \note An implementation may optimize away the move when virtual data objects are used. 58 | * \param [in] graph The reference to the graph. 59 | * \param [in, out] first The first data object. 60 | * \param [out] second The second data object with meta-data identical to the input data object. 61 | * \return \ref vx_node. 62 | * \retval vx_node A node reference. Any possible errors preventing a successful creation 63 | * should be checked using \ref vxGetStatus 64 | * \ingroup group_vision_function_move 65 | */ 66 | VX_API_ENTRY vx_node VX_API_CALL vxMoveNode(vx_graph graph, vx_reference first, vx_reference second); 67 | 68 | /*! \brief Swap data from one object to another. 69 | * \param [in] context The OpenVX context. 70 | * \param [in, out] first The first data object. 71 | * \param [in, out] second The second data object with meta-data identical to the input data object. 72 | * \return A \ref vx_status_e enumeration. 73 | * \retval VX_SUCCESS Success 74 | * \retval * An error occurred. See \ref vx_status_e. 75 | * \ingroup group_vision_function_swap 76 | */ 77 | VX_API_ENTRY vx_status VX_API_CALL vxuSwap(vx_context context, vx_reference first, vx_reference second); 78 | 79 | /*! \brief Move data from one object to another. 80 | * \note In immediate mode identical to Swap. 81 | * \param [in] context The OpenVX context. 82 | * \param [in, out] first The first data object. 83 | * \param [out] second The second data object with meta-data identical to the input data object. 84 | * \return A \ref vx_status_e enumeration. 85 | * \retval VX_SUCCESS Success 86 | * \retval * An error occurred. See \ref vx_status_e. 87 | * \ingroup group_vision_function_move 88 | */ 89 | VX_API_ENTRY vx_status VX_API_CALL vxuMove(vx_context context, vx_reference first, vx_reference second); 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /include/VX/vx_vendors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2023 The Khronos Group Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _OPENVX_VENDORS_H_ 18 | #define _OPENVX_VENDORS_H_ 19 | 20 | /*! 21 | * \file 22 | * \brief The Vendor ID list for OpenVX. 23 | */ 24 | 25 | /*! \brief The Vendor ID of the Implementation. As new vendors submit their 26 | * implementations, this enumeration will grow. 27 | * \ingroup group_basic_features 28 | */ 29 | enum vx_vendor_id_e { 30 | VX_ID_KHRONOS = 0x000, /*!< \brief The Khronos Group */ 31 | VX_ID_TI = 0x001, /*!< \brief Texas Instruments, Inc. */ 32 | VX_ID_QUALCOMM = 0x002, /*!< \brief Qualcomm, Inc. */ 33 | VX_ID_NVIDIA = 0x003, /*!< \brief NVIDIA Corporation */ 34 | VX_ID_ARM = 0x004, /*!< \brief ARM Ltd. */ 35 | VX_ID_BDTI = 0x005, /*!< \brief Berkley Design Technology, Inc. */ 36 | VX_ID_RENESAS = 0x006, /*!< \brief Renasas Electronics */ 37 | VX_ID_VIVANTE = 0x007, /*!< \brief Vivante Corporation */ 38 | VX_ID_XILINX = 0x008, /*!< \brief Xilinx Inc. */ 39 | VX_ID_AXIS = 0x009, /*!< \brief Axis Communications */ 40 | VX_ID_MOVIDIUS = 0x00A, /*!< \brief Movidius Ltd. */ 41 | VX_ID_SAMSUNG = 0x00B, /*!< \brief Samsung Electronics */ 42 | VX_ID_FREESCALE = 0x00C, /*!< \brief Freescale Semiconductor */ 43 | VX_ID_AMD = 0x00D, /*!< \brief Advanced Micro Devices */ 44 | VX_ID_BROADCOM = 0x00E, /*!< \brief Broadcom Corporation */ 45 | VX_ID_INTEL = 0x00F, /*!< \brief Intel Corporation */ 46 | VX_ID_MARVELL = 0x010, /*!< \brief Marvell Technology Group Ltd. */ 47 | VX_ID_MEDIATEK = 0x011, /*!< \brief MediaTek, Inc. */ 48 | VX_ID_ST = 0x012, /*!< \brief STMicroelectronics */ 49 | VX_ID_CEVA = 0x013, /*!< \brief CEVA DSP */ 50 | VX_ID_ITSEEZ = 0x014, /*!< \brief Itseez, Inc. */ 51 | VX_ID_IMAGINATION=0x015, /*!< \brief Imagination Technologies */ 52 | VX_ID_NXP = 0x016, /*!< \brief NXP Semiconductors */ 53 | VX_ID_VIDEANTIS = 0x017, /*!< \brief Videantis */ 54 | VX_ID_SYNOPSYS = 0x018, /*!< \brief Synopsys */ 55 | VX_ID_CADENCE = 0x019, /*!< \brief Cadence */ 56 | VX_ID_HUAWEI = 0x01A, /*!< \brief Huawei */ 57 | VX_ID_SOCIONEXT = 0x01B, /*!< \brief Socionext */ 58 | VX_ID_BOSCH = 0x01C, /*!< \brief Robert Bosch GmbH */ 59 | /* Add new vendor code above this line */ 60 | VX_ID_USER = 0xFFE, /*!< \brief For use by vxAllocateUserKernelId and vxAllocateUserKernelLibraryId */ 61 | VX_ID_MAX = 0xFFF, 62 | /*! \brief For use by all Kernel authors until they can obtain an assigned ID. */ 63 | VX_ID_DEFAULT = VX_ID_MAX, 64 | }; 65 | 66 | #endif 67 | 68 | --------------------------------------------------------------------------------