intel / media-driver

Intel Graphics Media Driver to support hardware decode, encode and video processing.
https://github.com/intel/media-driver/wiki
Other
939 stars 337 forks source link

[Bug]: Gstreamer vaapipostproc element converts ARGB format incorrectly #1796

Open russnic opened 2 months ago

russnic commented 2 months ago

Which component impacted?

Video Processing

Is it regression? Good in old configuration?

No, this issue exist a long time

What happened?

When I attempt to create a test video via gstreamer using ARGB format the vaapipostproc does not convert the colours correctly, see below.

ARGB Pipeline:

gst-launch-1.0 -e videotestsrc num-buffers=60 ! video/x-raw,format=ARGB,width=1920,height=1080,framerate=60/1 ! vaapipostproc ! vaapih264enc ! h264parse ! mp4mux ! filesink location=/home/user/videotestsrc-argb.mp4

ARGB Video:

https://github.com/intel/media-driver/assets/128496652/2c4e659c-494b-4fda-813e-98cd0eaefe68

A pipeline that generates a test video with UYVY format and vaapipostproc has the correct colours

UYVY Pipeline:

gst-launch-1.0 -e videotestsrc num-buffers=60 ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1 ! vaapipostproc ! vaapih264enc ! h264parse ! mp4mux ! filesink location=/home/user/videotestsrc-uyvy.mp4

UYVY Video:

https://github.com/intel/media-driver/assets/128496652/086d0fef-5c4a-46e7-a259-ed7713161bbe

A pipeline that swaps vaapipostproc for videoconvert using ARGB format has the correct colours

videoconvert pipeline:

gst-launch-1.0 -e videotestsrc num-buffers=60 ! video/x-raw,format=ARGB,width=1920,height=1080,framerate=60/1 ! videoconvert ! vaapih264enc ! h264parse ! mp4mux ! filesink location=/home/user/videotestsrc-videoconvert-argb.mp4

https://github.com/intel/media-driver/assets/128496652/cf8355e8-7405-42b9-b943-492bd9074bf9

What's the usage scenario when you are seeing the problem?

Content Creation

What impacted?

All of the above was completed on Ubuntu 24.04 and GStreamer 1.24.2

However, I've also tested/confirmed issue is on Ubuntu 20.04 and GStreamer 1.16.3

Debug Information

  1. I’m unable to find libva/libva-utils/gmmlib/media-driver on my system but have the below installed

    user@host:~$ apt list --installed intel*
    Listing... Done
    intel-media-va-driver-non-free/noble,now 24.1.0+ds1-1 amd64 [installed]
  2. user@host:~$ ls /dev/dri
    by-path  card0  renderD128
  3. user@host:~$ lspci -nn |grep  -Ei 'VGA|DISPLAY'
    00:02.0 VGA compatible controller [0300]: Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620] [8086:3ea0] (rev 02)
  4. user@host:~$ sudo vainfo
    error: XDG_RUNTIME_DIR is invalid or not set in the environment.
    error: can't connect to X server!
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
    libva info: Found init function __vaDriverInit_1_20
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 1.20 (libva 2.12.0)
    vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.1.0 ()
    vainfo: Supported profile and entrypoints
      VAProfileNone                   :    VAEntrypointVideoProc
      VAProfileNone                   :    VAEntrypointStats
      VAProfileMPEG2Simple            :    VAEntrypointVLD
      VAProfileMPEG2Simple            :    VAEntrypointEncSlice
      VAProfileMPEG2Main              :    VAEntrypointVLD
      VAProfileMPEG2Main              :    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointVLD
      VAProfileH264Main               :    VAEntrypointEncSlice
      VAProfileH264Main               :    VAEntrypointFEI
      VAProfileH264Main               :    VAEntrypointEncSliceLP
      VAProfileH264High               :    VAEntrypointVLD
      VAProfileH264High               :    VAEntrypointEncSlice
      VAProfileH264High               :    VAEntrypointFEI
      VAProfileH264High               :    VAEntrypointEncSliceLP
      VAProfileVC1Simple              :    VAEntrypointVLD
      VAProfileVC1Main                :    VAEntrypointVLD
      VAProfileVC1Advanced            :    VAEntrypointVLD
      VAProfileJPEGBaseline           :    VAEntrypointVLD
      VAProfileJPEGBaseline           :    VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:    VAEntrypointFEI
      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          :    VAEntrypointVLD
      VAProfileVP8Version0_3          :    VAEntrypointEncSlice
      VAProfileHEVCMain               :    VAEntrypointVLD
      VAProfileHEVCMain               :    VAEntrypointEncSlice
      VAProfileHEVCMain               :    VAEntrypointFEI
      VAProfileHEVCMain10             :    VAEntrypointVLD
      VAProfileHEVCMain10             :    VAEntrypointEncSlice
      VAProfileVP9Profile0            :    VAEntrypointVLD
      VAProfileVP9Profile2            :    VAEntrypointVLD
  5. ARGB: libva_trace.log.142533.thd-0x00179cb4.txt libva_trace.log.142533.thd-0x00179ccf.txt libva_trace.log.142533.thd-0x00179cd1.txt

UYVY: libva_trace.log.142701.thd-0x00179d8a.txt libva_trace.log.142701.thd-0x00179d8d.txt libva_trace.log.142701.thd-0x00179d8f.txt

6. GPU does not hang

Do you want to contribute a patch to fix the issue?

None

intel-mediadev commented 1 month ago

Auto Created VSMGWL-73412 for further analysis.