1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
3 * PiSP Back End configuration definitions.
5 * Copyright (C) 2021 - Raspberry Pi Ltd
8 #ifndef _UAPI_PISP_BE_CONFIG_H_
9 #define _UAPI_PISP_BE_CONFIG_H_
11 #include <linux/types.h>
13 #include "pisp_common.h"
15 /* byte alignment for inputs */
16 #define PISP_BACK_END_INPUT_ALIGN 4u
17 /* alignment for compressed inputs */
18 #define PISP_BACK_END_COMPRESSED_ALIGN 8u
19 /* minimum required byte alignment for outputs */
20 #define PISP_BACK_END_OUTPUT_MIN_ALIGN 16u
21 /* preferred byte alignment for outputs */
22 #define PISP_BACK_END_OUTPUT_MAX_ALIGN 64u
24 /* minimum allowed tile width anywhere in the pipeline */
25 #define PISP_BACK_END_MIN_TILE_WIDTH 16u
26 /* minimum allowed tile width anywhere in the pipeline */
27 #define PISP_BACK_END_MIN_TILE_HEIGHT 16u
29 #define PISP_BACK_END_NUM_OUTPUTS 2
30 #define PISP_BACK_END_HOG_OUTPUT 1
32 #define PISP_BACK_END_NUM_TILES 64
34 enum pisp_be_bayer_enable {
35 PISP_BE_BAYER_ENABLE_INPUT = 0x000001,
36 PISP_BE_BAYER_ENABLE_DECOMPRESS = 0x000002,
37 PISP_BE_BAYER_ENABLE_DPC = 0x000004,
38 PISP_BE_BAYER_ENABLE_GEQ = 0x000008,
39 PISP_BE_BAYER_ENABLE_TDN_INPUT = 0x000010,
40 PISP_BE_BAYER_ENABLE_TDN_DECOMPRESS = 0x000020,
41 PISP_BE_BAYER_ENABLE_TDN = 0x000040,
42 PISP_BE_BAYER_ENABLE_TDN_COMPRESS = 0x000080,
43 PISP_BE_BAYER_ENABLE_TDN_OUTPUT = 0x000100,
44 PISP_BE_BAYER_ENABLE_SDN = 0x000200,
45 PISP_BE_BAYER_ENABLE_BLC = 0x000400,
46 PISP_BE_BAYER_ENABLE_STITCH_INPUT = 0x000800,
47 PISP_BE_BAYER_ENABLE_STITCH_DECOMPRESS = 0x001000,
48 PISP_BE_BAYER_ENABLE_STITCH = 0x002000,
49 PISP_BE_BAYER_ENABLE_STITCH_COMPRESS = 0x004000,
50 PISP_BE_BAYER_ENABLE_STITCH_OUTPUT = 0x008000,
51 PISP_BE_BAYER_ENABLE_WBG = 0x010000,
52 PISP_BE_BAYER_ENABLE_CDN = 0x020000,
53 PISP_BE_BAYER_ENABLE_LSC = 0x040000,
54 PISP_BE_BAYER_ENABLE_TONEMAP = 0x080000,
55 PISP_BE_BAYER_ENABLE_CAC = 0x100000,
56 PISP_BE_BAYER_ENABLE_DEBIN = 0x200000,
57 PISP_BE_BAYER_ENABLE_DEMOSAIC = 0x400000,
60 enum pisp_be_rgb_enable {
61 PISP_BE_RGB_ENABLE_INPUT = 0x000001,
62 PISP_BE_RGB_ENABLE_CCM = 0x000002,
63 PISP_BE_RGB_ENABLE_SAT_CONTROL = 0x000004,
64 PISP_BE_RGB_ENABLE_YCBCR = 0x000008,
65 PISP_BE_RGB_ENABLE_FALSE_COLOUR = 0x000010,
66 PISP_BE_RGB_ENABLE_SHARPEN = 0x000020,
67 /* Preferred colours would occupy 0x000040 */
68 PISP_BE_RGB_ENABLE_YCBCR_INVERSE = 0x000080,
69 PISP_BE_RGB_ENABLE_GAMMA = 0x000100,
70 PISP_BE_RGB_ENABLE_CSC0 = 0x000200,
71 PISP_BE_RGB_ENABLE_CSC1 = 0x000400,
72 PISP_BE_RGB_ENABLE_DOWNSCALE0 = 0x001000,
73 PISP_BE_RGB_ENABLE_DOWNSCALE1 = 0x002000,
74 PISP_BE_RGB_ENABLE_RESAMPLE0 = 0x008000,
75 PISP_BE_RGB_ENABLE_RESAMPLE1 = 0x010000,
76 PISP_BE_RGB_ENABLE_OUTPUT0 = 0x040000,
77 PISP_BE_RGB_ENABLE_OUTPUT1 = 0x080000,
78 PISP_BE_RGB_ENABLE_HOG = 0x200000
81 #define PISP_BE_RGB_ENABLE_CSC(i) (PISP_BE_RGB_ENABLE_CSC0 << (i))
82 #define PISP_BE_RGB_ENABLE_DOWNSCALE(i) (PISP_BE_RGB_ENABLE_DOWNSCALE0 << (i))
83 #define PISP_BE_RGB_ENABLE_RESAMPLE(i) (PISP_BE_RGB_ENABLE_RESAMPLE0 << (i))
84 #define PISP_BE_RGB_ENABLE_OUTPUT(i) (PISP_BE_RGB_ENABLE_OUTPUT0 << (i))
87 * We use the enable flags to show when blocks are "dirty", but we need some
91 PISP_BE_DIRTY_GLOBAL = 0x0001,
92 PISP_BE_DIRTY_SH_FC_COMBINE = 0x0002,
93 PISP_BE_DIRTY_CROP = 0x0004
97 * struct pisp_be_global_config - PiSP global enable bitmaps
98 * @bayer_enables: Bayer input enable flags
99 * @rgb_enables: RGB output enable flags
100 * @bayer_order: Bayer input format ordering
101 * @pad: Padding bytes
103 struct pisp_be_global_config {
108 } __attribute__((packed));
111 * struct pisp_be_input_buffer_config - PiSP Back End input buffer
112 * @addr: Input buffer address
114 struct pisp_be_input_buffer_config {
115 /* low 32 bits followed by high 32 bits (for each of up to 3 planes) */
117 } __attribute__((packed));
120 * struct pisp_be_dpc_config - PiSP Back End DPC config
122 * Defective Pixel Correction configuration
124 * @coeff_level: Coefficient for the darkest neighbouring pixel value
125 * @coeff_range: Coefficient for the range of pixels for this Bayer channel
127 * @flags: DPC configuration flags
129 struct pisp_be_dpc_config {
133 #define PISP_BE_DPC_FLAG_FOLDBACK 1
135 } __attribute__((packed));
138 * struct pisp_be_geq_config - PiSP Back End GEQ config
140 * Green Equalisation configuration
142 * @offset: Offset value for threshold calculation
143 * @slope_sharper: Slope/Sharper configuration
144 * @min: Minimum value the threshold may have
145 * @max: Maximum value the threshold may have
147 struct pisp_be_geq_config {
149 #define PISP_BE_GEQ_SHARPER BIT(15)
150 #define PISP_BE_GEQ_SLOPE ((1 << 10) - 1)
151 /* top bit is the "sharper" flag, slope value is bottom 10 bits */
155 } __attribute__((packed));
158 * struct pisp_be_tdn_input_buffer_config - PiSP Back End TDN input buffer
159 * @addr: TDN input buffer address
161 struct pisp_be_tdn_input_buffer_config {
162 /* low 32 bits followed by high 32 bits */
164 } __attribute__((packed));
167 * struct pisp_be_tdn_config - PiSP Back End TDN config
169 * Temporal Denoise configuration
171 * @black_level: Black level value subtracted from pixels
172 * @ratio: Multiplier for the LTA input frame
173 * @noise_constant: Constant offset value used in noise estimation
174 * @noise_slope: Noise estimation multiplier
175 * @threshold: Threshold for TDN operations
176 * @reset: Disable TDN operations
179 struct pisp_be_tdn_config {
182 __u16 noise_constant;
187 } __attribute__((packed));
190 * struct pisp_be_tdn_output_buffer_config - PiSP Back End TDN output buffer
191 * @addr: TDN output buffer address
193 struct pisp_be_tdn_output_buffer_config {
194 /* low 32 bits followed by high 32 bits */
196 } __attribute__((packed));
199 * struct pisp_be_sdn_config - PiSP Back End SDN config
201 * Spatial Denoise configuration
203 * @black_level: Black level subtracted from pixel for noise estimation
204 * @leakage: Proportion of the original undenoised value to mix in
207 * @noise_constant: Noise constant used for noise estimation
208 * @noise_slope: Noise slope value used for noise estimation
209 * @noise_constant2: Second noise constant used for noise estimation
210 * @noise_slope2: Second slope value used for noise estimation
212 struct pisp_be_sdn_config {
216 __u16 noise_constant;
218 __u16 noise_constant2;
220 } __attribute__((packed));
223 * struct pisp_be_stitch_input_buffer_config - PiSP Back End Stitch input
224 * @addr: Stitch input buffer address
226 struct pisp_be_stitch_input_buffer_config {
227 /* low 32 bits followed by high 32 bits */
229 } __attribute__((packed));
231 #define PISP_BE_STITCH_STREAMING_LONG 0x8000
232 #define PISP_BE_STITCH_EXPOSURE_RATIO_MASK 0x7fff
235 * struct pisp_be_stitch_config - PiSP Back End Stitch config
237 * Stitch block configuration
239 * @threshold_lo: Low threshold value
240 * @threshold_diff_power: Low and high threshold difference
241 * @pad: Padding bytes
242 * @exposure_ratio: Multiplier to convert long exposure pixels into
243 * short exposure pixels
244 * @motion_threshold_256: Motion threshold above which short exposure
246 * @motion_threshold_recip: Reciprocal of motion_threshold_256 value
248 struct pisp_be_stitch_config {
250 __u8 threshold_diff_power;
253 /* top bit indicates whether streaming input is the long exposure */
254 __u16 exposure_ratio;
256 __u8 motion_threshold_256;
257 __u8 motion_threshold_recip;
258 } __attribute__((packed));
261 * struct pisp_be_stitch_output_buffer_config - PiSP Back End Stitch output
262 * @addr: Stitch input buffer address
264 struct pisp_be_stitch_output_buffer_config {
265 /* low 32 bits followed by high 32 bits */
267 } __attribute__((packed));
270 * struct pisp_be_cdn_config - PiSP Back End CDN config
272 * Colour Denoise configuration
274 * @thresh: Constant for noise estimation
275 * @iir_strength: Relative strength of the IIR part of the filter
276 * @g_adjust: Proportion of the change assigned to the G channel
278 struct pisp_be_cdn_config {
282 } __attribute__((packed));
284 #define PISP_BE_LSC_LOG_GRID_SIZE 5
285 #define PISP_BE_LSC_GRID_SIZE (1 << PISP_BE_LSC_LOG_GRID_SIZE)
286 #define PISP_BE_LSC_STEP_PRECISION 18
289 * struct pisp_be_lsc_config - PiSP Back End LSC config
291 * Lens Shading Correction configuration
293 * @grid_step_x: Reciprocal of cell size width
294 * @grid_step_y: Reciprocal of cell size height
295 * @lut_packed: Jointly-coded RGB gains for each LSC grid
297 struct pisp_be_lsc_config {
298 /* (1<<18) / grid_cell_width */
300 /* (1<<18) / grid_cell_height */
302 /* RGB gains jointly encoded in 32 bits */
303 #define PISP_BE_LSC_LUT_SIZE (PISP_BE_LSC_GRID_SIZE + 1)
304 __u32 lut_packed[PISP_BE_LSC_LUT_SIZE][PISP_BE_LSC_LUT_SIZE];
305 } __attribute__((packed));
308 * struct pisp_be_lsc_extra - PiSP Back End LSC Extra config
309 * @offset_x: Horizontal offset into the LSC table of this tile
310 * @offset_y: Vertical offset into the LSC table of this tile
312 struct pisp_be_lsc_extra {
315 } __attribute__((packed));
317 #define PISP_BE_CAC_LOG_GRID_SIZE 3
318 #define PISP_BE_CAC_GRID_SIZE (1 << PISP_BE_CAC_LOG_GRID_SIZE)
319 #define PISP_BE_CAC_STEP_PRECISION 20
322 * struct pisp_be_cac_config - PiSP Back End CAC config
324 * Chromatic Aberration Correction config
326 * @grid_step_x: Reciprocal of cell size width
327 * @grid_step_y: Reciprocal of cell size height
328 * @lut: Pixel shift for the CAC grid
330 struct pisp_be_cac_config {
331 /* (1<<20) / grid_cell_width */
333 /* (1<<20) / grid_cell_height */
335 /* [gridy][gridx][rb][xy] */
336 #define PISP_BE_CAC_LUT_SIZE (PISP_BE_CAC_GRID_SIZE + 1)
337 __s8 lut[PISP_BE_CAC_LUT_SIZE][PISP_BE_CAC_LUT_SIZE][2][2];
338 } __attribute__((packed));
341 * struct pisp_be_cac_extra - PiSP Back End CAC extra config
342 * @offset_x: Horizontal offset into the CAC table of this tile
343 * @offset_y: Horizontal offset into the CAC table of this tile
345 struct pisp_be_cac_extra {
348 } __attribute__((packed));
350 #define PISP_BE_DEBIN_NUM_COEFFS 4
353 * struct pisp_be_debin_config - PiSP Back End Debin config
355 * Debinning configuration
357 * @coeffs: Filter coefficients for debinning
358 * @h_enable: Horizontal debinning enable
359 * @v_enable: Vertical debinning enable
360 * @pad: Padding bytes
362 struct pisp_be_debin_config {
363 __s8 coeffs[PISP_BE_DEBIN_NUM_COEFFS];
367 } __attribute__((packed));
369 #define PISP_BE_TONEMAP_LUT_SIZE 64
372 * struct pisp_be_tonemap_config - PiSP Back End Tonemap config
374 * Tonemapping configuration
376 * @detail_constant: Constant value for threshold calculation
377 * @detail_slope: Slope value for threshold calculation
378 * @iir_strength: Relative strength of the IIR fiter
379 * @strength: Strength factor
380 * @lut: Look-up table for tonemap curve
382 struct pisp_be_tonemap_config {
383 __u16 detail_constant;
387 __u32 lut[PISP_BE_TONEMAP_LUT_SIZE];
388 } __attribute__((packed));
391 * struct pisp_be_demosaic_config - PiSP Back End Demosaic config
393 * Demosaic configuration
395 * @sharper: Use other Bayer channels to increase sharpness
396 * @fc_mode: Built-in false colour suppression mode
397 * @pad: Padding bytes
399 struct pisp_be_demosaic_config {
403 } __attribute__((packed));
406 * struct pisp_be_ccm_config - PiSP Back End CCM config
408 * Colour Correction Matrix configuration
410 * @coeffs: Matrix coefficients
411 * @pad: Padding bytes
412 * @offsets: Offsets triplet
414 struct pisp_be_ccm_config {
418 } __attribute__((packed));
421 * struct pisp_be_sat_control_config - PiSP Back End SAT config
423 * Saturation Control configuration
425 * @shift_r: Left shift for Red colour channel
426 * @shift_g: Left shift for Green colour channel
427 * @shift_b: Left shift for Blue colour channel
430 struct pisp_be_sat_control_config {
435 } __attribute__((packed));
438 * struct pisp_be_false_colour_config - PiSP Back End False Colour config
440 * False Colour configuration
442 * @distance: Distance of neighbouring pixels, either 1 or 2
443 * @pad: Padding bytes
445 struct pisp_be_false_colour_config {
448 } __attribute__((packed));
450 #define PISP_BE_SHARPEN_SIZE 5
451 #define PISP_BE_SHARPEN_FUNC_NUM_POINTS 9
454 * struct pisp_be_sharpen_config - PiSP Back End Sharpening config
456 * Sharpening configuration
458 * @kernel0: Coefficient for filter 0
459 * @pad0: Padding byte
460 * @kernel1: Coefficient for filter 1
461 * @pad1: Padding byte
462 * @kernel2: Coefficient for filter 2
463 * @pad2: Padding byte
464 * @kernel3: Coefficient for filter 3
465 * @pad3: Padding byte
466 * @kernel4: Coefficient for filter 4
467 * @pad4: Padding byte
468 * @threshold_offset0: Offset for filter 0 response calculation
469 * @threshold_slope0: Slope multiplier for the filter 0 response calculation
470 * @scale0: Scale factor for filter 0 response calculation
471 * @pad5: Padding byte
472 * @threshold_offset1: Offset for filter 0 response calculation
473 * @threshold_slope1: Slope multiplier for the filter 0 response calculation
474 * @scale1: Scale factor for filter 0 response calculation
475 * @pad6: Padding byte
476 * @threshold_offset2: Offset for filter 0 response calculation
477 * @threshold_slope2: Slope multiplier for the filter 0 response calculation
478 * @scale2: Scale factor for filter 0 response calculation
479 * @pad7: Padding byte
480 * @threshold_offset3: Offset for filter 0 response calculation
481 * @threshold_slope3: Slope multiplier for the filter 0 response calculation
482 * @scale3: Scale factor for filter 0 response calculation
483 * @pad8: Padding byte
484 * @threshold_offset4: Offset for filter 0 response calculation
485 * @threshold_slope4: Slope multiplier for the filter 0 response calculation
486 * @scale4: Scale factor for filter 0 response calculation
487 * @pad9: Padding byte
488 * @positive_strength: Factor to scale the positive sharpening strength
489 * @positive_pre_limit: Maximum allowed possible positive sharpening value
490 * @positive_func: Gain factor applied to positive sharpening response
491 * @positive_limit: Final gain factor applied to positive sharpening
492 * @negative_strength: Factor to scale the negative sharpening strength
493 * @negative_pre_limit: Maximum allowed possible negative sharpening value
494 * @negative_func: Gain factor applied to negative sharpening response
495 * @negative_limit: Final gain factor applied to negative sharpening
496 * @enables: Filter enable mask
497 * @white: White output pixel filter mask
498 * @black: Black output pixel filter mask
499 * @grey: Grey output pixel filter mask
501 struct pisp_be_sharpen_config {
502 __s8 kernel0[PISP_BE_SHARPEN_SIZE * PISP_BE_SHARPEN_SIZE];
504 __s8 kernel1[PISP_BE_SHARPEN_SIZE * PISP_BE_SHARPEN_SIZE];
506 __s8 kernel2[PISP_BE_SHARPEN_SIZE * PISP_BE_SHARPEN_SIZE];
508 __s8 kernel3[PISP_BE_SHARPEN_SIZE * PISP_BE_SHARPEN_SIZE];
510 __s8 kernel4[PISP_BE_SHARPEN_SIZE * PISP_BE_SHARPEN_SIZE];
512 __u16 threshold_offset0;
513 __u16 threshold_slope0;
516 __u16 threshold_offset1;
517 __u16 threshold_slope1;
520 __u16 threshold_offset2;
521 __u16 threshold_slope2;
524 __u16 threshold_offset3;
525 __u16 threshold_slope3;
528 __u16 threshold_offset4;
529 __u16 threshold_slope4;
532 __u16 positive_strength;
533 __u16 positive_pre_limit;
534 __u16 positive_func[PISP_BE_SHARPEN_FUNC_NUM_POINTS];
535 __u16 positive_limit;
536 __u16 negative_strength;
537 __u16 negative_pre_limit;
538 __u16 negative_func[PISP_BE_SHARPEN_FUNC_NUM_POINTS];
539 __u16 negative_limit;
544 } __attribute__((packed));
547 * struct pisp_be_sh_fc_combine_config - PiSP Back End Sharpening and
548 * False Colour config
550 * Sharpening and False Colour configuration
552 * @y_factor: Control amount of desaturation of pixels being darkened
553 * @c1_factor: Control amount of brightening of a pixel for the Cb
555 * @c2_factor: Control amount of brightening of a pixel for the Cr
559 struct pisp_be_sh_fc_combine_config {
564 } __attribute__((packed));
566 #define PISP_BE_GAMMA_LUT_SIZE 64
569 * struct pisp_be_gamma_config - PiSP Back End Gamma configuration
570 * @lut: Gamma curve look-up table
572 struct pisp_be_gamma_config {
573 __u32 lut[PISP_BE_GAMMA_LUT_SIZE];
574 } __attribute__((packed));
577 * struct pisp_be_crop_config - PiSP Back End Crop config
581 * @offset_x: Number of pixels cropped from the left of the tile
582 * @offset_y: Number of pixels cropped from the top of the tile
583 * @width: Width of the cropped tile output
584 * @height: Height of the cropped tile output
586 struct pisp_be_crop_config {
587 __u16 offset_x, offset_y;
589 } __attribute__((packed));
591 #define PISP_BE_RESAMPLE_FILTER_SIZE 96
594 * struct pisp_be_resample_config - PiSP Back End Resampling config
596 * Resample configuration
598 * @scale_factor_h: Horizontal scale factor
599 * @scale_factor_v: Vertical scale factor
600 * @coef: Resample coefficients
602 struct pisp_be_resample_config {
603 __u16 scale_factor_h, scale_factor_v;
604 __s16 coef[PISP_BE_RESAMPLE_FILTER_SIZE];
605 } __attribute__((packed));
608 * struct pisp_be_resample_extra - PiSP Back End Resample config
610 * Resample configuration
612 * @scaled_width: Width in pixels of the scaled output
613 * @scaled_height: Height in pixels of the scaled output
614 * @initial_phase_h: Initial horizontal phase
615 * @initial_phase_v: Initial vertical phase
617 struct pisp_be_resample_extra {
620 __s16 initial_phase_h[3];
621 __s16 initial_phase_v[3];
622 } __attribute__((packed));
625 * struct pisp_be_downscale_config - PiSP Back End Downscale config
627 * Downscale configuration
629 * @scale_factor_h: Horizontal scale factor
630 * @scale_factor_v: Vertical scale factor
631 * @scale_recip_h: Horizontal reciprocal factor
632 * @scale_recip_v: Vertical reciprocal factor
634 struct pisp_be_downscale_config {
635 __u16 scale_factor_h;
636 __u16 scale_factor_v;
639 } __attribute__((packed));
642 * struct pisp_be_downscale_extra - PiSP Back End Downscale Extra config
643 * @scaled_width: Scaled image width
644 * @scaled_height: Scaled image height
646 struct pisp_be_downscale_extra {
649 } __attribute__((packed));
652 * struct pisp_be_hog_config - PiSP Back End HOG config
654 * Histogram of Oriented Gradients configuration
656 * @compute_signed: Set 0 for unsigned gradients, 1 for signed
657 * @channel_mix: Channels proportions to use
658 * @stride: Stride in bytes between blocks directly below
660 struct pisp_be_hog_config {
664 } __attribute__((packed));
666 struct pisp_be_axi_config {
667 __u8 r_qos; /* Read QoS */
668 __u8 r_cache_prot; /* Read { prot[2:0], cache[3:0] } */
669 __u8 w_qos; /* Write QoS */
670 __u8 w_cache_prot; /* Write { prot[2:0], cache[3:0] } */
671 } __attribute__((packed));
674 * enum pisp_be_transform - PiSP Back End Transform flags
675 * @PISP_BE_TRANSFORM_NONE: No transform
676 * @PISP_BE_TRANSFORM_HFLIP: Horizontal flip
677 * @PISP_BE_TRANSFORM_VFLIP: Vertical flip
678 * @PISP_BE_TRANSFORM_ROT180: 180 degress rotation
680 enum pisp_be_transform {
681 PISP_BE_TRANSFORM_NONE = 0x0,
682 PISP_BE_TRANSFORM_HFLIP = 0x1,
683 PISP_BE_TRANSFORM_VFLIP = 0x2,
684 PISP_BE_TRANSFORM_ROT180 =
685 (PISP_BE_TRANSFORM_HFLIP | PISP_BE_TRANSFORM_VFLIP)
688 struct pisp_be_output_format_config {
689 struct pisp_image_format_config image;
696 } __attribute__((packed));
699 * struct pisp_be_output_buffer_config - PiSP Back End Output buffer
700 * @addr: Output buffer address
702 struct pisp_be_output_buffer_config {
703 /* low 32 bits followed by high 32 bits (for each of 3 planes) */
705 } __attribute__((packed));
708 * struct pisp_be_hog_buffer_config - PiSP Back End HOG buffer
709 * @addr: HOG buffer address
711 struct pisp_be_hog_buffer_config {
712 /* low 32 bits followed by high 32 bits */
714 } __attribute__((packed));
717 * struct pisp_be_config - RaspberryPi PiSP Back End Processing configuration
719 * @global: Global PiSP configuration
720 * @input_format: Input image format
721 * @decompress: Decompress configuration
722 * @dpc: Defective Pixel Correction configuration
723 * @geq: Green Equalisation configuration
724 * @tdn_input_format: Temporal Denoise input format
725 * @tdn_decompress: Temporal Denoise decompress configuration
726 * @tdn: Temporal Denoise configuration
727 * @tdn_compress: Temporal Denoise compress configuration
728 * @tdn_output_format: Temporal Denoise output format
729 * @sdn: Spatial Denoise configuration
730 * @blc: Black Level Correction configuration
731 * @stitch_compress: Stitch compress configuration
732 * @stitch_output_format: Stitch output format
733 * @stitch_input_format: Stitch input format
734 * @stitch_decompress: Stitch decompress configuration
735 * @stitch: Stitch configuration
736 * @lsc: Lens Shading Correction configuration
737 * @wbg: White Balance Gain configuration
738 * @cdn: Colour Denoise configuration
739 * @cac: Colour Aberration Correction configuration
740 * @debin: Debinning configuration
741 * @tonemap: Tonemapping configuration
742 * @demosaic: Demosaicing configuration
743 * @ccm: Colour Correction Matrix configuration
744 * @sat_control: Saturation Control configuration
745 * @ycbcr: YCbCr colour correction configuration
746 * @sharpen: Sharpening configuration
747 * @false_colour: False colour correction
748 * @sh_fc_combine: Sharpening and False Colour correction
749 * @ycbcr_inverse: Inverse YCbCr colour correction
750 * @gamma: Gamma curve configuration
751 * @csc: Color Space Conversion configuration
752 * @downscale: Downscale configuration
753 * @resample: Resampling configuration
754 * @output_format: Output format configuration
755 * @hog: HOG configuration
757 struct pisp_be_config {
758 struct pisp_be_global_config global;
759 struct pisp_image_format_config input_format;
760 struct pisp_decompress_config decompress;
761 struct pisp_be_dpc_config dpc;
762 struct pisp_be_geq_config geq;
763 struct pisp_image_format_config tdn_input_format;
764 struct pisp_decompress_config tdn_decompress;
765 struct pisp_be_tdn_config tdn;
766 struct pisp_compress_config tdn_compress;
767 struct pisp_image_format_config tdn_output_format;
768 struct pisp_be_sdn_config sdn;
769 struct pisp_bla_config blc;
770 struct pisp_compress_config stitch_compress;
771 struct pisp_image_format_config stitch_output_format;
772 struct pisp_image_format_config stitch_input_format;
773 struct pisp_decompress_config stitch_decompress;
774 struct pisp_be_stitch_config stitch;
775 struct pisp_be_lsc_config lsc;
776 struct pisp_wbg_config wbg;
777 struct pisp_be_cdn_config cdn;
778 struct pisp_be_cac_config cac;
779 struct pisp_be_debin_config debin;
780 struct pisp_be_tonemap_config tonemap;
781 struct pisp_be_demosaic_config demosaic;
782 struct pisp_be_ccm_config ccm;
783 struct pisp_be_sat_control_config sat_control;
784 struct pisp_be_ccm_config ycbcr;
785 struct pisp_be_sharpen_config sharpen;
786 struct pisp_be_false_colour_config false_colour;
787 struct pisp_be_sh_fc_combine_config sh_fc_combine;
788 struct pisp_be_ccm_config ycbcr_inverse;
789 struct pisp_be_gamma_config gamma;
790 struct pisp_be_ccm_config csc[PISP_BACK_END_NUM_OUTPUTS];
791 struct pisp_be_downscale_config downscale[PISP_BACK_END_NUM_OUTPUTS];
792 struct pisp_be_resample_config resample[PISP_BACK_END_NUM_OUTPUTS];
793 struct pisp_be_output_format_config
794 output_format[PISP_BACK_END_NUM_OUTPUTS];
795 struct pisp_be_hog_config hog;
796 } __attribute__((packed));
799 * enum pisp_tile_edge - PiSP Back End Tile position
800 * @PISP_LEFT_EDGE: Left edge tile
801 * @PISP_RIGHT_EDGE: Right edge tile
802 * @PISP_TOP_EDGE: Top edge tile
803 * @PISP_BOTTOM_EDGE: Bottom edge tile
805 enum pisp_tile_edge {
806 PISP_LEFT_EDGE = (1 << 0),
807 PISP_RIGHT_EDGE = (1 << 1),
808 PISP_TOP_EDGE = (1 << 2),
809 PISP_BOTTOM_EDGE = (1 << 3)
813 * struct pisp_tile - Raspberry Pi PiSP Back End tile configuration
815 * Tile parameters: each set of tile parameters is a 160-bytes block of data
816 * which contains the tile processing parameters.
818 * @edge: Edge tile flag
819 * @pad0: Padding bytes
820 * @input_addr_offset: Top-left pixel offset, in bytes
821 * @input_addr_offset2: Top-left pixel offset, in bytes for the second/
823 * @input_offset_x: Horizontal offset in pixels of this tile in the
825 * @input_offset_y: Vertical offset in pixels of this tile in the
827 * @input_width: Width in pixels of this tile
828 * @input_height: Height in pixels of the this tile
829 * @tdn_input_addr_offset: TDN input image offset, in bytes
830 * @tdn_output_addr_offset: TDN output image offset, in bytes
831 * @stitch_input_addr_offset: Stitch input image offset, in bytes
832 * @stitch_output_addr_offset: Stitch output image offset, in bytes
833 * @lsc_grid_offset_x: Horizontal offset in the LSC table for this tile
834 * @lsc_grid_offset_y: Vertical offset in the LSC table for this tile
835 * @cac_grid_offset_x: Horizontal offset in the CAC table for this tile
836 * @cac_grid_offset_y: Horizontal offset in the CAC table for this tile
837 * @crop_x_start: Number of pixels cropped from the left of the
839 * @crop_x_end: Number of pixels cropped from the right of the
841 * @crop_y_start: Number of pixels cropped from the top of the
843 * @crop_y_end: Number of pixels cropped from the bottom of the
845 * @downscale_phase_x: Initial horizontal phase in pixels
846 * @downscale_phase_y: Initial vertical phase in pixels
847 * @resample_in_width: Width in pixels of the tile entering the
849 * @resample_in_height: Height in pixels of the tile entering the
851 * @resample_phase_x: Initial horizontal phase for the Resample block
852 * @resample_phase_y: Initial vertical phase for the Resample block
853 * @output_offset_x: Horizontal offset in pixels where the tile will
854 * be written into the output image
855 * @output_offset_y: Vertical offset in pixels where the tile will be
856 * written into the output image
857 * @output_width: Width in pixels in the output image of this tile
858 * @output_height: Height in pixels in the output image of this tile
859 * @output_addr_offset: Offset in bytes into the output buffer
860 * @output_addr_offset2: Offset in bytes into the output buffer for the
861 * second and third plane
862 * @output_hog_addr_offset: Offset in bytes into the HOG buffer where
863 * results of this tile are to be written
866 __u8 edge; /* enum pisp_tile_edge */
869 __u32 input_addr_offset;
870 __u32 input_addr_offset2;
871 __u16 input_offset_x;
872 __u16 input_offset_y;
876 __u32 tdn_input_addr_offset;
877 __u32 tdn_output_addr_offset;
878 __u32 stitch_input_addr_offset;
879 __u32 stitch_output_addr_offset;
881 __u32 lsc_grid_offset_x;
882 __u32 lsc_grid_offset_y;
884 __u32 cac_grid_offset_x;
885 __u32 cac_grid_offset_y;
887 __u16 crop_x_start[PISP_BACK_END_NUM_OUTPUTS];
888 __u16 crop_x_end[PISP_BACK_END_NUM_OUTPUTS];
889 __u16 crop_y_start[PISP_BACK_END_NUM_OUTPUTS];
890 __u16 crop_y_end[PISP_BACK_END_NUM_OUTPUTS];
892 /* Ordering is planes then branches */
893 __u16 downscale_phase_x[3 * PISP_BACK_END_NUM_OUTPUTS];
894 __u16 downscale_phase_y[3 * PISP_BACK_END_NUM_OUTPUTS];
896 __u16 resample_in_width[PISP_BACK_END_NUM_OUTPUTS];
897 __u16 resample_in_height[PISP_BACK_END_NUM_OUTPUTS];
899 /* Ordering is planes then branches */
900 __u16 resample_phase_x[3 * PISP_BACK_END_NUM_OUTPUTS];
901 __u16 resample_phase_y[3 * PISP_BACK_END_NUM_OUTPUTS];
903 __u16 output_offset_x[PISP_BACK_END_NUM_OUTPUTS];
904 __u16 output_offset_y[PISP_BACK_END_NUM_OUTPUTS];
905 __u16 output_width[PISP_BACK_END_NUM_OUTPUTS];
906 __u16 output_height[PISP_BACK_END_NUM_OUTPUTS];
908 __u32 output_addr_offset[PISP_BACK_END_NUM_OUTPUTS];
909 __u32 output_addr_offset2[PISP_BACK_END_NUM_OUTPUTS];
911 __u32 output_hog_addr_offset;
913 } __attribute__((packed));
916 * struct pisp_be_tiles_config - Raspberry Pi PiSP Back End configuration
917 * @tiles: Tile descriptors
918 * @num_tiles: Number of tiles
919 * @config: PiSP Back End configuration
921 struct pisp_be_tiles_config {
922 struct pisp_tile tiles[PISP_BACK_END_NUM_TILES];
924 struct pisp_be_config config;
925 } __attribute__((packed));
927 #endif /* _UAPI_PISP_BE_CONFIG_H_ */