summaryrefslogtreecommitdiff
path: root/src/libcamera/transform.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-10-19 16:01:27 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-23 16:05:59 +0300
commitb54c935dd764ac3348bcedb9ff67d53a26cfaceb (patch)
treece558e390a37d6a92cde7c77d60f8387f0a4b053 /src/libcamera/transform.cpp
parent250577878bff825516ea5a942aea1b3339acb15c (diff)
libcamera: transform: Invert operator*() operands
The current definition of operator*(Transform t1, Transform t0) follows the function composition notion, where t0 is applied first then t1 is applied last. In order to introduce operator*(Orientation, Transform) where a Transform is applied on top of an Orientation, invert the operand order of operator*(Transform, Transform) so that usage of operator* with both Orientation and Transform can be made associative. For example: Orientation o; Transform t = t1 * t2 Orientation o1 = o * t = o * (t1 * t2) = (o * t1) * t2 = o * t1 * t2 Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/transform.cpp')
-rw-r--r--src/libcamera/transform.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp
index c3059401..9316db00 100644
--- a/src/libcamera/transform.cpp
+++ b/src/libcamera/transform.cpp
@@ -189,24 +189,24 @@ Input image | | goes to output image | |
*/
/**
- * \brief Compose two transforms together
- * \param[in] t1 The second transform
- * \param[in] t0 The first transform
+ * \brief Compose two transforms by applying \a t0 first then \a t1
+ * \param[in] t0 The first transform to apply
+ * \param[in] t1 The second transform to apply
*
- * Composing transforms follows the usual mathematical convention for
- * composing functions. That is, when performing `t1 * t0`, \a t0 is applied
- * first, and then \a t1.
- * For example, `Transpose * HFlip` performs `HFlip` first and then the
- * `Transpose` yielding `Rot270`, as shown below.
+ * Compose two transforms into a transform that is equivalent to first applying
+ * \a t0 and then applying \a t1. For example, `HFlip * Transpose` performs
+ * `HFlip` first and then the `Transpose` yielding `Rot270`, as shown below.
~~~
A-B B-A B-D
Input image | | -> HFLip -> | | -> Transpose -> | | = Rot270
C-D D-C A-C
~~~
- * Note that composition is generally non-commutative for Transforms,
- * and not the same as XOR-ing the underlying bit representations.
+ * Note that composition is generally non-commutative for Transforms, and not
+ * the same as XOR-ing the underlying bit representations.
+ *
+ * \return A Transform equivalent to applying \a t0 and then \a t1
*/
-Transform operator*(Transform t1, Transform t0)
+Transform operator*(Transform t0, Transform t1)
{
/*
* Reorder the operations so that we imagine doing t0's transpose