我对directshow中帧速率下降的问题感到沮丧吗? [英] I am frustrated about the question of frame rate drop in directshow?

查看:146
本文介绍了我对directshow中帧速率下降的问题感到沮丧吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在directshow中从USB2.0 carame获取视频。但是,由于它的高分辨率,视频数据通过变换滤镜后fram率降低。

相机支持1920 *的分辨率1080 30fps,通过测试变换滤波器的时间花费,我知道它花费15ms。为什么帧速率只有1000 /(33.3 + 15)= 20.7而不是30.似乎处理数据和获取数据是同步执行的。我想要在变换滤波器处理视频数据期间实现滤波器获取数据。

我不确定我是否清楚地描述了这个问题。我真的非常感谢你的帮助!



我尝试了什么:



我尝试使用多线程解决它但失败了。





I get the video from USB2.0 carame in directshow.However,because of it's high resolution,the fram rate decrease after video datas pass the transform filter.
the camera supports resolution of 1920*1080 30fps,by testing the time spending in transform filter,i known it costs 15ms.Why the frame rate is only 1000/(33.3+15)=20.7 rather 30.It seems that processing data and fetching data are performed synchronously.I want to acheive that the filter fetch data during the transform filter processes the video datas.
I'm not sure if i describe the question clearly.I'm really thanks your help!

What I have tried:

I try to use Multithreading to solve it but failed.


HRESULT CCsSobelV2::Transform(IMediaSample *pIn, IMediaSample *pOut)
 {
 /*while (!condition)
 {

 } */ 
 HRESULT hr = Copy(pIn, pOut);//Copy the input buffer input to the output buffer, the execution time is approximately 2ms
 if (FAILED(hr))
 return hr; 
 return Transform(pOut);//Custom transformation of the data in the output buffer

}

上面的代码是 Transform() function已经被覆盖了。事实上,如果转换(Pout)花费10ms,帧速率将是1000 /(33.3 + 10)fps.PS:我的相机提供1920 * 1080视频30fps

the code above is Transform() function which has been override.The truth is if Transform(Pout) costs 10ms,the frame rate will be 1000/(33.3+10)fps.PS:my camera provides 1920*1080 video at 30fps

推荐答案

你有转换时间和渲染时间。



和FPS是整体CPU负载和GPU能力的函数。



然后是单通与双通渲染...



FPS不是科学;这是一种平衡行为。
You have "transform" time and "render" time.

And FPS is a function of the overall CPU load and GPU "capability".

Then there is "single-pass" versus "double-pass" rendering...

FPS is not "science"; it's a balancing act.


这篇关于我对directshow中帧速率下降的问题感到沮丧吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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