mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Devarsh Thakkar <devarsht@ti.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>, <mchehab@kernel.org>,
	<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<benjamin.gaignard@collabora.com>,
	<sebastian.fricke@collabora.com>
Cc: <laurent.pinchart@ideasonboard.com>, <praneeth@ti.com>,
	<nm@ti.com>, <vigneshr@ti.com>, <a-bhatia1@ti.com>,
	<j-luthra@ti.com>, <b-brnich@ti.com>, <detheridge@ti.com>,
	<p-mantena@ti.com>, <vijayp@ti.com>, <andrzej.p@collabora.com>,
	<nicolas@ndufresne.ca>, Markus Elfring <Markus.Elfring@web.de>
Subject: Re: [PATCH v13 03/13] media: v4l2-jpeg: Export reference quantization and huffman tables
Date: Wed, 19 Jun 2024 19:49:44 +0530	[thread overview]
Message-ID: <e948cea7-d5c7-a7e6-d921-ad7c2f93cd5a@ti.com> (raw)
In-Reply-To: <59866428-342b-4ba4-a7c7-2df1477aa7e6@xs4all.nl>

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

  reply	other threads:[~2024-06-19 14:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 13:19 [PATCH v13 00/13] Add V4L2 M2M Driver for E5010 JPEG Encoder Devarsh Thakkar
2024-06-07 13:24 ` [PATCH v13 01/13] media: dt-bindings: Add Imagination " Devarsh Thakkar
2024-06-07 13:28 ` [PATCH v13 02/13] media: imagination: Add E5010 JPEG Encoder driver Devarsh Thakkar
2024-06-07 13:28 ` [PATCH v13 03/13] media: v4l2-jpeg: Export reference quantization and huffman tables Devarsh Thakkar
2024-06-13 10:08   ` Hans Verkuil
2024-06-19 14:19     ` Devarsh Thakkar [this message]
2024-06-20  7:02       ` Hans Verkuil
2024-06-20  7:22         ` [v13 " Markus Elfring
2024-06-21  8:52         ` [PATCH v13 " Devarsh Thakkar
2024-06-21  9:28           ` Sebastian Fricke
2024-06-07 13:29 ` [PATCH v13 04/13] media: Documentation: Document v4l2-jpeg helper functions Devarsh Thakkar
2024-06-07 13:29 ` [PATCH v13 05/13] media: imagination: Use exported tables from v4l2-jpeg core Devarsh Thakkar
2024-06-07 13:30 ` [PATCH v13 06/13] media: verisilicon : Use exported tables from v4l2-jpeg for hantro codec Devarsh Thakkar
2024-06-07 13:30 ` [PATCH v13 07/13] math.h: Add macros for rounding to closest value Devarsh Thakkar
2024-06-07 13:30 ` [PATCH v13 08/13] math.h: Use kernel-doc syntax for divison macros Devarsh Thakkar
2024-06-07 13:31 ` [PATCH v13 09/13] Documentation: core-api: Add math.h macros and functions Devarsh Thakkar
2024-06-26 23:59   ` Randy Dunlap
2024-06-07 13:31 ` [PATCH v13 10/13] lib: add basic KUnit test for lib/math Devarsh Thakkar
2024-06-07 13:32 ` [PATCH v13 11/13] lib: math_kunit: Add tests for new macros related to rounding to nearest value Devarsh Thakkar
2024-06-07 13:32 ` [PATCH v13 12/13] media: imagination: Round to closest multiple for cropping region Devarsh Thakkar
2024-06-07 13:33 ` [PATCH v13 13/13] gpu: ipu-v3: Use generic macro for rounding closest to specified value Devarsh Thakkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e948cea7-d5c7-a7e6-d921-ad7c2f93cd5a@ti.com \
    --to=devarsht@ti.com \
    --cc=Markus.Elfring@web.de \
    --cc=a-bhatia1@ti.com \
    --cc=andrzej.p@collabora.com \
    --cc=b-brnich@ti.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=detheridge@ti.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=j-luthra@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=nm@ti.com \
    --cc=p-mantena@ti.com \
    --cc=praneeth@ti.com \
    --cc=sebastian.fricke@collabora.com \
    --cc=vigneshr@ti.com \
    --cc=vijayp@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®