Tuesday, February 24, 2015

Sample code for using Image Stride value

Image Stride

When a video image is stored in memory, the memory buffer might contain extra padding bytes after each row of pixels. The padding bytes affect how the image is stored in memory, but do not affect how the image is displayed.
The stride is the number of bytes from one row of pixels in memory to the next row of pixels in memory. Stride is also called pitch.

void ProcessVideoImage(
    BYTE*       pDestScanLine0,    
    LONG        lDestStride,       
    const BYTE* pSrcScanLine0,     
    LONG        lSrcStride,        
    DWORD       dwWidthInPixels,    
    DWORD       dwHeightInPixels
    )
{
    for (DWORD y = 0; y < dwHeightInPixels; y++)
    {
        SOURCE_PIXEL_TYPE *pSrcPixel = (SOURCE_PIXEL_TYPE*)pDestScanLine0;
        DEST_PIXEL_TYPE *pDestPixel = (DEST_PIXEL_TYPE*)pSrcScanLine0;

        for (DWORD x = 0; x < dwWidthInPixels; x +=2)
        {
            pDestPixel[x] = TransformPixelValue(pSrcPixel[x]);
        }
        pDestScanLine0 += lDestStride;
        pSrcScanLine0 += lSrcStride;
    }
}




https://msdn.microsoft.com/en-us/library/windows/desktop/aa473780(v=vs.85).aspx



1 comment:

  1. Betway Casino Hotel and Resort - Goyang
    Located on the beach 바다 이야기 먹튀 and within a 10-minute 아시안부키 walk of the 토토가입머니 Ville du Casino Resort, Betway Casino Hotel and Spa 슬롯나라 has an outdoor pool. It's a quick bet365 es walk

    ReplyDelete