Forums - Calculating stride and width for different fastcv API's

2 posts / 0 new
Last post
Calculating stride and width for different fastcv API's
Join Date: 8 Jun 20
Posts: 7
Posted: Wed, 2020-09-16 00:06


I have an input having width=1440, height=1080 and input is in Gray.

I am using some fastcv API' to process above input images. i,e fcvMultiplyScalars16, fcvElementMultiplyu8u16, fcvAddWeightedu8 and fcvBoxFilter3x3u8.

There is no clear details on how to calculate stride and width for each of above API.

input source Stride=0, output stride = 0

fcvMultiplyScalars16(int16src,srcWidth*3, srcHeight,srcStride,1,0,bitBufferdata, dstStride);

Here we are giving srcWidth as srcwidth*3 i.e 1440*3 and srcStride=0, dstStride=0


fcvElementMultiplyu8u16(bitBuffercpy, srcWidth*3, srcHeight, srcStride, bitBuffercpy, srcStride, squareBufferdata,dstStride);

Here also input width is srcWidth*3(1440*3), inputsource and output stride is 0


fcvMultiplyScalars16, fcvElementMultiplyu8u16 are working if i give width and stride as above.

But fcvAddWeightedu8 and fcvBoxFilter3x3u8 are not working if i give width and stride like above.


fcvAddWeightedu8(input1, srcWidth*3, srcHeight, srcStride,input2,srcStride,(1.0-0.8),0.8,output,dstStride );

fcvBoxFilter3x3u8(input,srcWidth, srcHeight,ImgSrcStride,lascaCountsdata,ImgdstStride);


I have also tried by giving just width as srcWidth and InputsrcStride=width, outputstride=width

fcvBoxFilter3x3u8(input,srcWidth, srcHeight,ImgSrcStride,lascaCountsdata,ImgdstStride);


Does this width, stride calculations changes for every fastcv API?

Does this widht, stride calculation depends on input and output data format i.e uint8_t*, uint16_t*?

Could you help me out giving proper width and stride to fastcv API's

Thanks and Regards
Rajesh Chanda


  • Up0
  • Down0
jeff4s Moderator
Join Date: 4 Nov 12
Posts: 98
Posted: Wed, 2020-09-16 11:27


The concept of stride is to allow padding of image to meet alignment requirements if necessary. It's measured in bytes in general. So yes it matters if input is uint8_t or uint16_t format. If there's no padding stride is same as width for 8-bit grayscale image. For uint16_t stride is 2xwidth, for example.



  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.