YUV444格式的U和V的缓冲区偏移值应该是多少?

例如,如果我使用的是YV12格式,则值如下:


  ppData.inputIDMAChannel.UBufOffset =
  iInputHeight * iInputWidth +
  (iInputHeight * iInputWidth)/ 4;
      ppData.inputIDMAChannel.VBufOffset = iInputHeight * iInputWidth;


iInputHeight = 160&iInputWidth = 112

ppdata是以下结构的对象:

    typedef struct ppConfigDataStruct
{
    //---------------------------------------------------------------
    // General controls
    //---------------------------------------------------------------
    UINT8         IntType;
                  //    FIRSTMODULE_INTERRUPT: the interrupt will be
                  //    rised once the first sub-module finished its job.
                  //    FRAME_INTERRUPT:   the interrput will be rised
                  //    after all sub-modules finished their jobs.
    //---------------------------------------------------------------
    // Format controls
    //---------------------------------------------------------------

    // For input
    idmaChannel     inputIDMAChannel;

    BOOL            bCombineEnable;
    idmaChannel     inputcombIDMAChannel;
    UINT8           inputcombAlpha;
    UINT32          inputcombColorkey;

    icAlphaType     alphaType;

    // For output
    idmaChannel     outputIDMAChannel;
    CSCEQUATION  CSCEquation;    // Selects R2Y or Y2R CSC Equation
    icCSCCoeffs     CSCCoeffs;      // Selects R2Y or Y2R CSC Equation
    icFlipRot          FlipRot;        // Flip/Rotate controls for VF
    BOOL    allowNopPP;   // flag to indicate we need a NOP PP processing

}*pPpConfigData, ppConfigData;


而idmaChannel的结构如下:

 typedef struct idmaChannelStruct
{
    icFormat       FrameFormat;  // YUV or RGB
    icFrameSize    FrameSize;  //  frame size
    UINT32         LineStride;//  stride in bytes
    icPixelFormat  PixelFormat;// Input frame RGB format, set NULL
                                    // to use standard settings.
    icDataWidth    DataWidth;// Bits per pixel for RGB format
    UINT32    UBufOffset;// offset of U buffer from Y buffer start address
                            // ignored if non-planar image format
    UINT32    VBufOffset;// offset of U buffer from Y buffer start address
                            // ignored if non-planar image format
} idmaChannel, *pIdmaChannel;


我想要YUV444的ppData.inputIDMAChannel.UBufOffset和ppData.inputIDMAChannel.VBufOffset的公式

提前致谢

最佳答案

鉴于YUV444每个组件使用8位,在我看来,公式应该很简单:

ppData.inputIDMAChannel.UBufOffset = 2 * iInputHeight * iInputWidth;
ppData.inputIDMAChannel.VBufOffset = iInputHeight * iInputWidth;

关于c++ - U和V缓冲区偏移的公式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2431138/

10-10 21:15