[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <904289bb-96a0-4a0d-9046-96acd8843b98@xs4all.nl>
Date: Thu, 20 Jun 2024 09:02:10 +0200
From: Hans Verkuil <hverkuil-cisco@...all.nl>
To: Devarsh Thakkar <devarsht@...com>, 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
On 19/06/2024 16:19, Devarsh Thakkar wrote:
> 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 ?
I've reviewed v14 3/6, so Sebastian when Sebastian posts a new PR I can process
it.
Ignore any reviews by Markus Elfring, he's a troll.
Regards,
Hans
Powered by blists - more mailing lists