MODIFICATION HISTORY:
Ver Who Date Changes ----- ---- -------- ------------------------------------------------------- 1.00a xd 02/10/09 First release 2.00a xd 12/14/09 Updated doxygen document tags 4.01a cw 06/27/12 Updated tcl file with new parameter names (num_x_taps) Updated mdd file with updated supported_peripherals field. 4.02a mpv 03/11/13 Updated the Driver to select the correct coeff bin. Changed RegValue variable to a volatile type Removed 10.x patch in the Tcl file 4.03a mpv 05/28/13 Fixed version limit in MDD file Updated the Driver input, output and aperture size mask 5.00a mpv 12/13/13 Updated to dynamic coeff generation to reduce driver size
#include "xscaler.h"
#include "xenv.h"
#include "xil_io.h"
#include "xil_assert.h"
Utility Macros | |
#define | round(x) ((x) >= 0 ? (s32)((x) + 0.5) : (s32)((x) - 0.5)) |
Functions | |
s16 * | XScaler_GenCoefTable (u32 Tap, u32 Phase) |
int | XScaler_CfgInitialize (XScaler *InstancePtr, XScaler_Config *CfgPtr, u32 EffectiveAddr) |
int | XScaler_SetAperture (XScaler *InstancePtr, XScalerAperture *AperturePtr) |
void | XScaler_GetAperture (XScaler *InstancePtr, XScalerAperture *AperturePtr) |
void | XScaler_SetPhaseNum (XScaler *InstancePtr, u16 VertPhaseNum, u16 HoriPhaseNum) |
void | XScaler_GetPhaseNum (XScaler *InstancePtr, u16 *VertPhaseNumPtr, u16 *HoriPhaseNumPtr) |
void | XScaler_SetStartFraction (XScaler *InstancePtr, XScalerStartFraction *StartFractionPtr) |
void | XScaler_GetStartFraction (XScaler *InstancePtr, XScalerStartFraction *StartFractionPtr) |
void | XScaler_GetCoeffBankSharingInfo (XScaler *InstancePtr, u8 *ChromaFormat, u8 *ChromaLumaShareCoeff, u8 *HoriVertShareCoeff) |
s16 * | XScaler_CoefValueLookup (u32 InSize, u32 OutSize, u32 Tap, u32 Phase) |
void | XScaler_LoadCoeffBank (XScaler *InstancePtr, XScalerCoeffBank *CoeffBankPtr) |
void | XScaler_SetActiveCoeffSet (XScaler *InstancePtr, u8 VertSetIndex, u8 HoriSetIndex) |
void | XScaler_GetActiveCoeffSet (XScaler *InstancePtr, u8 *VertSetIndexPtr, u8 *HoriSetIndexPtr) |
Variables | |
u16 | XScaler_CoefficientBinScalingFactors [XSCL_NUM_COEF_BINS] |
|
This macro calculates the integral value nearest to x rounding half-way cases away from zero, regardless of the current rounding direction.
|
|
This function initializes a Scaler device. This function must be called prior to using a Scaler device. Initialization of a Scaler includes setting up the instance data, and ensuring the hardware is in a quiescent state.
|
|
This function returns the pointer to the coefficients for a scaling operation given input/output sizes and the Tap and Phase numbers.
|
|
XScaler_GenCoefTable generates XScaler_coef_table containing the coefficient values for scaling operations |
|
This function fetches the indexes of active vertical and horizontal coefficient sets being used by a Scaler device. Each coefficient set contains 4 banks: Horizontal Luma, Horizontal Chroma, Vertical Luma and Vertical Chroma. The horizontal part is independent from the vertical part and the Scaler device supports using the horizontal part of one coefficient set w/ the vertical part of a different coefficient set.
|
|
This function gets aperture of a Scaler device. The aperture setting consists of input video aperture and output video size.
|
|
This function fetches the color space format and coefficient bank sharing decisions made on a Scaler device at build-time.
The application of this function is responsible for loading the correct number of coefficient banks in the proper sequence order. The number of coefficient banks to load and the proper loading sequence totally depends on the values of the output parameters of this function. Please use the table below as reference.
ChromaFormat ChromaLumaShareCoeff HoriVertShareCoeff # of sequence coeff of banks loading to load coeff banks ------------ -------------------- ------------------ -------- ------------- YUV420 1 1 1 1.Single bank ------------ -------------------- ------------------ -------- ------------- YUV420 1 0 2 1.Hori bank 2.Vert bank ------------ -------------------- ------------------ -------- ------------- YUV420 0 1 2 1.Luma bank 2.Chroma bank ------------ -------------------- ------------------ -------- ------------- YUV420 0 0 4 1.Hori Luma 2.Hori Chroma 3.Vert Luma 4.Vert Chroma ------------ -------------------- ------------------ -------- ------------- YUV422 1 1 1 1.Single bank ------------ -------------------- ------------------ -------- ------------- YUV422 1 0 2 1.Hori bank 2.Vert bank ------------ -------------------- ------------------ -------- ------------- YUV422 0 1 2 1.Luma bank 2.Chroma bank ------------ -------------------- ------------------ -------- ------------- YUV422 0 0 4 1.Hori Luma 2.Hori Chroma 3.Vert Luma 4.Vert Chroma ------------ -------------------- ------------------ -------- ------------- YUV444 Always 1 1 1 1.Single bank ------------ -------------------- ------------------ -------- ------------- YUV444 Always 1 0 2 1.Hori bank 2.Vert bank ------------ -------------------- ------------------ -------- ------------- |
|
This function gets the numbers of vertical and horizontal phases currently used by a Scaler device.
|
|
This function gets Luma and Chroma start fractional values currently used by a Scaler device.
|
|
This function loads a coefficient bank to the Scaler core. A complete coefficient set contains 4 banks (if Luma, Chroma, Horizontal and Vertical filter operations do not share common banks. For more details see XScaler_GetCoeffBankSharingInfo()): Horizontal Luma, Horizontal Chroma, Vertical Luma and Vertical Chroma. all 4 banks must be loaded back to back in the order listed here. The caller is responsible for ensuring the sequence and this function does not check it. An example sequence to load an whole coefficient set is like: XScaler_LoadCoeffBank(&Scaler, &HoriLumaCoeffBank); XScaler_LoadCoeffBank(&Scaler, &HoriChromaCoeffBank); XScaler_LoadCoeffBank(&Scaler, &VertLumaCoeffBank); XScaler_LoadCoeffBank(&Scaler, &VertChromaCoeffBank);
|
|
This function chooses the active vertical and horizontal coefficient sets to be used by a Scaler device. Each coefficient set contains 4 banks: Horizontal Luma, Horizontal Chroma, Vertical Luma and Vertical Chroma. The horizontal part is independent from the vertical part and the Scaler device supports using the horizontal part of one coefficient set w/ the vertical part of a different coefficient set.
|
|
This function sets up aperture of a Scaler device. The aperture setting consists of input video aperture and output video size. This function calculates the scale factor accordingly based on the aperture setting and sets up the Scaler appropriately.
|
|
This function sets the numbers of vertical and horizontal phases to be used by a Scaler device.
|
|
This function sets up Luma and Chroma start fractional values used by a Scaler device.
|
|
XScaler_CoefficientsBinScalingFactors contains scaling factors calculated using (Output_Size * 10000 / Input_Size). This table could help find the index of coefficient Bin given an input size and a output size. |