如何计算Visual Studio的间距 [英] How to calculate pitch of an image Visual studio

查看:158
本文介绍了如何计算Visual Studio的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算输入的解码视频帧的音高。有没有公​​式可以做到这一点。目前,我正在从创建解码器和调用映射解码器的CUDA函数中获得收益。
主要问题是我可以直接使用宽度和高度来计算图像的间距吗?

I want to calculate the pitch of an input decoded video frame. Is there any formulae to do it. I am at the moment getting the pitch from creating a decoder and calling the CUDA function of mapping decoder. BUt by main question is can I calculate the pitch of an image directly using width and height ?

推荐答案

间距或widthstep(以字节为单位)通常是128字节的一些便捷倍数,例如512或1024。显然,它比图像本身还要宽,因此它必须至少为 image_width(以元素数为单位) x element_size(以字节为单位)

The pitch or widthstep (in bytes) is usually some convenient multiple of 128 bytes, like 512 or 1024. It's obviously going to be wider than the image itself, so it must be at least image_width (in no. of elements) x element_size (in bytes).

它将是下一个可用的间距,因此,如果您的图像宽511个char元素,应该是512个字节。但是当然,填充要求取决于在设备内存中创建映像的方式。

It will be the next available pitch, so if your image is 511 char elements wide, it should be 512 bytes. But of course the padding requirements are dependent on the way the image was created in device memory.

这篇关于如何计算Visual Studio的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