Git Product home page Git Product logo

libvpl's Introduction

Intel® Video Processing Library (Intel® VPL)

Intel® Video Processing Library (Intel® VPL) provides access to hardware accelerated video decode, encode, and processing capabilities on Intel® GPUs to support AI visual inference, media delivery, cloud gaming, and virtual desktop infrastructure use cases.

See the specification for additional information.

This repository contains the following components:

  • Copies of the Intel® VPL API header files. The version of the API is listed in the mfxdefs.h file.
  • Intel® VPL Dispatcher
  • Examples demonstrating API usage

Important

Intel® VPL Tools are no longer in this repository. They have all been moved to https://github.com/intel/libvpl-tools

To use Intel® VPL for video processing you need to install at least one implementation. Here is a list:

Architecture

graph TD;
    dispatcher["Intel® VPL Dispatcher"]-->oneVPL-intel-gpu;
    dispatcher-->msdk["Intel® MediaSDK"];
Loading

As shown in this diagram, the Intel® VPL Dispatcher forwards function calls from the application to use the selected runtime.

Dispatcher behavior when targeting Intel® GPUs

Runtime loaded by Intel® VPL Dispatcher and their Microsoft* DirectX* support:

GPU Media SDK Intel® VPL Microsoft* DirectX* Support
Earlier platforms, back to BDW (Broadwell) ✔️ DX9/DX11
ICL (Ice Lake) ✔️ DX9/DX11
JSL (Jasper Lake) ✔️ DX9/DX11
EHL (Elkhart Lake) ✔️ DX9/DX11
SG1 ✔️ DX9/DX11
TGL (Tiger Lake) ✔️ ✔️ DX9/DX11*
DG1 (Intel® Iris® Xe MAX graphics) ✔️ ✔️ DX11*
RKL (Rocket Lake) ✔️ DX11
ADL-S (Alder Lake S) ✔️ DX11
ADL-P (Alder Lake P) ✔️ DX11
ADL-N (Alder Lake N) ✔️ DX11
DG2 (Intel® Arc™ A-Series Graphics) ✔️ DX11
ATSM (Intel® Data Center GPU Flex Series) ✔️ DX11
RPL-S (Raptor Lake S) ✔️ DX11
RPL-P (Raptor Lake P) ✔️ DX11
MTL (Meteor Lake) ✔️ DX11
ARL-S (Arrow Lake S) ✔️ DX11
ARL-H (Arrow Lake H) ✔️ DX11
LNL (Lunar Lake) ✔️ DX11
Future platforms... ✔️ DX11

For TGL and DG1, if both Intel® VPL and Intel® Media SDK runtime are installed then the Intel® VPL Dispatcher will prefer Intel® VPL runtime unless the application requests D3D9 by setting the filter property "mfxImplDescription.AccelerationMode" to MFX_ACCEL_MODE_VIA_D3D9.

Installing Intel® VPL

Installation options

Intel® VPL may be installed:

Using Intel® VPL

Configure your shell environment

If you did not install to standard system locations, you need to set up the environment, so tools like CMake and pkg-config can find the library and headers.

For Linux:

source <vpl-install-location>/etc/vpl/vars.sh

For Windows:

<vpl-install-location>\etc\vpl\vars.bat

Link to Intel® VPL with CMake

Add the following code to your CMakeLists, assuming TARGET is defined as the component that wants to use Intel® VPL:

if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
 set(CMAKE_LIBRARY_ARCHITECTURE x86)
endif()
find_package(VPL REQUIRED)
target_link_libraries(${TARGET} VPL::dispatcher)

Link to Intel® VPL from Bash with pkg-config

The following command line illustrates how to link a simple program to Intel® VPL using pkg-config.

gcc program.cpp `pkg-config --cflags --libs vpl`

How to Contribute

See CONTRIBUTING.md for more information.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Security

See the Intel® Security Center for information on how to report a potential security issue or vulnerability.

libvpl's People

Contributors

akwrobel avatar aukhina avatar changchingyew avatar christa03 avatar furongzhang avatar hoesheng avatar igorbelyakovintel avatar janezhang8 avatar jeffreymcallister avatar jluii avatar jonrecker avatar mav-intel avatar mgonchar avatar microyy avatar mounikamandava avatar nngokhale avatar romka0017 avatar rupakroyintel avatar sbalandi avatar sengguan avatar shepark avatar siewhoon avatar splotnikv avatar supreetsinghpalne avatar tengjinchung avatar tletnes avatar vcheah avatar ying2guo avatar yskuridi avatar zlice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libvpl's Issues

[regression][configure] commit 33ac97cd cause build problem

we build this repo without wayland support and without BUILD_TOOLS=OFF before
But now we need to add BUILD_TOOLS=OFF for the build, so it is the configure problem

User Specified Option Requirements Met (e.g. deps)? Feature Result Configure Result
BUILD_TOOLS=OFF Yes Disabled Success
BUILD_TOOLS=OFF No Disabled Success
BUILD_TOOLS=ON Yes Enabled Success
BUILD_TOOLS=ON No Error Error
Unspecified Yes Enabled Success
Unspecified No Disabled Success

The table (above) are the expected results. But the last use-case does not work.
The user should not be forced to disable an optional feature because they don’t have or want its dependencies installed.
The configure should automatically turn on/off optional features if the user does not specify it explicitly.
The only time configure should error is if the user explicitly enables an optional feature but has not satisfied the requirements (e.g. dependencies).

regression commit: 33ac97c

Decoding midway into a stream

Hello,

I am implementing the decoder for a livestream type application.
Using your reference hello-decode example, I noticed the following:

    // Prepare input bitstream and start decoding
    bitstream.MaxLength = BITSTREAM_BUFFER_SIZE;
    bitstream.Data      = (mfxU8 *)calloc(bitstream.MaxLength, sizeof(mfxU8));
    VERIFY(bitstream.Data, "Not able to allocate input buffer");
    bitstream.CodecId = MFX_CODEC_HEVC;

    // Pre-parse input stream
    sts = ReadEncodedStream(bitstream, source);
    VERIFY(MFX_ERR_NONE == sts, "Error reading bitstream\n");

    decodeParams.mfx.CodecId = MFX_CODEC_HEVC;
    decodeParams.IOPattern   = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
    sts                      = MFXVideoDECODE_DecodeHeader(session, &bitstream, &decodeParams);
    VERIFY(MFX_ERR_NONE == sts, "Error decoding header\n");

    // input parameters finished, now initialize decode
    sts = MFXVideoDECODE_Init(session, &decodeParams);
    VERIFY(MFX_ERR_NONE == sts, "Error initializing decode\n");

