drivers/staging/media/ipu3/ipu3-css-params.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/ipu3/ipu3-css-params.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/ipu3/ipu3-css-params.c- Extension
.c- Size
- 95458 bytes
- Lines
- 2964
- Domain
- Driver Families
- Bucket
- drivers/staging
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hipu3-css.hipu3-css-fw.hipu3-tables.hipu3-css-params.h
Detected Declarations
struct imgu_css_scaler_infostruct imgu_css_resostruct imgu_css_frame_paramsstruct imgu_css_stripe_paramsstruct process_linesfunction imgu_css_scaler_get_expfunction imgu_css_scaler_setup_lutfunction imgu_css_scaler_calc_scaled_outputfunction imgu_css_scaler_calcfunction imgu_css_osys_set_formatfunction imgu_css_osys_calc_stripe_offsetfunction imgu_css_osys_calc_stripe_phase_initfunction imgu_css_osys_calc_inp_stripe_widthfunction imgu_css_osys_out_stripe_widthfunction imgu_css_osys_calc_frame_and_stripe_paramsfunction imgu_css_osys_calcfunction tilefunction spacefunction gridfunction minfunction imgu_css_acc_process_linesfunction imgu_css_af_ops_calcfunction imgu_css_awb_fr_ops_calcfunction imgu_css_awb_ops_calcfunction imgu_css_grid_endfunction imgu_css_grid_end_calcfunction imgu_css_cfg_acc_stripefunction imgu_css_cfg_acc_dvsfunction acc_bds_per_stripe_datafunction valuesfunction NULLfunction parametersfunction parametersfunction imgu_css_cfg_gdc_table
Annotated Snippet
struct imgu_css_scaler_info {
unsigned int phase_step; /* Same for luma/chroma */
int exp_shift;
unsigned int phase_init; /* luma/chroma dependent */
int pad_left;
int pad_right;
int crop_left;
int crop_top;
};
static unsigned int imgu_css_scaler_get_exp(unsigned int counter,
unsigned int divider)
{
int i = fls(divider) - fls(counter);
if (i <= 0)
return 0;
if (divider >> i < counter)
i = i - 1;
return i;
}
/* Set up the CSS scaler look up table */
static void
imgu_css_scaler_setup_lut(unsigned int taps, unsigned int input_width,
unsigned int output_width, int phase_step_correction,
const int *coeffs, unsigned int coeffs_size,
s8 coeff_lut[], struct imgu_css_scaler_info *info)
{
int tap, phase, phase_sum_left, phase_sum_right;
int exponent = imgu_css_scaler_get_exp(output_width, input_width);
int mantissa = (1 << exponent) * output_width;
unsigned int phase_step, phase_taps;
if (input_width == output_width) {
for (phase = 0; phase < IMGU_SCALER_PHASES; phase++) {
phase_taps = phase * IMGU_SCALER_FILTER_TAPS;
for (tap = 0; tap < taps; tap++)
coeff_lut[phase_taps + tap] = 0;
}
info->phase_step = IMGU_SCALER_PHASES *
(1 << IMGU_SCALER_PHASE_COUNTER_PREC_REF);
info->exp_shift = 0;
info->pad_left = 0;
info->pad_right = 0;
info->phase_init = 0;
info->crop_left = 0;
info->crop_top = 0;
return;
}
for (phase = 0; phase < IMGU_SCALER_PHASES; phase++) {
phase_taps = phase * IMGU_SCALER_FILTER_TAPS;
for (tap = 0; tap < taps; tap++) {
/* flip table to for convolution reverse indexing */
s64 coeff = coeffs[coeffs_size -
((tap * (coeffs_size / taps)) + phase) - 1];
coeff *= mantissa;
coeff = div64_long(coeff, input_width);
/* Add +"0.5" */
coeff += 1 << (IMGU_SCALER_COEFF_BITS - 1);
coeff >>= IMGU_SCALER_COEFF_BITS;
coeff_lut[phase_taps + tap] = coeff;
}
}
phase_step = IMGU_SCALER_PHASES *
(1 << IMGU_SCALER_PHASE_COUNTER_PREC_REF) *
output_width / input_width;
phase_step += phase_step_correction;
phase_sum_left = (taps / 2 * IMGU_SCALER_PHASES *
(1 << IMGU_SCALER_PHASE_COUNTER_PREC_REF)) -
(1 << (IMGU_SCALER_PHASE_COUNTER_PREC_REF - 1));
phase_sum_right = (taps / 2 * IMGU_SCALER_PHASES *
(1 << IMGU_SCALER_PHASE_COUNTER_PREC_REF)) +
(1 << (IMGU_SCALER_PHASE_COUNTER_PREC_REF - 1));
info->exp_shift = IMGU_SCALER_MAX_EXPONENT_SHIFT - exponent;
info->pad_left = (phase_sum_left % phase_step == 0) ?
phase_sum_left / phase_step - 1 : phase_sum_left / phase_step;
info->pad_right = (phase_sum_right % phase_step == 0) ?
phase_sum_right / phase_step - 1 : phase_sum_right / phase_step;
info->phase_init = phase_sum_left - phase_step * info->pad_left;
info->phase_step = phase_step;
info->crop_left = taps - 1;
Annotation
- Immediate include surface: `linux/device.h`, `ipu3-css.h`, `ipu3-css-fw.h`, `ipu3-tables.h`, `ipu3-css-params.h`.
- Detected declarations: `struct imgu_css_scaler_info`, `struct imgu_css_reso`, `struct imgu_css_frame_params`, `struct imgu_css_stripe_params`, `struct process_lines`, `function imgu_css_scaler_get_exp`, `function imgu_css_scaler_setup_lut`, `function imgu_css_scaler_calc_scaled_output`, `function imgu_css_scaler_calc`, `function imgu_css_osys_set_format`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.