[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e948cea7-d5c7-a7e6-d921-ad7c2f93cd5a@ti.com>
Date: Wed, 19 Jun 2024 19:49:44 +0530
From: Devarsh Thakkar <devarsht@...com>
To: Hans Verkuil <hverkuil-cisco@...all.nl>, <mchehab@...nel.org>,
<linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<benjamin.gaignard@...labora.com>, <sebastian.fricke@...labora.com>
CC: <laurent.pinchart@...asonboard.com>, <praneeth@...com>, <nm@...com>,
<vigneshr@...com>, <a-bhatia1@...com>, <j-luthra@...com>,
<b-brnich@...com>, <detheridge@...com>, <p-mantena@...com>,
<vijayp@...com>, <andrzej.p@...labora.com>, <nicolas@...fresne.ca>,
Markus Elfring
<Markus.Elfring@....de>
Subject: Re: [PATCH v13 03/13] media: v4l2-jpeg: Export reference quantization
and huffman tables
Hi Hans, Sebastian,
Thanks for the review Hans.
On 13/06/24 15:38, Hans Verkuil wrote:
> Hi Devarsh,
[..]
>
> Why make this so complicated?
>
> Just do this:
>
> const u8 v4l2_jpeg_table_luma_qt[V4L2_JPEG_PIXELS_IN_BLOCK] = {
> 16, 11, 10, 16, 24, 40, 51, 61,
> 12, 12, 14, 19, 26, 58, 60, 55,
> 14, 13, 16, 24, 40, 57, 69, 56,
> 14, 17, 22, 29, 51, 87, 80, 62,
> 18, 22, 37, 56, 68, 109, 103, 77,
> 24, 35, 55, 64, 81, 104, 113, 92,
> 49, 64, 78, 87, 103, 121, 120, 101,
> 72, 92, 95, 98, 112, 100, 103, 99
> };
> EXPORT_SYMBOL_GPL(v4l2_jpeg_table_luma_qt);
>
> and in the header add:
>
> extern const u8 v4l2_jpeg_table_luma_qt[V4L2_JPEG_PIXELS_IN_BLOCK];
>
> Same for the other tables.
>
> And in the header add:
>
> extern const u8 v4l2_jpeg_table_luma_qt[V4L2_JPEG_PIXELS_IN_BLOCK];
>
> It's similar to e.g. 'const u8 v4l2_vp9_kf_y_mode_prob[10][10][9];'
> in v4l2-vp9.c/h.
>
> It also ensures that the compiler knows the size of each array,
> so it can detect out-of-bounds errors. And you can drop the accessor
> functions, as there is no longer any need for that.
>
> I really want this out-of-bounds detection, the code as it is now is too
> risky. So please make a v14.
>
Yes agreed, initially I had a similar thought to use extern declared variables
but somehow couldn't find any good examples as you shared so thought to have
wrapper functions but anyways have fixed this in v14.
>> +
>> +static const u8 chroma_qt[] = {
>
> Just to make it clear: don't use [] here, use the actual define for the
> array size. That way you get a compiler warning if you missed an entry
> in the initialization.
>
> Apologies for the late review, I only noticed this when I checked the
> pull request.
>
No worries for the delay, these are good comments and I have fixed them in v14
[1] appreciate if it's possible to have a quick review and if it looks good
possible to pull it in this week's RC cycle ? This will help me plan to send
math.h and rounding related patches (patch 7/13 to patch 12/13) from v13 [2]
as separate series more quickly as aligned. Also there was a new suggestion
[3] to use guard(mutex) in remove method, I was thinking to evaluate that and
pull that in as a separate patchset after this series gets merged and include
as part of next set of patches involving math.h and rounding macros discussed
above so that I can test them all together all at once since I am running a
bunch of manual and automated tests so wanted to reduce the cycles, will that
be fine ?
Kindly let me know your opinion.
[1]: https://lore.kernel.org/all/20240618193651.2771478-1-devarsht@ti.com/
[2]: https://lore.kernel.org/all/20240607131900.3535250-1-devarsht@ti.com/
[3]: https://lore.kernel.org/all/2fed4937-e9ea-4635-a061-5c5a0533b152@web.de/
Regards
Devarsh
Powered by blists - more mailing lists