media: verisilicon: Create AV1 helper library
Subsystems (3)
Benjamin Gaignard
maintainerPATCH v3 1/1 media: verisilicon: Create AV1 helper library
Regroup all none hardware related AV1 functions into a helper library. The goal is to avoid code duplication for futur AV1 codecs.
Tested on rock 5b board Fluster score remains the same 204/241.
---
changes in version 3:
- Remove useless wrapper functions.
drivers/media/platform/verisilicon/Makefile | 7 +-
.../media/platform/verisilicon/hantro_av1.c | 780 +++++++++++++++
.../media/platform/verisilicon/hantro_av1.h | 62 ++
...entropymode.c => hantro_av1_entropymode.c} | 18 +-
...entropymode.h => hantro_av1_entropymode.h} | 18 +-
...av1_filmgrain.c => hantro_av1_filmgrain.c} | 82 +-
.../verisilicon/hantro_av1_filmgrain.h | 44 +
.../media/platform/verisilicon/hantro_hw.h | 7 +-
.../verisilicon/rockchip_av1_filmgrain.h | 36 -
.../verisilicon/rockchip_vpu981_hw_av1_dec.c | 935 ++----------------
.../platform/verisilicon/rockchip_vpu_hw.c | 7 +-
11 files changed, 1041 insertions(+), 955 deletions(-)
create mode 100644 drivers/media/platform/verisilicon/hantro_av1.c
create mode 100644 drivers/media/platform/verisilicon/hantro_av1.h
rename drivers/media/platform/verisilicon/{rockchip_av1_entropymode.c => hantro_av1_entropymode.c} (99%)
rename drivers/media/platform/verisilicon/{rockchip_av1_entropymode.h => hantro_av1_entropymode.h} (95%)
rename drivers/media/platform/verisilicon/{rockchip_av1_filmgrain.c => hantro_av1_filmgrain.c} (92%)
create mode 100644 drivers/media/platform/verisilicon/hantro_av1_filmgrain.h
delete mode 100644 drivers/media/platform/verisilicon/rockchip_av1_filmgrain.hdrivers/media/platform/verisilicon/Makefile +4 -3
@@ -19,7 +19,10 @@ hantro-vpu-y += \ hantro_hevc.o \ hantro_mpeg2.o \ hantro_vp8.o \ - hantro_vp9.o + hantro_vp9.o \ + hantro_av1.o \ + hantro_av1_filmgrain.o \ + hantro_av1_entropymode.o hantro-vpu-$(CONFIG_VIDEO_HANTRO_IMX8M) += \ imx8m_vpu_hw.o
@@ -33,8 +36,6 @@ hantro-vpu-$(CONFIG_VIDEO_HANTRO_ROCKCHIP) += \ rockchip_vpu2_hw_mpeg2_dec.o \ rockchip_vpu2_hw_vp8_dec.o \ rockchip_vpu981_hw_av1_dec.o \ - rockchip_av1_filmgrain.o \ - rockchip_av1_entropymode.o \ rockchip_vpu_hw.o hantro-vpu-$(CONFIG_VIDEO_HANTRO_SUNXI) += \
drivers/media/platform/verisilicon/hantro_av1.c new file +780 -0
780 lines not on this page · raw message
drivers/media/platform/verisilicon/hantro_av1.h new file +62 -0
62 lines not on this page · raw message
drivers/media/platform/verisilicon/hantro_av1_entropymode.c renamed from drivers/media/platform/verisilicon/rockchip_av1_entropymode.c +9 -9
@@ -11,7 +11,7 @@*/ #include "hantro.h" -#include "rockchip_av1_entropymode.h" +#include "hantro_av1_entropymode.h" #define AOM_ICDF ICDF#define AOM_CDF2 (a0) AOM_ICDF(a0)
@@ -4195,7 +4195,7 @@ static const u16 default_bits_cdf[][10] = { } }; -static int rockchip_av1_get_q_ctx (int q) +static int hantro_av1_get_q_ctx (int q) {if (q <=20 )return 0 ;
@@ -4206,10 +4206,10 @@ static int rockchip_av1_get_q_ctx(int q)return 3 ; } -void rockchip_av1_default_coeff_probs (u32 base_qindex,void *ptr) +void hantro_av1_default_coeff_probs (u32 base_qindex,void *ptr) {struct av1cdfs *cdfs = (struct av1cdfs *)ptr; -const int index =rockchip_av1_get_q_ctx (base_qindex); +const int index =hantro_av1_get_q_ctx (base_qindex);memcpy (cdfs->txb_skip_cdf, av1_default_txb_skip_cdfs[index],sizeof (av1_default_txb_skip_cdfs[0 ]));
@@ -4240,8 +4240,8 @@ void rockchip_av1_default_coeff_probs(u32 base_qindex, void *ptr) sizeof(av1_default_eob_multi1024_cdfs[0])); } -void rockchip_av1_set_default_cdfs (struct av1cdfs *cdfs, -struct mvcdfs *cdfs_ndvc) +void hantro_av1_set_default_cdfs (struct av1cdfs *cdfs, +struct mvcdfs *cdfs_ndvc) {memcpy (cdfs->partition_cdf, default_partition_cdf,sizeof (cdfs->partition_cdf));
@@ -4398,7 +4398,7 @@ void rockchip_av1_set_default_cdfs(struct av1cdfs *cdfs, sizeof(cdfs->compound_idx_cdf)); } -void rockchip_av1_get_cdfs (struct hantro_ctx *ctx,u32 ref_idx) +void hantro_av1_get_cdfs (struct hantro_ctx *ctx,u32 ref_idx) {struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;
@@ -4406,8 +4406,8 @@ void rockchip_av1_get_cdfs(struct hantro_ctx *ctx, u32 ref_idx) av1_dec->cdfs_ndvc = &av1_dec->cdfs_last_ndvc[ref_idx]; } -void rockchip_av1_store_cdfs (struct hantro_ctx *ctx, -u32 refresh_frame_flags) +void hantro_av1_store_cdfs (struct hantro_ctx *ctx, +u32 refresh_frame_flags) {struct hantro_av1_dec_hw_ctx *av1_dec = &ctx->av1_dec;int i;
drivers/media/platform/verisilicon/hantro_av1_entropymode.h renamed from drivers/media/platform/verisilicon/rockchip_av1_entropymode.h +9 -9
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _ROCKCHIP_AV1_ENTROPYMODE_H_ -#define _ROCKCHIP_AV1_ENTROPYMODE_H_ +#ifndef _HANTRO_AV1_ENTROPYMODE_H_ +#define _HANTRO_AV1_ENTROPYMODE_H_#include <linux/types.h>
@@ -262,11 +262,11 @@ struct av1cdfs { u16 dummy3[16]; }; -void rockchip_av1_store_cdfs (struct hantro_ctx *ctx, -u32 refresh_frame_flags); -void rockchip_av1_get_cdfs (struct hantro_ctx *ctx,u32 ref_idx); -void rockchip_av1_set_default_cdfs (struct av1cdfs *cdfs, -struct mvcdfs *cdfs_ndvc); -void rockchip_av1_default_coeff_probs (u32 base_qindex,void *ptr); +void hantro_av1_store_cdfs (struct hantro_ctx *ctx, +u32 refresh_frame_flags); +void hantro_av1_get_cdfs (struct hantro_ctx *ctx,u32 ref_idx); +void hantro_av1_set_default_cdfs (struct av1cdfs *cdfs, +struct mvcdfs *cdfs_ndvc); +void hantro_av1_default_coeff_probs (u32 base_qindex,void *ptr); -#endif /* _ROCKCHIP_AV1_ENTROPYMODE_H_ */ +#endif /* _HANTRO_AV1_ENTROPYMODE_H_ */
drivers/media/platform/verisilicon/hantro_av1_filmgrain.c renamed from drivers/media/platform/verisilicon/rockchip_av1_filmgrain.c +41 -41
147 lines not on this page · raw message
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +44 -0
44 lines not on this page · raw message
drivers/media/platform/verisilicon/hantro_hw.h +2 -5
@@ -15,8 +15,8 @@#include <media/v4l2-vp9.h> #include <media/videobuf2-core.h> -#include "rockchip_av1_entropymode.h" -#include "rockchip_av1_filmgrain.h" +#include "hantro_av1_entropymode.h" +#include "hantro_av1_filmgrain.h" #define DEC_8190_ALIGN_MASK 0x07U
@@ -459,10 +459,7 @@ void hantro_hevc_ref_init(struct hantro_ctx *ctx);dma_addr_t hantro_hevc_get_ref_buf (struct hantro_ctx *ctx,s32 poc);int hantro_hevc_add_ref_buf (struct hantro_ctx *ctx,int poc,dma_addr_t addr); -int rockchip_vpu981_av1_dec_init (struct hantro_ctx *ctx); -void rockchip_vpu981_av1_dec_exit (struct hantro_ctx *ctx);int rockchip_vpu981_av1_dec_run (struct hantro_ctx *ctx); -void rockchip_vpu981_av1_dec_done (struct hantro_ctx *ctx);static inline unsigned short hantro_vp9_num_sbs (unsigned short dimension) {
drivers/media/platform/verisilicon/rockchip_av1_filmgrain.h deleted +0 -36
@@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef _ROCKCHIP_AV1_FILMGRAIN_H_ -#define _ROCKCHIP_AV1_FILMGRAIN_H_ - -#include <linux/types.h> - -void rockchip_av1_generate_luma_grain_block (s32 (*luma_grain_block)[73 ][82 ], -s32 bitdepth, -u8 num_y_points, -s32 grain_scale_shift, -s32 ar_coeff_lag, -s32 (*ar_coeffs_y)[24 ], -s32 ar_coeff_shift, -s32 grain_min, -s32 grain_max, -u16 random_seed); - -void rockchip_av1_generate_chroma_grain_block (s32 (*luma_grain_block)[73 ][82 ], -s32 (*cb_grain_block)[38 ][44 ], -s32 (*cr_grain_block)[38 ][44 ], -s32 bitdepth, -u8 num_y_points, -u8 num_cb_points, -u8 num_cr_points, -s32 grain_scale_shift, -s32 ar_coeff_lag, -s32 (*ar_coeffs_cb)[25 ], -s32 (*ar_coeffs_cr)[25 ], -s32 ar_coeff_shift, -s32 grain_min, -s32 grain_max, -u8 chroma_scaling_from_luma, -u16 random_seed); - -#endif
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c +86 -849
1,205 lines not on this page · raw message
drivers/media/platform/verisilicon/rockchip_vpu_hw.c +4 -3
@@ -9,6 +9,7 @@#include <linux/clk.h> #include "hantro.h" +#include "hantro_av1.h" #include "hantro_jpeg.h" #include "hantro_g1_regs.h" #include "hantro_h1_regs.h"
@@ -608,9 +609,9 @@ static const struct hantro_codec_ops rk3568_vepu_codec_ops[] = {static const struct hantro_codec_ops rk3588_vpu981_codec_ops[] = { [HANTRO_MODE_AV1_DEC ] = { .run = rockchip_vpu981_av1_dec_run, - .init = rockchip_vpu981_av1_dec_init, - .exit = rockchip_vpu981_av1_dec_exit, - .done = rockchip_vpu981_av1_dec_done, + .init = hantro_av1_init, + .exit = hantro_av1_exit, + .done = hantro_av1_update_prob, }, };/*
Signature · 1 line
2.43.0
Hi Benjamin,
I have a few comments about this:
Quoted 2 lines · Benjamin Gaignard
Regroup all none hardware related AV1 functions into a helper library. The goal is to avoid code duplication for futur AV1 codecs.
futur -> future
Quoted 29 lines
Tested on rock 5b board Fluster score remains the same 204/241.
Signed-off-by Benjamin Gaignard <[email protected]>Reviewed-by Nicolas Dufresne <[email protected]>---
changes in version 3:
- Remove useless wrapper functions.drivers/media/platform/verisilicon/Makefile | 7 +- .../media/platform/verisilicon/hantro_av1.c | 780 +++++++++++++++ .../media/platform/verisilicon/hantro_av1.h | 62 ++ ...entropymode.c => hantro_av1_entropymode.c} | 18 +- ...entropymode.h => hantro_av1_entropymode.h} | 18 +- ...av1_filmgrain.c => hantro_av1_filmgrain.c} | 82 +- .../verisilicon/hantro_av1_filmgrain.h | 44 + .../media/platform/verisilicon/hantro_hw.h | 7 +- .../verisilicon/rockchip_av1_filmgrain.h | 36 - .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 935 ++---------------- .../platform/verisilicon/rockchip_vpu_hw.c | 7 +- 11 files changed, 1041 insertions(+), 955 deletions(-) create mode 100644 drivers/media/platform/verisilicon/hantro_av1.c create mode 100644 drivers/media/platform/verisilicon/hantro_av1.h rename drivers/media/platform/verisilicon/{rockchip_av1_entropymode.c => hantro_av1_entropymode.c} (99%) rename drivers/media/platform/verisilicon/{rockchip_av1_entropymode.h => hantro_av1_entropymode.h} (95%) rename drivers/media/platform/verisilicon/{rockchip_av1_filmgrain.c => hantro_av1_filmgrain.c} (92%) create mode 100644 drivers/media/platform/verisilicon/hantro_av1_filmgrain.h delete mode 100644 drivers/media/platform/verisilicon/rockchip_av1_filmgrain.h
<snip>
Quoted 6 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +0
-0@@ -0,0 +1,780 @@
<snip>
drivers/media/platform/verisilicon/hantro_av1.c line 568
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +10
-0+ +int hantro_av1_tile_log2 (int target) +{ +int k; + +/* +* returns the smallest value for k such that 1 << k is greater +* than or equal to target +*/ +for (k =0 ; (1 << k) < target; k++);
Checkpatch gives:
ERROR: trailing statements should be on next line #637: FILE: drivers/media/platform/verisilicon/hantro_av1.c:568:
+ for (k = 0; (1 << k) < target; k++);
Just move the ';' to the next line.
Quoted 4 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +4
-0+ +return k; +} +
<snip>
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +4
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _HANTRO_AV1_FILMGRAIN_H_ +#define _HANTRO_AV1_FILMGRAIN_H_
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h line 14
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +10
-0+ +#include <linux/types.h> + +struct hantro_av1_film_grain { +u8 scaling_lut_y[256 ]; +u8 scaling_lut_cb[256 ]; +u8 scaling_lut_cr[256 ]; +s16 cropped_luma_grain_block[4096 ]; +s16 cropped_chroma_grain_block[1024 *2 ]; +};
This struct is not used in hantro_av1_filmgrain.c/h.
Does this belong here?
Quoted 19 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +19
-0+ +void hantro_av1_generate_luma_grain_block (s32 (*luma_grain_block)[73 ][82 ], +s32 bitdepth, +u8 num_y_points, +s32 grain_scale_shift, +s32 ar_coeff_lag, +s32 (*ar_coeffs_y)[24 ], +s32 ar_coeff_shift, +s32 grain_min, +s32 grain_max, +u16 random_seed); + +void hantro_av1_generate_chroma_grain_block(s32 (*luma_grain_block)[73][82], + s32 (*cb_grain_block)[38][44], + s32 (*cr_grain_block)[38][44], + s32 bitdepth, + u8 num_y_points, + u8 num_cb_points, + u8 num_cr_points,
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h line 43
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +10
-0+s32 grain_scale_shift, + s32 ar_coeff_lag, + s32 (*ar_coeffs_cb)[25], + s32 (*ar_coeffs_cr)[25], + s32 ar_coeff_shift, + s32 grain_min, + s32 grain_max, + u8 chroma_scaling_from_luma, + u16 random_seed); +
I get a lot of checkpatch warnings of this type:
WARNING: function definition argument 's32' should also have an identifier name #1205: FILE: drivers/media/platform/verisilicon/hantro_av1_filmgrain.h:16:
+void hantro_av1_generate_luma_grain_block(s32 (*luma_grain_block)[73][82], Looking at how it is used in rockchip_vpu981_av1_dec_set_fgs() I think this can be done a lot easier if you add a new struct here containing those arrays. E.g.:
struct hantro_av1_coeffs_grain_block {
s32 ar_coeffs_y[24];
s32 ar_coeffs_cb[25];
s32 ar_coeffs_cr[25];
s32 luma_grain_block[73][82];
s32 cb_grain_block[38][44];
s32 cr_grain_block[38][44];
};Then in rockchip_vpu981_av1_dec_set_fgs you can just kzalloc that struct and pass it to these filmgrain functions.
Also consider using #defines for the array sizes.
If you decide not to use a struct, then you can at least change simply use 's32 luma_grain_block[73][82]' as arguments to these helper functions. There is no need to complicate the function prototypes.
But I think creating a struct is a cleaner approach.
Regards,
Hans
Benjamin Gaignard
maintainerLe 04/05/2026 à 09:20, Hans Verkuil a écrit :
Quoted 59 lines
Hi Benjamin,
I have a few comments about this:
Quoted 2 lines · Benjamin Gaignard
Regroup all none hardware related AV1 functions into a helper library. The goal is to avoid code duplication for futur AV1 codecs.
futur -> future
Quoted 28 lines
Tested on rock 5b board Fluster score remains the same 204/241.
Signed-off-by Benjamin Gaignard <[email protected]>Reviewed-by Nicolas Dufresne <[email protected]>---
changes in version 3:
- Remove useless wrapper functions.drivers/media/platform/verisilicon/Makefile | 7 +- .../media/platform/verisilicon/hantro_av1.c | 780 +++++++++++++++ .../media/platform/verisilicon/hantro_av1.h | 62 ++ ...entropymode.c => hantro_av1_entropymode.c} | 18 +- ...entropymode.h => hantro_av1_entropymode.h} | 18 +- ...av1_filmgrain.c => hantro_av1_filmgrain.c} | 82 +- .../verisilicon/hantro_av1_filmgrain.h | 44 + .../media/platform/verisilicon/hantro_hw.h | 7 +- .../verisilicon/rockchip_av1_filmgrain.h | 36 - .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 935 ++---------------- .../platform/verisilicon/rockchip_vpu_hw.c | 7 +- 11 files changed, 1041 insertions(+), 955 deletions(-)create mode 100644
drivers/media/platform/verisilicon/hantro_av1.c
create mode 100644drivers/media/platform/verisilicon/hantro_av1.h
renamedrivers/media/platform/verisilicon/{rockchip_av1_entropymode.c=>hantro_av1_entropymode.c} (99%) renamedrivers/media/platform/verisilicon/{rockchip_av1_entropymode.h=>hantro_av1_entropymode.h} (95%) renamedrivers/media/platform/verisilicon/{rockchip_av1_filmgrain.c=>hantro_av1_filmgrain.c} (92%) create mode 100644drivers/media/platform/verisilicon/hantro_av1_filmgrain.h
delete mode 100644drivers/media/platform/verisilicon/rockchip_av1_filmgrain.h<snip>
Quoted 6 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +0
-0@@ -0,0 +1,780 @@<snip>
drivers/media/platform/verisilicon/hantro_av1.c line 568
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +10
-0+ +int hantro_av1_tile_log2 (int target) +{ +int k; + +/* +* returns the smallest value for k such that 1 << k is greater +* than or equal to target +*/ +for (k =0 ; (1 << k) < target; k++);Checkpatch gives:
Quoted 5 lines
ERROR: trailing statements should be on next line #637: FILE:
drivers/media/platform/verisilicon/hantro_av1.c:568:
+ for (k = 0; (1 << k) < target; k++);Just move the ';' to the next line.
OK I will do that.
Quoted 29 lines
Quoted 5 lines
drivers/media/platform/verisilicon/hantro_av1.c new file +4
-0+ +return k; +} +<snip>
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +4
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _HANTRO_AV1_FILMGRAIN_H_ +#define _HANTRO_AV1_FILMGRAIN_H_drivers/media/platform/verisilicon/hantro_av1_filmgrain.h line 14
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +10
-0+ +#include <linux/types.h> + +struct hantro_av1_film_grain { +u8 scaling_lut_y[256 ]; +u8 scaling_lut_cb[256 ]; +u8 scaling_lut_cr[256 ]; +s16 cropped_luma_grain_block[4096 ]; +s16 cropped_chroma_grain_block[1024 *2 ]; +};This struct is not used in hantro_av1_filmgrain.c/h.
Quoted 1 line
Does this belong here?
The same structure can used for future Verisilicon hardware block so I would prefer to keep it here.
Quoted 48 lines
Quoted 20 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +19
-0+ +void hantro_av1_generate_luma_grain_block (s32 (*luma_grain_block)[73 ][82 ], +s32 bitdepth, +u8 num_y_points, +s32 grain_scale_shift, +s32 ar_coeff_lag, +s32 (*ar_coeffs_y)[24 ], +s32 ar_coeff_shift, +s32 grain_min, +s32 grain_max, +u16 random_seed); + +void hantro_av1_generate_chroma_grain_block(s32 (*luma_grain_block)[73][82], + s32 (*cb_grain_block)[38][44], + s32 (*cr_grain_block)[38][44], + s32 bitdepth, + u8 num_y_points, + u8 num_cb_points, + u8 num_cr_points,drivers/media/platform/verisilicon/hantro_av1_filmgrain.h line 43
Quoted 10 lines
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h new file +10
-0+s32 grain_scale_shift, + s32 ar_coeff_lag, + s32 (*ar_coeffs_cb)[25], + s32 (*ar_coeffs_cr)[25], + s32 ar_coeff_shift, + s32 grain_min, + s32 grain_max, + u8 chroma_scaling_from_luma, + u16 random_seed); +I get a lot of checkpatch warnings of this type:
WARNING: function definition argument 's32' should also have an identifier name #1205: FILE:
drivers/media/platform/verisilicon/hantro_av1_filmgrain.h:16:
+void hantro_av1_generate_luma_grain_block(s32 (*luma_grain_block)[73][82], Looking at how it is used inrockchip_vpu981_av1_dec_set_fgs()I think this can be done a lot easier if you add a new struct here containing those arrays. E.g.:struct hantro_av1_coeffs_grain_block { s32 ar_coeffs_y[24]; s32 ar_coeffs_cb[25]; s32 ar_coeffs_cr[25]; s32 luma_grain_block[73][82]; s32 cb_grain_block[38][44]; s32 cr_grain_block[38][44]; };
Quoted 2 lines
Then in
rockchip_vpu981_av1_dec_set_fgsyou can just kzalloc that struct and pass it to these filmgrain functions.
I will do that.
Quoted 2 lines
Also consider using #defines for the array sizes.
Chapter "7.18.3.3. Generate grain process" of AV1 spec doesn't define/name these values so keep them like this make the code more easy to review with the spec.
https://aomediacodec.github.io/av1-spec/#generate-grain-process
That said I'm always for naming values so good suggestion are welcome.
Thanks,
Benjamin
Quoted 11 lines
If you decide not to use a struct, then you can at least change simply use 's32 luma_grain_block[73][82]' as arguments to these helper functions. There is no need to complicate the function prototypes.
But I think creating a struct is a cleaner approach.
Regards,
Hans