libyami icon indicating copy to clipboard operation
libyami copied to clipboard

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

Open dvrogozh opened this issue 8 years ago • 9 comments

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:

  • libyami-utils: d1c686b configure.ac: bump reuqested yami API to 0.5.1
  • libyami: 70e9b9f jpegunit: modify vaapiDecoderJPEG_unittest
  • libva: 899f5a Bump libva to 1.8.3.pre1 for development
  • intel-vaapi-driver: 5f479ac Fix AUD insert issue in AVC encoder with GEN6/7.5/8.

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

dvrogozh avatar May 25 '17 19:05 dvrogozh

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

xuguangxin avatar May 26 '17 18:05 xuguangxin

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?

wudping avatar May 27 '17 01:05 wudping

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.

dvrogozh avatar May 27 '17 01:05 dvrogozh

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 avatar May 27 '17 01:05 wudping

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_yami_2.264 result: [wdp@gstyami:test_]$md5sum out_yami_0.264 f9302d11dd938ff70d0e8651acdaedd8 out_yami_0.264 [wdp@gstyami:test_]$md5sum out_yami_1.264 f9302d11dd938ff70d0e8651acdaedd8 out_yami_1.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_mode2_0.264 qp=25 mode=2 result: [wdp@gstyami:test_]$md5sum dout_mode2_0.264 857fe0cd8f1fce93e04dda3e9d63cef3 dout_mode2_0.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 avatar Jun 01 '17 10:06 wudping

avcenc is also with this problem.

wudping avatar Jun 13 '17 07:06 wudping

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 [email protected] 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 <[email protected]>

this commit for vaapi driver.

commit 7633739615b39762a10ccc85c3e52aa281e98592 Author: Xiang, Haihao [email protected] 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 <[email protected]>

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

xuguangxin avatar Jun 19 '17 03:06 xuguangxin

hi @dvrogozh , Any update on this?

xuguangxin avatar Jun 26 '17 04:06 xuguangxin

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

wudping avatar Jun 29 '17 07:06 wudping