Re: [PATCH v13 03/13] media: v4l2-jpeg: Export reference quantization and huffman tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx/
[2]: https://lore.kernel.org/all/20240607131900.3535250-1-devarsht@xxxxxx/
[3]: https://lore.kernel.org/all/2fed4937-e9ea-4635-a061-5c5a0533b152@xxxxxx/

Regards
Devarsh




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux