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