226 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * Copyright (C) STMicroelectronics SA 20154 * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.5 */6 7#ifndef DELTA_MJPEG_FW_H8#define DELTA_MJPEG_FW_H9 10/*11 * struct jpeg_decoded_buffer_address_t12 *13 * defines the addresses where the decoded picture/additional14 * info related to the block structures will be stored15 *16 * @display_luma_p: address of the luma buffer17 * @display_chroma_p: address of the chroma buffer18 */19struct jpeg_decoded_buffer_address_t {20 u32 luma_p;21 u32 chroma_p;22};23 24/*25 * struct jpeg_display_buffer_address_t26 *27 * defines the addresses (used by the Display Reconstruction block)28 * where the pictures to be displayed will be stored29 *30 * @struct_size: size of the structure in bytes31 * @display_luma_p: address of the luma buffer32 * @display_chroma_p: address of the chroma buffer33 * @display_decimated_luma_p: address of the decimated luma buffer34 * @display_decimated_chroma_p: address of the decimated chroma buffer35 */36struct jpeg_display_buffer_address_t {37 u32 struct_size;38 u32 display_luma_p;39 u32 display_chroma_p;40 u32 display_decimated_luma_p;41 u32 display_decimated_chroma_p;42};43 44/*45 * used for enabling main/aux outputs for both display &46 * reference reconstruction blocks47 */48enum jpeg_rcn_ref_disp_enable_t {49 /* enable decimated (for display) reconstruction */50 JPEG_DISP_AUX_EN = 0x00000010,51 /* enable main (for display) reconstruction */52 JPEG_DISP_MAIN_EN = 0x00000020,53 /* enable both main & decimated (for display) reconstruction */54 JPEG_DISP_AUX_MAIN_EN = 0x00000030,55 /* enable only reference output(ex. for trick modes) */56 JPEG_REF_MAIN_EN = 0x00000100,57 /*58 * enable reference output with decimated59 * (for display) reconstruction60 */61 JPEG_REF_MAIN_DISP_AUX_EN = 0x00000110,62 /*63 * enable reference output with main64 * (for display) reconstruction65 */66 JPEG_REF_MAIN_DISP_MAIN_EN = 0x00000120,67 /*68 * enable reference output with main & decimated69 * (for display) reconstruction70 */71 JPEG_REF_MAIN_DISP_MAIN_AUX_EN = 0x0000013072};73 74/* identifies the horizontal decimation factor */75enum jpeg_horizontal_deci_factor_t {76 /* no resize */77 JPEG_HDEC_1 = 0x00000000,78 /* Advanced H/2 resize using improved 8-tap filters */79 JPEG_HDEC_ADVANCED_2 = 0x00000101,80 /* Advanced H/4 resize using improved 8-tap filters */81 JPEG_HDEC_ADVANCED_4 = 0x0000010282};83 84/* identifies the vertical decimation factor */85enum jpeg_vertical_deci_factor_t {86 /* no resize */87 JPEG_VDEC_1 = 0x00000000,88 /* V/2 , progressive resize */89 JPEG_VDEC_ADVANCED_2_PROG = 0x00000204,90 /* V/2 , interlaced resize */91 JPEG_VDEC_ADVANCED_2_INT = 0x00000020892};93 94/* status of the decoding process */95enum jpeg_decoding_error_t {96 JPEG_DECODER_NO_ERROR = 0,97 JPEG_DECODER_UNDEFINED_HUFF_TABLE = 1,98 JPEG_DECODER_UNSUPPORTED_MARKER = 2,99 JPEG_DECODER_UNABLE_ALLOCATE_MEMORY = 3,100 JPEG_DECODER_NON_SUPPORTED_SAMP_FACTORS = 4,101 JPEG_DECODER_BAD_PARAMETER = 5,102 JPEG_DECODER_DECODE_ERROR = 6,103 JPEG_DECODER_BAD_RESTART_MARKER = 7,104 JPEG_DECODER_UNSUPPORTED_COLORSPACE = 8,105 JPEG_DECODER_BAD_SOS_SPECTRAL = 9,106 JPEG_DECODER_BAD_SOS_SUCCESSIVE = 10,107 JPEG_DECODER_BAD_HEADER_LENGTH = 11,108 JPEG_DECODER_BAD_COUNT_VALUE = 12,109 JPEG_DECODER_BAD_DHT_MARKER = 13,110 JPEG_DECODER_BAD_INDEX_VALUE = 14,111 JPEG_DECODER_BAD_NUMBER_HUFFMAN_TABLES = 15,112 JPEG_DECODER_BAD_QUANT_TABLE_LENGTH = 16,113 JPEG_DECODER_BAD_NUMBER_QUANT_TABLES = 17,114 JPEG_DECODER_BAD_COMPONENT_COUNT = 18,115 JPEG_DECODER_DIVIDE_BY_ZERO_ERROR = 19,116 JPEG_DECODER_NOT_JPG_IMAGE = 20,117 JPEG_DECODER_UNSUPPORTED_ROTATION_ANGLE = 21,118 JPEG_DECODER_UNSUPPORTED_SCALING = 22,119 JPEG_DECODER_INSUFFICIENT_OUTPUTBUFFER_SIZE = 23,120 JPEG_DECODER_BAD_HWCFG_GP_VERSION_VALUE = 24,121 JPEG_DECODER_BAD_VALUE_FROM_RED = 25,122 JPEG_DECODER_BAD_SUBREGION_PARAMETERS = 26,123 JPEG_DECODER_PROGRESSIVE_DECODE_NOT_SUPPORTED = 27,124 JPEG_DECODER_ERROR_TASK_TIMEOUT = 28,125 JPEG_DECODER_ERROR_FEATURE_NOT_SUPPORTED = 29126};127 128/* identifies the decoding mode */129enum jpeg_decoding_mode_t {130 JPEG_NORMAL_DECODE = 0,131};132 133enum jpeg_additional_flags_t {134 JPEG_ADDITIONAL_FLAG_NONE = 0,135 /* request firmware to return values of the CEH registers */136 JPEG_ADDITIONAL_FLAG_CEH = 1,137 /* output storage of auxiliary reconstruction in Raster format. */138 JPEG_ADDITIONAL_FLAG_RASTER = 64,139 /* output storage of auxiliary reconstruction in 420MB format. */140 JPEG_ADDITIONAL_FLAG_420MB = 128141};142 143/*144 * struct jpeg_video_decode_init_params_t - initialization command parameters145 *146 * @circular_buffer_begin_addr_p: start address of fw circular buffer147 * @circular_buffer_end_addr_p: end address of fw circular buffer148 */149struct jpeg_video_decode_init_params_t {150 u32 circular_buffer_begin_addr_p;151 u32 circular_buffer_end_addr_p;152 u32 reserved;153};154 155/*156 * struct jpeg_decode_params_t - decode command parameters157 *158 * @picture_start_addr_p: start address of jpeg picture159 * @picture_end_addr_p: end address of jpeg picture160 * @decoded_buffer_addr: decoded picture buffer161 * @display_buffer_addr: display picture buffer162 * @main_aux_enable: enable main and/or aux outputs163 * @horizontal_decimation_factor:horizontal decimation factor164 * @vertical_decimation_factor: vertical decimation factor165 * @xvalue0: the x(0) coordinate for subregion decoding166 * @xvalue1: the x(1) coordinate for subregion decoding167 * @yvalue0: the y(0) coordinate for subregion decoding168 * @yvalue1: the y(1) coordinate for subregion decoding169 * @decoding_mode: decoding mode170 * @additional_flags: additional flags171 * @field_flag: determines frame/field scan172 * @is_jpeg_image: 1 = still jpeg, 0 = motion jpeg173 */174struct jpeg_decode_params_t {175 u32 picture_start_addr_p;176 u32 picture_end_addr_p;177 struct jpeg_decoded_buffer_address_t decoded_buffer_addr;178 struct jpeg_display_buffer_address_t display_buffer_addr;179 enum jpeg_rcn_ref_disp_enable_t main_aux_enable;180 enum jpeg_horizontal_deci_factor_t horizontal_decimation_factor;181 enum jpeg_vertical_deci_factor_t vertical_decimation_factor;182 u32 xvalue0;183 u32 xvalue1;184 u32 yvalue0;185 u32 yvalue1;186 enum jpeg_decoding_mode_t decoding_mode;187 u32 additional_flags;188 u32 field_flag;189 u32 reserved;190 u32 is_jpeg_image;191};192 193/*194 * struct jpeg_decode_return_params_t195 *196 * status returned by firmware after decoding197 *198 * @decode_time_in_us: decoding time in microseconds199 * @pm_cycles: profiling information200 * @pm_dmiss: profiling information201 * @pm_imiss: profiling information202 * @pm_bundles: profiling information203 * @pm_pft: profiling information204 * @error_code: status of the decoding process205 * @ceh_registers: array where values of the Contrast Enhancement206 * Histogram (CEH) registers will be stored.207 * ceh_registers[0] correspond to register MBE_CEH_0_7,208 * ceh_registers[1] correspond to register MBE_CEH_8_15209 * ceh_registers[2] correspond to register MBE_CEH_16_23210 * Note that elements of this array will be updated only211 * if additional_flags has JPEG_ADDITIONAL_FLAG_CEH set.212 */213struct jpeg_decode_return_params_t {214 /* profiling info */215 u32 decode_time_in_us;216 u32 pm_cycles;217 u32 pm_dmiss;218 u32 pm_imiss;219 u32 pm_bundles;220 u32 pm_pft;221 enum jpeg_decoding_error_t error_code;222 u32 ceh_registers[32];223};224 225#endif /* DELTA_MJPEG_FW_H */226