STRUCT RKISP1_CIF_ISP_CAC_CONFIG(9)
π NAME π
struct rkisp1_cif_isp_cac_config β chromatic aberration correction configuration π
(yes bestie, this is a page from the Kernel API Manual, and the header up top lowkey gets chopped to struct rkisp...p_cac_config(9) because terminals are dramatic, but the real name is the full one above π«Ά)
β¨ SYNOPSIS β¨
struct rkisp1_cif_isp_cac_config {
__u8 h_clip_mode;
__u8 v_clip_mode;
__u16 h_count_start;
__u16 v_count_start;
__u16 red[3];
__u16 blue[3];
__u8 x_nf;
__u8 x_ns;
__u8 y_nf;
__u8 y_ns;
};
That's the whole struct, no cap. Note the slightly goofy trailing space + }; situation β that's just how the original spells it, so we're keeping it exactly π₯
π MEMBERS π
Ok so these are the fields, and every single one has rules, so pay attention:
h_clip_modeβ maximum horizontal shift, taken fromenum rkisp1_cif_isp_cac_h_clip_mode. That's the horizontal vibe limit bestie.v_clip_modeβ maximum vertical shift, taken fromenum rkisp1_cif_isp_cac_v_clip_mode. Same energy, but vertical.h_count_startβ horizontal coordinate of the optical center, and it's a 13-bit unsigned integer with range[1,8191]. Not 0, bestie, it starts at 1 πv_count_startβ vertical coordinate of the optical center, also a 13-bit unsigned integer, also[1,8191].redβ red coefficients, 5.4 two's complement, range[-16,15.9375]. It's an array, three of them.blueβ blue coefficients, 5.4 two's complement, range[-16,15.9375]. Also three of them. Green? Not invited to this party, iykyk.x_nfβ horizontal normalization scale parameter, 5-bit unsigned integer,[0,31].x_nsβ horizontal normalization shift parameter, 4-bit unsigned integer,[0,15].y_nfβ vertical normalization scale parameter, 5-bit unsigned integer,[0,31].y_nsβ vertical normalization shift parameter, 4-bit unsigned integer,[0,15].
π DESCRIPTION π
So what does this thing actually do? It's chromatic aberration correction, and the way it works is genuinely iconic: the correction is carried out by shifting the red and blue pixels relative to the green ones, depending on the distance from the optical center. That's the whole plot π¬
For each pixel, the x/y distances from the optical center are calculated, and then transformed into the [0,255] range based on the following formula:
(((d << 4) >> ns) * nf) >> 5
where d is the distance, ns and nf are the normalization parameters: π (yes the original ends on that colon, we're not touching it)
β οΈ These parameters should be chosen based on the image resolution, the position of the optical center, and the shape of pixels, so that no normalized distance is larger than 255. That's a hard requirement, bestie β go over 255 and you're not slaying anymore. Also: if the pixels have square shape, the two sets of parameters should be equal. fr fr.
The actual amount of correction is calculated with a third degree polynomial:
c[0] * r + c[1] * r^2 + c[2] * r^3
where c is the set of coefficients for the given color, and r is distance: (another colon, another day)
Finally, the amount is clipped as requested β that's what those clip modes up there are for π
A positive result will shift away from the optical center, while a negative one will shift towards the optical center. In the latter case, the pixel values at the edges are duplicated. Not invented, not extrapolated β duplicated. Periodt.
π¦ SEE ALSO π¦
Grab a snack, this list is long long. But every single one of these is part of the family:
- Kernel file
./include/uapi/linux/rkisp1-config.h enum rkisp1_cif_isp_version(9)enum rkisp1_cif_isp_exp_ctrl_autostop(9)enum rkisp1_cif_isp_exp_meas_mode(9)struct rkisp1_cif_isp_window(9)struct rkisp1_cif_isp_bls_fixed_val(9)struct rkisp1_cif_isp_bls_config(9)struct rkisp1_cif_isp_dpcc_methods_config(9)struct rkisp1_cif_isp_dpcc_config(9)struct rkisp1_cif_isp_gamma_corr_curve(9)struct rkisp1_cif_isp_gamma_curve_x_axis_pnts(9)struct rkisp1_cif_isp_sdg_config(9)struct rkisp1_cif_isp_lsc_config(9)struct rkisp1_cif_isp_ie_config(9)struct rkisp1_cif_isp_cproc_config(9)struct rkisp1_cif_isp_awb_meas_config(9)struct rkisp1_cif_isp_awb_gain_config(9)struct rkisp1_cif_isp_flt_config(9)struct rkisp1_cif_isp_bdm_config(9)struct rkisp1_cif_isp_ctk_config(9)struct rkisp1_cif_isp_goc_config(9)struct rkisp1_cif_isp_hst_config(9)struct rkisp1_cif_isp_aec_config(9)struct rkisp1_cif_isp_afc_config(9)enum rkisp1_cif_isp_dpf_gain_usage(9)enum rkisp1_cif_isp_dpf_rb_filtersize(9)enum rkisp1_cif_isp_dpf_nll_scale_mode(9)struct rkisp1_cif_isp_dpf_nll(9)struct rkisp1_cif_isp_dpf_rb_flt(9)struct rkisp1_cif_isp_dpf_g_flt(9)struct rkisp1_cif_isp_dpf_gain(9)struct rkisp1_cif_isp_dpf_config(9)struct rkisp1_cif_isp_dpf_strength_config(9)struct rkisp1_cif_isp_isp_other_cfg(9)struct rkisp1_cif_isp_isp_meas_cfg(9)struct rkisp1_params_cfg(9)struct rkisp1_cif_isp_compand_bls_config(9)struct rkisp1_cif_isp_compand_curve_config(9)struct rkisp1_cif_isp_wdr_tone_curve(9)struct rkisp1_cif_isp_wdr_iref_config(9)struct rkisp1_cif_isp_wdr_config(9)enum rkisp1_cif_isp_cac_v_clip_mode(9)struct rkisp1_cif_isp_awb_meas(9)struct rkisp1_cif_isp_awb_stat(9)struct rkisp1_cif_isp_bls_meas_val(9)struct rkisp1_cif_isp_ae_stat(9)struct rkisp1_cif_isp_af_meas_val(9)struct rkisp1_cif_isp_af_stat(9)struct rkisp1_cif_isp_hist_stat(9)struct rkisp1_cif_isp_stat(9)struct rkisp1_stat_buffer(9)enum rkisp1_ext_params_block_type(9)rkisp1_ext_params_block_header(9)struct rkisp1_ext_params_bls_config(9)struct rkisp1_ext_params_dpcc_config(9)struct rkisp1_ext_params_sdg_config(9)struct rkisp1_ext_params_lsc_config(9)struct rkisp1_ext_params_awb_gain_config(9)struct rkisp1_ext_params_flt_config(9)struct rkisp1_ext_params_bdm_config(9)struct rkisp1_ext_params_ctk_config(9)struct rkisp1_ext_params_goc_config(9)struct rkisp1_ext_params_dpf_config(9)struct rkisp1_ext_params_dpf_strength_config(9)struct rkisp1_ext_params_cproc_config(9)struct rkisp1_ext_params_ie_config(9)struct rkisp1_ext_params_awb_meas_config(9)struct rkisp1_ext_params_hst_config(9)struct rkisp1_ext_params_aec_config(9)struct rkisp1_ext_params_afc_config(9)struct rkisp1_ext_params_compand_bls_config(9)struct rkisp1_ext_params_compand_curve_config(9)struct rkisp1_ext_params_wdr_config(9)struct rkisp1_ext_params_cac_config(9)enum rkisp1_ext_param_buffer_version(9)struct rkisp1_ext_params_cfg(9)
ok that's the whole page, you ate that π
Sign-off time: this little beauty lives in ./include/uapi/linux, and the page is dated October 2026, page name struct rkisp...p_cac_config(9). Go forth and correct those chromatic aberrations, bestie β¨ππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms