[libcamera-devel] [PATCH RFC 1/7] android: yuv: separate source destination in length check
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Fri Sep 22 12:34:23 CEST 2023
Hi Mattijs
On Fri, Sep 15, 2023 at 09:57:25AM +0200, Mattijs Korpershoek via libcamera-devel wrote:
> Right now, the assumption of PostProcessorYuv is that both the source
> and the destination are in formats::NV12.
>
> This might change in the future, if we add other formats or pixel format
> conversion as supported in libyuv.
>
> Split out source and destination check to prepare for that.
>
> No functional change.
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> ---
> src/android/yuv/post_processor_yuv.cpp | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp
> index ed44e6fe02da..9631c9617154 100644
> --- a/src/android/yuv/post_processor_yuv.cpp
> +++ b/src/android/yuv/post_processor_yuv.cpp
> @@ -133,14 +133,17 @@ void PostProcessorYuv::calculateLengths(const StreamConfiguration &inCfg,
> sourceSize_ = inCfg.size;
> destinationSize_ = outCfg.size;
>
> - const PixelFormatInfo &nv12Info = PixelFormatInfo::info(formats::NV12);
> + const PixelFormatInfo &sourceInfo = PixelFormatInfo::info(formats::NV12);
> for (unsigned int i = 0; i < 2; i++) {
> sourceStride_[i] = inCfg.stride;
> - destinationStride_[i] = nv12Info.stride(destinationSize_.width, i, 1);
> + sourceLength_[i] = sourceInfo.planeSize(sourceSize_.height, i,
> + sourceStride_[i]);
> + }
>
> - sourceLength_[i] = nv12Info.planeSize(sourceSize_.height, i,
> - sourceStride_[i]);
> - destinationLength_[i] = nv12Info.planeSize(destinationSize_.height, i,
> - destinationStride_[i]);
> + const PixelFormatInfo &destinationInfo = PixelFormatInfo::info(formats::NV12);
> + for (unsigned int i = 0; i < 2; i++) {
> + destinationStride_[i] = sourceInfo.stride(destinationSize_.width, i, 1);
> + destinationLength_[i] = sourceInfo.planeSize(destinationSize_.height, i,
> + destinationStride_[i]);
You probably want to use the newly introduced destinationInfo here ?
> }
> }
>
> --
> 2.41.0
>
More information about the libcamera-devel
mailing list