intel / libyami

Yet Another Media Infrastructure. it is core part of media codec with hardware acceleration, it is yummy to your video experience on Linux like platform.
Apache License 2.0
147 stars 106 forks source link

[AVC][SKL] bit2bit mismatches on B-frames encoding in CQP mode #739

Open dvrogozh opened 7 years ago

dvrogozh commented 7 years ago

I observe bit2bit mismatches on AVC encoding on B-frames in the CQP mode on yamitranscode. This is really annoying and gates further experiments with VAAPI and libyami.

Command line example:

yamitranscode \
  -i input_1920x1080.264 \
  -o out.264 \
  -W 1920 -H 1080 \
  -c AVC \
  -ipperiod 2 \
  -intraperiod 30 \
  --rcmode CQP \
  -qp 25 \
  -N 100

I used SKL NUC to catch this. Code of libva, libyami is the latest for 5/25/2017:

Please, mind that I do not observe this issue on avcenc: avcenc 1920 1080 sunflower_1920x1080_500.yuv out.264 --qp=25 --mode=2

xuguangxin commented 7 years ago

Hi @dvrogozh , thanks for report this. We will look at it.

Hi @wudping , Please help to reproduce it and use Valgrind do some investigate. thanks

wudping commented 7 years ago

Hi @dvrogozh , Sorry, I am not sure if I get the mean of bit2bit mismatches. Do you mean that the direct_8x8_inference_flag(or some other flags) is wrong in B frame?

dvrogozh commented 7 years ago

Bit2bit means that checksum for the outpu file is different each time you run the same command line, I used sha1sum. I did not check what is the difference each time, that can be single bit or entire difference for b-frames. I did check though that issue did not showup if I encode with ip frames only or ipb with avcenc.

wudping commented 7 years ago

Thanks @dvrogozh . Okay, I have done a test on KBL, use your cmd: [dpwu@supperkbl:vp8_svc-t]$yamitranscode -i 500F_1920x1080.264 -o out_3.264 -W 1920 -H 1080 -c AVC -ipperiod 2 -intraperiod 30 --rcmode CQP -qp 25 -N 100

I think that the following results mean there are no the problem on KBL, right? [dpwu@supperkbl:vp8_svc-t]$md5sum out_1.264 1e92a252fa7c6b18dc1b4bcd084fe4b7 out_1.264 [dpwu@supperkbl:vp8_svc-t]$md5sum out_2.264 1e92a252fa7c6b18dc1b4bcd084fe4b7 out_2.264 [dpwu@supperkbl:vp8_svc-t]$md5sum out_3.264 1e92a252fa7c6b18dc1b4bcd084fe4b7 out_3.264 [dpwu@supperkbl:vp8_svc-t]$md5sum out.264 1e92a252fa7c6b18dc1b4bcd084fe4b7 out.264

I am gonna have a try on SKL.

wudping commented 7 years ago

Hi @dvrogozh, I have double-checked the issue on SKL, I find out that libva's commit ID should be 5899f5. It turns out that the bit2bit mismatches issue depend on the Frame-Number. Because it's without problem if encode frame number is 30; but when frame number is 500, the problem is reproduced.

frame number is 30: cmd: yamiencode -i ../medias_for_verify/h264_enc_yuv/1920x1080_30F_002.I420 -W 1920 -H 1080 -c AVC -ipperiod 2 -intraperiod 30 --rcmode CQP -qp 25 -N 100 -o out_yami2.264 result: [wdp@gstyami:test]$md5sum out_yami_0.264 f9302d11dd938ff70d0e8651acdaedd8 out_yami0.264 [wdp@gstyami:test]$md5sum out_yami_1.264 f9302d11dd938ff70d0e8651acdaedd8 out_yami1.264 [wdp@gstyami:test]$md5sum out_yami_2.264 f9302d11dd938ff70d0e8651acdaedd8 out_yami_2.264

frame number is 500: cmd: avcenc 1920 1080 ../medias_for_verify/h264_enc_yuv/1920x1080_500F_001.I420 dout_mode20.264 qp=25 mode=2 result: [wdp@gstyami:test]$md5sum dout_mode2_0.264 857fe0cd8f1fce93e04dda3e9d63cef3 dout_mode20.264 [wdp@gstyami:test]$md5sum dout_mode2_1.264 cca31bb1dedd0b254b0d1db1fbb48d3c dout_mode2_1.264

So, I hope you can have a try with frame number is 500.

wudping commented 7 years ago

avcenc is also with this problem.

xuguangxin commented 7 years ago

Hi @dvrogozh , we can't reproduce the issue. I can't find libva revision 899f5a . So, I used latest one. I tried more than ten times, the md5 always same.

I use this commit for libva

commit 83fcb107ad01ee6acc558b736b12db6bea6f7d2f Author: Philipp Kerling pkerling@casix.org Date: Tue Jun 13 09:54:06 2017 +0200

wayland: Also support wl_drm version 1

Just using version 2 without checking would lead to a protocol error
bringing down the entire application, and wl_drm version 1 is still
supported since v2 only adds PRIME capabilities.

Signed-off-by: Philipp Kerling <pkerling@casix.org>

this commit for vaapi driver.

commit 7633739615b39762a10ccc85c3e52aa281e98592 Author: Xiang, Haihao haihao.xiang@intel.com Date: Tue Jun 13 00:05:20 2017 +0800

Bump intel-vaapi-driver to 1.8.4.pre1 for development

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>

could you help to try this again using latest libva and driver? thanks

xuguangxin commented 7 years ago

hi @dvrogozh , Any update on this?

wudping commented 7 years ago

hi @xuguangxin , This issue can be reproduced on SKL.