XDAIS Types and Constants
本文对xDM结构体中的各变量和结构体参数进行了解析,部分翻译不准确,仅供参考。
Shared XDM Definitions(共享XDM的定义)
Data Structures 均包含在头文件xdm.h中
1)struct XDM_BufDesc : Buffer descriptor for multiple buffers. (多个缓冲区的缓冲区描述符)
2)struct XDM_SingleBufDesc: Single buffer descriptor. (单个缓冲区描述)
3)struct XDM1_SingleBufDesc: Single buffer descriptor.
4)struct XDM1_BufDesc: Buffer descriptor.
5)struct XDM_AlgBufInfo: Buffer information descriptor for input and output buffers.
6)struct XDM_Date: Date and time.
7)struct XDM_Point: 2-dimensional point (二维点x,y)
8)struct XDM_Rect: Rectangle. (矩形)
9)struct XDM_ContextInfo: Buffer information descriptor for input and output buffers.
10)struct XDM_Context: Context used by split codecs.
1)
struct XDM_BufDesc
{
XDAS_Int8 ** bufs //指向包含buffer地址的数组的指针
XDAS_Int32 numBufs //Number of buffers
XDAS_Int32 * bufSizes //每个buffer的大小,单位是8-bit的字节
}
#define XDM_MAX_IO_BUFFERS 16 //Max I/O Buffers
XDM_BufDesc outBufs;
XDAS_Int32 bufSizeArray[XDM_MAX_IO_BUFFERS];
XDAS_Int8 *pBuffers[XDM_MAX_IO_BUFFERS];
XDAS_Int8 buffer1[4096];
XDAS_Int8 buffer2[1024];
// ensure all pBuffers and bufSizeArray are initially NULL
memset(pBuffers, 0, sizeof(pBuffers[0]) * XDM_MAX_IO_BUFFERS);
memset(bufSizeArray, 0,sizeof(bufSizeArray[0]) * XDM_MAX_IO_BUFFERS);
pBuffers[0] = buffer1;
pBuffers[4] = buffer2;
bufSizeArray[0] = 4096;
bufSizeArray[4] = 1024;
outBufs.bufs = pBuffers;
outBufs.numBufs = 2;
outBufs.bufSizes = bufSizeArray;
2)
struct XDM_SingleBufDesc
{
XDAS_Int8 * buf //指向buffer地址的指针
XDAS_Int32 bufSize //buffer的大小,单位是8-bit的字节
}
3)
struct XDM1_SingleBufDesc
{
XDAS_Int8 * buf
XDAS_Int32 bufSize
XDAS_Int32 accessMask
}
XDAS_Int32 accessMask :Mask filled by the algorithm, declaring how the buffer was accessed by the algorithm processor.
(Mask 被算法填充,声明算法处理器怎样访问buffer的)
Remarks:If the buffer was not accessed by the algorithm processor (e.g., it was filled via DMA or other hardware accelerator that doesn't write through the algorithm's CPU), then no bits in this mask should be set. (如果buffer没有被算法处理器访问(它由DMA或其他没有通过算法CPU写的硬件加速器填充)),这样在mask中没有任何bit被设置
It is acceptible (and appropriate!)to set several bits in this mask if the algorithm accessed the buffer in several ways.(如果算法访问几次buffer,则在mask中被接收几个bit)
This mask is often used by the application and/or framework to appropriately manage cache on cache-based systems.(该mask常被应用程序和/或framework使用以恰当的管理基于cache系统上的cache)
See also: XDM_AccessMode //Access modes used to declare how the algorithm accessed buffers. (负责声明算法怎么访问buffer的接入模块)
Remarks:
This indicates how the algorithm's CPU accessed the buffer, independent of DMA or other hardware accellerators. For example, if the buffer was written to with DMA (as opposed to writing to the buffer with the CPU write instructions), the algorithm should not set the XDM_ACCESSMODE_WRITE bit.
(这指出了算法CPU怎么访问buffer,独立的DMA或者其他硬件加速器的。例如,如果buffer用DMA写入了(与其相反的是用CPU写结构体来写入buffer),则算法将不设置XDM_ACCESSMODE_WRITE bit)
The value of the enum is the bit offset into a mask. The value of the enum is not the value to assign the mask.
(枚举类型数据(enum)的值是掩码中的位偏移,而非可以直接赋给掩码的值。mask m=0100b;那么enum e=3;而不是0100b=4;)
This enumeration data type should not be used for storage, but rather only for its constant values.
(枚举数据类型不用于存储,因为它是个常量)
Enumerator:
XDM_ACCESSMODE_READ The algorithm read from the buffer using the CPU.(算法用CPU从buffer中读)
See also:
XDM_SETACCESSMODE_READ:
#define XDM_SETACCESSMODE_READ (x) ((x) |= (0x1 << XDM_ACCESSMODE_READ))//Set the bit to indicate CPU read access in an access mask.(设置bit位以指示CPU读取的访问的接入掩码)
Parameters: x access mask.
Remarks: This is typically used by an algorithm. (这个被算法使用)
XDM_ISACCESSMODE_READ:
#define XDM_ISACCESSMODE_WRITE (x) (((x) >> XDM_ACCESSMODE_WRITE) & 0x1)//Check an access mask for CPU write access.(为CPU写入校验接入掩码)
Parameters:x access mask.
Remarks: This is typically used by an application.(这个被应用程序使用)
XDM_ACCESSMODE_WRITE The algorithm wrote to the buffer using the CPU.(算法使用CPU向buffer写入)
See also:
XDM_SETACCESSMODE_WRITE
#define XDM_SETACCESSMODE_WRITE(x )((x) |= (0x1 << XDM_ACCESSMODE_WRITE))//Set the bit to indicate CPU write access in an access mask.
Parameters:x access mask.
Remarks:This is typically used by an algorithm.
XDM_ISACCESSMODE_WRITE
#define XDM_ISACCESSMODE_WRITE(x) (((x) >> XDM_ACCESSMODE_WRITE) & 0x1)//Check an access mask for CPU write access.
Parameters:x access mask.
Remarks:This is typically used by an application.
4)
struct XDM1_BufDesc
{
XDAS_Int32 numBufs //Number of buffers in descs array,Must be less than XDM_MAX_IO_BUFFERS.
XDM1_SingleBufDesc descs [16]
}
5)
struct XDM_AlgBufInfo
{
XDAS_Int32 minNumInBufs //Minimum number of input buffers.
XDAS_Int32 minNumOutBufs //Minimum number of output buffers.
XDAS_Int32 minInBufSize [16] //Minimum size, in 8-bit bytes, required for each input buffer
XDAS_Int32 minOutBufSize [16] //Minimum size, in 8-bit bytes, required for each output buffer.
}
6)
struct XDM_Date
{
XDAS_Int32 msecsOfDay //Milliseconds of the day
XDAS_Int32 month //Month (0 = January, 11 = December)
XDAS_Int32 dayOfMonth //Month (1 - 31)
XDAS_Int32 dayOfWeek //Day of week (0 = Sunday, 6 = Saturday)
XDAS_Int32 year //Year (since 0)
}
7)
struct XDM_Point
{
XDAS_Int32 x
XDAS_Int32 y
}
8)
XDM_Rect
{
XDM_Point topLeft
XDM_Point bottomRight
}
9)
XDM_ContextInfo
{
XDAS_Int32 minContextSize //Minimum size, in 8-bit bytes, required for the alg context.
XDAS_Int32 minIntermediateBufSizes [32] //Minimum size, in 8-bit bytes, required for each intermediate(中间的) buffer.Remarks:The codec indicates the number of intermediate buffers required by zero-terminating this array.(每个中间buffer所要求的最小的大小。注意:codec指定了中间buffer的数量)
}
10)
XDM_Contex
t{
XDM1_SingleBufDesc algContext //App allocated(指定,保留) and provided。Remarks:Split codecs can use this for passing scalar data to the next part. (分割编解码器可以使用这个传递标量数据到下一个部分。)
XDAS_Int32 numInBufs //Number of input data buffers
XDAS_Int32 numOutBufs //Number of output data buffers
XDAS_Int32 numInOutBufs //Number of in/out data buffers
XDM1_SingleBufDesc inBufs [32] //Input data Cbuffers.Remarks: This is a sparse array.(这是一个稀疏数组)
XDM1_SingleBufDesc outBufs [32] //Output data buffers.Remarks:This is a sparse array.
XDM1_SingleBufDesc inOutBufs [32] //Input/Output data buffers.Remarks:This is a sparse array.
XDM1_SingleBufDesc intermediateBufs [32] //Intermediate, working buffers.Remarks:For FRONT codec parts, these buffers are treated as OUT buffers (i.e., written to by the algorithm). For BACK codec parts, these buffers are treated as IN buffers (i.e., read from by the algorithm). For MIDDLE codec parts, these buffers are treated as IN/OUT buffers (i.e., the codec can read from, and write to them). This is a null-terminated array (备注:为前端编解码器部件,这些缓冲区被视为出缓冲器(即算法写入 )。背面编解码器部分,这些缓冲区被视为缓冲区(即读取算法)。中间的编解码器的部分,这些缓冲区被视为/出缓冲器(即编解码器可以读出,并写入这些)。这是一个非终止数组)
}