📄 csl_resz.h
字号:
/** @mainpage RESZ CSL 3.x
*
* @section Introduction
*
* @subsection xxx Purpose and Scope
* The purpose of this document is to identify a set of common CSL APIs for
* the RESZ module across various devices. The CSL developer is expected to
* refer to this document while designing APIs for these modules. Some of the
* listed APIs may not be applicable to a given RESZ module. While other cases
* this list of APIs may not be sufficient to cover all the features of a
* particular RESZ Module. The CSL developer should use his discretion designing
* new APIs or extending the existing ones to cover these.
*
* @subsection aaa Terms and Abbreviations
* -# CSL: Chip Support Library
* -# API: Application Programmer Interface
*
* @subsection References
* -# CSL-001-DES, CSL 3.x Design Specification DocumentVersion 1.02
* -# RESZ_SPEC, RESZ Detailed Design Specification, Version 1.00.w.36
*
*/
/** @file csl_resz.h
*
* @brief Header file for functional layer of CSL
*
* Description
* - The different enumerations, structure definitions
* and function declarations
*
* Modification 1
* - modified on: 10/13/2004
* - reason: Created the sources
*
* Modification 2
* - modified on: 05/11/2005
* - reason: Added several modifications based on DSC feedback
*
* @date 13th Oct, 2004
* @author Sandeep Tiwari
*
*/
#ifndef _CSL_RESZ_H_
#define _CSL_RESZ_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <cslr.h>
#include <csl_error.h>
#include <csl_sysData.h>
#include <csl_types.h>
#include <cslr_resz.h>
/**************************************************************************\
* RESZ global macro declarations
\**************************************************************************/
/** Constants for passing parameters to the RESZ Hardware Setup function
*/
/** For indicating that the RESZ module is enabled */
#define CSL_RESZ_ENABLE (CSL_RESZ_PCR_ENABLE_ENABLE)
/** For indicating that the RESZ module is disabled */
#define CSL_RESZ_DISABLE (CSL_RESZ_PCR_ENABLE_DISABLE)
/** For indicating that the RESZ module is busy */
#define CSL_RESZ_BUSY (CSL_RESZ_PCR_BUSY_BUSY)
/** For indicating that the RESZ module is not busy */
#define CSL_RESZ_NOT_BUSY (CSL_RESZ_PCR_BUSY_NOTBUSY)
/** For indicating that the input type is YUV422 color interleaved */
#define CSL_RESZ_TYPE_INTERLEAVED (CSL_RESZ_RSZ_CNT_INPTYP_YUV422_INTERLEAVED)
/** For indicating that the input type is color separate */
#define CSL_RESZ_TYPE_SEPARATE (CSL_RESZ_RSZ_CNT_INPTYP_COLOR_SEP_8BIT)
/** For indicating that the position in 16-bit word is YC */
#define CSL_RESZ_POS_YC (CSL_RESZ_RSZ_CNT_YCPOS_YC)
/** For indicating that the position in 16-bit word is CY*/
#define CSL_RESZ_POS_CY (CSL_RESZ_RSZ_CNT_YCPOS_CY)
/** For indicating that the luma enhancement is disabled */
#define CSL_RESZ_YENH_DISABLE (CSL_RESZ_YENH_ALGO_DISABLE)
/** For indicating that the luma enhancement algorithm uses a 3 tap high pass filter */
#define CSL_RESZ_YENH_HPF_3TAP (CSL_RESZ_YENH_ALGO_HPF_3TAP)
/** For indicating that the luma enhancement algorithm uses a 5 tap high pass filter */
#define CSL_RESZ_YENH_HPF_5TAP (CSL_RESZ_YENH_ALGO_HPF_5TAP)
/** For indicating that the chrominance algo is same as luminance processing */
#define CSL_RESZ_CHROM_ALGO_SAME_AS_LUMA (CSL_RESZ_RSZ_CNT_CBILIN_SAME_AS_LUMA)
/** For indicating that the chrominance algo is bilinear interpolation */
#define CSL_RESZ_CHROM_ALGO_BILINEAR (CSL_RESZ_RSZ_CNT_CBILIN_BILIN_INTERP)
/**************************************************************************\
* RESZ global typedef declarations
\**************************************************************************/
/** @brief This object contains the reference to the instance of RESZ opened
* using the @a CSL_reszOpen().
*
* The pointer to this, is passed to all RESZ CSL APIs.
*/
typedef struct CSL_ReszObj {
/** This is the mode which the CSL instance is opened */
CSL_OpenMode openMode;
/** This is a unique identifier to the instance of RESZ being
* referred to by this object
*/
CSL_Uid uid;
/** This is the variable that contains the current state of a
* resource being shared by current instance of RESZ with
* other peripherals
*/
CSL_Xio xio;
/** This is a pointer to the registers of the instance of RESZ
* referred to by this object
*/
CSL_ReszRegsOvly regs;
/** This is the instance of RESZ being referred to by this object */
CSL_ReszNum perNum;
}CSL_ReszObj;
typedef struct CSL_ReszObj *CSL_ReszHandle;
/** @brief RESZ Peripheral ID, Class, and Revision structure
*
* This structure is used for querying the RESZ peripheral ID, class, and revision
*/
typedef struct CSL_ReszRevStatus_{
/** RESZ Peripheral ID */
Uint16 peripheralID;
/** Class Identification */
Uint16 classID;
/** Revision Number*/
Uint16 revNum;
}CSL_ReszRevStatus;
/** @brief Enumeration for queries passed to @a CSL_reszGetHwStatus()
*
* This is used to get the status of different operations or to get the
* existing setup of RESZ.
*/
typedef enum {
/** Get the RESZ module ID and revision numbers (response type: @a (CSL_ReszRevStatus*)) */
CSL_RESZ_QUERY_REV_ID = 1,
/** Get the RESZ busy status (response type: @a (Uint16*) ) */
CSL_RESZ_QUERY_IS_BUSY,
/** Called after settings are set, checks to see if any interdependant
setting restrictions are violated (response type: @a (Uint32*) )
If there are no violations, the function will return a CSL_SOK condition
and the response value will be equal to 0. If there are any violations,
the function will return the CSL_ESYS_FAIL error and the response value will
have bits set which indicate any violations found. The following are the
violation codes for the bits of the response variable:
0: Output Width is over the limit (4x-1/2x: width<1280, <1/2x-1/4x: width<640)
1: Output Width is not even
2: Output Width is not a multiple of 16 bytes (for vertical upsizing)
3. Color Separate mode is turned on when input source is not SDRAM
4: Vertical Resize Ratio out of range (64..1024)
5: Horizontal Resize Ratio out of range (64..1024)
6: Input Height violation
7: Input Width violation
8: Vertical Start Phase violation
9: Horizontal Start Phase violation
10: Input Height is larger than preview output height (if source is preview)
11: Input Width is larger than preview output width (if source is preview)
12: Input Height is larger than ccdc output height (if source is ccdc)
13: Input Width is larger than ccdc output width (if source is ccdc)
14: Input address is not zero (when input source is not SDRAM)
15: Input offset is not zero (when input source is not SDRAM)
16: Vertical Start Pixel is not zero (if source is SDRAM)
17: Horizontal Start Pixel is beyond its maximum allowed value (if source is SDRAM)
18: Warning: Unpreferred use of Bilinear Interpolation
19: Output Line offset (SDR_OUTOFF) is smaller than output line width
20 - 31: RESERVED
*/
CSL_RESZ_QUERY_CHECK_SETTINGS
} CSL_ReszHwStatusQuery;
/** @brief Enumeration for queries passed to @a CSL_reszHwControl()
*
* This is used to select the commands to control the operations
* existing setup of RESZ. The arguments to be passed with each
* enumeration if any are specified next to the enumeration.
*/
typedef enum {
/** Enable/Disable the Resizer: argument @a (Uint16 *)
CSL_RESZ_ENABLE, CSL_RESZ_DISABLE */
CSL_RESZ_CMD_ENABLE = 1,
/** Set input source: argument @a (CSL_ReszInputSource *) */
CSL_RESZ_CMD_SELECT_INPUT_SOURCE,
/** Select Input type: argument @a (Uint16 *)
CSL_RESZ_TYPE_INTERLEAVED, CSL_RESZ_TYPE_SEPARATE*/
CSL_RESZ_CMD_SELECT_INPUT_TYPE,
/** Sets the filter coefficients: argument @a (CSL_ReszFilterConfig*) */
CSL_RESZ_CMD_SET_FILTER_COEFF,
/** Set starting phase: argument @a (CSL_ReszStartPhase *) */
CSL_RESZ_CMD_SET_START_PHASE,
/** Set resizing value: argument @a (CSL_ReszResizeValue *) */
CSL_RESZ_CMD_SET_RESIZE_VALUE,
/** Set input starting position: argument @a
(CSL_ReszStartInfo *) */
CSL_RESZ_CMD_IN_START_POS,
/** Set input width and height before resizing:
argument @a (CSL_ReszInputSize *) */
CSL_RESZ_CMD_IN_SIZE,
/** Set input SDRAM address : argument @a (Uint32 *) */
CSL_RESZ_CMD_IN_SDRAM_ADDR,
/** Set input SDRAM offset : argument @a (Uint16 *) */
CSL_RESZ_CMD_IN_SDRAM_OFFSET,
/** Set output width and height after resizing:
argument @a (CSL_ReszOutSize *) */
CSL_RESZ_CMD_OUT_SIZE,
/** Set output SDRAM address : argument @a (Uint32 *) */
CSL_RESZ_CMD_OUT_SDRAM_ADDR,
/** Set output SDRAM offset : argument @a (Uint16 *) */
CSL_RESZ_CMD_OUT_SDRAM_OFFSET,
/** Set Chrominance algorithm: argument @a (Uint16 *)
CSL_RESZ_CHROM_ALGO_SAME_AS_LUMA, CSL_RESZ_CHROM_ALGO_BILINEAR*/
CSL_RESZ_CMD_SELECT_CHROM_ALGO,
/** Set luminance and chrominance position : argument @a (Uint16 *)
CSL_RESZ_POS_YC, CSL_RESZ_POS_CY*/
CSL_RESZ_CMD_POS_LUMI_CHROM,
/** Configure luminance enhancer:
argument @a (CSL_ReszLumEnhance *) */
CSL_RESZ_CMD_LUMINANCE,
/** Calculates the appropriate Resize value or Input Size and/or filter coefficients:
argument @a (CSL_ReszHwSetup *)
There are 2 modes of calculation in this function:
1. Input & Output sizes known (Calculate Resize Value)
Set 'input', 'output', and 'phase' to their desired values
and set ratio = 0. The return struct will set the appropriate
rsz value and may modify the input value to meet restrictions.
2. Resize value & Output size known (Calculate Required Input Size)
Set 'ratio', 'output', and 'phase' to their desired values
and set input = 0. The return struct will set the appropriate
input value.
For mode 1 above, the resize ratio may be calculated under the following 2 conditions:
1. inMax = TRUE. The input passed to this function is the maximum allowable input.
This can be the case if the input is the output of the preview engine, or the input
from SDRAM is the whole image.
2. inMax = FALSE. The input passed to this function is at least 4 pixels from the sides of
the actual edge of the image (padded data available). This is applicable when resizing
a smaller portion of an image.
Notes: This function expects that either the 'input' or the 'ratio' value is
set to 0. If they are both 0, then the CSL_ESYS_INVPARAMS error
is returned.
This function will also calculate the filter coefficients for the given/calculated resize ratios
if the filterCoeffs variable is passed. If the filterCoeffs is NULL, then the filter coefficients
will not be calculated and the variable will remain null.
*/
CSL_RESZ_CMD_CALCULATE_HW_SETUP,
/** Calculates the parameters required for each vertical slice of a slicing operation:
argument @a (CSL_ReszHwSetup *) */
CSL_RESZ_CMD_CALCULATE_SLICING,
/** Sets the parameters for resizing a single slice of the image:
argument @a (CSL_ReszSliceInfo *) */
CSL_RESZ_CMD_SET_SLICE
} CSL_ReszHwControlCmd;
/** @brief Enumeration for different input sources to the RESZ
*
* This is used to set the input source to the resizer
*/
typedef enum {
/** Preview Engine */
CSL_RESZ_INPUT_PREVIEW = 0,
/** SDRAM */
CSL_RESZ_INPUT_SDRAM,
/** CCD Controller */
CSL_RESZ_INPUT_CCDC
} CSL_ReszInputSource;
/** @brief Enumeration for error bit codes from the @a CSL_reszCheckSettings() API
*
* This is used to identify the error bit codes fron the @a CSL_reszCheckSettings() API
*/
typedef enum {
/** Indicates that there are no errors, all restrictions are met */
CSL_RESZ_ERR_NO_ERRORS = 0x00000000,
/** Bit 0: Output Width is over the limit (4x-1/2x: width<1280, <1/2x-1/4x: width<640) */
CSL_RESZ_ERR_OUT_WIDTH_OVER_LIMIT = 0x00000001,
/** Bit 1: Output Width is not even */
CSL_RESZ_ERR_OUT_WIDTH_NOT_EVEN = 0x00000002,
/** Bit 2: Output Width is not a multiple of 16 bytes (for vertical upsizing) */
CSL_RESZ_ERR_OUT_WIDTH_NOT_MULT_16 = 0x00000004,
/** Bit 3. Color Separate mode is turned on (when input source is not SDRAM) */
CSL_RESZ_ERR_COLOR_SEP_ON = 0x00000008,
/** Bit 4: Vertical Resize Ratio out of range (64..1024) */
CSL_RESZ_ERR_VERT_RATIO = 0x00000010,
/** Bit 5: Horizontal Resize Ratio out of range (64..1024) */
CSL_RESZ_ERR_HORZ_RATIO = 0x00000020,
/** Bit 6: Input Height violation */
CSL_RESZ_ERR_INPUT_HEIGHT = 0x00000040,
/** Bit 7: Input Width violation */
CSL_RESZ_ERR_INPUT_WIDTH = 0x00000080,
/** Bit 8: Vertical Start Phase violation */
CSL_RESZ_ERR_VERT_ST_PHASE = 0x00000100,
/** Bit 9: Horizontal Start Phase violation */
CSL_RESZ_ERR_HORZ_ST_PHASE = 0x00000200,
/** Bit 10: Input Height is larger than preview output height (if source is preview) */
CSL_RESZ_ERR_IN_HEIGHT_LARGER_PRV = 0x00000400,
/** Bit 11: Input Width is larger than preview output width (if source is preview) */
CSL_RESZ_ERR_IN_WIDTH_LARGER_PRV = 0x00000800,
/** Bit 12: Input Height is larger than ccdc output height (if source is ccdc) */
CSL_RESZ_ERR_IN_HEIGHT_LARGER_CCDC = 0x00001000,
/** Bit 13: Input Width is larger than ccdc output width (if source is ccdc) */
CSL_RESZ_ERR_IN_WIDTH_LARGER_CCDC = 0x00002000,
/** Bit 14: Input address is not zero (when input source is not SDRAM) */
CSL_RESZ_ERR_IN_ADDR_NOT_ZERO = 0x00004000,
/** Bit 15: Input offset is not zero (when input source is not SDRAM) */
CSL_RESZ_ERR_IN_OFFSET_NOT_ZERO = 0x00008000,
/** Bit 16: Vertical Start Pixel is not zero (if source is SDRAM) */
CSL_RESZ_ERR_VERT_ST_PIX_NOT_ZERO = 0x00010000,
/** Bit 17: Horizontal Start Pixel is beyond its maximum allowed value (if source is SDRAM) */
CSL_RESZ_ERR_HORZ_ST_PIX_OVER_MAX = 0x00020000,
/** Bit 18: Warning: Unpreferred use of Bilinear Interpolation */
CSL_RESZ_ERR_BILINEAR_WARNING = 0x00040000,
/** Bit 19: Output Line offset (SDR_OUTOFF) is smaller than output line width */
CSL_RESZ_ERR_SDR_OUTOFF_TOO_SMALL = 0x00080000
} CSL_ReszErrorBits;
/**
* This structure is used to obtain the filter information of
* RESZ @ CSL_reszHwControl() function
*/
typedef struct CSL_ReszFilterConfig {
/** Horizontal filter type */
Uint16 *horzFilter;
/** Vertical filter type */
Uint16 *vertFilter;
}CSL_ReszFilterConfig;
/**
* This structure is used to obtain the starting phase of
* RESZ @ CSL_reszHwControl() function
*/
typedef struct CSL_ReszStartPhase {
/** Horizontal starting phase (0 - 7) */
Uint8 hPhase;
/** Vertical starting phase (0 - 7) */
Uint8 vPhase;
}CSL_ReszStartPhase;
/**
* This structure is used to obtain the resizing value of
* RESZ @ CSL_reszHwControl() function
*/
typedef struct CSL_ReszResizeValue {
/** Horizontal resizing value (64 - 1024) */
Uint16 hrzValue;
/** Vertical resizing value (64 - 1024) */
Uint16 vrzValue;
}CSL_ReszResizeValue;
/**
* This structure is used to obtain the width and height
* for both the input and output
* RESZ @ CSL_reszHwControl() function
*/
typedef struct CSL_ReszSize {
/** width (in horizontal direction) */
Uint16 width;
/** height (in vertical direction) */
Uint16 height;
}CSL_ReszSize;
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -