[libcamera-devel] [PATCH RFC 1/7] android: yuv: separate source destination in length check
Mattijs Korpershoek
mkorpershoek at baylibre.com
Sun Sep 24 13:54:40 CEST 2023
Hi Jacopo,
Thank you for your review.
On ven., sept. 22, 2023 at 12:34, Jacopo Mondi <jacopo.mondi at ideasonboard.com> wrote:
> 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 ?
Urgh. Indeed. Thank you for catching this, will fix in v2.
>
>> }
>> }
>>
>> --
>> 2.41.0
>>
More information about the libcamera-devel
mailing list