This only works if the decoder starts from the beginning of the stream at which point it proceeds to decode properly for each subsequent MFXVideoDECODE_DecodeFrameAsync() call.

However, what happens if you are not at the beginning of the stream ( aka join it halfway, like during a live streaming event? ) In this case, my testing indicates that the:

    // input parameters finished, now initialize decode
    sts = MFXVideoDECODE_Init(session, &decodeParams);
    VERIFY(MFX_ERR_NONE == sts, "Error initializing decode\n");

will fail with "Error initializing decode". What should I be doing in order to join a stream midway if I do not have the data from the very start of the stream? Should I be caching the start stream data somehere and use it to "boot up/start up" the decoder before proceeding to decode the actual stream if I were to join the stream in the middle?

Thanks

Can't build via End-To-End Scripts for oneVPL base and CPU stops with Error 2

Don't know what else to add. OneVPL and OneVPL-cpu are cloned in same base folder. Using Ubuntu 22.04

ls
oneVPL  oneVPL-cpu  oneVPL-intel-gpu

I ran oneVPL/script/e2e/build first and then

sudo oneVPL/script/e2e/build

[ 25%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/cpu_vpp.cpp.o
[ 27%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/cpu_vpp.cpp.o -MF CMakeFiles/vplswref64.dir/src/cpu_vpp.cpp.o.d -o CMakeFiles/vplswref64.dir/src/cpu_vpp.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/cpu_vpp.cpp
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw.cpp
[ 30%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_core.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_core.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_core.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_core.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_core.cpp
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw.cpp: In function ‘mfxStatus MFXInit(mfxIMPL, mfxVersion*, _mfxSession**)’:
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw.cpp:21:21: warning: ‘mfxStatus MFXInitEx(mfxInitParam, _mfxSession**)’ is deprecated [-Wdeprecated-declarations]
   21 |     return MFXInitEx(par, session);
      |            ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/local/include/vpl/mfxvideo.h:9,
                 from /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/cpu_common.h:21,
                 from /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/./cpu_workstream.h:12,
                 from /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw.cpp:7:
/usr/local/include/vpl/mfxsession.h:91:36: note: declared here
   91 | MFX_DEPRECATED mfxStatus MFX_CDECL MFXInitEx(mfxInitParam par, mfxSession *session);
      |                                    ^~~~~~~~~
[ 35%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_decode.cpp.o
[ 35%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_decvpp.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_decode.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_decode.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_decode.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_decode.cpp
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_decvpp.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_decvpp.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_decvpp.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_decvpp.cpp
[ 37%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_encode.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_encode.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_encode.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_encode.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_encode.cpp
[ 40%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpl.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpl.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpl.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpl.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_vpl.cpp
[ 42%] Building CXX object cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpp.cpp.o
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/c++ -DENABLE_ENCODER_OPENH264 -DONEVPL_EXPERIMENTAL -DVPL_VERSION_MAJOR=0 -DVPL_VERSION_MINOR=0 -DVPL_VERSION_PATCH=1 -D_FORTIFY_SOURCE=2 -Dvplswref64_EXPORTS -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu -I/home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/ext/ffmpeg-codecs/../../../_deps/include -O3 -DNDEBUG -fPIC -Wall -Wformat -Wformat-security -Werror=format-security -MD -MT cpu/CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpp.cpp.o -MF CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpp.cpp.o.d -o CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpp.cpp.o -c /home/max/Desktop/mesa/vpl2/oneVPL-cpu/cpu/src/libmfxvplsw_vpp.cpp
[ 45%] Linking CXX shared library ../libvplswref64.so.1
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/cpu && /usr/bin/cmake -E cmake_link_script CMakeFiles/vplswref64.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O3 -DNDEBUG -Wl,-Bsymbolic,-z,defs -shared -Wl,-soname,libvplswref64.so.1 -o ../libvplswref64.so.1 CMakeFiles/vplswref64.dir/src/cpu_common.cpp.o CMakeFiles/vplswref64.dir/src/cpu_decode.cpp.o CMakeFiles/vplswref64.dir/src/cpu_decodevpp.cpp.o CMakeFiles/vplswref64.dir/src/cpu_encode.cpp.o CMakeFiles/vplswref64.dir/src/cpu_frame.cpp.o CMakeFiles/vplswref64.dir/src/cpu_frame_pool.cpp.o CMakeFiles/vplswref64.dir/src/cpu_vpp.cpp.o CMakeFiles/vplswref64.dir/src/cpu_workstream.cpp.o CMakeFiles/vplswref64.dir/src/frame_lock.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_core.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_decode.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_decvpp.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_encode.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpl.cpp.o CMakeFiles/vplswref64.dir/src/libmfxvplsw_vpp.cpp.o  ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavfilter.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavcodec.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavutil.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libswscale.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libSvtHevcEnc.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libSvtAv1Enc.a ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libdav1d.a -ldl ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libopenh264.a 
/usr/bin/ld: ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavcodec.a(libaomdec.o): in function `aom_decode':
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:167: undefined reference to `aom_codec_decode'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:179: undefined reference to `aom_codec_get_frame'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:205: undefined reference to `aom_codec_control'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:169: undefined reference to `aom_codec_error'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:170: undefined reference to `aom_codec_error_detail'
/usr/bin/ld: ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavcodec.a(libaomdec.o): in function `aom_free':
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:242: undefined reference to `aom_codec_destroy'
/usr/bin/ld: ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavcodec.a(libaomdec.o): in function `av1_init':
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:248: undefined reference to `aom_codec_av1_dx'
/usr/bin/ld: ../../cpu/ext/ffmpeg-codecs/../../../_deps/lib/libavcodec.a(libaomdec.o): in function `aom_init':
/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:50: undefined reference to `aom_codec_version_str'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:51: undefined reference to `aom_codec_build_config'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:53: undefined reference to `aom_codec_dec_init_ver'
/usr/bin/ld: /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_extbuild/FFmpeg-n5.1.2/libavcodec/libaomdec.c:54: undefined reference to `aom_codec_error'
collect2: error: ld returned 1 exit status
make[2]: *** [cpu/CMakeFiles/vplswref64.dir/build.make:345: libvplswref64.so.1] Error 1
make[2]: Leaving directory '/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build'
make[1]: *** [CMakeFiles/Makefile2:942: cpu/CMakeFiles/vplswref64.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 47%] Linking CXX static library ../../../../lib/libgtest.a
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/test/unit/googletest/googletest && /usr/bin/cmake -P CMakeFiles/gtest.dir/cmake_clean_target.cmake
cd /home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build/test/unit/googletest/googletest && /usr/bin/cmake -E cmake_link_script CMakeFiles/gtest.dir/link.txt --verbose=1
/usr/bin/ar qc ../../../../lib/libgtest.a CMakeFiles/gtest.dir/src/gtest-all.cc.o
/usr/bin/ranlib ../../../../lib/libgtest.a
make[2]: Leaving directory '/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build'
[ 47%] Built target gtest
make[1]: Leaving directory '/home/max/Desktop/mesa/vpl2/oneVPL-cpu/_build'
make: *** [Makefile:166: all] Error 2

I'm adding the full output.
onevpl build.txt

MFX_VERSION_NEXT is not defined

When including mfxdefs.h in application code the compiler generates warning:

/media/install/include/vpl/mfxdefs.h:88:52: warning: "MFX_VERSION_NEXT" is not defined, evaluates to 0 [-Wundef]
   88 | #if !defined(MFX_DEPRECATED_OFF) && (MFX_VERSION < MFX_VERSION_NEXT)

<Features Request> More ratecontrol options

Hi, i currently using this software with sample_multi_transcode but it have few ratecontrol options live VBR, CQP. Its possible to add more ratecontrol options to sample_multi_transcode like ICQ, QVBR?
Or add VppHvsDenoise to sample_encode? I'm currently using vppHVSDenoise to denoise my videos and it works like i want but only in sample_multi_transcode. I hope soon this features will be added

Thanks

libvpl does not find backend although it's visible to dynamic linker, and installed to same place as libvpl

Setup

  • Ubuntu 22.04 container build

  • All media stack components built with /usr/local/lib as their installation destination

  • Dynamic linker see the relevant libraries, and lists them before the system ones:

$ ldconfig -v 2>/dev/null | grep -e ^/ -e libvpl -e libva -e libmfx -e libdrm
/usr/local/lib: (from /etc/ld.so.conf.d/libc.conf:2)
	libva.so.2 -> libva.so.2.1400.0
	libmfx.so.1 -> libmfx.so.1.35
	libmfxhw64.so.1 -> libmfxhw64.so.1.35
	libvpl.so.2 -> libvpl.so.2.7
	libdrm.so.2 -> libdrm.so.2.4.0
	libva-x11.so.2 -> libva-x11.so.2.1400.0
	libva-drm.so.2 -> libva-drm.so.2.1400.0
	libva-glx.so.2 -> libva-glx.so.2.1400.0
	libmfx-gen.so.1.2 -> libmfx-gen.so.1.2.7
	libdrm_intel.so.1 -> libdrm_intel.so.1.0.0
	libva-wayland.so.2 -> libva-wayland.so.2.1400.0
/lib/x86_64-linux-gnu: (from /etc/ld.so.conf.d/x86_64-linux-gnu.conf:3)
	libva.so.2 -> libva.so.2.1400.0
	libdrm.so.2 -> libdrm.so.2.4.0
	libva-x11.so.2 -> libva-x11.so.2.1400.0
	libva-drm.so.2 -> libva-drm.so.2.1400.0
	libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.0.0
	libdrm_nouveau.so.2 -> libdrm_nouveau.so.2.0.0
	libdrm_radeon.so.1 -> libdrm_radeon.so.1.0.1
	libva-wayland.so.2 -> libva-wayland.so.2.1400.0
/lib: (from <builtin>:0)

Use-case

  • Do transcoding: sample_multi_transcode -i::h265 /media/test_yuv420p.h265 -o::h264 /dev/null
  • or just try checking VPL backend capabilities: vpl-inspect

Actual outcome

$ vpl-inspect
Warning - no implementations found by MFXEnumImplementations()

Expected outcome

Because all relevant libraries are visible to dynamic linker, and in the same install target directory as libvpl, backend should be found/loaded, like happens when LD_LIBRARY_PATH is pointed to that directory:

$ LD_LIBRARY_PATH=/usr/local/lib  vpl-inspect 
libva info: VA-API version 1.14.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
libva info: VA-API version 1.14.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0

Implementation #0: mfx-gen
  Library path: /usr/local/lib/libmfx-gen.so.1.2.7
  AccelerationMode: MFX_ACCEL_MODE_VIA_VAAPI
  ApiVersion: 2.7
  Impl: MFX_IMPL_TYPE_HARDWARE
  VendorImplID: 0x0000
  ImplName: mfx-gen
  License: MIT License
  Version: 1.2
  Keywords: 
  VendorID: 0x8086
  mfxAccelerationModeDescription:
    Version: 1.0
    Mode: MFX_ACCEL_MODE_VIA_VAAPI

Specialized HDR Encoding Options

System information

  • GPU platform enabling for new feature: IceLake and newer
  • Host machine if it's discrete card: n/a
  • libva/libva-utils/gmmlib/media-driver/Media SDK version you are using? Media SDK API 1.35 (oneVPL once OEM updates driver)
  • Are you willing to contribute it?(Yes/No) Yes, but my programming knowledge is limited

Feature Information

Describe the feature and expected behavior

Because HDR PQ EOTF has different bit allocation than SDR gamma EOTF, x265 has options "--aq-mode 2" (raises or lowers per-block quantization based on complexity analysis of the source image with auto variance) and "--hdr-opt" (adds luma and chroma offsets for HDR/WCG content) that attempt to improve quality when encoding PQ HDR content.

Customer usage and impact for this feature

Quantization for HDR and SDR video in the current implementation is the same which causes blocking/banding/bitrates that are too low for chosen QP when encoding PQ HDR video. This bias toward SDR video is especially apparent when tone-mapping HDR video to SDR with the vpp hdr2sdr filter before encoding; the bitrate while encoding tone-mapped SDR video (with same QP setting) is double or triple that of the unaltered PQ HDR video and the end result is much better quality when visually compared.

Additional context
Add any other context or screenshots about the feature request here.

https://x265.readthedocs.io/en/2.5/cli.html

https://en.wikipedia.org/wiki/Perceptual_quantizer

Passing a user data pointer along with a frame when encoding video

I want to pass a pointer to metadata belonging to my application along with a frame and retrieve the associated pointer. Unfortunately I haven't seen any straightforward way to do that. Is passing a user pointer along with a frame when queuing for encoding and retrieving along with bitstream supported?

dpcpp blur udf failing with error CL_DEVICE_NOT_FOUND

The dpdpp blur udf is failing with the below mentioned error:

[Wed Apr 12 10:09:33 2023] ERROR:initialize:116: Failed to initialize UDF: No device of requested type available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (CL_DEVICE_NOT_FOUND)

Using the intel-basekit 2023.1.0 version for linux downloaded using the apt package manager method.
Is there any workaround to resolve the above issue ?

How to select different devices with MFXLoad and MFXCreateSession API

I have both an Intel Arc as well as an Intel UHD 770 iGPU, and would like to be able to select which hardware to use.
I could not find what is the way to select the hardware adapter with the newer Load and CreateSession method. The documentation only mention it with the legacy API.

Could a code sample be provided that demonstrates this functionality?

2022.2.x Release and Release notes missing on Github

Although 2022.2.x has seen several patch versions, it is not available as a "release".

Release notes are completely missing, some information for 2022.2.0 is available here:
https://www.intel.com/content/www/us/en/developer/tools/oneapi/onevpl.html#gs.ce7b1t

  • Multiple hardware adapters are supported as part of the 2.6 API update. They provide faster performance by taking advantage of available platform resources.
  • Windows* 11, Microsoft Visual Studio* 2022, and Microsoft Windows Server* 2022 have been added to include support for the latest development environments.
  • MPEG2 decode is now supported in a CPU implementation to improve codec coverage for systems that do not have dedicated hardware.
  • For a complete list of new features, see the Release Notes.

In the past (e.g. https://github.com/oneapi-src/oneVPL/releases/tag/v2021.2.2) even patch releases had release notes.

GPL-3.0 incompatible licenses: MS Visual Studio

In third-party-programs.txt "MS Visual Studio" licenses are mentioned. These are not GPL 3.0 compatible, i.e. you can't link GPL 3.0 sources against libvpl. This makes it difficult for a Linux distributor to ship this library. :-(

Is this an oversight, intentional or just can't be changed?

sample_multi_transcode is missing

Hi,

Can you please say if there're plans to put sample_multi_transcode in the repp ? Currently I see that sample_decode, sample_encode, sample_vpp are available.

how to encode jpg on ROI?

oneVPL works fine when encoding jpg on whole surface, but when I encodeing on roi zone, I got an damaged picture.
can you tell me how to encoding jpg on roi zone?

my code : https://pan.baidu.com/s/1ioYAlxaYIqteMlJbnsJ7_w?pwd=klkh
line 114 of hello-encode-jpg.cpp is the good case;
line 119 is bad case

compile & run:
mkdir build
cd build
cmake ..
make
./hello-encode -hw -i ../out.raw -w 1920 -h 1080

environment:
vpl-inspect.txt

"-svtav1-params" equivalent for av1_qsv encoder (to pass HDR10 mastering metadata)?

Hello, I am working to understand how to take advantage of the av1_qsv encoder with my A770 DG2 dGPU. I am trying to encode 10-bit AV1 files with HDR10, but I am struggling to understand how to encode the HDR10 metadata.

With svt-av1, you can pass in the parameters in ffmpeg using the "-svtav1-params" command-line option, for example:
-c:v libsvtav1 -svtav1-params "preset=6:crf=13:tune=0:enable-hdr=1:color-primaries=9:transfer-characteristics=16:matrix-coefficients=9:mastering-display=G(0.265,0.69)B(0.15,0.06)R(0.68,0.32)WP(0.3127,0.329)L(4000.0,0.005):content-light=1000,755"
(svtav1 parameters are all documented here: https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md ). The x265 encoder has an equivalent option (x265-params) as well.

Is there a way to do the equivalent with the OneVPL / av1_qsv encoder in ffmpeg?

Thanks!

[BUG]onevpl runtime call TileSet error

platform:ADL TGL DG2
describe:When I run the code stream of decode AV1 in gst-libvpl, I will encounter segmentation fault (core dumped).It is random.
cmd: gst-launch-1.0 -vf filesrc location=input_av1.ivf ! ivfparse ! av1parse ! msdkav1dec ! videoconvert chroma-mode=none dither=0 ! video/x-raw,format=I420 ! checksumsink2 qos=false file-checksum=false frame-checksum=false plane-checksum=false eos-after=100 dump-output=true dump-location=output.yuv

gdb gst-launch-1.0: run filesrc location=input_av1.ivf ! ivfparse ! av1parse ! msdkav1dec ! fakesink

log:Thread 66 "ivfparse0:sink" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffea7fc700 (LWP 954016)]
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:262
262 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) where
#0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:262
#1 0x00007ffff632aeec in UMC_AV1_DECODER::TileSet::TileSet(UMC::MediaData*, std::vector<UMC_AV1_DECODER::TileLocation, std::allocator<UMC_AV1_DECODER::TileLocation> > const&) ()
at /home/media-ci/gst-vaapi/media/build/lib/libmfx-gen.so.1.2.7
#2 0x00007ffff632b4bf in UMC_AV1_DECODER::AV1DecoderFrame::AddTileSet(UMC::MediaData*, std::vector<UMC_AV1_DECODER::TileLocation, std::allocator<UMC_AV1_DECODER::TileLocation> > const&) ()
at /home/media-ci/gst-vaapi/media/build/lib/libmfx-gen.so.1.2.7
#3 0x00007ffff632814d in UMC_AV1_DECODER::AV1Decoder::GetFrame(UMC::MediaData*, UMC::MediaData*) () at /home/media-ci/gst-vaapi/media/build/lib/libmfx-gen.so.1.2.7
#4 0x00007ffff6323f9b in VideoDECODEAV1::SubmitFrame(mfxBitstream*, mfxFrameSurface1*, mfxFrameSurface1**) () at /home/media-ci/gst-vaapi/media/build/lib/libmfx-gen.so.1.2.7
#5 0x00007ffff63243ff in VideoDECODEAV1::DecodeFrameCheck(mfxBitstream*, mfxFrameSurface1*, mfxFrameSurface1**, MFX_ENTRY_POINT*) () at /home/media-ci/gst-vaapi/media/build/lib/libmfx-gen.so.1.2.7

ERROR: cannot create session -- no implementations meet selection criteria ERROR: not able to create VPL session

Facing issue with the demo:

oneapi toolkit version : 2023.1 (https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?operatingsystem=linux&distributions=offline&version=2023.1)

System info:
Linux Ubuntu 22 Generic 5.19.0-42

Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

Issue:

intel@ubuntu:~/oneapi/oneVPL/examples/interop/vpl-infer/build$ ./vpl-infer -i cars_320x240.h265 -m mobilenet-ssd.xml
OpenVINO Runtime
    Version : 2022.3.0
    Build   : 2022.3.0-9052-9752fafe8eb-releases/2022/3

Loading network model files: mobilenet-ssd.xml
    Model name: MobileNet-SSD
    Inputs
        Input name: data
        Input type: f32
        Input shape: [1,3,300,300]
    Outputs
        Output name: detection_out
        Output type: f32
        Output shape: [1,1,100,7]

ERROR: cannot create session -- no implementations meet selection criteria
ERROR: not able to create VPL session

[hello-decode] Redundant pixels would be written into file

After applying the change to decode H.264 bitstream, which was encoded with 16 pixels aligned in width and height:

diff --git a/examples/hello/hello-decode/src/hello-decode.cpp b/examples/hello/hello-decode/src/hello-decode.cpp
index 6f555ee..e649294 100644
--- a/examples/hello/hello-decode/src/hello-decode.cpp
+++ b/examples/hello/hello-decode/src/hello-decode.cpp
@@ -82,7 +82,7 @@ int main(int argc, char *argv[]) {
     cfg[1] = MFXCreateConfig(loader);
     VERIFY(NULL != cfg[1], "MFXCreateConfig failed")
     cfgVal[1].Type     = MFX_VARIANT_TYPE_U32;
-    cfgVal[1].Data.U32 = MFX_CODEC_HEVC;
+    cfgVal[1].Data.U32 = MFX_CODEC_AVC;
     sts                = MFXSetConfigFilterProperty(
         cfg[1],
         (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID",
@@ -113,13 +113,13 @@ int main(int argc, char *argv[]) {
     bitstream.MaxLength = BITSTREAM_BUFFER_SIZE;
     bitstream.Data      = (mfxU8 *)calloc(bitstream.MaxLength, sizeof(mfxU8));
     VERIFY(bitstream.Data, "Not able to allocate input buffer");
-    bitstream.CodecId = MFX_CODEC_HEVC;
+    bitstream.CodecId = MFX_CODEC_AVC;

     // Pre-parse input stream
     sts = ReadEncodedStream(bitstream, source);
     VERIFY(MFX_ERR_NONE == sts, "Error reading bitstream\n");

-    decodeParams.mfx.CodecId = MFX_CODEC_HEVC;
+    decodeParams.mfx.CodecId = MFX_CODEC_AVC;
     decodeParams.IOPattern   = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
     sts                      = MFXVideoDECODE_DecodeHeader(session, &bitstream, &decodeParams);
     VERIFY(MFX_ERR_NONE == sts, "Error decoding header\n");

with the command:

hello-decode -hw -i client_bitstream.h264

Then I'd get the decoded YUV data like:

image

In order to show it correctly, I had to adjust its size with aligned one, but with redundant 8 lines displayed at the bottom:

image

Calling SetCurrentDirectory during MFXEnumImplementations is unsafe

MFXEnumImplementations calls SetCurrentDirectory through LoaderCtxVPL::SearchDirForLibs:
https://github.com/oneapi-src/oneVPL/blob/e12ace9761bb52786409e830f619916b86e87fc5/dispatcher/vpl/mfx_dispatcher_vpl_loader.cpp#L174

Unfortunately, SetCurrentDirectory affects the entire processes, causing other threads to fail if they expect the current directory to remain unchanged. i.e. it's not OK for a library to call this function since it's not reasonable to assume no other threads are running.

Link to oneVPL with CMake

In this step, which CMakeList(in which folder) should I add the following code to?
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_LIBRARY_ARCHITECTURE x86)
endif()
find_package(VPL REQUIRED)
target_link_libraries(${TARGET} VPL::dispatcher)

MFXLoad support in C++ interface is missing

In order to transition to the new recommended oneVPL dispatcher interface users of MFXVideoSession C++ wrapper class should completely rewrite parts of their code. C-interface users only need to replace one or two blocks of code.
Adding extra method(s) wrapping calls to MFXLoad/MFXCreateConfig/... to the mentioned class would smoothen the transition for C++-users.

Typos in output: preffer -> prefer, preffered -> preferred

Code has following typos in its output:

  • preffer -> prefer
  • preffered -> preferred (note 'rr')

See git grep preffer (and e.g. Oxford language dictionary).

PS. while this bug is about user visible output, git grep Preffer shows also typoed variable name.

Fix hardening flags

RELRO options should appear in linker flags.
Preferably in form:

target_link_options(VPL PRIVATE
  LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libVPL.map
  LINKER:--no-undefined,-z,relro,-z,now,-z,noexecstack
  -fstack-protector
  )

sample_encode shouldn`t use VPP if color conversion has been done by FileReader

in case of hardware encoding of I420 input file:
pParams->FileInputFourCC == MFX_FOURCC_I420;
pParams->EncodeFourCC = MFX_FOURCC_NV12;

This conversion will be done in FileReader. But in pipeline_encode.cpp on line 1783 sample will set bVPP flag to "true" and will create VPP instance. In this case VPP will just copy surface without any conversion.

I suggest change condition

if (pParams->nWidth != pParams->nDstWidth || pParams->nHeight != pParams->nDstHeight ||
pParams->FileInputFourCC != pParams->EncodeFourCC)

to

if (pParams->nWidth != pParams->nDstWidth || pParams->nHeight != pParams->nDstHeight ||
m_InputFourCC != pParams->EncodeFourCC)

[ATS-M3]Sample decode should not use vebox

os: ubuntu 20.04
kernel: 5.10.54+prerelease2400
oneVPL: 3470ecd
libva: dad7abcb958b97b50c318dd42a477e035a42e358
ffmpeg: 534c4db1800ebdb1e7dab031a63413d74bab4bf8
gmmlib: 29152fc6d39f87983b176664f225d42af039f716
media-driver: c8decb7f6e8bc1c77f6becdbe7bbe0e1697d62e8

cmd:
./sample_decode h264 -i 1080p60fps.264 -o /dev/null -hw -vaapi
test result:
fps channels vdbox1 vdbox2 vebox
30 60 52.82% 52.23% 100%

The usage rate of vebox should be 0%.

Inability to build dispatcher with X11 disabled

libva: intel/libva@da4a18f
vpl-dispatch:8b69f02

If libva does not enable X11 when compiling the vpl-dispatch, you will encounter a build error.
The configuration I just pulled is the latest one, which I reproduced on TGL.
But it seems that this has nothing to do with the platform

except:vpl-dispatch can build without X11.

The latest version is not uploaded on NuGet

Hi, I checked the manual to install oneVPL, and I am trying it according this doc below.
https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-windows/top/installation/install-using-package-managers/nuget.html

But I noticed the latest version of the package have not been uploaded yet.
https://www.nuget.org/packages/onevpl.devel.win-x64
https://www.nuget.org/packages/onevpl.devel.linux-x64

I assume that NuGet hosting is not maintained frequently.
I would like to know the best way to install the oneVPL package. Should we check out from this repository?

Configuration installing to (prefix)/etc/ when prefix is used

When an install prefix is used (which is typical for installation on Linux), the configuration files wind up in (prefix)/etc . So in the typical case of CMAKE_INSTALL_PREFIX being /usr , we wind up with:

/usr/etc/modulefiles
/usr/etc/modulefiles/vpl
/usr/etc/vpl
/usr/etc/vpl/vars.sh

I don't think this is correct or intended, but I don't know what the 'right' way to fix it would be.

CMake's documented special handling here only covers "(dir) equal to SYSCONFDIR, LOCALSTATEDIR or RUNSTATEDIR". What we do is this:

if(NOT ONEAPI_INSTALL_ENVDIR)
  set(ONEAPI_INSTALL_ENVDIR ${CMAKE_INSTALL_SYSCONFDIR}/${PROJECT_NAME})
endif()

if(NOT ONEAPI_INSTALL_MODFILEDIR)
  set(ONEAPI_INSTALL_MODFILEDIR ${CMAKE_INSTALL_SYSCONFDIR}/modulefiles)
endif()

and then we install things to those directories, e.g.:

  install(
    PROGRAMS vpl
    DESTINATION ${ONEAPI_INSTALL_MODFILEDIR}
    COMPONENT dev)

which, I think, results in cmake expanding ONEAPI_INSTALL_MODFILEDIR , since it's a relative path, and including the prefix, so we wind up with /usr/etc/modulefiles.

I did come up with a bit of an ugly hack, which is to explicitly set ONEAPI_INSTALL_FULL_ENVDIR and ONEAPI_INSTALL_FULL_MODFILEDIR in oneAPIInstallDirs.cmake and then install the files to the _FULL_ paths not the relative ones. But that also requires adding extra stuff in the if(USE_ONEAPI_INSTALL_LAYOUT) branch and just generally feels kinda ugly. This seems like the kind of thing where you'd expect it to be something that's commonly encountered and a solved problem already, but I couldn't find anything for it, weirdly.

Software implementaion of MFXVideoDECODE_DecodeHeader doesn't fill mfxVideoParam structure if bitstream contains only single HEVC I-frame.

I used hello-decvpp openVPL example on some raw hevc-compressed videos from the internet in softaware mode (using -sw command line option) and it worked fine so i proceeded with implementation of my HEVC-decoding application, expecting the software decoder to work well.
I wrote everything like in that hello-decvpp example except that I receive compressed video frames from the internet and put discrete single I-frames in AnnexB bitstream format (skipping P-frames, which i don't need) to the bitstream with next code (executed each I-frame):

mfxBitstream bitstream = {};
bitstream.MaxLength = bitstream.DataLength = myIFrameSizeInBytes;
bitstream.Data = myIFrameData;
bitstream.CodecId = MFX_CODEC_HEVC;

Then I try to read video parameters (like width, height and fourCC) from the I-frame header with:

m_videoParams = {};
m_videoParams.mfx.CodecId = MFX_CODEC_HEVC;
m_videoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
sts = MFXVideoDECODE_DecodeHeader(m_session, pBitstream, &m_videoParams);

I get sts == MFX_ERR_NONE but most of the fields of m_videoParams (like .mfx.FrameInfo.Height, etc.) remain equal zero. I noticed that if i keep the first I-frame in the bitstream and then append the next one, after the second frame arrives and bitstream contains both of them (with MaxLength & DataLength fields = sum of sizes of two frames in bytes), function MFXVideoDECODE_DecodeHeader behaves as expected and fills in the needed fields of mfxVideoParam structure.

I played with it a little bit more and discovered that actualy what is enough is just to append to the bitstream 8 bytes in the end after the single I-frame (as if a next VPS NAL-unit piece resides there):

0x00 0x00 0x00 0x01 0x40 0x01 0x0c 0x01

First I though that maybe the function expects for more than 1 frame to be in the bitstream, but then i discovered that hardware implementation has no such problem and just an I-frame may be passed there in the bitstream (without magical 8 bytes) to get needed video parameters in the mfxVideoParam structure. Also it's strange that i can't extract video parameters from single I-frame with all its SPS,PPS and VPS as those should contain the info.

My software implementation version: 2.2
My hardware implementation version: 1.33 (d3d9+hw)
My CPU: Intel Core I5-7400, drivers updated

LookAheadDepth a valid option for AV1?

A cursory look at the code in the oneVPL-intel-gpu suggests this option should work for AV1. At least there are plenty of references to it in apparent AV1 code.

To test this, I modified sample_encoder.cpp to encode AV1, but as soon as I specify the LookAheadDepth option the sync operation gives error -16 (undefined behaviour).

Without this option, the encode works correctly.

Am I doing something wrong?

I also noticed that both FFmpeg and QSVEnc appear to hang when attempting to use the lookahead depth option.

I am using Windows 11 Pro, latest 3802 driver and latest oneVPL release (2022.2.5).

Here is my modified code, which sets up the extra parameters.

//==============================================================================
// Copyright Intel Corporation
//
// SPDX-License-Identifier: MIT
//==============================================================================

///
/// A minimal oneAPI Video Processing Library (oneVPL) encode application,
/// using 2.x API with internal memory management
///
/// @file

#include "util.h"

#define TARGETKBPS                 4000
#define FRAMERATE                  30
#define OUTPUT_FILE                "out.av1"
#define BITSTREAM_BUFFER_SIZE      2000000
#define MAJOR_API_VERSION_REQUIRED 2
#define MINOR_API_VERSION_REQUIRED 2

void Usage(void) {
    printf("\n");
    printf("   Usage  :  hello-encode\n");
    printf("     -hw        use hardware implementation\n");
    printf("     -sw        use software implementation\n");
    printf("     -i input file name (raw frames)\n");
    printf("     -w input width\n");
    printf("     -h input height\n\n");
    printf("   Example:  hello-encode -i in.i420 -w 320 -h 240\n");
    printf("   To view:  ffplay %s\n\n", OUTPUT_FILE);
    printf(" * Encode raw frames to AV1 elementary stream in %s\n\n", OUTPUT_FILE);
    printf("   CPU native color format is I420/yuv420p.  GPU native color format is "
           "NV12\n");
    return;
}

int main(int argc, char *argv[]) {
    // Variables used for legacy and 2.x
    bool isDraining                = false;
    bool isStillGoing              = true;
    bool isFailed                  = false;
    FILE *sink                     = NULL;
    FILE *source                   = NULL;
    mfxBitstream bitstream         = {};
    mfxFrameSurface1 *encSurfaceIn = NULL;
    mfxSession session             = NULL;
    mfxSyncPoint syncp             = {};
    mfxU32 framenum                = 0;
    mfxStatus sts                  = MFX_ERR_NONE;
    mfxStatus sts_r                = MFX_ERR_NONE;
    Params cliParams               = {};
    mfxVideoParam encodeParams     = {};
    mfxExtCodingOption extc        = {};
    mfxExtCodingOption2 extco2     = {};
    mfxExtCodingOption3 extco3     = {};

    // variables used only in 2.x version
    mfxConfig cfg[3];
    mfxVariant cfgVal[3];
    mfxLoader loader = NULL;

    // Parse command line args to cliParams
    if (ParseArgsAndValidate(argc, argv, &cliParams, PARAMS_ENCODE) == false) {
        Usage();
        return 1; // return 1 as error code
    }

    source = fopen(cliParams.infileName, "rb");
    VERIFY(source, "Could not open input file");

    sink = fopen(OUTPUT_FILE, "wb");
    VERIFY(sink, "Could not create output file");

    // Initialize VPL session
    loader = MFXLoad();
    VERIFY(NULL != loader, "MFXLoad failed -- is implementation in path?");

    // Implementation used must be the type requested from command line
    cfg[0] = MFXCreateConfig(loader);
    VERIFY(NULL != cfg[0], "MFXCreateConfig failed")

    sts =
        MFXSetConfigFilterProperty(cfg[0], (mfxU8 *)"mfxImplDescription.Impl", cliParams.implValue);
    VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for Impl");

    // Implementation must provide an AV1 encoder
    cfg[1] = MFXCreateConfig(loader);
    VERIFY(NULL != cfg[1], "MFXCreateConfig failed")
    cfgVal[1].Type     = MFX_VARIANT_TYPE_U32;
    cfgVal[1].Data.U32 = MFX_CODEC_AV1;
    sts                = MFXSetConfigFilterProperty(
        cfg[1],
        (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID",
        cfgVal[1]);
    VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for encoder CodecID");

    // Implementation used must provide API version 2.2 or newer
    cfg[2] = MFXCreateConfig(loader);
    VERIFY(NULL != cfg[2], "MFXCreateConfig failed")
    cfgVal[2].Type     = MFX_VARIANT_TYPE_U32;
    cfgVal[2].Data.U32 = VPLVERSION(MAJOR_API_VERSION_REQUIRED, MINOR_API_VERSION_REQUIRED);
    sts                = MFXSetConfigFilterProperty(cfg[2],
                                     (mfxU8 *)"mfxImplDescription.ApiVersion.Version",
                                     cfgVal[2]);
    VERIFY(MFX_ERR_NONE == sts, "MFXSetConfigFilterProperty failed for API version");

    sts = MFXCreateSession(loader, 0, &session);
    VERIFY(MFX_ERR_NONE == sts,
           "Cannot create session -- no implementations meet selection criteria");

    // Print info about implementation loaded
    ShowImplementationInfo(loader, 0);

    // Initialize encode parameters
    encodeParams.mfx.CodecId                 = MFX_CODEC_AV1;
    encodeParams.mfx.TargetUsage             = MFX_TARGETUSAGE_BALANCED;
    encodeParams.mfx.TargetKbps              = TARGETKBPS;
    encodeParams.mfx.RateControlMethod       = MFX_RATECONTROL_VBR;
    encodeParams.mfx.FrameInfo.FrameRateExtN = FRAMERATE;
    encodeParams.mfx.FrameInfo.FrameRateExtD = 1;
    if (MFX_IMPL_SOFTWARE == cliParams.impl) {
        encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_I420;
    }
    else {
        encodeParams.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
    }
    encodeParams.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
    encodeParams.mfx.FrameInfo.CropW        = cliParams.srcWidth;
    encodeParams.mfx.FrameInfo.CropH        = cliParams.srcHeight;
    encodeParams.mfx.FrameInfo.Width        = ALIGN16(cliParams.srcWidth);
    encodeParams.mfx.FrameInfo.Height       = ALIGN16(cliParams.srcHeight);

    encodeParams.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;

    // Initialise look ahead
    mfxExtBuffer* extparam[3] = { nullptr };
    encodeParams.ExtParam = extparam;
    encodeParams.NumExtParam = 0;
    extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2;
    extco2.Header.BufferSz = sizeof(extco2);
    extco2.ExtBRC = MFX_CODINGOPTION_ON;
    extco2.LookAheadDepth = 10;
    encodeParams.ExtParam[encodeParams.NumExtParam++] = (mfxExtBuffer*)&extco2;

    // Initialize encoder
    sts = MFXVideoENCODE_Init(session, &encodeParams);
    VERIFY(MFX_ERR_NONE == sts, "Encode init failed");

    // Prepare output bitstream
    bitstream.MaxLength = BITSTREAM_BUFFER_SIZE;
    bitstream.Data      = (mfxU8 *)calloc(bitstream.MaxLength, sizeof(mfxU8));

    printf("Encoding %s -> %s\n", cliParams.infileName, OUTPUT_FILE);

    printf("Input colorspace: ");
    switch (encodeParams.mfx.FrameInfo.FourCC) {
        case MFX_FOURCC_I420: // CPU input
            printf("I420 (aka yuv420p)\n");
            break;
        case MFX_FOURCC_NV12: // GPU input
            printf("NV12\n");
            break;
        default:
            printf("Unsupported color format\n");
            isFailed = true;
            goto end;
            break;
    }

    mfxU64 next_pts = 0;

    while (isStillGoing == true) {
        // Load a new frame if not draining
        if (isDraining == false) {
            sts = MFXMemory_GetSurfaceForEncode(session, &encSurfaceIn);
            VERIFY(MFX_ERR_NONE == sts, "Could not get encode surface");

            sts = ReadRawFrame_InternalMem(encSurfaceIn, source);
            if (sts != MFX_ERR_NONE)
                isDraining = true;
        }

        encSurfaceIn->Data.TimeStamp = next_pts;
        next_pts += 90000 / FRAMERATE;

        sts = MFXVideoENCODE_EncodeFrameAsync(session,
                                              NULL,
                                              (isDraining == true) ? NULL : encSurfaceIn,
                                              &bitstream,
                                              &syncp);

        if (!isDraining) {
            sts_r = encSurfaceIn->FrameInterface->Release(encSurfaceIn);
            VERIFY(MFX_ERR_NONE == sts_r, "mfxFrameSurfaceInterface->Release failed");
        }
        switch (sts) {
            case MFX_ERR_NONE:
                // MFX_ERR_NONE and syncp indicate output is available
                if (syncp) {
                    // Encode output is not available on CPU until sync operation
                    // completes
                    sts = MFXVideoCORE_SyncOperation(session, syncp, WAIT_100_MILLISECONDS);
                    printf("MFXVideoCORE_SyncOperation returned %d\n", sts);
                    VERIFY(MFX_ERR_NONE == sts, "MFXVideoCORE_SyncOperation error");
                    WriteEncodedStream(bitstream, sink);
                    framenum++;
                }
                break;
            case MFX_ERR_NOT_ENOUGH_BUFFER:
                // This example deliberatly uses a large output buffer with immediate
                // write to disk for simplicity. Handle when frame size exceeds
                // available buffer here
                break;
            case MFX_ERR_MORE_DATA:
                // The function requires more data to generate any output
                if (isDraining == true)
                    isStillGoing = false;
                break;
            case MFX_ERR_DEVICE_LOST:
                // For non-CPU implementations,
                // Cleanup if device is lost
                break;
            case MFX_WRN_DEVICE_BUSY:
                // For non-CPU implementations,
                // Wait a few milliseconds then try again
                break;
            default:
                printf("unknown status %d\n", sts);
                isStillGoing = false;
                break;
        }
    }

end:
    printf("Encoded %d frames\n", framenum);

    // Clean up resources - It is recommended to close components first, before
    // releasing allocated surfaces, since some surfaces may still be locked by
    // internal resources.
    if (source)
        fclose(source);

    if (sink)
        fclose(sink);

    MFXVideoENCODE_Close(session);
    MFXClose(session);

    if (bitstream.Data)
        free(bitstream.Data);

    if (loader)
        MFXUnload(loader);

    if (isFailed) {
        return -1;
    }
    else {
        return 0;
    }
}

Can't use GPU decoding

Hi!
I made a program using oneVPL to decode AVC and HEVC streams. While using this program with CPU implementation by initialising the session as follow, it works fine.

ImplValue.Type = MFX_VARIANT_TYPE_U32;
ImplValue.Data.U32 = MFX_IMPL_TYPE_SOFTWARE;
cfg[0] = MFXCreateConfig(loader);
mfxStatus sts = MFXSetConfigFilterProperty(cfg[0], (const mfxU8*)"mfxImplDescription.Impl", ImplValue);

But when I try to use GPU capabilities (ImplValue.Data.U32 = MFX_IMPL_TYPE_HARDWARE;), decoding doesn't work. My IGP is an Iris Plus Graphics 655 and should be handled by oneAPI, and my drivers are up to date.

I tried to use the libraries installed by the oneAPI installer and also tried to compile from source with no result.

I can't figure out what I missed and could use a little help.
Thanks in advance,
Nicolas.

ICQ for AV1 not working

Reference: #79

@oviano helped me find this issue, and can explain it better than I can...

Getting this error while using ICQ:

Error allocating the output packet rate=xxxxkbits/s speed = x.xx Error submitting video frame to the encoder

It looks like neither param.mfx.BufferSizeInKB or param.mfx.BRCParamMultiplier in qsv_retrieve_enc_av1_params get set when the codec is AV1, and are thus still zero

Hardware decoding returns null pointers

When I decode via software everything works as expected. But when I switch over to hardware decoding the data buffers are null. Do you need to pass a work surface rather than null to MFXVideoDECODE_DecodeFrameAsync when decoding via hardware?

Identifier 'StringFromGUID2' not found in dispatcher/windows/mfx_driver_store_loader.cpp

Platform: Windows (same behaviour on 10 and 11)
Build system: VS2022 + CMake
CMake options: BUILD_DISPATCHER_ONLY=ON, BUILD_TESTS=OFF, BUILD_SHARED_LIBS=OFF

When attempting to build the oneVPL dispatcher, I receive the following error:

...\onevpl-src\dispatcher\windows\mfx_driver_store_loader.cpp(71,9): error C3861: 'StringFromGUID2': identifier not found [...\onevpl-build\dispatcher\VPL.vcxproj]

Per the docs, StringFromGUID2 is defined in combaseapi.h, and objbase.h should be included to use it.

Adding a #include <objbase.h> to the top of mfx_driver_store_loader.cpp allows the build to continue.

how to use tracer.exe to dump msdk log messages on Windows

I am using the open source oneVPL dispatcher and the inner-source mdp-msdk-lib to build the runtime. After I downloaded the tracer.exe from msdk official website and pressed the start button, no bytes are written into the log file. Does the runtime that I'm using have to be the msdk runtime in the dev package? I put the libmfx64-gen.dll which I built myself under C:\Windows\System32 and seems that tracer.log doesn't react to it when I run the application to call the runtime.

Wrong chroma loading for NV12 colorspace

CSmplYUVReader::LoadNextFrame(mfxFrameSurface1* pSurface) produce surface with wrong chroma samples for NV12 colorspace.

NV12 is interleaved colorspace so Reader should use the same logic as for P010 colorspace.
Please see the same code in legacy media SDK, Reader works correctly there.

Typos: "implemetation" -> "implementation"

Count & location of these typos (some of them are user visible):

$ git grep -i implemetation | wc
     24     123    2608
$ git grep -il implemetation 
api/vpl/preview/impl_selector.hpp
api/vpl/preview/session.hpp
preview/python/binding/impl_selector.cpp
preview/python/binding/session.cpp
tools/legacy/sample_common/src/vpl_implementation_loader.cpp

[regression][compile] on c33e87261b

c33e872 break build process:

02:10:26,269 INFO  - /opt/media/build/onevpl/tools/cli/system_analyzer/system_analyzer.cpp:22:14: fatal error: va/va.h: No such file or directory
02:10:26,269 INFO  -    22 |     #include "va/va.h"
02:10:26,269 INFO  -       |              ^~~~~~~~~
02:10:26,269 INFO  - compilation terminated.
02:10:26,271 INFO  - make[2]: *** [tools/cli/system_analyzer/CMakeFiles/system_analyzer.dir/build.make:63: tools/cli/system_analyzer/CMakeFiles/system_analyzer.dir/system_analyzer.cpp.o] Error 1
02:10:26,271 INFO  - make[2]: Leaving directory '/opt/media/build/onevpl/__cmake_build'
02:10:26,271 INFO  - make[1]: *** [CMakeFiles/Makefile2:625: tools/cli/system_analyzer/CMakeFiles/system_analyzer.dir/all] Error 2
02:10:26,271 INFO  - make[1]: *** Waiting for unfinished jobs....

root cause:
this part force load from -I/usr/include as build deps, not load form pkgconfig return value: pkg-config --cflags libva: -I/opt/media/install/include
with system side /usr/include installed libva can FIX this, but should support with pkgconfig return flag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.