CESNET / UltraGrid

UltraGrid low-latency audio and video network transmission system
http://www.ultragrid.cz
Other
499 stars 53 forks source link

VAProfileHEVCMain444_12 #396

Closed alatteri closed 1 month ago

alatteri commented 3 months ago

Hello UG Team,

I am revisiting hevc_qsv on Intel NUC with Xe graphics, on Ubuntu 24.04.

Running vainfo I am seeing the format VAProfileHEVCMain444_12 :VAEntrypointVLD listed. Does this mean hevc_qsv supports 12bit 444, and would no longer need the conversion to x2rgb10le or xv30le.

I am testing a UHD 12bit 444 RGB signal via BMD SDI and only getting around 22fps. If I specify -param lavc-use-codec=x2rgb10le then UG is stable @24.

uv  -t decklink -c libavcodec:encoder=hevc_qsv

[lavc hevc_qsv @ 0x7a8050001440] Warning in encoder initialization: incompatible video parameters (5)
[lavc] Selected pixfmt: xv30le
[lavc] Selected pixfmt has subsampling 4:4:4, which is usually not supported by HW coders
[lavc] Use ':subs=420' or ':safe' to disable.
[lavc] Selected color depth 10 b may not be supported by HW coders.
[lavc] Use ':depth=8' or ':safe' to disable.
[to_lavc_vid_conv] conversion is reducing bit depth from 16 to 10 and subsampling from 4444 to 4440
[DeckLink capture] 110 frames in 5.0209 seconds = 21.9084 FPS
[DeckLink capture] 110 frames in 5.02689 seconds = 21.8823 FPS
[DeckLink capture] 110 frames in 5.04129 seconds = 21.8198 FPS
[DeckLink capture] 110 frames in 5.03972 seconds = 21.8266 FPS
[DeckLink capture] 110 frames in 5.04793 seconds = 21.7911 FPS
[DeckLink capture] 109 frames in 5.01137 seconds = 21.7505 FPS
[lavc] Average compression time of last 100 frames is 45.771609 ms but time per frame is only 41.666667 ms!
[lavc] Also pixfmt change of last frame took 12.6095 ms.
Consider adding "--conv-policy cds" to prevent color space conversion.
uv -t decklink:codec=R12L -c libavcodec:encoder=hevc_qsv --param lavc-use-codec=x2rgb10le

[lavc hevc_qsv @ 0x7f0810001040] Warning in encoder initialization: incompatible video parameters (5)
[lavc] Selected pixfmt: x2rgb10le
[lavc] Selected pixfmt has subsampling 4:4:4, which is usually not supported by HW coders
[lavc] Use ':subs=420' or ':safe' to disable.
[lavc] Selected color depth 10 b may not be supported by HW coders.
[lavc] Use ':depth=8' or ':safe' to disable.
[to_lavc_vid_conv] conversion is reducing bit depth from 12 to 10
[DeckLink capture] 111 frames in 5.0395 seconds = 22.026 FPS
[DeckLink capture] 120 frames in 5.0001 seconds = 23.9995 FPS
[DeckLink capture] 120 frames in 5.00035 seconds = 23.9983 FPS
[DeckLink capture] 120 frames in 5.00025 seconds = 23.9988 FPS
[DeckLink capture] 121 frames in 5.04125 seconds = 24.002 FPS
[DeckLink capture] 120 frames in 5.00026 seconds = 23.9988 FPS
[DeckLink capture] 121 frames in 5.04164 seconds = 24.0001 FPS
MartinPulec commented 3 months ago

Hi Alan, unfortunately I don't have much to look into the current state now, but I'll try to add references at least.

Running vainfo I am seeing the format VAProfileHEVCMain444_12 :VAEntrypointVLD listed.

I believe that VLD means decoding, for encoding there must be something like VAEntrypointEncSliceLP or VAEntrypointEncSlice (or maybe also VAEntrypointEncPicture, which seems to apply to MJPEG)

Does this mean hevc_qsv supports 12bit 444, and would no longer need the conversion to x2rgb10le or xv30le.

Even if 12-bit entrypoint was available, still the pixel format of the codec would have probably a different layout than R12L, so some pixfmt change will be required.

If I specify -param lavc-use-codec=x2rgb10le then UG is stable

x2rgb is disabled to fix (or workaround if you wish) the issue GH-341. It is indeed faster, the YUV->RGB conversion is HW accelerated. But, (it used to be that) qsv internally converted to BT.601 limited-range and the metadata were not correctly set. AFAIK, there is no change since then. If you wish to move forward with X2RGB, we'd perhaps need some workaround.

alatteri commented 3 months ago

Hi Martin,

Thank you for the response, you are correct regarding VAEntrypointVLD being a decoder.

Probably nothing has changed regarding the colorspace issue, but I wanted to test it under Ubuntu 24.04 to see if anything changed. I have yet to test color accuracy, was going for performance and stability first.

There is listed in vainfo VAProfileHEVCMain12 : VAEntrypointEncSlice --- I wonder if this is 12bit but 420, as there is also VAProfileHEVCMain422_12.

Anyway, VAProfileHEVCMain444_10 and VAProfileHEVCSccMain444_10 still seem to be the most relevant.

Such a shame Intel dropped the ball on colorspace with that platform, otherwise it would be perfect. Small, low power, and cheapest HW accelerated solution.

MartinPulec commented 3 months ago

VAProfileHEVCMain12 : VAEntrypointEncSlice --- I wonder if this is 12bit but 420, as there is also VAProfileHEVCMain422_12.

just FYI, I think that no 12-bit format can be used with QSV in UG right now, see the pixfmt list, the question is just AV_PIX_FMT_QSV, which stands for hwaccel API, which we do not currently use for QSV.