mpp icon indicating copy to clipboard operation
mpp copied to clipboard

H264/H265 encoding latency

Open Consti10 opened this issue 4 years ago • 6 comments

Hello, I am wondering if it is possible to measure the encoding latency (delta between frame N in -> frame N out) by just measuring the time it takes until MppEncoder::process() returns.

Or is the following possible with rv1126 encoder hw: put in frame 0 -> get out nothing put in frame 1 -> get out frame 0 put in frame 2 -> get out frame 1

(e.g. encoder buffers 1 or more frames).

Because on the rpi encoder for example, the encoding process is pipelined.

Consti10 avatar May 16 '21 02:05 Consti10

To show task timing setprop mpp_debug 1 or export mpp_debug=1. The encoder put/get function is block mode only. The non-block mode need to notify when the input buffer is at end of usage.

HermanChen avatar May 17 '21 01:05 HermanChen

Is that the same as doing: echo 0x100 > /sys/module/rk_vcodec/parameters/mpp_dev_debug As described here: https://github.com/rockchip-linux/mpp/issues/154 ? After doing so, I think I get the encoding latency from dmesg:

7a41d745-8d70-41e8-818d-eee002e1d93d

Can you do the same for the isp ? e.g. processing time for a frame on isp ?

Consti10 avatar May 17 '21 13:05 Consti10

The isp part is not in mpp

HermanChen avatar May 18 '21 00:05 HermanChen

But rk_vcodec is neither, right ?

Consti10 avatar May 18 '21 14:05 Consti10

rk_vcodec is part of mpp. The timing is the hardware encoding time for each encoding task. The latency contain hardware working time and software time.

https://github.com/rockchip-linux/mpp/blob/5b1156a47bc81462ce5d7c600d5a15b338dd4d82/mpp/mpp.cpp#L453-L456 Here you can enable the total timing record when mpp encoding one frame.

HermanChen avatar May 19 '21 08:05 HermanChen

thanks. Can you point me in the right direction regarding isp or do you not know how ?

Consti10 avatar May 20 '21 17:05 Consti10