[libcamera-devel,1/3] android: post_processor: Introduce a PostProcessor interface
diff mbox series

Message ID 20201015171457.75678-2-email@uajain.com
State Accepted
Headers show
Series
  • android: Introduce PostProcessor interface
Related show

Commit Message

Umang Jain Oct. 15, 2020, 5:14 p.m. UTC
Introduce a PostProcessor interface for the streams that require any
kind of processing (refer to CameraStream::Type) for their consumption
by the HAL layer. The PostProcessor interface can be configured via
configure() and the actual processing can be initiated using process().

The post-processing layer can be extended to have multiple post
processors for various stream configurations. As of now, we only have
one post processor (JPEG), hence the subsequent commit will port its
function to this interface.

Signed-off-by: Umang Jain <email@uajain.com>
---
 src/android/post_processor.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/android/post_processor.h

Comments

Kieran Bingham Oct. 15, 2020, 7:33 p.m. UTC | #1
Hi Umang

On 15/10/2020 18:14, Umang Jain wrote:
> Introduce a PostProcessor interface for the streams that require any
> kind of processing (refer to CameraStream::Type) for their consumption

At some point, we should make this decision on what the stream needs,
rather than it's type. But this is fine for now.


> by the HAL layer. The PostProcessor interface can be configured via
> configure() and the actual processing can be initiated using process().
> 
> The post-processing layer can be extended to have multiple post
> processors for various stream configurations. As of now, we only have
> one post processor (JPEG), hence the subsequent commit will port its
> function to this interface.
> 
> Signed-off-by: Umang Jain <email@uajain.com>

This looks good to me.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/android/post_processor.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100644 src/android/post_processor.h
> 
> diff --git a/src/android/post_processor.h b/src/android/post_processor.h
> new file mode 100644
> index 0000000..a891c43
> --- /dev/null
> +++ b/src/android/post_processor.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2020, Google Inc.
> + *
> + * post_processor.h - CameraStream Post Processing Interface
> + */
> +#ifndef __ANDROID_POST_PROCESSOR_H__
> +#define __ANDROID_POST_PROCESSOR_H__
> +
> +#include <libcamera/buffer.h>
> +#include <libcamera/span.h>
> +#include <libcamera/stream.h>
> +
> +class CameraMetadata;
> +
> +class PostProcessor
> +{
> +public:
> +	virtual ~PostProcessor() {}
> +
> +	virtual int configure(const libcamera::StreamConfiguration &inCfg,
> +			      const libcamera::StreamConfiguration &outCfg) = 0;
> +	virtual int process(const libcamera::FrameBuffer *source,
> +			    const libcamera::Span<uint8_t> &destination,
> +			    CameraMetadata *metadata) = 0;
> +};
> +
> +#endif /* __ANDROID_POST_PROCESSOR_H__ */
>
Laurent Pinchart Oct. 16, 2020, 4:59 a.m. UTC | #2
Hi Umang,

(CC'ing Hiro-san)

Thank you for the patch.

On Thu, Oct 15, 2020 at 10:44:55PM +0530, Umang Jain wrote:
> Introduce a PostProcessor interface for the streams that require any
> kind of processing (refer to CameraStream::Type) for their consumption
> by the HAL layer. The PostProcessor interface can be configured via
> configure() and the actual processing can be initiated using process().
> 
> The post-processing layer can be extended to have multiple post
> processors for various stream configurations. As of now, we only have
> one post processor (JPEG), hence the subsequent commit will port its
> function to this interface.
> 
> Signed-off-by: Umang Jain <email@uajain.com>

I think this does the job nicely for the JPEG encoder. I expect the API
to be reworked as part of Hiro's work, which is completely fine.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/android/post_processor.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100644 src/android/post_processor.h
> 
> diff --git a/src/android/post_processor.h b/src/android/post_processor.h
> new file mode 100644
> index 0000000..a891c43
> --- /dev/null
> +++ b/src/android/post_processor.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: LGPL-2.1-or-later */
> +/*
> + * Copyright (C) 2020, Google Inc.
> + *
> + * post_processor.h - CameraStream Post Processing Interface
> + */
> +#ifndef __ANDROID_POST_PROCESSOR_H__
> +#define __ANDROID_POST_PROCESSOR_H__
> +
> +#include <libcamera/buffer.h>
> +#include <libcamera/span.h>
> +#include <libcamera/stream.h>
> +
> +class CameraMetadata;
> +
> +class PostProcessor
> +{
> +public:
> +	virtual ~PostProcessor() {}
> +
> +	virtual int configure(const libcamera::StreamConfiguration &inCfg,
> +			      const libcamera::StreamConfiguration &outCfg) = 0;
> +	virtual int process(const libcamera::FrameBuffer *source,
> +			    const libcamera::Span<uint8_t> &destination,
> +			    CameraMetadata *metadata) = 0;
> +};
> +
> +#endif /* __ANDROID_POST_PROCESSOR_H__ */

Patch
diff mbox series

diff --git a/src/android/post_processor.h b/src/android/post_processor.h
new file mode 100644
index 0000000..a891c43
--- /dev/null
+++ b/src/android/post_processor.h
@@ -0,0 +1,28 @@ 
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2020, Google Inc.
+ *
+ * post_processor.h - CameraStream Post Processing Interface
+ */
+#ifndef __ANDROID_POST_PROCESSOR_H__
+#define __ANDROID_POST_PROCESSOR_H__
+
+#include <libcamera/buffer.h>
+#include <libcamera/span.h>
+#include <libcamera/stream.h>
+
+class CameraMetadata;
+
+class PostProcessor
+{
+public:
+	virtual ~PostProcessor() {}
+
+	virtual int configure(const libcamera::StreamConfiguration &inCfg,
+			      const libcamera::StreamConfiguration &outCfg) = 0;
+	virtual int process(const libcamera::FrameBuffer *source,
+			    const libcamera::Span<uint8_t> &destination,
+			    CameraMetadata *metadata) = 0;
+};
+
+#endif /* __ANDROID_POST_PROCESSOR_H__ */