简体   繁体   English

MediaCodec解码时间计算

[英]MediaCodec decode time calculation

What would be the best way to calculate the decode time of a frame decoded by mediacodec? 计算由媒体编解码器解码的帧的解码时间的最佳方法是什么? the execution time of the code below is clearly not the correct time. 下面代码的执行时间显然不是正确的时间。 Is there any way to know how long each frame/frames took to decode? 有什么方法可以知道每个帧解码需要多长时间?

Thanks. 谢谢。

startTime...

dequeueInputBuffer();

getInputBuffer();

//   copy frame to input buffer

queueInputBuffer();

dequeueOutputBuffer();

releaseOutputBuffer();

stopTime...

exectime = startTime - StopTime

It's difficult to get a meaningful measurement of the time required to decode a single frame, because you'll be measuring latency as well as throughput. 很难对解码单个帧所需的时间进行有意义的度量,因为您将要测量延迟和吞吐量。 Data has to be passed from the app to the mediaserver process, into the driver, decoded, and then the decoded data has to make the same journey in reverse. 数据必须从应用程序传递到媒体服务器进程,再传递到驱动程序中,然后进行解码,然后解码后的数据必须反向进行相同的过程。 There can be additional pipelining in the driver itself. 驱动程序本身可以包含其他流水线。

You can get a reasonable approximation by decoding a few hundred frames and then dividing the total time by the number of frames. 通过解码几百帧,然后将总时间除以帧数,可以得到一个合理的近似值。

What is it you're trying to accomplish? 您要完成什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM