Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

artifacts with non 4:2:0 input with iHD at some resolutins #30

Open
bmegli opened this issue Feb 28, 2021 · 9 comments
Open

artifacts with non 4:2:0 input with iHD at some resolutins #30

bmegli opened this issue Feb 28, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@bmegli
Copy link
Owner

bmegli commented Feb 28, 2021

Happens only with some resolutions (e.g. 848x480).

See also UNHVD#28

@bmegli bmegli added the bug Something isn't working label Feb 28, 2021
@bmegli
Copy link
Owner Author

bmegli commented Feb 28, 2021

The workaround for gen 8 - 9.5 is to use i965 driver instead

The temporary workaround for gen 10+ may be:

  • perform software color conversion
  • perform hardware scaling to resolution without problem

bmegli added a commit that referenced this issue Oct 5, 2023
- for troubleshooting #30
@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

Below succeeds

./hve-encode-raw-h264-bgr0 10 h264_vaapi

Modifying resolution to non standard 1932x1096 and enabling verbosity level to trace results in segmentation fault

./hve-encode-raw-h264-bgr0 10 h264_vaapi
[AVHWDeviceContext @ 0x561786994540] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x561786994540] libva: VA-API version 1.7.0
[AVHWDeviceContext @ 0x561786994540] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x561786994540] libva: Found init function __vaDriverInit_1_7
[AVHWDeviceContext @ 0x561786994540] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x561786994540] Initialised VAAPI connection: version 1.7
[AVHWDeviceContext @ 0x561786994540] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x561786994540] Format 0x42475241 -> argb.
[AVHWDeviceContext @ 0x561786994540] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x561786994540] Format 0x52474241 -> abgr.
[AVHWDeviceContext @ 0x561786994540] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x561786994540] Format 0x42475258 -> 0rgb.
[AVHWDeviceContext @ 0x561786994540] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x561786994540] Format 0x52474258 -> 0bgr.
[AVHWDeviceContext @ 0x561786994540] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x30335258 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x50424752 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x50524742 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x561786994540] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x561786994540] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x561786994540] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x561786994540] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x561786994540] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x561786994540] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x561786994540] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x561786994540] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x561786994540] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x561786994540] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x561786994540] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x561786994540] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ().
[AVHWDeviceContext @ 0x561786994540] Driver not found in known nonstandard list, using standard behaviour.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0.
[AVHWFramesContext @ 0x5617869ad680] Direct mapping possible.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x1.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x2.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x3.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x4.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x5.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x6.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x7.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x8.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x9.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xa.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xb.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xc.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xd.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xe.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0xf.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x10.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x11.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x12.
[AVHWFramesContext @ 0x5617869ad680] Created surface 0x13.
[h264_vaapi @ 0x561786988f40] Input surface format is nv12.
[h264_vaapi @ 0x561786988f40] Using VAAPI profile VAProfileH264High (7).
[h264_vaapi @ 0x561786988f40] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[h264_vaapi @ 0x561786988f40] Using VAAPI render target format YUV420 (0x1).
[h264_vaapi @ 0x561786988f40] Driver supports RC modes CQP, CBR, VBR, ICQ, QVBR, AVBR.
[h264_vaapi @ 0x561786988f40] No quality level set; using default (20).
[h264_vaapi @ 0x561786988f40] RC mode: ICQ.
[h264_vaapi @ 0x561786988f40] RC quality: 20.
[h264_vaapi @ 0x561786988f40] RC framerate: 30/1 (30.00 fps).
[h264_vaapi @ 0x561786988f40] Using intra and P-frames (supported references: 8 / 2).
[h264_vaapi @ 0x561786988f40] All wanted packed headers available (wanted 0xd, found 0x1f).
[h264_vaapi @ 0x561786988f40] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x5617869d2b40] Created surface 0x14.
[AVHWFramesContext @ 0x5617869d2b40] Direct mapping possible.
[h264_vaapi @ 0x561786988f40] Using level 4.2.
Segmentation fault (core dumped)

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

Notably 1932 divides by no more than 4

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

From this:

It looks like iHD requires internally 16 (AVC) or 8 (HEVC) byte alignment.

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

With trial and error it looks like height (not testing width yet) has to be divisible by 32

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

From Intel Media Server Studio SDK

Common for all components: minimum supported resolution is 32x32, frame width/height
must be a multiple of 32.

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

It is av_hwframe_transfer_data that segfaults

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

Kind of trial and error for now.

I can avoid the segfault by preparing AVHWFramesContext with height divisible by 32.

E.g. for 1920x48 input use 1920x64 hardware frames context

@bmegli
Copy link
Owner Author

bmegli commented Oct 5, 2023

Kind of trial and error for now.

No, this worked by pure luck and doesn't generalize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant