1// Copyright (c) 2021 Qualcomm Technologies, Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_QCOM_image_processing.adoc[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2022-07-08
11*Interactions and External Dependencies*::
12  - This extension requires
13    {spirv}/QCOM/SPV_QCOM_image_processing.html[`SPV_QCOM_image_processing`]
14  - This extension provides API support for
15    {GLSLregistry}/qcom/GLSL_QCOM_image_processing.txt[`GL_QCOM_image_processing`]
16
17*Contributors*::
18  - Jeff Leger, Qualcomm Technologies, Inc.
19  - Ruihao Zhang, Qualcomm Technologies, Inc.
20
21=== Description
22
23GPUs are commonly used to process images for various applications from 3D
24graphics to UI and from composition to compute applications.
25Simple scaling and filtering can be done with bilinear filtering, which
26comes for free during texture sampling.
27However, as screen sizes get larger and more use cases rely on GPU such as
28camera and video post-processing needs, there is increasing demand for GPU
29to support higher order filtering and other advanced image processing.
30
31This extension introduces a new set of SPIR-V built-in functions for image
32processing.
33It exposes the following new imaging operations
34
35  * The `OpImageSampleWeightedQCOM` instruction takes 3 operands: _sampled
36    image_, _weight image_, and texture coordinates.
37    The instruction computes a weighted average of an MxN region of texels
38  in the _sampled image_, using a set of MxN weights in the _weight image_.
39  * The `OpImageBoxFilterQCOM` instruction takes 3 operands: _sampled
40    image_, _box size_, and texture coordinates.
41    Note that _box size_ specifies a floating point width and height in
42    texels.
43    The instruction computes a weighted average of all texels in the
44    _sampled image_ that are covered (either partially or fully) by a box
45    with the specified size and centered at the specified texture
46    coordinates.
47  * The `OpImageBlockMatchSADQCOM` and `OpImageBlockMatchSSDQCOM`
48    instructions each takes 5 operands: _target image_, _target
49    coordinates_, _reference image_, _reference coordinates_, and _block
50    size_.
51    Each instruction computes an error metric, that describes whether a
52    block of texels in the _target image_ matches a corresponding block of
53    texels in the _reference image_.
54    The error metric is computed per-component.
55    `OpImageBlockMatchSADQCOM` computes "Sum Of Absolute Difference" and
56    `OpImageBlockMatchSSDQCOM` computes "Sum of Squared Difference".
57
58Each of the image processing instructions operate only on 2D images.
59The instructions do not-support sampling of mipmap, multi-plane,
60multi-layer, multi-sampled, or depth/stencil images.
61The instructions can be used in any shader stage.
62
63Implementations of this this extension should support these operations
64natively at the HW instruction level, offering potential performance gains
65as well as ease of development.
66
67include::{generated}/interfaces/VK_QCOM_image_processing.adoc[]
68
69=== Version History
70
71  * Revision 1, 2022-07-08 (Jeff Leger)
72