[PATCH 1/8] include: linux: Add Wdr to rkisp1-config.h

Paul Elder paul.elder at ideasonboard.com
Mon May 12 11:23:48 CEST 2025


Quoting Stefan Klug (2025-04-11 15:04:08)
> From: Jai Luthra <me at jailuthra.in>
> 
> Update linux headers.
> 
> Signed-off-by: Jai Luthra <me at jailuthra.in>
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>

Acked-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  include/linux/rkisp1-config.h | 72 +++++++++++++++++++++++++++++++++++
>  1 file changed, 72 insertions(+)
> 
> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
> index edbc6cb65d1c..656835577c9e 100644
> --- a/include/linux/rkisp1-config.h
> +++ b/include/linux/rkisp1-config.h
> @@ -169,6 +169,13 @@
>   */
>  #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS      64
>  
> +/*
> + * Wide Dynamic Range
> + */
> +#define RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV    32
> +#define RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF     (RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV + 1)
> +#define RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS   4
> +
>  /*
>   * Measurement types
>   */
> @@ -889,6 +896,52 @@ struct rkisp1_cif_isp_compand_curve_config {
>         __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];
>  };
>  
> +/**
> + * struct rkisp1_cif_isp_wdr_tone_curve - Tone mapping curve definition for WDR unit.
> + *
> + * @dY: the dYn increments for horizontal (input) axis of the tone curve.
> + *      each 3-bit dY value represents an increment of 2**(value+3).
> + *      dY[0] bits 0:2 is increment dY1, bit 3 unused
> + *      dY[0] bits 4:6 is increment dY2, bit 7 unused
> + *      ...
> + *      dY[0] bits 28:30 is increment dY8, bit 31 unused
> + *      ... and so on till dY[3] bits 28:30 is increment dY32, bit 31 unused.
> + * @ym: the Ym values for the vertical (output) axis of the tone curve.
> + *      each value is 13 bit.
> + *
> + * The reset values define a linear curve which has the same effect as bypass:
> + *
> + * dY[0..3] = 0x44444444, This means that input sample range of 0-4096 is
> + * divided in 32 equal increments of 2**(4+3) = 128 units
> + *
> + * ym[0] = 0x0000, ym[1] = 0x0080, ... ym[31] = 0x0f80, ym[32] = 0x1000
> + * which increases by 0x80 = 128 units
> + *
> + */
> +struct rkisp1_cif_isp_wdr_tone_curve {
> +       __u32 dY[RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS];
> +       __u16 ym[RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF];
> +};
> +
> +struct rkisp1_cif_isp_wdr_iref_config {
> +       __u8 rgb_factor;
> +       __u8 use_y9_8;
> +       __u8 use_rgb7_8;
> +       __u8 disable_transient;
> +};
> +
> +struct rkisp1_cif_isp_wdr_config {
> +       struct rkisp1_cif_isp_wdr_tone_curve tone_curve;
> +       struct rkisp1_cif_isp_wdr_iref_config iref_config;
> +       __u16 rgb_offset;
> +       __u16 luma_offset;
> +       __u16 dmin_thresh;
> +       __u8 dmin_strength;
> +       __u8 use_rgb_colorspace;
> +       __u8 bypass_chroma_mapping;
> +       __u8 use_iref;
> +};
> +
>  /*---------- PART2: Measurement Statistics ------------*/
>  
>  /**
> @@ -1059,6 +1112,7 @@ struct rkisp1_stat_buffer {
>   * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block
>   * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve
>   * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve
> + * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range
>   */
>  enum rkisp1_ext_params_block_type {
>         RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,
> @@ -1081,6 +1135,7 @@ enum rkisp1_ext_params_block_type {
>         RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,
>         RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,
>         RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,
> +       RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR,
>  };
>  
>  #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE     (1U << 0)
> @@ -1460,6 +1515,23 @@ struct rkisp1_ext_params_compand_curve_config {
>         struct rkisp1_cif_isp_compand_curve_config config;
>  } __attribute__((aligned(8)));
>  
> +/**
> + * struct rkisp1_ext_params_wdr_config - RkISP1 extensible params
> + *                                       Wide dynamic range config
> + *
> + * RkISP1 extensible parameters WDR block.
> + * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR`
> + *
> + * @header: The RkISP1 extensible parameters header, see
> + *         :c:type:`rkisp1_ext_params_block_header`
> + * @config: WDR configuration, see
> + *         :c:type:`rkisp1_cif_isp_wdr_config`
> + */
> +struct rkisp1_ext_params_wdr_config {
> +       struct rkisp1_ext_params_block_header header;
> +       struct rkisp1_cif_isp_wdr_config config;
> +} __attribute__((aligned(8)));
> +
>  /*
>   * The rkisp1_ext_params_compand_curve_config structure is counted twice as it
>   * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.
> -- 
> 2.43.0
>


More information about the libcamera-devel mailing list