sync with OpenBSD -current

This commit is contained in:
purplerain 2024-07-20 20:41:33 +00:00
parent b5b25afdb8
commit 2c72e27ed2
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
147 changed files with 41128 additions and 10 deletions

View file

@ -1,5 +1,5 @@
# $OpenBSD: 3RDPARTY,v 1.427 2024/07/11 08:29:54 matthieu Exp $
# $OpenBSD: 3RDPARTY,v 1.429 2024/07/19 19:00:02 matthieu Exp $
#
Package: Freetype
Version: 2.13.0
@ -9,13 +9,13 @@ Archive Site: http://download.savannah.gnu.org/releases/freetype/
Package: xterm
Version: 378
Current Vers: 392
Current Vers: 393
Maintainer: Thomas E. Dickey
Archive Site: http://invisible-island.net/xterm/xterm.html
Package: Mesa
Version 23.3.6
Current Vers: 24.1.2
Current Vers: 24.1.4
Maintainer: Brian Paul
Archive Site: https://archive.mesa3d.org/
@ -37,6 +37,11 @@ Current Vers: 1.5.10
Maintainer: Emmanuele Bassi
Archive Site: https://github.com/anholt/libepoxy/releases
Package: libva
Version: 2.22
Current Vers: 2.22
Archive Site: https://github.com/intel/libva
Package: fontconfig
Version: 2.14.2
Current Vers: 2.15.0

View file

@ -1,4 +1,4 @@
# $OpenBSD: MODULES,v 1.523 2024/07/11 08:29:54 matthieu Exp $
# $OpenBSD: MODULES,v 1.525 2024/07/19 15:12:09 matthieu Exp $
#
# X.Org maintained modules
#
@ -177,7 +177,7 @@ lib/libXxf86dga 1.1.6
lib/libXxf86vm 1.1.5
lib/libfontenc 1.1.8
lib/libpciaccess 0.18.1
lib/libxcb 1.17.0 needs-update
lib/libxcb 1.17.0
lib/libxcvt 0.1.2
lib/libxkbfile 1.1.3
lib/libxshmfence 1.3.2

View file

@ -81,6 +81,40 @@
./usr/X11R6/include/libdrm/via_drm.h
./usr/X11R6/include/libdrm/virtgpu_drm.h
./usr/X11R6/include/libdrm/vmwgfx_drm.h
./usr/X11R6/include/va/va.h
./usr/X11R6/include/va/va_backend.h
./usr/X11R6/include/va/va_backend_glx.h
./usr/X11R6/include/va/va_backend_prot.h
./usr/X11R6/include/va/va_backend_vpp.h
./usr/X11R6/include/va/va_compat.h
./usr/X11R6/include/va/va_dec_av1.h
./usr/X11R6/include/va/va_dec_hevc.h
./usr/X11R6/include/va/va_dec_jpeg.h
./usr/X11R6/include/va/va_dec_vp8.h
./usr/X11R6/include/va/va_dec_vp9.h
./usr/X11R6/include/va/va_dec_vvc.h
./usr/X11R6/include/va/va_dri2.h
./usr/X11R6/include/va/va_dricommon.h
./usr/X11R6/include/va/va_drm.h
./usr/X11R6/include/va/va_drmcommon.h
./usr/X11R6/include/va/va_egl.h
./usr/X11R6/include/va/va_enc_av1.h
./usr/X11R6/include/va/va_enc_h264.h
./usr/X11R6/include/va/va_enc_hevc.h
./usr/X11R6/include/va/va_enc_jpeg.h
./usr/X11R6/include/va/va_enc_mpeg2.h
./usr/X11R6/include/va/va_enc_vp8.h
./usr/X11R6/include/va/va_enc_vp9.h
./usr/X11R6/include/va/va_fei.h
./usr/X11R6/include/va/va_fei_h264.h
./usr/X11R6/include/va/va_fei_hevc.h
./usr/X11R6/include/va/va_glx.h
./usr/X11R6/include/va/va_prot.h
./usr/X11R6/include/va/va_str.h
./usr/X11R6/include/va/va_tpi.h
./usr/X11R6/include/va/va_version.h
./usr/X11R6/include/va/va_vpp.h
./usr/X11R6/include/va/va_x11.h
./usr/X11R6/include/xf86drm.h
./usr/X11R6/include/xf86drmMode.h
./usr/X11R6/include/xorg
@ -281,12 +315,21 @@
./usr/X11R6/lib/libdrm_radeon_p.a
./usr/X11R6/lib/libepoxy.a
./usr/X11R6/lib/libepoxy.so.4.1
./usr/X11R6/lib/libgallium_drv_video.a
./usr/X11R6/lib/libgbm.a
./usr/X11R6/lib/libgbm.so.0.6
./usr/X11R6/lib/libgbm_p.a
./usr/X11R6/lib/libglapi.a
./usr/X11R6/lib/libglapi.so.1.0
./usr/X11R6/lib/libglapi_p.a
./usr/X11R6/lib/libva-drm.la
./usr/X11R6/lib/libva-drm.so.2.22
./usr/X11R6/lib/libva-glx.la
./usr/X11R6/lib/libva-glx.so.2.22
./usr/X11R6/lib/libva-x11.la
./usr/X11R6/lib/libva-x11.so.2.22
./usr/X11R6/lib/libva.la
./usr/X11R6/lib/libva.so.2.22
./usr/X11R6/lib/libvulkan_intel.so
./usr/X11R6/lib/libvulkan_intel_hasvk.so
./usr/X11R6/lib/libvulkan_radeon.so
@ -305,6 +348,10 @@
./usr/X11R6/lib/pkgconfig/libdrm.pc
./usr/X11R6/lib/pkgconfig/libdrm_amdgpu.pc
./usr/X11R6/lib/pkgconfig/libdrm_intel.pc
./usr/X11R6/lib/pkgconfig/libva-drm.pc
./usr/X11R6/lib/pkgconfig/libva-glx.pc
./usr/X11R6/lib/pkgconfig/libva-x11.pc
./usr/X11R6/lib/pkgconfig/libva.pc
./usr/X11R6/lib/pkgconfig/osmesa.pc
./usr/X11R6/lib/pkgconfig/xf86driproto.pc
./usr/X11R6/lib/pkgconfig/xorg-joystick.pc

View file

@ -76,6 +76,40 @@
./usr/X11R6/include/libdrm/via_drm.h
./usr/X11R6/include/libdrm/virtgpu_drm.h
./usr/X11R6/include/libdrm/vmwgfx_drm.h
./usr/X11R6/include/va/va.h
./usr/X11R6/include/va/va_backend.h
./usr/X11R6/include/va/va_backend_glx.h
./usr/X11R6/include/va/va_backend_prot.h
./usr/X11R6/include/va/va_backend_vpp.h
./usr/X11R6/include/va/va_compat.h
./usr/X11R6/include/va/va_dec_av1.h
./usr/X11R6/include/va/va_dec_hevc.h
./usr/X11R6/include/va/va_dec_jpeg.h
./usr/X11R6/include/va/va_dec_vp8.h
./usr/X11R6/include/va/va_dec_vp9.h
./usr/X11R6/include/va/va_dec_vvc.h
./usr/X11R6/include/va/va_dri2.h
./usr/X11R6/include/va/va_dricommon.h
./usr/X11R6/include/va/va_drm.h
./usr/X11R6/include/va/va_drmcommon.h
./usr/X11R6/include/va/va_egl.h
./usr/X11R6/include/va/va_enc_av1.h
./usr/X11R6/include/va/va_enc_h264.h
./usr/X11R6/include/va/va_enc_hevc.h
./usr/X11R6/include/va/va_enc_jpeg.h
./usr/X11R6/include/va/va_enc_mpeg2.h
./usr/X11R6/include/va/va_enc_vp8.h
./usr/X11R6/include/va/va_enc_vp9.h
./usr/X11R6/include/va/va_fei.h
./usr/X11R6/include/va/va_fei_h264.h
./usr/X11R6/include/va/va_fei_hevc.h
./usr/X11R6/include/va/va_glx.h
./usr/X11R6/include/va/va_prot.h
./usr/X11R6/include/va/va_str.h
./usr/X11R6/include/va/va_tpi.h
./usr/X11R6/include/va/va_version.h
./usr/X11R6/include/va/va_vpp.h
./usr/X11R6/include/va/va_x11.h
./usr/X11R6/include/xf86drm.h
./usr/X11R6/include/xf86drmMode.h
./usr/X11R6/include/xorg
@ -269,12 +303,21 @@
./usr/X11R6/lib/libdrm_radeon_p.a
./usr/X11R6/lib/libepoxy.a
./usr/X11R6/lib/libepoxy.so.4.1
./usr/X11R6/lib/libgallium_drv_video.a
./usr/X11R6/lib/libgbm.a
./usr/X11R6/lib/libgbm.so.0.6
./usr/X11R6/lib/libgbm_p.a
./usr/X11R6/lib/libglapi.a
./usr/X11R6/lib/libglapi.so.1.0
./usr/X11R6/lib/libglapi_p.a
./usr/X11R6/lib/libva-drm.la
./usr/X11R6/lib/libva-drm.so.2.22
./usr/X11R6/lib/libva-glx.la
./usr/X11R6/lib/libva-glx.so.2.22
./usr/X11R6/lib/libva-x11.la
./usr/X11R6/lib/libva-x11.so.2.22
./usr/X11R6/lib/libva.la
./usr/X11R6/lib/libva.so.2.22
./usr/X11R6/lib/libvulkan_radeon.so
./usr/X11R6/lib/libxshmfence.a
./usr/X11R6/lib/libxshmfence.la
@ -291,6 +334,10 @@
./usr/X11R6/lib/pkgconfig/libdrm.pc
./usr/X11R6/lib/pkgconfig/libdrm_amdgpu.pc
./usr/X11R6/lib/pkgconfig/libdrm_radeon.pc
./usr/X11R6/lib/pkgconfig/libva-drm.pc
./usr/X11R6/lib/pkgconfig/libva-glx.pc
./usr/X11R6/lib/pkgconfig/libva-x11.pc
./usr/X11R6/lib/pkgconfig/libva.pc
./usr/X11R6/lib/pkgconfig/osmesa.pc
./usr/X11R6/lib/pkgconfig/xf86driproto.pc
./usr/X11R6/lib/pkgconfig/xshmfence.pc

View file

@ -76,6 +76,40 @@
./usr/X11R6/include/libdrm/via_drm.h
./usr/X11R6/include/libdrm/virtgpu_drm.h
./usr/X11R6/include/libdrm/vmwgfx_drm.h
./usr/X11R6/include/va/va.h
./usr/X11R6/include/va/va_backend.h
./usr/X11R6/include/va/va_backend_glx.h
./usr/X11R6/include/va/va_backend_prot.h
./usr/X11R6/include/va/va_backend_vpp.h
./usr/X11R6/include/va/va_compat.h
./usr/X11R6/include/va/va_dec_av1.h
./usr/X11R6/include/va/va_dec_hevc.h
./usr/X11R6/include/va/va_dec_jpeg.h
./usr/X11R6/include/va/va_dec_vp8.h
./usr/X11R6/include/va/va_dec_vp9.h
./usr/X11R6/include/va/va_dec_vvc.h
./usr/X11R6/include/va/va_dri2.h
./usr/X11R6/include/va/va_dricommon.h
./usr/X11R6/include/va/va_drm.h
./usr/X11R6/include/va/va_drmcommon.h
./usr/X11R6/include/va/va_egl.h
./usr/X11R6/include/va/va_enc_av1.h
./usr/X11R6/include/va/va_enc_h264.h
./usr/X11R6/include/va/va_enc_hevc.h
./usr/X11R6/include/va/va_enc_jpeg.h
./usr/X11R6/include/va/va_enc_mpeg2.h
./usr/X11R6/include/va/va_enc_vp8.h
./usr/X11R6/include/va/va_enc_vp9.h
./usr/X11R6/include/va/va_fei.h
./usr/X11R6/include/va/va_fei_h264.h
./usr/X11R6/include/va/va_fei_hevc.h
./usr/X11R6/include/va/va_glx.h
./usr/X11R6/include/va/va_prot.h
./usr/X11R6/include/va/va_str.h
./usr/X11R6/include/va/va_tpi.h
./usr/X11R6/include/va/va_version.h
./usr/X11R6/include/va/va_vpp.h
./usr/X11R6/include/va/va_x11.h
./usr/X11R6/include/xf86drm.h
./usr/X11R6/include/xf86drmMode.h
./usr/X11R6/include/xorg
@ -269,12 +303,21 @@
./usr/X11R6/lib/libdrm_radeon_p.a
./usr/X11R6/lib/libepoxy.a
./usr/X11R6/lib/libepoxy.so.4.1
./usr/X11R6/lib/libgallium_drv_video.a
./usr/X11R6/lib/libgbm.a
./usr/X11R6/lib/libgbm.so.0.6
./usr/X11R6/lib/libgbm_p.a
./usr/X11R6/lib/libglapi.a
./usr/X11R6/lib/libglapi.so.1.0
./usr/X11R6/lib/libglapi_p.a
./usr/X11R6/lib/libva-drm.la
./usr/X11R6/lib/libva-drm.so.2.22
./usr/X11R6/lib/libva-glx.la
./usr/X11R6/lib/libva-glx.so.2.22
./usr/X11R6/lib/libva-x11.la
./usr/X11R6/lib/libva-x11.so.2.22
./usr/X11R6/lib/libva.la
./usr/X11R6/lib/libva.so.2.22
./usr/X11R6/lib/libxshmfence.a
./usr/X11R6/lib/libxshmfence.la
./usr/X11R6/lib/libxshmfence.so.0.0
@ -290,6 +333,10 @@
./usr/X11R6/lib/pkgconfig/libdrm.pc
./usr/X11R6/lib/pkgconfig/libdrm_amdgpu.pc
./usr/X11R6/lib/pkgconfig/libdrm_radeon.pc
./usr/X11R6/lib/pkgconfig/libva-drm.pc
./usr/X11R6/lib/pkgconfig/libva-glx.pc
./usr/X11R6/lib/pkgconfig/libva-x11.pc
./usr/X11R6/lib/pkgconfig/libva.pc
./usr/X11R6/lib/pkgconfig/osmesa.pc
./usr/X11R6/lib/pkgconfig/xf86driproto.pc
./usr/X11R6/lib/pkgconfig/xshmfence.pc

View file

@ -81,6 +81,40 @@
./usr/X11R6/include/libdrm/via_drm.h
./usr/X11R6/include/libdrm/virtgpu_drm.h
./usr/X11R6/include/libdrm/vmwgfx_drm.h
./usr/X11R6/include/va/va.h
./usr/X11R6/include/va/va_backend.h
./usr/X11R6/include/va/va_backend_glx.h
./usr/X11R6/include/va/va_backend_prot.h
./usr/X11R6/include/va/va_backend_vpp.h
./usr/X11R6/include/va/va_compat.h
./usr/X11R6/include/va/va_dec_av1.h
./usr/X11R6/include/va/va_dec_hevc.h
./usr/X11R6/include/va/va_dec_jpeg.h
./usr/X11R6/include/va/va_dec_vp8.h
./usr/X11R6/include/va/va_dec_vp9.h
./usr/X11R6/include/va/va_dec_vvc.h
./usr/X11R6/include/va/va_dri2.h
./usr/X11R6/include/va/va_dricommon.h
./usr/X11R6/include/va/va_drm.h
./usr/X11R6/include/va/va_drmcommon.h
./usr/X11R6/include/va/va_egl.h
./usr/X11R6/include/va/va_enc_av1.h
./usr/X11R6/include/va/va_enc_h264.h
./usr/X11R6/include/va/va_enc_hevc.h
./usr/X11R6/include/va/va_enc_jpeg.h
./usr/X11R6/include/va/va_enc_mpeg2.h
./usr/X11R6/include/va/va_enc_vp8.h
./usr/X11R6/include/va/va_enc_vp9.h
./usr/X11R6/include/va/va_fei.h
./usr/X11R6/include/va/va_fei_h264.h
./usr/X11R6/include/va/va_fei_hevc.h
./usr/X11R6/include/va/va_glx.h
./usr/X11R6/include/va/va_prot.h
./usr/X11R6/include/va/va_str.h
./usr/X11R6/include/va/va_tpi.h
./usr/X11R6/include/va/va_version.h
./usr/X11R6/include/va/va_vpp.h
./usr/X11R6/include/va/va_x11.h
./usr/X11R6/include/xf86drm.h
./usr/X11R6/include/xf86drmMode.h
./usr/X11R6/include/xorg
@ -281,12 +315,21 @@
./usr/X11R6/lib/libdrm_radeon_p.a
./usr/X11R6/lib/libepoxy.a
./usr/X11R6/lib/libepoxy.so.4.1
./usr/X11R6/lib/libgallium_drv_video.a
./usr/X11R6/lib/libgbm.a
./usr/X11R6/lib/libgbm.so.0.6
./usr/X11R6/lib/libgbm_p.a
./usr/X11R6/lib/libglapi.a
./usr/X11R6/lib/libglapi.so.1.0
./usr/X11R6/lib/libglapi_p.a
./usr/X11R6/lib/libva-drm.la
./usr/X11R6/lib/libva-drm.so.2.22
./usr/X11R6/lib/libva-glx.la
./usr/X11R6/lib/libva-glx.so.2.22
./usr/X11R6/lib/libva-x11.la
./usr/X11R6/lib/libva-x11.so.2.22
./usr/X11R6/lib/libva.la
./usr/X11R6/lib/libva.so.2.22
./usr/X11R6/lib/libvulkan_intel.so
./usr/X11R6/lib/libvulkan_intel_hasvk.so
./usr/X11R6/lib/libvulkan_radeon.so
@ -305,6 +348,10 @@
./usr/X11R6/lib/pkgconfig/libdrm.pc
./usr/X11R6/lib/pkgconfig/libdrm_amdgpu.pc
./usr/X11R6/lib/pkgconfig/libdrm_intel.pc
./usr/X11R6/lib/pkgconfig/libva-drm.pc
./usr/X11R6/lib/pkgconfig/libva-glx.pc
./usr/X11R6/lib/pkgconfig/libva-x11.pc
./usr/X11R6/lib/pkgconfig/libva.pc
./usr/X11R6/lib/pkgconfig/osmesa.pc
./usr/X11R6/lib/pkgconfig/xf86driproto.pc
./usr/X11R6/lib/pkgconfig/xorg-joystick.pc

View file

@ -177,6 +177,7 @@
./usr/X11R6/include/pixman-1
./usr/X11R6/include/pixman-1/pixman-version.h
./usr/X11R6/include/pixman-1/pixman.h
./usr/X11R6/include/va
./usr/X11R6/include/vulkan
./usr/X11R6/include/xcb
./usr/X11R6/lib

View file

@ -41,8 +41,10 @@
./usr/X11R6/lib/modules/drivers/openchrome_drv.so
./usr/X11R6/lib/modules/drivers/r128_drv.la
./usr/X11R6/lib/modules/drivers/r128_drv.so
./usr/X11R6/lib/modules/drivers/r600_drv_video.so
./usr/X11R6/lib/modules/drivers/radeon_drv.la
./usr/X11R6/lib/modules/drivers/radeon_drv.so
./usr/X11R6/lib/modules/drivers/radeonsi_drv_video.so
./usr/X11R6/lib/modules/drivers/savage_drv.la
./usr/X11R6/lib/modules/drivers/savage_drv.so
./usr/X11R6/lib/modules/drivers/siliconmotion_drv.la

View file

@ -14,8 +14,10 @@
./usr/X11R6/lib/modules/drivers/ati_drv.so
./usr/X11R6/lib/modules/drivers/modesetting_drv.la
./usr/X11R6/lib/modules/drivers/modesetting_drv.so
./usr/X11R6/lib/modules/drivers/r600_drv_video.so
./usr/X11R6/lib/modules/drivers/radeon_drv.la
./usr/X11R6/lib/modules/drivers/radeon_drv.so
./usr/X11R6/lib/modules/drivers/radeonsi_drv_video.so
./usr/X11R6/lib/modules/drivers/wsfb_drv.la
./usr/X11R6/lib/modules/drivers/wsfb_drv.so
./usr/X11R6/lib/modules/drivers/wsudl_drv.la

View file

@ -43,8 +43,10 @@
./usr/X11R6/lib/modules/drivers/openchrome_drv.so
./usr/X11R6/lib/modules/drivers/r128_drv.la
./usr/X11R6/lib/modules/drivers/r128_drv.so
./usr/X11R6/lib/modules/drivers/r600_drv_video.so
./usr/X11R6/lib/modules/drivers/radeon_drv.la
./usr/X11R6/lib/modules/drivers/radeon_drv.so
./usr/X11R6/lib/modules/drivers/radeonsi_drv_video.so
./usr/X11R6/lib/modules/drivers/savage_drv.la
./usr/X11R6/lib/modules/drivers/savage_drv.so
./usr/X11R6/lib/modules/drivers/siliconmotion_drv.la

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.46 2021/11/11 08:59:43 matthieu Exp $
# $OpenBSD: Makefile,v 1.47 2024/07/19 14:42:33 rsadowski Exp $
.include <bsd.xconf.mk>
@ -51,6 +51,7 @@ SUBDIR+= libxshmfence
.if ${XENOCARA_BUILD_GL:L} == "yes"
SUBDIR+= libdrm
SUBDIR+= libva
SUBDIR+= mesa
SUBDIR+= libGLU libGLw
SUBDIR+= libepoxy

6
lib/libva/.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View file

@ -0,0 +1,38 @@
param(
[Parameter()]
[String]$architecture
)
function EnterDevShellEnv {
param(
[Parameter()]
[String]$arch
)
$vsw = Get-Command 'vswhere'
$VSFfavors = 'Community','Professional','Enterprise','BuildTools' | %{ "Microsoft.VisualStudio.Product.$_" }
$vs = & $vsw.Path -products $VSFfavors -latest -format json | ConvertFrom-Json
$tools_dir = Join-Path $vs.installationPath 'Common7' 'Tools'
# Try the root tools dir
$devshell = Join-Path $tools_dir 'Microsoft.VisualStudio.DevShell.dll'
# Try finding it under vsdevshell
if (!(Test-Path $devshell -Type Leaf)) {
$devshell = Join-Path $tools_dir 'vsdevshell' 'Microsoft.VisualStudio.DevShell.dll'
}
# Fail if didn't find the DevShell library
if (!(Test-Path $devshell -Type Leaf)) {
throw "error: cannot find Microsoft.VisualStudio.DevShell.dll"
}
Import-Module $devshell
Enter-VsDevShell -VsInstanceId $vs.instanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$arch -no_logo"
}
# Enter VsDevShell, capture the environment difference and export it to github env
$env_before = @{}
Get-ChildItem env: | %{ $env_before.Add($_.Name, $_.Value) }
EnterDevShellEnv -arch "$architecture"
$env_after = @{}
Get-ChildItem env: | %{ $env_after.Add($_.Name, $_.Value) }
$env_diff = $env_after.GetEnumerator() | where { -not $env_before.ContainsKey($_.Name) -or $env_before[$_.Name] -ne $_.Value }
$env_diff | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }

30
lib/libva/.github/workflows/docs.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: docs
permissions:
contents: read
on:
push:
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/docs.yml'
pull_request:
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/docs.yml'
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y \
doxygen \
libdrm-dev \
meson
- name: build the docs
run: meson setup _build -D enable_docs=true && meson compile -C _build

23
lib/libva/.github/workflows/freebsd.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: freebsd
permissions:
contents: read
on: [push, pull_request]
jobs:
freebsd:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Install prerequisites and build'
uses: vmactions/freebsd-vm@v1
with:
prepare: |
pkg install -y meson pkgconf libdrm libXext libXfixes wayland
pkg install -y -x '^mesa($|-libs)'
run: |
meson setup _build -D werror=true
meson compile -C _build
meson install -C _build

57
lib/libva/.github/workflows/ghpages.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: Deploy Docs to GitHub
on:
release:
types: [published]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Get latest tag'
run: echo "GIT_LATEST_TAG=$(git tag | grep '^[0-9]\+\.[0-9]\+\?\.[0-9]\+\?$' | sort -V -r | head -n1)" >> $GITHUB_ENV
- name: 'Variables'
run: |
echo $GITHUB_REF_NAME
echo $GIT_LATEST_TAG
- name: 'Install prerequisites'
if: github.ref_name == env.GIT_LATEST_TAG
run: |
sudo apt-get update
sudo apt-get install -y \
libdrm-dev \
doxygen \
meson \
- name: 'Build the Docs'
if: github.ref_name == env.GIT_LATEST_TAG
run: meson setup _build -D enable_docs=true && meson compile -C _build
- name: 'Upload the artifacts'
if: github.ref_name == env.GIT_LATEST_TAG
uses: actions/upload-pages-artifact@v3
with:
path: "_build/doc/html-out"
- name: 'Deploy to GitHub Pages'
if: github.ref_name == env.GIT_LATEST_TAG
id: deployment
uses: actions/deploy-pages@v4

View file

@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
if (( $# != 1 )); then
echo Script requires one argument - the clang version to be installed
exit 1
fi
if ! which $CC >/dev/null 2>&1; then
case $DISTRO in
"ubuntu-22.04") distro_name=jammy;;
"ubuntu-20.04") distro_name=focal;;
*)
echo "Unknown distribution $DISTRO"
exit 1
esac
case $1 in
"14" | "15") llvm_version=$1;;
*)
echo "Unknown llvm version $1"
exit 1
esac
sources="deb [trusted=yes] http://apt.llvm.org/$distro_name/ llvm-toolchain-$distro_name-$llvm_version main"
echo "clang-$llvm_version missed in the image, installing from llvm"
echo "$sources" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang-$llvm_version
fi

18
lib/libva/.github/workflows/style.sh vendored Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
modified_lines=$(git status --short -uno | wc -l)
(( modified_lines == 0 )) && exit 0
echo >&2
echo >&2 "ERROR: Style changes detected"
echo >&2
git diff
echo >&2
echo >&2 "ERROR: Squash the above changes as needed"
echo >&2
exit 1

21
lib/libva/.github/workflows/style.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: style
permissions:
contents: read
on: [push, pull_request]
jobs:
style-check:
runs-on: ubuntu-22.04
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Install prerequisites'
run: |
sudo apt-get update
sudo apt-get install -y \
astyle
- name: 'Check for style changes'
run: ./style_unify && .github/workflows/style.sh

62
lib/libva/.github/workflows/ubuntu.yml vendored Normal file
View file

@ -0,0 +1,62 @@
name: ubuntu
permissions:
contents: read
on: [push, pull_request]
env:
CFLAGS: -Wall -Werror
jobs:
test:
strategy:
matrix:
compiler: [clang-15, gcc]
os: [ubuntu-22.04, ubuntu-20.04]
build: [meson, autotools]
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.compiler }}
DISTRO: ${{ matrix.os }}
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Install toolchain'
if: ${{ (matrix.compiler == 'clang-15') }}
run: .github/workflows/install-clang.sh 15
- name: 'Install prerequisites'
run: |
sudo apt-get update
sudo apt-get install -y \
libdrm-dev \
libegl1-mesa-dev \
libgl1-mesa-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-dri3-dev \
libxext-dev \
libxfixes-dev \
libwayland-dev \
meson
- name: 'Print compiler version'
run: ${{ matrix.compiler }} --version
- name: 'Configure (meson)'
if: ${{ (matrix.build == 'meson') }}
run: meson setup ./builddir --prefix=/usr
- name: 'Build (meson)'
if: ${{ (matrix.build == 'meson') }}
run: meson compile -C ./builddir || ninja -C ./builddir
- name: 'Install (meson)'
if: ${{ (matrix.build == 'meson') }}
run: sudo meson install -C ./builddir
- name: 'Configure (autotools)'
if: ${{ (matrix.build == 'autotools') }}
run: ./autogen.sh --prefix=/usr
- name: 'Build (autotools)'
if: ${{ (matrix.build == 'autotools') }}
run: make
- name: 'Build and Install (autotools)'
if: ${{ (matrix.build == 'autotools') }}
run: sudo make install

77
lib/libva/.github/workflows/windows.yml vendored Normal file
View file

@ -0,0 +1,77 @@
name: windows
permissions:
contents: read
on: [push, pull_request]
jobs:
windows-msvc:
runs-on: windows-2022
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup Python'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: 'Install Meson'
run: pip install meson
- name: 'Enter DevShell'
run: '.github\workflows\EnterDevShell.ps1 ${{ inputs.architecture }}'
shell: pwsh
- name: 'Configure with meson'
run: meson setup _build -D werror=true
- name: 'Build'
run: meson compile -C _build
- name: 'Install'
run: meson install -C _build
windows-msvc-debug:
runs-on: windows-2022
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup Python'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: 'Install Meson'
run: pip install meson
- name: 'Enter DevShell'
run: '.github\workflows\EnterDevShell.ps1 ${{ inputs.architecture }}'
shell: pwsh
- name: 'Configure with meson'
run: meson setup _build -D werror=true -D buildtype=debug
- name: 'Build'
run: meson compile -C _build
- name: 'Install'
run: meson install -C _build
windows-mingw:
runs-on: windows-2022
env:
CC: gcc
defaults:
run:
shell: msys2 {0}
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: false
pacboy: >-
toolchain:p
meson:p
- name: 'Enter DevShell'
run: '.github\workflows\EnterDevShell.ps1 ${{ inputs.architecture }}'
shell: pwsh
- name: 'Configure'
run: meson setup _build -D werror=true
- name: 'Build'
run: meson compile -C _build
- name: 'Install'
run: meson install -C _build

35
lib/libva/.gitignore vendored Normal file
View file

@ -0,0 +1,35 @@
*~
*.o
*.lo
*.la
*.orig
*.rej
*.loT
*.bin
*.pc
.deps
.libs
Makefile
Makefile.in
TAGS
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
/m4
missing
stamp-h1
/va/va_version.h
/va/wayland/wayland-drm-client-protocol.*
/doc/Doxyfile
/doc/html-out

4
lib/libva/Android.mk Normal file
View file

@ -0,0 +1,4 @@
# Recursive call sub-folder Android.mk
#
include $(call all-subdir-makefiles)

86
lib/libva/CONTRIBUTING.md Normal file
View file

@ -0,0 +1,86 @@
# Contributing to libva
Libva is an open source project licensed under the [MIT License](https://opensource.org/licenses/MIT)
## Coding Style
Libva does not have a defined coding style at this time, but that will be updated.
## Certificate of Origin
In order to get a clear contribution chain of trust we use the [signed-off-by language](https://01.org/community/signed-process)
used by the Linux kernel project.
## Patch format
Beside the signed-off-by footer, we expect each patch to comply with the following format:
```
<component>: Change summary
More detailed explanation of your changes: Why and how.
Wrap it to 72 characters.
See [here](http://chris.beams.io/posts/git-commit/)
for some more good advices.
Signed-off-by: <contributor@foo.com>
```
For example:
```
drm: remove va_drm_is_authenticated check
If we do not use a render node we must authenticate. Doing the extra
GetClient calls/ioctls does not help much, so don't bother.
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
```
## Pull requests
We accept github pull requests.
Once you've finished making your changes push them to your fork and send the PR via the github UI.
## Reporting a security issue
Please refer to [security.md](security.md) file for details.
## Public issue tracking
If you have a problem, please let us know. IRC is a perfectly fine place
to quickly informally bring something up, if you get a response. The
[mailing list](https://lists.01.org/postorius/lists/intel-vaapi-media.lists.01.org)
is a more durable communication channel.
If it's a bug not already documented, by all means please [open an
issue in github](https://github.com/intel/libva/issues/new) so we all get visibility
to the problem and can work towards a resolution.
For feature requests we're also using github issues, with the label
"enhancement".
Our github bug/enhancement backlog and work queue are tracked in a
[Libva waffle.io kanban](https://waffle.io/intel/libva).
## Closing issues
You can either close issues manually by adding the fixing commit SHA1 to the issue
comments or by adding the `Fixes` keyword to your commit message:
```
ssntp: test: Add Disconnection role checking tests
We check that we get the right role from the disconnection
notifier.
Fixes #121
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
```
Github will then automatically close that issue when parsing the
[commit message](https://help.github.com/articles/closing-issues-via-commit-messages/).

19
lib/libva/COPYING Normal file
View file

@ -0,0 +1,19 @@
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

32
lib/libva/Makefile.am Normal file
View file

@ -0,0 +1,32 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = va pkgconfig
if ENABLE_DOCS
SUBDIRS += doc
endif
EXTRA_DIST=doc/va_footer.html meson.build meson_options.txt
MAINTAINERCLEANFILES=

View file

@ -0,0 +1,12 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.1 2024/07/19 14:35:16 rsadowski Exp $
SHARED_LIBS += va-drm 2.22
SHARED_LIBS += va-glx 2.22
SHARED_LIBS += va-x11 2.22
SHARED_LIBS += va 2.22
CONFIGURE_ARGS= --disable-wayland
CONFIGURE_ARGS+= \
--with-drivers-path=${DESTDIR}${X11BASE}/lib/modules/drivers/
.include <bsd.xorg.mk>

567
lib/libva/NEWS Normal file
View file

@ -0,0 +1,567 @@
libva NEWS -- summary of user visible changes. 2024-06-20
Copyright (C) 2009-2024 Intel Corporation
version 2.22.0 - 20.Jun.2024
* va:Add VVC decode LibVA interface.
* va: fix --version-script detection for lld >= 17
* wayland: add support for linux-dmabuf
* meson:remove autogen.sh from the meson script
* trace: Add bit_depth capturing in trace log
version 2.21.0 - 12.Mar.2024
* va: Add allow_content_tools and force_intger_mv to AV1 enc
* va: add VASurfaceAttribAlignmentSize
* va: Re-add drm_state and fd checks to VA_DRM_GetDriverNames
* va: export symbol vaGetLibFunc for Windows
* va: Add PRIME3 defination and correct the value
* va: add driver name map for new intel KMD xe
* va: export symbol vaMapBuffer2 for Windows
* va: add new interface vaMapBuffer2 for map operation optimization
* va: Add VAConfigAttribEncMaxTileRows and VAConfigAttribEncMaxTileCols
* va: fix handling when all wayland backends fail
* va_trace:add return value trace for vaPutSurfaces
* ci: harden permissions for all github workflows
* ci: update to vmactions/freebsd-vm from v0 to v1
* ci: windows.yml: Add windows-msvc-debug
* meson: create dist archives suitable for building with configure, too
* autogen.sh: successfully detect if the autoreconf program is installed
* build(deps): bump actions/upload-pages-artifact from 2 to 3
* build(deps): bump actions/deploy-pages from 3 to 4
* build(deps): bump actions/setup-python from 4 to 5
* build(deps): bump actions/deploy-pages from 2 to 3
* win32: Fix debug build break
version 2.20.0 - 14.Sep.2023
* va: drop no longer applicable vaGetDriverNames check
* va: remove unreachable "DRIVER BUG"
* x11/dri2: limit the array handling to avoid out of range access
* va/backend: document the vaGetDriver* APIs
* va/backend: annotate vafool as deprecated
* win32: remove duplicate adapter_luid entry
* va: Added Q416 fourcc (three-plane 16-bit YUV 4:4:4)
* trace: fix minor issue about printf data type and value range
* jpeg: add support for crop and partial decode
* trace: Unlock mutex before return
* trace: Add trace for vaExportSurfaceHandle
* av1: Revise offsets comments for av1 encode
* va: Add new VADecodeErrorType to indicate the reset happended in the driver.
* drm: limit the array size to avoid out of range
* va: fix:set driver number to be zero if vaGetDriverNames failed
* va: fix:don't leak driver names, when override is set
* win32: Only print win32 driver messages in DEBUG builds
* va: Add vendor string on va_TraceInitialize
* va: remove legacy code paths
* drm: remove no longer used helpers
* x11: remove legacy code paths
* x11: allow disabling DRI3 via LIBVA_DRI3_DISABLE env var
* x11: implement vaGetDriverNames
* va/x11/va_nvctrl: remove some dead code
* va/x11/va_fglrx: remove some dead code
* va: optimize code of getting driver name for all protocols/os(wayland,x11,drm,win32,android)
version 2.19.0 - 04.Jul.2023
* docs: fix references and descriptions snf focyhrn mstkup
* ci: add build docs test
* win: change default driver search path to bindir
* win: rely on compiler to define link names
* add: Add mono_chrome to VAEncSequenceParameterBufferAV1
* add: Enable support for license acquisition of multiple protected playbacks
* fix: year for version 2.18.0 in NEWS
* fix: use secure_getenv instead of getenv
* trace: Improve and add VA trace log for AV1 encode
* trace: Unify va log message, replace va_TracePrint with va_TraceMsg.
version 2.18.0 - 19.Mar.2023
* doc: Add build and install libva informatio in home page.
* fix: NULL check before calling strncmp.
* ci: add dependabot
* va: fix the codying style of CHECK_DISPLAY
* va: remove dummy isValid() hook
* x11: use LIBVA_DRI3_DISABLE in GetNumCandidates
* win: compat_win32: Add getenv wrapper for WIN32
* win(WSL): va_drm_utils: Map d3d12 gallium driver for Windows Subsytem for Linux
* fix: Add libva.def into distribution package
* x11: allow disabling DRI3 via LIBVA_DRI3_DISABLe env var
* ci: enable Werror across the build
* win: explicitly ignore CloseAdapter return value
* win: use wide string literal where needed
* win: Add vaDisplayIsValid to .def export list
* va: Always build with va-messaging API
* meson: docs: use libva_version over project_version()
* ci: add github pages workflow
* meson: docs: add encoder interface for av1
* va: add VAProfileH264High10
* fix: Remove reference to non-existent symbol
* va: va/sysdeps.h: remove Android section
* va: remove Android pre Jelly Bean workarounds
* va: remove unused drm_sarea.h include & ANDROID references in va_dricommon.h
version 2.17.0 - 16.Dec.2022
* win: Simplify signature for driver name loading
* win: Rewrite driver registry query and fix some bugs/leaks/inefficiencies
* win: Add missing null check after calloc
* va: Update security disclaimer
* ci: drop paths-ignore in github workflow
* dep:remove the file .cvsignore
* ci: install-clang.sh: install the requested version
* ci: freebsd: add pretty(ier) step names
* ci: freebsd: use meson setup and meson install
* ci: ubuntu: add pretty(ier) step names
* ci: polish the windows/meson invocations
* ci: style: use prettier formatting
* pkgconfig: add 'with-legacy' for emgd, nvctrl and fglrx
* meson: add 'with-legacy' for emgd, nvctrl and fglrx
* x11: move all FGLRX code to va_fglrx.c
* x11: move all NVCTRL code to va_nvctrl.c
* meson: stop using deprecated meson.source_root()
* meson: stop using configure_file copy=true
* va: correctly include the win32 (local) headers
* ci: add style check/unify job
* win: clean-up the coding style
* va: dos2unix all the files
* ci: add meson permutation in the Ubuntu builds
* ci: remove unused make check
* drm: remove unnecessary dri2 version/extension query
* ci: use matrix, add ubuntu 20.04 + clang-15
* trace: annotate internal functions with DLL_HIDDEN
* build/sysdeps: Remove HAVE_GNUC_VISIBILITY_ATTRIBUTE and use _GNUC_ support level attribute instead
* meson: Check support for -Wl,-version-script and build link_args accordingly
* ci: switch python action from @v2 to @v4
* ci: dos2unix for windows workflow files
* ci: switch checkout action from @v2 to @v3
* meson: Set va_win32 soversion to '' and remove the install_data rename
* fix: resouce check null
* ci: Add msvc/mingw Windows CI
* va_trace: Add Win32 memory types in va_TraceSurfaceAttributes
* va_trace: va_TraceSurfaceAttributes should check the VASurfaceAttribMemoryType
* va: Adds Win32 Node and Windows build support
* va: Adds compat_win32 abstraction for Windows build and prepares va common code for windows build
* pkgconfig: Add Win32 package for when WITH_WIN32 is enabled
* meson: Add with_win32 option, makes libdrm non-mandatory on Win
* ci(va_win): add libx11-xcb-dev libxcb-dri3-dev to trigger X11 backend build
* x11: add basic DRI3 support
* drm: remove VA_DRM_IsRenderNodeFd() helper
* drm: add radeon drm + radeonsi mesa combo
version 2.16.0 - 27.Sep.2022
* add: Add HierarchicalFlag & hierarchical_level_plus1 for AV1e.
* dep: Update README.md to remove badge links
* dep: Removed waffle-io badge from README to fix broken link
* dep: Drop mailing list, IRC and Slack
* autotools: use wayland-scanner private-code
* autotools: use the wayland-scanner.pc to locate the prog
* meson: use wayland-scanner private-code
* meson: request native wayland-scanner
* meson: use the wayland-scanner.pc to locate the prog
* meson: set HAVE_VA_X11 when applicable
* style:Correct slight coding style in several new commits
* trace: add Linux ftrace mode for va trace
* trace: Add missing pthread_mutex_destroy
* drm: remove no-longer needed X == X mappings
* drm: fallback to drm driver name == va driver name
* drm: simplify the mapping table
* x11: simplify the mapping table
* android: open() with O_CLOEXEC for device fd
* android: remove convoluted open_device() helper
* android: drop va_fool references
* ci: strengthen ci with -Werror
* ci: va/x11/nvctl: fix Wdeprecated-non-prototype on close_display
* ci: add clang-15 coverage and rearrange runners
* ci: upgrade FreeBSD to 13.1
version 2.15.0 - 28.Jun.2022
* Add: new display HW attribute to report PCI ID
* Add: sample depth related parameters for AV1e
* Add: refresh_frame_flags for AV1e
* Add: missing fields in va_TraceVAEncSequenceParameterBufferHEVC.
* Add: nvidia-drm to the drm driver map
* Add: type and buffer for delta qp per block
* Deprecation: remove the va_fool support
* Fix:Correct the version of meson build on master branch
* Fix:X11 DRI2: check if device is a render node
* Build:Use also strong stack protection if supported
* Trace:print the string for profile/entrypoint/configattrib
version 2.14.0 - 16.Feb.2022
* add: Add av1 encode interfaces
* add: VA/X11 VAAPI driver mapping for crocus DRI driver
* doc: Add description of the fd management for surface importing
* ci: fix freebsd build
* meson: Copy public headers to build directory to support subproject
version 2.13.0 - 16.Sep.2021
* fix:Check the function pointer before using
* code style:unify the code styles using the style_unify script
* doc:Fix av1 dec doc page link issue
* add:(sep_layer) add new surface format fourcc XYUV
version 2.12.0 - 17.Jun.2021
* add: Report the capability of vaCopy support
* add: Report the capability of sub device
* add: Add config attributes to advertise HEVC/H.265 encoder features
* add: Video processing HVS Denoise: Added 4 modes
* add: Introduce VASurfaceAttribDRMFormatModifiers
* add: Add 3DLUT Filter in Video Processing.
* doc: Update log2_tile_column description for vp9enc
* trace: Correct av1 film grain trace information
* ci: Fix freebsd build by switching to vmactions/freebsd-vm@v0.1.3
version 2.11.0 - 23.Mar.2021
* add: LibVA Protected Content API
* add: Add a configuration attribute to advertise AV1d LST feature
* fix: wayland: don't try to authenticate with render nodes
* autotools: use shell grouping instead of sed to prepend a line
* trace: Add details data dump for mpeg2 IQ matrix.
* doc: update docs for VASurfaceAttribPixelFormat
* doc: Libva documentation edit for AV1 reference frames
* doc: Modify AV1 frame_width_minus1 and frame_height_minus1 comment
* doc: Remove tile_rows and tile_cols restriction to match AV1 spec
* doc: Format code for doxygen output
* doc: AV1 decode documentation edit for superres_scale_denominator
* ci: upgrade FreeBSD to 12.2
* ci: disable travis build
* ci: update cache before attempting to install packages
* ci: avoid running workloads on other workloads changes
* ci: enable github actions
version 2.10.0 - 04.Dec.2020
* add: Pass offset and size of pred_weight_table
* add: add vaCopy interface to copy surface and buffer
* add: add definition for different execution
* add: New parameters for transport controlled BRC were added
* add: add FreeBSD support
* add: add a bufer type to adjust context priority dynamically
* fix: correct the api version in meson.build
* fix: remove deprecated variable from va_trace.c
* fix: Use va_deprecated for the deprecate variable
* fix: Mark chroma_sample_position as deprecated
* doc: va_dec_av1: clarifies CDEF syntax element packing
* doc: [AV1] Update documented ranges for loop filter and quantization params.
* doc: Update va.h for multi-threaded usages
* trace: va/va_trace: ignore system gettid() on Linux
version 2.9.0 - 11.Sep.2020
* trace: Refine the va_TraceVAPictureParameterBufferAV1.
* doc: Add comments for backward/forward reference to avoid confusion
* doc: Modify comments in av1 decoder interfaces
* doc: Update mailing list
* Add SCC fields trace for HEVC SCC encoding.
* Add FOURCC code for Y212 and Y412 format.
* Add interpolation method for scaling.
* add attributes for context priority setting
* Add vaSyncBuffer for output buffers synchronization
* Add vaSyncSurface2 with timeout
version 2.8.0 - 18.Jun.2020
* trace: enable return value trace for successful function call
* trace: divide va_TraceEndPicture to two seperate function
* trace: add support for VAProfileHEVCSccMain444_10
* fix:Fixes file descriptor leak
* add fourcc code for P012 format
* travis: Add a test that code files don't have the exec bit set
* Remove the execute bit from all source code files
* meson: Allow for libdir and includedir to be absolute paths
* trace: Fix format string warnings
* fix:Fix clang warning (reading garbage)
* add definition to enforce both reflist not empty
* trace: List correct field names in va_TraceVAPictureParameterBufferHEVC
* change the return value to be UNIMPLEMENTED when the function pointer is NULL
* remove check of vaPutSurface implementation
* Add new slice structure flag for CAPS reporting
* VA/X11: VAAPI driver mapping for iris DRI driver
* VA/X11: enable driver candidate selection for DRI2
* Add SCC flags to enable/disable features
* fix: Fix HDR10 MaxCLL and MaxFALL documentation
* Add VAProfileHEVCSccMain444_10 for HEVC
* change the compatible list to be dynamic one
* trace:Convert VAProfileAV1Profile0 VAProfileAV1Profile1 to string
version 2.7.0 - 26.Mar.2020
* trace: av1 decode buffers trace
* trace: Add HEVC REXT and SCC trace for decoding.
* Add av1 decode interfaces
* Fix crashes on system without supported hardware by PR #369.
* Add 2 FourCC for 10bit RGB(without Alpha) format: X2R10G10B10 and X2B10G10R10.
* Fix android build issue #365 and remove some trailing whitespace
* Adjust call sequence to ensure authenticate operation is executed to fix #355
version 2.6.0 - 15.Dec.2019
* enable the mutiple driver selection logic and enable it for DRM.
* drm: Add iHD to driver_name_map
* Add missed slice parameter 'slice_data_num_emu_prevn_bytes'
* ensure that all meson files are part of the release tarball
* configure: use correct comparison operator
* trace: support VAConfigAttribMultipleFrame in trace
* remove incorrect field of VAConfigAttribValDecJPEG
* va/va_trace: Dump VP9 parameters for profile 1~3
* add multiple frame capability report
* add variable to indicate layer infromation
* trace: fix memory leak on closing the trace
* add prediction direction caps report
* Add comments for colour primaries and transfer characteristics in VAProcColorProperties
version 2.5.0 - 05.Jul.2019
* Correct the comment of color_range.
* Add VA_FOURCC_A2B10G10R10 for format a2b10g10r10.
* Adjust VAEncMiscParameterQuantization structure to be align with VAEncMiscParameterBuffer(possible to impact BC)
* Add attribute for max frame size
* Add va_footer.html into distribution build
* va_trace: hevc profiles added
* Add new definition for input/output surface flag
* va/va_trace: add trace support for VAEncMiscParameterTypeSkipFrame structure.
* va/va_trace: add MPEG2 trace support for MiscParam and SequenceParam
* va_openDriver: check strdup return value
* Mark some duplicated field as deprecated
* Add return value into logs
* va/va_trace: add trace support for VAEncMiscParameterEncQuality structure.
* Add newformat foucc defination
* va_backend: remove unneeded linux/videodev2.h include
* va_trace: add missing <sys/time.h> include
* configure: don't build glx if VA/X11 isn't built
* va/va_trace: unbreak with C89 after b3694671c784
* [common] Add A2RGB10 fourcc definition
* build: meson: enables va messaging and visibility
* va/va_trace: add trace support for RIR(rolling intra refresh).
* va/va_trace: add trace support for ROI(region of interest).
version 2.4.0 - 25.Jan.2019
* va_TraceSurface support for VA_FOURCC_P010
* Add pointer to struct wl_interface for driver to use
* (integrate) va: fix new line symbol in error message
* av: avoid driver path truncation
* Fix compilation warning (uninit and wrong variable types) for Android O MR1
* Allow import of the DRM PRIME 2 memory type
* android: ignore unimportant compile warnnings
* compile: fix sign/unsign compare in va_trace.c
* android: replace utils/Log.h with log/log.h
* High Dynamic Range Tone Mapping: Add a new filter for input metadata and some comments.
* Remove restrictions on vaSetDriverName()
version 2.3.0 - 30.Sep.2018
* Bump VA-API version to 1.3.0 and libva to 2.3.0
* Add max frame size parameters for multiple pass case in legacy mode
* Add new BRC mode AVBR
* Add new interface for High Dynamic Range tone mapping
* Add missing enum to string conversions
* Add hevc subsets parameters structure
* Add Customized Noise Reduction (HVS) interfaces
* Add new BRC mode definition QVBR
* Add more complete colour properties for use in VPP
Version 2.2.0 - 12.July.2018
* Bump VA-API version to 1.2.0 and libva to 2.2.0
* Add support for hevc range extension decoding
* Add support for fast intra prediction in HEVC FEI
* Add 10/12-bit YUV render target formats
* Add fourcc code for Y210/Y216/Y410/Y416/RGB565/BGR565
* Add VA_STATUS_ERROR_NOT_ENOUGH_BUFFER
* Add VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT
* Improve documentation
Version 2.1.0 - 12.Feb.2018
* Bump VA-API version to 1.1.0 and libva to 2.1.0
* Add API for multi-frame processing
* Add entrypoint VAEntrypointStats for Statistics
* Add data structures for HEVC FEI support
* Add new attributes for decoding/encoding/video processing
* Add new VPP filter for Total Color Correction
* Add blending interface in VPP
* Add rotation interface in VPP
* Add mirroring interface in VPP
* Add Chroma siting flags in VPP
* Add new color standard definitions
* Add new interface for exporting surface
* Add message callbacks for drivers to use
Version 2.0.0 - 21.Oct.2017
* Bump VA-API version to 1.0.0 and libva to 2.0.0
* Add new API for H264 FEI support
* Add definition of VA_FOURCC_I420
* Add functions for converting common enums to strings
* Deprecate H.264 baseline profile and FMO support
* Deprecate packed misc packed header flag
* Delete libva-tpi and libva-egl backends
* Refine VASliceParameterBufferHEVC, VAEncMiscParameterBuffer
* Fix errors in VAConfigAttribValEncROI, VAEncMacroblockParameterBufferH264
* Fix race condition in wayland support
* Rename vaMessageCallback to VAMessageCallback
* Make logging callbacks library-safe
Version 1.8.3 - 28.Jun.2017
* Bump libva to 1.8.3
* Fix build issue on Android
* Remove the dummy driver
* Add traces for MB rate control / temporal layer
* Set verbosity level between {0, 1, 2} by setting the variable LIBVA_MESSAGING_LEVEL
in /etc/libva.conf or by setting the environment variable LIBVA_MESSAGING_LEVEL.
Version 1.8.2 - 22.May.2017
* Bump libva to 1.8.2
Version 1.8.1 - 10.Apr.2017
* Bump libva to 1.8.1
Version 1.8.0 - 31.March.2017
* Bump VA API version to 0.40
* API: Change vaRenderPicture semantics that vaRenderPicture no longer deletes the passed buffer automatically.
* API: Add VA_FOURCC_I010 for 10bit surface
* API: Add vaSetErrorCallback and vaSetInfoCallback for error and info message.
* va/drm: Update the support for Mesa Gallium driver
* va/drm: Fix authentication check for /dev/dri/card0
* Move all utilities and tests to libva-utils (https://github.com/01org/libva-utils)
Version 1.7.3 - DD.Nov.2016
* Bump VA API version to 0.39.4
* API: add support for bitrate control per temporal layer
* API: update the usage for framerate in VAEncMiscParameterFrameRate to support non-integer frame-rate
* Add has_prime_sharing flag in VADriverVTableWayland to indicate if buffer sharing with prime fd can
be used in the backend driver
Version 1.7.2 - 05.Sep.2016
* Bump VA API version to 0.39.3
* API: add support for ROI
* Add support for VP9 encoder in VA tracer
* Refine test cases
* Fix the issue of not properly terminating the parsed environment values with '\0'
https://bugs.freedesktop.org/show_bug.cgi?id=96677
Version 1.7.1 - 21.Jun.2016
* Bump VA API version to 0.39.2
* API: add support for VP9 8bit encode
* API: add support for low power/high performance encode
* API: add support for encoding ROI attribute
* API: add support for macroblock based rate control
* Fix VA tracer to support multiple contexts in one instance
Version 1.7.0 - 15.Mar.2016
* Bump VA API version to 0.39
* Add support for VP9 10bit decode API
* Allow libva to load the vaapi driver provided by Mesa Gallium for nouveau and radeon
* Fix libva-glx against OpenGL 3.1 or above
Version 1.6.2 - 15.Dec.2015
* Bump VA API version to 0.38.1
* Add new RT format for 16 bits per channel memory layout(P010,P016): VA_RT_FORMAT_YUV420_10BPP
* Add new fourcc codes: VA_FOURCC_P010, VA_FOURCC_P016, VA_FOURCC_YV16
* Fix crash if user doesn't have right to access the DRI device
* Fix uninitialized x11_screen driver context member for X11 output
https://bugs.freedesktop.org/show_bug.cgi?id=61603
* Fix the issue of not to use LIBVA_DRIVER_NAME
https://bugs.freedesktop.org/show_bug.cgi?id=72822
* Fix build issue with wayland
https://bugs.freedesktop.org/show_bug.cgi?id=79478
* vainfo: Add option '--display'
Version 1.6.1 - 09.Sep.2015
* Add support for VP9 decode and HEVC encode in VA trace module
* Add VP9 profile to vainfo
* Enhance VA trace to dump VP8 encode parameters
Version 1.6.0 - 01.Jul.2015
* Bump VA API version to 0.38
* Add support for HEVC encode API
* Add support for VP9 decode API
* Add API (vaSetDriverName()) to allow the user to specify the loaded backend driver
* Add VAConfigAttribEncSkipFrame and corresponding structures to support
sending skip frame parameters to the backend driver.
* Add support for querying slice decoding mode supported by the backend driver
* Fix quality issue in the JPEG encode demo
Version 1.5.1 - DD.Mar.2015
* API: correct the comment for num_token_partitions in struct _VAEncPictureParameterBufferVP8
* VA/x11: fix double Unlocks/SyncHandle to avoid segmentation fault
Version 1.5.0 - 28.Dec.2014
* API: add support for HEVC decoding
* API: extend JPEG encoding data structures and add configuration attribute for JPEG encoding
* Add a unit test for JPEG encoding (Sirisha Muppavarapu)
* Add support for HEVC decoding and JPEG encoding in VA trace utility
* Fix out of tree builds (Emil Velikov)
* VA/X11: fix BadDrawable issue when calling vaTerminate() after the pixmaps have been destroyed (Lionel Landwerlin)
Version 1.4.1 - 24.Oct.2014
* Add support for DRM Render-Nodes (Andrey Larionov)
Version 1.4.0 - 30.Sep.2014
* API: add support for VP8 encoding
* API: add H.264 MVC profiles for decoding and encoding
* API: add buffer export interfaces for interop with 3rdparty APIs (EGL, OCL)
* API: add suppor for encoder quality level
* API: add attribute usage hint flag
* Fix build on 64-bit versions of Android (Qiming Shi)
* Assorted fixes to the VA fool and trace modules (Austin Yuan)
Version 1.3.1 - 09.May.2014
* API: fix VA_ENC_PACKED_HEADER_RAW_DATA value
* API: add STE filter to the VPP pipeline
* Update doxygen tags in libva
* Fix doc/Makefile.am
* A workaround for https://bugs.freedesktop.org/show_bug.cgi?id=76755
Version 1.3.0 - 24.Mar.2014
* API: add support for VP8 decoding
* API: drop VAEntrypointMax enumeration
* Enhancement for VA trace utility
Version 1.2.1 - 27.Jun.2013
* Fix https://bugs.freedesktop.org/show_bug.cgi?id=66221
* Add back VA_DRIVER_INIT_FUNC definition for testing
Version 1.2.0 - 25.Jun.2013
* API: new H.264 encoding API for Main and High profiles
* API: add support for MPEG-2 encoding
* API: add video processing interfaces
* API: add vaQuerySurfaceAttributes() to query surface attributes supported by the underlying drivers.
* API: new version of vaCreateSurfaces()
* API: add new surface attributes to enable VA surface creation from external buffer
* API: add new RT formats and fourcc codes
* Refine VA trace utility
* Refine H.264 encoding test cases {avcenc, h264enc}
* A new test case for MPEG-2 encoding
* A lot of bug fixes
Version 1.1.1 - 19.Mar.2013
* Support wayland 1.0 protocol (Rob Bradford)
* Automake 1.13 fixups (Armin K)
Version 1.1.0 - 04.Oct.2012
* API: add Wayland support
* API: add raw DRM support for headless pipelines
* Fix generic VA/GLX implementation for newer cluttersink versions
* Fix threading issues in VA objects reference code (+Krzysztof Kotlenga)
* Fix build on Android Ice Cream Sandwich (+Haitao Huang, Daniel Charles)
Version 1.0.16 - 02.Aug.2012
* API: data structures for JPEG Baseline decoding
* API: clarify the definition of slice_data_bit_offset
* Add a simple test case for JPEG decoding
Version 1.0.15 - 28.Oct.2011
* API: make {Top,Bottom}FieldOrderCnt signed (Yi Wang)
* Add auto-generated Debian packaging
* Refine VA trace & VA fool utilities
* Move i965 driver to a specific repository (vaapi/intel-driver)
* Fix DSO link issue in tests
* Fix fglrx driver name detection
* Fix API vs. DSO vs. package versioning
Version 1.0.14 - 28.Jul.2011
* API: rename VA_DECODE_ERROR_TYPE to VADecodeErrorType
* Fix memory leaks (Edgar Hucek)
* Fix VA trace logs (Alexander Osin)
* Fix vaTerminate() with some applications, e.g. GStreamer
Version 1.0.13 - 30.May.2011
* API: fix VA_ROTATION_270 definition
* Add a simple H.264 encoder "avcenc" (Chang Zhou)
* Fix VA tracer (Alexander Osin)
* Fix vaBufferInfo() interface (Alexander Osin)
Version 1.0.12 - 01.Apr.2011
* API: add VARenderMode interface to select overlay or GPU rendering mode
* API: add VARenderDevice interface to allow rendering to an external device
* API: add VADisplayAttribOverlay{ColorKey,AutoPaintColorKey} interface
* Fix build issues on Android 2.3
Changes for older versions can be found in git log or previously
released packages.

67
lib/libva/README.md Normal file
View file

@ -0,0 +1,67 @@
# Libva Project
Libva is an implementation for VA-API (Video Acceleration API)
VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing. It consists of a main library and driver-specific acceleration backends for each supported hardware vendor.
If you would like to contribute to libva, check our [Contributing guide](https://github.com/intel/libva/blob/master/CONTRIBUTING.md).
We also recommend taking a look at the ['janitorial' bugs](https://github.com/intel/libva/issues?q=is%3Aopen+is%3Aissue+label%3AJanitorial) in our list of open issues as these bugs can be solved without an extensive knowledge of libva.
We would love to help you start contributing!
Doxygen files are regularly updated through Github Pages and can be accessed directly through [github pages libva](http://intel.github.io/libva/)
The libva development team can be reached via github issues.
# Build and Install Libva
*This build documentation was tested under clear Ubuntu Server 18.04 (with gcc-7.3.0, gcc-8.1.0 and clang-6.0 compilers) but it should work on another OS distributions with various versions of gcc and clang.*
## Install all required common packages:
```
sudo apt-get install git cmake pkg-config meson libdrm-dev automake libtool
```
Take latest libva version:
```
git clone https://github.com/intel/libva.git
cd libva
```
## Build with autogen and Meson
When you install the libva from OSV package repositories, different OSV distro use different default location for libva. Basically, Debian/Ubuntu family install libva to /usr/lib/x86_64-linux-gnu and rpm family like Fedora/CentOS/SUSE/RHEL install libva to /usr/lib64. For Other media component default location, you could refer to [Install from OSV package](https://github.com/intel/media-driver/wiki/Install-from-OSV-package))
Without prefix setting, libva will be install to /usr/local/lib as default. If you use other path as installation target folder or no prefix, you have to add the folder to your environment variable or use LD_LIBRARY_PATH to specify the location, like LD_LIBRARY_PATH=/usr/local/lib if no prefix.
If you intent to overwrite system default libva, you could use same OSV distro prefix, then system libva will be replaced and also your new installed libva version will be overwrited when you upgrade it from OSV distro package repository.
For debian family, you could use autogen
```
./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
make
sudo make install
```
or build using Meson
```
mkdir build
cd build
meson .. -Dprefix=/usr -Dlibdir=/usr/lib/x86_64-linux-gnu
ninja
sudo ninja install
```
For rpm family, you could use autogen
```
./autogen.sh --prefix=/usr --libdir=/usr/lib64
make
sudo make install
```
or build using Meson
```
mkdir build
cd build
meson .. -Dprefix=/usr -Dlibdir=/usr/lib64
ninja
sudo ninja install
```

58
lib/libva/autogen.sh Normal file
View file

@ -0,0 +1,58 @@
#!/bin/sh
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
PROJECT="libva"
# for `meson dist`
if test -z "$srcdir"; then
srcdir="$MESON_PROJECT_DIST_ROOT"
test -n "$srcdir" || srcdir="$MESON_DIST_ROOT"
test -n "$srcdir" && NOCONFIGURE=1
fi
test -n "$srcdir" || srcdir="`dirname \"$0\"`"
test -n "$srcdir" || srcdir=.
if ! test -f "$srcdir/configure.ac"; then
echo "Failed to find the top-level $PROJECT directory"
exit 1
fi
olddir="`pwd`"
cd "$srcdir"
mkdir -p m4
AUTORECONF=`command -v autoreconf`
if test -z $AUTORECONF; then
echo "*** No autoreconf found ***"
exit 1
else
autoreconf -v --install || exit $?
fi
cd "$olddir"
if test -z "$NOCONFIGURE"; then
$srcdir/configure "$@" && echo "Now type 'make' to compile $PROJECT."
fi

View file

@ -0,0 +1,54 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#!/bin/sh
libva_topdir="$1"
version_h_in="$2"
parse_configure_ac() {
sed -n "/^m4_define.*${1}.*\[\([0-9]*\)\].*/s//\1/p" ${libva_topdir}/configure.ac
}
parse_configure() {
sed -n "/^${1}=\([0-9]*\)/s//\1/p" ${libva_topdir}/configure
}
if test -f "${libva_topdir}/configure.ac"; then
va_api_major_version=`parse_configure_ac va_api_major_version`
va_api_minor_version=`parse_configure_ac va_api_minor_version`
va_api_micro_version=`parse_configure_ac va_api_micro_version`
elif test -f "${libva_topdir}/configure"; then
va_api_major_version=`parse_configure VA_API_MAJOR_VERSION`
va_api_minor_version=`parse_configure VA_API_MINOR_VERSION`
va_api_micro_version=`parse_configure VA_API_MICRO_VERSION`
else
echo "ERROR: configure or configure.ac file not found in $libva_topdir/"
exit 1
fi
va_api_version="$va_api_major_version.$va_api_minor_version.$va_api_micro_version"
sed -e "s/@VA_API_MAJOR_VERSION@/${va_api_major_version}/" \
-e "s/@VA_API_MINOR_VERSION@/${va_api_minor_version}/" \
-e "s/@VA_API_MICRO_VERSION@/${va_api_micro_version}/" \
-e "s/@VA_API_VERSION@/${va_api_version}/" \
$version_h_in

370
lib/libva/configure.ac Normal file
View file

@ -0,0 +1,370 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# VA-API version
# - increment major for any ABI change
# - increment minor for any interface change (e.g. new/modified function)
# - increment micro for any other change (new flag, new codec definition, etc.)
# - reset micro version to zero when minor version is incremented
# - reset minor version to zero when major version is incremented
m4_define([va_api_major_version], [1])
m4_define([va_api_minor_version], [22])
m4_define([va_api_micro_version], [0])
m4_define([va_api_version],
[va_api_major_version.va_api_minor_version.va_api_micro_version])
# libva package version number, (as distinct from shared library version)
# XXX: we want the package version to remain at 1.0.x for VA-API 0.32.y
#
# - major version is automatically generated from VA-API major version
# - minor version is automatically generated from VA-API minor version
# - increment micro for any library release
# - reset micro version to zero when VA-API major or minor version is changed
m4_define([libva_major_version], [m4_eval(va_api_major_version + 1)])
m4_define([libva_minor_version], [m4_eval(va_api_minor_version)])
m4_define([libva_micro_version], [0])
m4_define([libva_pre_version], [0])
m4_define([libva_version],
[libva_major_version.libva_minor_version.libva_micro_version])
m4_if(libva_pre_version, [0], [], [
m4_append([libva_version], libva_pre_version, [.pre])
])
# libva library version number (generated, do not change)
# XXX: we want the SONAME to remain at libva.so.1 for VA-API major == 0
#
# The library name is generated libva.<x>.<y>.0 where
# <x> = VA-API major version + 1
# <y> = 100 * VA-API minor version + VA-API micro version
#
# For example:
# VA-API 0.32.0 generates libva.so.1.3200.0
# VA-API 0.34.1 generates libva.so.1.3401.0
# VA-API 1.2.13 generates libva.so.2.213.0
m4_define([libva_interface_bias], [m4_eval(va_api_major_version + 1)])
m4_define([libva_interface_age], [0])
m4_define([libva_binary_age],
[m4_eval(100 * va_api_minor_version + va_api_micro_version - libva_interface_age)])
m4_define([libva_lt_current],
[m4_eval(100 * va_api_minor_version + va_api_micro_version + libva_interface_bias)])
m4_define([libva_lt_revision],
[m4_eval(libva_interface_age)])
m4_define([libva_lt_age],
[m4_eval(libva_binary_age - libva_interface_age)])
# libdrm minimun version requirement
# 2.4.75 for drmGetDevices2
m4_define([libdrm_version], [2.4.75])
# Wayland minimum version number
# 1.11.0 for wl_proxy_create_wrapper
m4_define([wayland_api_version], [1.11.0])
AC_PREREQ(2.57)
AC_INIT([libva],
[libva_version],
[https://github.com/intel/libva/issues/new],
[libva],
[https://github.com/intel/libva])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([dist-bzip2 foreign -Wno-portability])
AC_CONFIG_HEADERS([config.h])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
VA_API_MAJOR_VERSION=va_api_major_version
VA_API_MINOR_VERSION=va_api_minor_version
VA_API_MICRO_VERSION=va_api_micro_version
VA_API_VERSION=va_api_version
AC_SUBST(VA_API_MAJOR_VERSION)
AC_SUBST(VA_API_MINOR_VERSION)
AC_SUBST(VA_API_MICRO_VERSION)
AC_SUBST(VA_API_VERSION)
LIBVA_MAJOR_VERSION=libva_major_version
LIBVA_MINOR_VERSION=libva_minor_version
LIBVA_MICRO_VERSION=libva_micro_version
LIBVA_VERSION=libva_version
AC_SUBST(LIBVA_MAJOR_VERSION)
AC_SUBST(LIBVA_MINOR_VERSION)
AC_SUBST(LIBVA_MICRO_VERSION)
AC_SUBST(LIBVA_VERSION)
LIBVA_LT_CURRENT=libva_lt_current
LIBVA_LT_REV=libva_lt_revision
LIBVA_LT_AGE=libva_lt_age
LIBVA_LT_VERSION="$LIBVA_LT_CURRENT:$LIBVA_LT_REV:$LIBVA_LT_AGE"
LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
AC_SUBST(LIBVA_LT_VERSION)
AC_SUBST(LIBVA_LT_LDFLAGS)
AC_ARG_ENABLE(docs,
[AC_HELP_STRING([--enable-docs],
[build Doxygen documentation @<:@default=no@:>@])],
[], [enable_docs="no"])
AC_ARG_ENABLE(drm,
[AC_HELP_STRING([--enable-drm],
[build with VA/DRM API support @<:@default=yes@:>@])],
[], [enable_drm="yes"])
AC_ARG_ENABLE(x11,
[AC_HELP_STRING([--enable-x11],
[build with VA/X11 API support @<:@default=auto@:>@])],
[], [enable_x11="auto"])
AC_ARG_ENABLE(glx,
[AC_HELP_STRING([--enable-glx],
[build with VA/GLX API support @<:@default=auto@:>@])],
[], [enable_glx="auto"])
AC_ARG_ENABLE([wayland],
[AC_HELP_STRING([--enable-wayland],
[build with VA/Wayland API support @<:@default=auto@:>@])],
[], [enable_wayland="auto"])
AC_ARG_WITH(legacy,
[AC_HELP_STRING([--with-legacy=[[components]]],
[build with legacy components @<:@default=emgd,nvctrl,fglrx@:>@])],
[], [with_legacy="emgd,nvctrl,fglrx"])
if test "$with_legacy" = *emgd*; then
AC_DEFINE([HAVE_EMGD], [1], [Defined to 1 if EMGD is built])
fi
if test "$with_legacy" = *nvctrl*; then
AC_DEFINE([HAVE_NVCTRL], [1], [Defined to 1 if NVCTRL is built])
fi
if test "$with_legacy" = *fglrx*; then
AC_DEFINE([HAVE_FGLRX], [1], [Defined to 1 if FGLRX is built])
fi
AC_ARG_WITH(drivers-path,
[AC_HELP_STRING([--with-drivers-path=[[path]]],
[drivers path])],
[], [with_drivers_path="$libdir/dri"])
LIBVA_DRIVERS_PATH="$with_drivers_path"
AC_SUBST(LIBVA_DRIVERS_PATH)
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_SED
PKG_PROG_PKG_CONFIG
AC_HEADER_STDC
AC_SYS_LARGEFILE
#check for secure_getenv
AC_CHECK_FUNCS(secure_getenv)
# Check for Doxygen
if test "$enable_docs" = "yes"; then
AC_CHECK_TOOL([DOXYGEN], [doxygen], [no])
if test "$DOXYGEN" = "no"; then
enable_docs="no"
fi
fi
AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
# Check for -ldl (often not required)
AC_SEARCH_LIBS([dlopen], [dl], [], [
AC_MSG_ERROR([unable to find the dlopen() function])
])
# Check for -fstack-protector and -fstack-protector-strong
SSP_CC_FLAG=""
if test "X$CC-cc" != "X"; then
# Do not duplicate options in CFLAGS
ssp_sp_set=no
ssp_sps_set=no
for ssp_x in $CFLAGS; do
case "X$ssp_x" in
X-fstack-protector) ssp_sp_set=yes ;;
X-fstack-protector-strong) ssp_sps_set=yes ;;
esac
done
ssp_old_cflags="$CFLAGS"
# Prefer -fstack-protector-strong over -fstack-protector
if test "X$ssp_sps_set" = "Xno"; then
SSP_CC_FLAG="-fstack-protector-strong"
fi
AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector-strong])
CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no])
AC_MSG_RESULT([$ssp_cc])
if test "X$ssp_cc" = "Xno"; then
# Fallback to -fstack-protector
if test "X$ssp_sp_set" = "Xno"; then
SSP_CC_FLAG="-fstack-protector"
fi
AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no])
AC_MSG_RESULT([$ssp_cc])
if test "X$ssp_cc" = "Xno"; then
SSP_CC_FLAG=""
fi
fi
CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
if test "X$ssp_cc" = "Xyes"; then
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
fi
AC_SUBST(SSP_CC_FLAG)
# Check for DRM (mandatory)
LIBDRM_VERSION=libdrm_version
PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
AC_SUBST(LIBDRM_VERSION)
USE_DRM="no"
if test "$enable_drm" = "yes"; then
USE_DRM="yes"
AC_DEFINE([HAVE_VA_DRM], [1], [Defined to 1 if VA/DRM API is built])
fi
AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
# Check for X11
USE_X11="no"
if test "x$enable_x11" != "xno"; then
PKG_CHECK_MODULES([X11], [x11 xext xfixes x11-xcb xcb xcb-dri3], [USE_X11="yes"], [:])
if test "x$USE_X11" = "xno" -a "x$enable_x11" = "xyes"; then
AC_MSG_ERROR([VA/X11 explicitly enabled, however $X11_PKG_ERRORS])
fi
if test "$USE_X11" = "yes"; then
AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
fi
fi
AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
# Check for GLX
USE_GLX="no"
if test "$USE_X11:$enable_glx" = "no:yes"; then
AC_MSG_ERROR([VA/GLX explicitly enabled, but VA/X11 isn't built])
fi
if test "$USE_X11" = "yes" -a "$enable_glx" != "no"; then
PKG_CHECK_MODULES([GLX], [gl x11], [USE_GLX="yes"], [:])
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $GLX_CFLAGS"
LIBS="$LIBS $GLX_LIBS"
AC_CHECK_HEADERS([GL/gl.h GL/glx.h], [:], [USE_GLX="no"])
AC_CHECK_LIB([GL], [glXCreateContext], [:] [USE_GLX="no"])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
if test "x$USE_GLX" = "xno" -a "x$enable_glx" = "xyes"; then
AC_MSG_ERROR([VA/GLX explicitly enabled, but libGL couldn't be found])
fi
if test "$USE_GLX" = "yes"; then
AC_DEFINE([HAVE_VA_GLX], [1], [Defined to 1 if VA/GLX API is built])
fi
fi
AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
# Check for Wayland
WAYLAND_API_VERSION=wayland_api_version
AC_SUBST(WAYLAND_API_VERSION)
USE_WAYLAND="no"
if test "x$enable_wayland" != "xno"; then
PKG_CHECK_MODULES([WAYLAND], [wayland-client >= wayland_api_version],
[USE_WAYLAND="yes"], [:])
if test "x$USE_WAYLAND" = "xno" -a "x$enable_wayland" = "xyes"; then
AC_MSG_ERROR([wayland explicitly enabled, however $WAYLAND_PKG_ERRORS])
fi
if test "$USE_WAYLAND" = "yes"; then
AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
if test "x$WAYLAND_SCANNER" = "x"; then
PKG_CHECK_MODULES([WL_SCANNER], [wayland-scanner >= 1.15],
[USE_WAYLAND="yes"], [:])
if test "x$USE_WAYLAND" = "xno" -a "x$enable_wayland" = "xyes"; then
AC_MSG_ERROR([wayland explicitly enabled, however $WL_SCANNER_PKG_ERRORS])
fi
AC_SUBST(WAYLAND_SCANNER, `$PKG_CONFIG --variable=wayland_scanner wayland-scanner`)
fi
AC_DEFINE([HAVE_VA_WAYLAND], [1],
[Defined to 1 if VA/Wayland API is built])
fi
fi
AM_CONDITIONAL(USE_WAYLAND, test "$USE_WAYLAND" = "yes")
pkgconfigdir=${libdir}/pkgconfig
AC_SUBST(pkgconfigdir)
# Check for builds without backend
if test "$USE_DRM:$USE_X11:$USE_WAYLAND" = "no:no:no"; then
AC_MSG_ERROR([Please select at least one backend (DRM, X11, Wayland)])
fi
AC_OUTPUT([
Makefile
doc/Makefile
pkgconfig/Makefile
pkgconfig/libva-drm.pc
pkgconfig/libva-glx.pc
pkgconfig/libva-wayland.pc
pkgconfig/libva-x11.pc
pkgconfig/libva.pc
va/Makefile
va/drm/Makefile
va/glx/Makefile
va/va_version.h
va/wayland/Makefile
va/x11/Makefile
])
# Print a small summary
BACKENDS=""
AS_IF([test x$USE_DRM = xyes], [BACKENDS="$BACKENDS drm"])
AS_IF([test x$USE_X11 = xyes], [BACKENDS="$BACKENDS x11"])
AS_IF([test x$USE_GLX = xyes], [BACKENDS="$BACKENDS glx"])
AS_IF([test x$USE_WAYLAND = xyes], [BACKENDS="$BACKENDS wayland"])
echo
echo "libva - ${LIBVA_VERSION} (VA-API ${VA_API_VERSION})"
echo
echo Installation prefix .............. : $prefix
echo Default driver path .............. : $LIBVA_DRIVERS_PATH
echo Extra window systems ............. : $BACKENDS
echo Build with legacy ................ : $with_legacy
echo Build documentation .............. : $enable_docs
echo

2470
lib/libva/doc/Doxyfile.in Normal file

File diff suppressed because it is too large Load diff

86
lib/libva/doc/Makefile.am Normal file
View file

@ -0,0 +1,86 @@
# Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
all: html
install-data-local: install-html
EXTRA_DIST = \
Doxyfile.in \
meson.build \
$(NULL)
VA_HEADER_DIR = $(top_srcdir)/va
VA_HEADER_FILES = \
$(VA_HEADER_DIR)/va.h \
$(VA_HEADER_DIR)/va_enc_h264.h \
$(VA_HEADER_DIR)/va_enc_mpeg2.h \
$(VA_HEADER_DIR)/va_enc_jpeg.h \
$(VA_HEADER_DIR)/va_enc_hevc.h \
$(VA_HEADER_DIR)/va_enc_vp8.h \
$(VA_HEADER_DIR)/va_enc_vp9.h \
$(VA_HEADER_DIR)/va_fei.h \
$(VA_HEADER_DIR)/va_fei_h264.h \
$(VA_HEADER_DIR)/va_fei_hevc.h \
$(VA_HEADER_DIR)/va_dec_hevc.h \
$(VA_HEADER_DIR)/va_dec_jpeg.h \
$(VA_HEADER_DIR)/va_dec_vp8.h \
$(VA_HEADER_DIR)/va_dec_vp9.h \
$(VA_HEADER_DIR)/va_dec_av1.h \
$(VA_HEADER_DIR)/va_prot.h \
$(VA_HEADER_DIR)/va_vpp.h \
$(NULL)
VA_HTML_FOOTER = $(top_srcdir)/doc/va_footer.html
Doxyfile: Doxyfile.in $(VA_HEADER_FILES) $(VA_HTML_FOOTER)
$(AM_V_GEN) $(SED) \
-e "s:\@PACKAGE_VERSION\@:$(PACKAGE_VERSION):" \
-e "s:\@VA_HEADER_DIR\@:$(VA_HEADER_DIR):" \
-e "s:\@VA_HEADER_FILES\@:$(VA_HEADER_FILES):" \
-e "s:\@VA_HTML_FOOTER\@:$(VA_HTML_FOOTER):" \
-e "s:\@OUTDIR\@::" \
$< > $@
html-out/index.html: Doxyfile
$(AM_V_GEN) $(DOXYGEN)
html: html-out/index.html
install-html-local:
install -d $(DESTDIR)$(docdir)/html
for file in `ls html-out/` ; do \
if test -f html-out/$$file ; then \
install -m 0644 html-out/$$file $(DESTDIR)$(docdir)/html ; \
else \
install -d $(DESTDIR)$(docdir)/html/$$file ; \
install -m 0644 html-out/$$file/* $(DESTDIR)$(docdir)/html/$$file; \
fi ; \
done
uninstall-local:
$(RM) -rf $(DESTDIR)$(docdir)/html
clean-local:
$(RM) -rf html-out latex
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in Doxyfile

View file

@ -0,0 +1,131 @@
#!/bin/bash
################################################################################
# Notes :
# Preconditions:
# - Packages doxygen doxygen-doc doxygen-latex doxygen-gui graphviz
# must be installed.
# - Doxygen configuration file must have the destination directory empty and
# source code directory.
# - A gh-pages branch should already exist.
#
# Required global variables:
# - DOXYFILE : The Doxygen configuration file.
# - GH_REPO_NAME : The name of the repository.
# - GH_REPO_REF : The GitHub reference to the repository.
# - GH_REPO_TOKEN : The GitHub application token.
#
# This script will generate Doxygen documentation and push the documentation to
# the gh-pages branch of a repository specified by GH_REPO_REF.
# Before this script is used there should already be a gh-pages branch in the
# repository.
#
################################################################################
################################################################################
##### Setup this script and get the current gh-pages branch. #####
echo 'Setting up the script...'
# Exit with nonzero exit code if anything fails
set -e
GH_REPO_NAME=
GH_REPO_REF=
GH_REPO_TOKEN=
usage() { echo "Usage: `basename $0` options (-n value) (-r value) (-t value)" 1>&2; exit 1; }
if ( ! getopts ":n:r:t:" opt); then
usage
fi
while getopts :n:r:t: opt; do
case $opt in
n)
GH_REPO_NAME=$OPTARG
;;
r)
GH_REPO_REF=$OPTARG
;;
t)
GH_REPO_TOKEN=$OPTARG
;;
*)
usage
;;
esac
done
shift $((OPTIND - 1))
[ -n "$GH_REPO_NAME" ] || {
echo "ERROR: -n GH_REPO_NAME is not defined" >/dev/stderr
exit 1
}
[ -n "$GH_REPO_REF" ] || {
echo "ERROR: -r GH_REPO_REF is not defined" >/dev/stderr
exit 1
}
[ -n "$GH_REPO_TOKEN" ] || {
echo "ERROR: -t GH_REPO_TOKEN is not defined" >/dev/stderr
exit 1
}
################################################################################
##### Upload the documentation to the gh-pages branch of the repository. #####
# Only upload if Doxygen successfully created the documentation.
# Check this by verifying that the html directory and the file html/index.html
# both exist. This is a good indication that Doxygen did it's work.
if [ -d "html-out" ] && [ -f "html-out/index.html" ]; then
# Create a clean working directory for this script.
mkdir code_docs
cd code_docs
# Get the current gh-pages branch
git clone -b gh-pages https://git@$GH_REPO_REF
cd $GH_REPO_NAME
##### Configure git.
# Set the push default to simple i.e. push only the current branch.
git config --global push.default simple
# Remove everything currently in the gh-pages branch.
# GitHub is smart enough to know which files have changed and which files have
# stayed the same and will only update the changed files. So the gh-pages branch
# can be safely cleaned, and it is sure that everything pushed later is the new
# documentation.
CURRENTCOMMIT=`git rev-parse HEAD`
git reset --hard `git rev-list HEAD | tail -n 1` # Reset working tree to initial commit
git reset --soft $CURRENTCOMMIT # Move HEAD back to where it was
# Move doxy files into local gh-pages branch folder
mv ../../html-out/* .
# Need to create a .nojekyll file to allow filenames starting with an underscore
# to be seen on the gh-pages site. Therefore creating an empty .nojekyll file.
# Presumably this is only needed when the SHORT_NAMES option in Doxygen is set
# to NO, which it is by default. So creating the file just in case.
echo "" > .nojekyll
echo 'Uploading documentation to the gh-pages branch...'
# Add everything in this directory (the Doxygen code documentation) to the
# gh-pages branch.
# GitHub is smart enough to know which files have changed and which files have
# stayed the same and will only update the changed files.
git add --all
# Commit the added files with a title and description containing the Travis CI
# build number and the GitHub commit reference that issued this build.
git commit -m "Deploy code docs to GitHub Pages"
# Force push to the remote gh-pages branch.
# The ouput is redirected to /dev/null to hide any sensitive credential data
# that might otherwise be exposed.
git push --force "https://${GH_REPO_TOKEN}@${GH_REPO_REF}" > /dev/null 2>&1
else
echo '' >&2
echo 'Warning: No documentation (html) files have been found!' >&2
echo 'Warning: Not going to push the documentation to GitHub!' >&2
exit 1
fi

56
lib/libva/doc/meson.build Normal file
View file

@ -0,0 +1,56 @@
if meson.version().version_compare('>= 0.56')
headerdir = join_paths(meson.project_source_root(), 'va')
else
headerdir = join_paths(meson.source_root(), 'va')
endif
footer = join_paths(meson.current_source_dir(), 'va_footer.html')
libva_headers_doc = [
'va.h',
'va_enc_h264.h',
'va_enc_mpeg2.h',
'va_enc_jpeg.h',
'va_enc_hevc.h',
'va_enc_vp8.h',
'va_enc_vp9.h',
'va_enc_av1.h',
'va_fei.h',
'va_fei_h264.h',
'va_fei_hevc.h',
'va_dec_hevc.h',
'va_dec_jpeg.h',
'va_dec_vp8.h',
'va_dec_vp9.h',
'va_dec_av1.h',
'va_prot.h',
'va_vpp.h'
]
libva_doc_files = []
headers = ''
foreach h : libva_headers_doc
libva_doc_files += join_paths (headerdir, h)
headers += ' ' + join_paths (headerdir, h)
endforeach
config = configuration_data()
config.set('PACKAGE_VERSION', libva_version)
config.set('VA_HEADER_DIR', headerdir)
config.set('VA_HEADER_FILES', headers)
config.set('VA_HTML_FOOTER', footer)
config.set('OUTDIR', meson.current_build_dir())
doxyfile = configure_file(
input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: config)
doc_install_dir = join_paths(get_option('datadir'), 'doc', meson.project_name())
custom_target(
'doc',
command: [ doxygen, doxyfile ],
depend_files: libva_doc_files,
input: doxyfile,
output: 'html-out',
install: true,
install_dir: doc_install_dir)

View file

@ -0,0 +1,4 @@
<hr class="footer"/><address class="footer"><small>
Generated for $projectname by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion</small></address>
</body>
</html>

160
lib/libva/meson.build Normal file
View file

@ -0,0 +1,160 @@
# libva package version number, (as distinct from shared library version)
# XXX: we want the package version to remain at 1.0.x for VA-API 0.32.y
#
# - major version is automatically generated from VA-API major version
# - minor version is automatically generated from VA-API minor version
# - increment micro for any library release
# - reset micro version to zero when VA-API major or minor version is changed
project(
'libva', 'c',
version : '2.22.0',
meson_version : '>= 0.53.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
# VA-API version
# - increment major for any ABI change
# - increment minor for any interface change (e.g. new/modified function)
# - increment micro for any other change (new flag, new codec definition, etc.)
# - reset micro version to zero when minor version is incremented
# - reset minor version to zero when major version is incremented
va_api_major_version = 1
va_api_minor_version = 22
va_api_micro_version = 0
va_api_version = '@0@.@1@.@2@'.format(va_api_major_version,
va_api_minor_version,
va_api_micro_version)
version_arr = meson.project_version().split('.')
libva_major_version = version_arr[0]
libva_minor_version = version_arr[1]
libva_micro_version = version_arr[2]
libva_version = '@0@.@1@.@2@'.format(libva_major_version,
libva_minor_version,
libva_micro_version)
if version_arr.length() == 4
libva_version = '@0@.pre@1@'.format(libva_version, version_arr[3])
endif
# libva library version number (generated, do not change)
# XXX: we want the SONAME to remain at libva.so.1 for VA-API major == 0
#
# The library name is generated libva.<x>.<y>.0 where
# <x> = VA-API major version + 1
# <y> = 100 * VA-API minor version + VA-API micro version
#
# For example:
# VA-API 0.32.0 generates libva.so.1.3200.0
# VA-API 0.34.1 generates libva.so.1.3401.0
# VA-API 1.2.13 generates libva.so.2.213.0
libva_interface_bias = va_api_major_version + 1
libva_interface_age = 0
libva_binary_age = 100 * va_api_minor_version + va_api_micro_version - libva_interface_age
libva_lt_current = 100 * va_api_minor_version + va_api_micro_version + libva_interface_bias
libva_lt_revision = libva_interface_age
libva_lt_age = libva_binary_age - libva_interface_age
libva_lt_current = libva_lt_current - libva_lt_age
libva_lt_version = '@0@.@1@.@2@'.format(libva_lt_current,
libva_lt_age,
libva_lt_revision)
sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
driverdir = get_option('driverdir')
if driverdir == ''
# "libdir" on Windows is essentially only for static and import libraries,
# while "bindir" is the actual runtime directory - containing both
# executable and dynamic libraries. During install meson uses correct install
# location depending on the type of library, requiring zero user intervention
# in the common case.
if host_machine.system() == 'windows'
driverdir = join_paths(get_option('prefix'), get_option('bindir'))
else
driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
endif
endif
configinc = include_directories('.')
cc = meson.get_compiler('c')
dl_dep = cc.find_library('dl', required : false)
WITH_DRM = not get_option('disable_drm') and (host_machine.system() != 'windows')
libdrm_dep = dependency('libdrm', version : '>= 2.4.75', required : (host_machine.system() != 'windows'))
WITH_X11 = false
if get_option('with_x11') != 'no'
x11_dep = dependency('x11', required : get_option('with_x11') == 'yes')
xext_dep = dependency('xext', required : get_option('with_x11') == 'yes')
xfixes_dep = dependency('xfixes', required : get_option('with_x11') == 'yes')
WITH_X11 = (x11_dep.found() and xext_dep.found() and xfixes_dep.found())
x11_xcb_dep = dependency('x11-xcb', required : get_option('with_x11') == 'yes')
xcb_dep = dependency('xcb', required : get_option('with_x11') == 'yes')
xcb_dri3_dep = dependency('xcb-dri3', required : get_option('with_x11') == 'yes')
WITH_X11 = (WITH_X11 and x11_xcb_dep.found() and xcb_dep.found() and xcb_dri3_dep.found())
endif
if not WITH_X11 and get_option('with_glx') == 'yes'
error('VA/GLX explicitly enabled, but VA/X11 isn\'t built')
endif
WITH_GLX = false
if WITH_X11 and get_option('with_glx') != 'no'
gl_dep = dependency('gl', required : get_option('with_glx') == 'yes')
WITH_GLX = gl_dep.found()
endif
WITH_WAYLAND = false
if get_option('with_wayland') != 'no'
wayland_dep = dependency('wayland-client', version : '>= 1.11.0',
required : get_option('with_wayland') == 'yes')
wayland_scanner_dep = dependency('wayland-scanner', version : '>= 1.15',
required : get_option('with_wayland') == 'yes',
native : true)
if wayland_scanner_dep.found()
wl_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
endif
WITH_WAYLAND = wayland_dep.found() and wayland_scanner_dep.found()
endif
WITH_WIN32 = false
libwin32_dep = []
if get_option('with_win32') != 'no'
WITH_WIN32 = (host_machine.system() == 'windows')
endif
if (not WITH_DRM and not WITH_X11 and not WITH_WAYLAND and not WITH_WIN32)
error('Please install at least one backend dev files (DRM, X11, Wayland, WIN32)')
endif
c_args = []
if get_option('with_legacy').contains('emgd')
c_args += ['-DHAVE_EMGD']
elif get_option('with_legacy').contains('nvctrl')
c_args += ['-DHAVE_NVCTRL']
elif get_option('with_legacy').contains('fglrx')
c_args += ['-DHAVE_FGLRX']
endif
if cc.has_function('secure_getenv')
c_args += ['-DHAVE_SECURE_GETENV']
endif
add_project_arguments(c_args, language: ['c'])
subdir('va')
subdir('pkgconfig')
doxygen = find_program('doxygen', required: false)
if get_option('enable_docs') and doxygen.found()
subdir('doc')
endif

View file

@ -0,0 +1,8 @@
option('driverdir', type : 'string', description : 'drivers path')
option('disable_drm', type : 'boolean', value : false)
option('with_x11', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_glx', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_wayland', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_win32', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
option('with_legacy', type : 'array', choices : ['emdg', 'nvctrl', 'fglrx'], value : [])
option('enable_docs', type : 'boolean', value : false)

View file

@ -0,0 +1,51 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pcfiles = libva.pc
if USE_DRM
pcfiles += libva-drm.pc
endif
if USE_X11
pcfiles += libva-x11.pc
endif
if USE_GLX
pcfiles += libva-glx.pc
endif
if USE_WAYLAND
pcfiles += libva-wayland.pc
endif
all_pcfiles_in = libva.pc.in
all_pcfiles_in += libva-drm.pc.in
all_pcfiles_in += libva-x11.pc.in
all_pcfiles_in += libva-glx.pc.in
all_pcfiles_in += libva-wayland.pc.in
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = $(pcfiles)
EXTRA_DIST = $(all_pcfiles_in) meson.build
DISTCLEANFILES = $(pcfiles)
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
display=drm
Name: libva-${display}
Description: Userspace Video Acceleration (VA) ${display} interface
Requires: libva
Version: @VA_API_VERSION@
Libs: -L${libdir} -lva-${display}
Cflags: -I${includedir}

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
display=glx
Name: libva-${display}
Description: Userspace Video Acceleration (VA) ${display} interface
Requires: libva
Version: @VA_API_VERSION@
Libs: -L${libdir} -lva-${display}
Cflags: -I${includedir}

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
display=wayland
Name: libva-${display}
Description: Userspace Video Acceleration (VA) ${display} interface
Requires: libva wayland-client
Version: @VA_API_VERSION@
Libs: -L${libdir} -lva-${display}
Cflags: -I${includedir}

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
display=x11
Name: libva-${display}
Description: Userspace Video Acceleration (VA) ${display} interface
Requires: libva
Version: @VA_API_VERSION@
Libs: -L${libdir} -lva-${display}
Cflags: -I${includedir}

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
driverdir=@LIBVA_DRIVERS_PATH@
libva_version=@LIBVA_VERSION@
Name: libva
Description: Userspace Video Acceleration (VA) core interface
Version: @VA_API_VERSION@
Libs: -L${libdir} -lva
Cflags: -I${includedir}

View file

@ -0,0 +1,60 @@
pkg = import('pkgconfig')
vars = ['libva_version=' + libva_version, 'va_api_version=' + va_api_version]
va_vars = vars + ['driverdir=' + driverdir]
pkg.generate(libva,
description: 'Userspace Video Acceleration (VA) core interface',
filebase: 'libva',
variables: va_vars,
version: va_api_version)
if WITH_DRM
drm_vars = vars + ['display=drm']
pkg.generate(libva_drm,
description: 'Userspace Video Acceleration (VA) DRM interface',
filebase: 'libva-drm',
requires: 'libva',
variables: drm_vars,
version: va_api_version)
endif
if WITH_X11
x11_vars = vars + ['display=x11']
pkg.generate(libva_x11,
description: 'Userspace Video Acceleration (VA) X11 interface',
filebase: 'libva-x11',
requires: 'libva',
variables: x11_vars,
version: va_api_version)
endif
if WITH_GLX
glx_vars = vars + ['display=glx']
pkg.generate(libva_glx,
description: 'Userspace Video Acceleration (VA) GLX interface',
filebase: 'libva-glx',
requires: 'libva',
variables: glx_vars,
version: va_api_version)
endif
if WITH_WAYLAND
wayland_vars = vars + ['display=wayland']
pkg.generate(libva_wayland,
description: 'Userspace Video Acceleration (VA) Wayland interface',
filebase: 'libva-wayland',
requires: 'libva, wayland-client',
variables: wayland_vars,
version: va_api_version)
endif
if WITH_WIN32
win32_vars = vars + ['display=win32']
pkg.generate(libva_win32,
description: 'Userspace Video Acceleration (VA) Win32 interface',
filebase: 'libva-win32',
requires: 'libva',
variables: win32_vars,
version: va_api_version)
endif

5
lib/libva/security.md Normal file
View file

@ -0,0 +1,5 @@
# Security Policy
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
## Reporting a Vulnerability
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).

10
lib/libva/style_unify Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
file=$(find . -name "*.[ch]" -o -name "*.cpp")
for i in $file
do
echo $i
astyle --style=linux -s4 -c -s -p -U -H -n $i
done

102
lib/libva/va/Android.mk Normal file
View file

@ -0,0 +1,102 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# For libva
# =====================================================
LOCAL_PATH:= $(call my-dir)
LIBVA_DRIVERS_PATH_32 := /vendor/lib/dri
LIBVA_DRIVERS_PATH_64 := /vendor/lib64/dri
include $(CLEAR_VARS)
#LIBVA_MINOR_VERSION := 31
#LIBVA_MAJOR_VERSION := 0
IGNORED_WARNNING = \
-Wno-sign-compare \
-Wno-missing-field-initializers \
-Wno-unused-parameter \
LOCAL_SRC_FILES := \
va.c \
va_trace.c \
va_str.c
LOCAL_CFLAGS_32 += \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH_32)\"" \
LOCAL_CFLAGS_64 += \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH_64)\"" \
LOCAL_CFLAGS := \
$(IGNORED_WARNNING) \
-DLOG_TAG=\"libva\"
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libva
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils liblog
intermediates := $(call local-generated-sources-dir)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(intermediates) \
$(LOCAL_C_INCLUDES)
GEN := $(intermediates)/va/va_version.h
$(GEN): SCRIPT := $(LOCAL_PATH)/../build/gen_version.sh
$(GEN): PRIVATE_CUSTOM_TOOL = sh $(SCRIPT) $(<D)/.. $< > $@
$(GEN): $(intermediates)/va/%.h : $(LOCAL_PATH)/%.h.in $(LOCAL_PATH)/../configure.ac
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_SHARED_LIBRARY)
# For libva-android
# =====================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
android/va_android.cpp \
drm/va_drm_utils.c
LOCAL_CFLAGS += \
-DLOG_TAG=\"libva-android\" \
$(IGNORED_WARNNING)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/drm
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libva-android
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := libva libdrm liblog
include $(BUILD_SHARED_LIBRARY)

154
lib/libva/va/Makefile.am Normal file
View file

@ -0,0 +1,154 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SUBDIRS =
AM_CPPFLAGS = \
-I$(top_srcdir) \
-DSYSCONFDIR='"$(sysconfdir)"' \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""
LDADD = \
$(LIBVA_LT_LDFLAGS)
libva_source_c = \
va.c \
va_compat.c \
va_str.c \
va_trace.c \
$(NULL)
libva_source_h = \
va.h \
va_backend.h \
va_backend_prot.h \
va_backend_vpp.h \
va_compat.h \
va_dec_av1.h \
va_dec_hevc.h \
va_dec_jpeg.h \
va_dec_vp8.h \
va_dec_vp9.h \
va_dec_vvc.h \
va_drmcommon.h \
va_egl.h \
va_enc_hevc.h \
va_enc_h264.h \
va_enc_jpeg.h \
va_enc_vp8.h \
va_fei.h \
va_fei_h264.h \
va_enc_mpeg2.h \
va_fei_hevc.h \
va_enc_vp9.h \
va_enc_av1.h \
va_str.h \
va_tpi.h \
va_version.h \
va_prot.h \
va_vpp.h \
$(NULL)
libva_source_h_priv = \
sysdeps.h \
va_internal.h \
va_trace.h \
$(NULL)
libva_ldflags = \
$(LDADD) -no-undefined \
-Wl,-version-script,${srcdir}/libva.syms \
$(NULL)
libva_cflags = \
-Wall \
$(NULL)
libva_cflags += $(SSP_CC_FLAG)
lib_LTLIBRARIES = libva.la
libvaincludedir = ${includedir}/va
libvainclude_HEADERS = $(libva_source_h)
noinst_HEADERS = $(libva_source_h_priv)
libva_la_SOURCES = $(libva_source_c)
libva_la_CFLAGS = $(libva_cflags)
libva_la_LDFLAGS = $(libva_ldflags)
libva_la_DEPENDENCIES = libva.syms
libva_la_LIBADD = $(LIBVA_LIBS)
if USE_DRM
SUBDIRS += drm
lib_LTLIBRARIES += libva-drm.la
libva_drm_la_SOURCES =
libva_drm_la_CFLAGS = $(libva_cflags)
libva_drm_la_LDFLAGS = $(LDADD)
libva_drm_la_DEPENDENCIES = libva.la drm/libva_drm.la
libva_drm_la_LIBADD = libva.la drm/libva_drm.la \
$(LIBVA_LIBS) $(DRM_LIBS)
endif
if USE_X11
SUBDIRS += x11
lib_LTLIBRARIES += libva-x11.la
libva_source_h += va_x11.h
libva_x11_la_SOURCES =
libva_x11_la_CFLAGS = $(libva_cflags)
libva_x11_la_LDFLAGS = $(LDADD)
libva_x11_la_DEPENDENCIES = libva.la x11/libva_x11.la
libva_x11_la_LIBADD = libva.la x11/libva_x11.la \
$(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) $(DRM_LIBS)
endif
if USE_GLX
SUBDIRS += glx
lib_LTLIBRARIES += libva-glx.la
libva_glx_la_SOURCES =
libva_glx_la_CFLAGS = $(libva_cflags)
libva_glx_la_LDFLAGS = $(LDADD)
libva_glx_la_DEPENDENCIES = libva.la glx/libva_glx.la libva-x11.la
libva_glx_la_LIBADD = libva.la glx/libva_glx.la libva-x11.la \
$(GLX_LIBS)
endif
if USE_WAYLAND
SUBDIRS += wayland
lib_LTLIBRARIES += libva-wayland.la
libva_wayland_la_SOURCES =
libva_wayland_la_CFLAGS = $(libva_cflags)
libva_wayland_la_LDFLAGS = $(LDADD)
libva_wayland_la_DEPENDENCIES = libva.la wayland/libva_wayland.la
libva_wayland_la_LIBADD = libva.la wayland/libva_wayland.la \
$(WAYLAND_LIBS) $(DRM_LIBS)
endif
DIST_SUBDIRS = x11 glx drm wayland
DISTCLEANFILES = \
va_version.h \
$(NULL)
EXTRA_DIST = \
libva.syms \
va_version.h.in \
meson.build \
libva.def \
$(NULL)

View file

@ -0,0 +1,24 @@
# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in

View file

@ -0,0 +1,134 @@
/*
* Copyright (c) 2007 Intel Corporation. All Rights Reserved.
* Copyright (c) 2023 Emil Velikov
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define _GNU_SOURCE 1
#include "sysdeps.h"
#include "va.h"
#include "va_backend.h"
#include "va_internal.h"
#include "va_trace.h"
#include "va_android.h"
#include "va_drmcommon.h"
#include "va_drm_utils.h"
#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <errno.h>
#define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); return VA_STATUS_ERROR_UNKNOWN; }
#define DEVICE_NAME "/dev/dri/renderD128"
static void va_DisplayContextDestroy(
VADisplayContextP pDisplayContext
)
{
struct drm_state *drm_state;
if (pDisplayContext == NULL)
return;
/* close the open-ed DRM fd */
drm_state = (struct drm_state *)pDisplayContext->pDriverContext->drm_state;
close(drm_state->fd);
free(pDisplayContext->pDriverContext->drm_state);
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
static VAStatus va_DisplayContextConnect(
VADisplayContextP pDisplayContext
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;
struct drm_state * const drm_state = (struct drm_state *)ctx->drm_state;
drm_state->fd = open(DEVICE_NAME, O_RDWR | O_CLOEXEC);
if (drm_state->fd < 0) {
fprintf(stderr, "Cannot open DRM device '%s': %d, %s\n",
DEVICE_NAME, errno, strerror(errno));
return VA_STATUS_ERROR_UNKNOWN;
}
drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
return VA_STATUS_SUCCESS;
}
static VAStatus
va_DisplayContextGetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
unsigned *num_drivers
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;
VAStatus status = va_DisplayContextConnect(pDisplayContext);
if (status != VA_STATUS_SUCCESS)
return status;
return VA_DRM_GetDriverNames(ctx, drivers, num_drivers);
}
VADisplay vaGetDisplay(
void *native_dpy /* implementation specific */
)
{
VADisplayContextP pDisplayContext;
VADriverContextP pDriverContext;
struct drm_state *drm_state;
if (!native_dpy)
return NULL;
pDisplayContext = va_newDisplayContext();
if (!pDisplayContext)
return NULL;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverNames = va_DisplayContextGetDriverNames;
pDriverContext = va_newDriverContext(pDisplayContext);
if (!pDriverContext) {
free(pDisplayContext);
return NULL;
}
pDriverContext->native_dpy = (void *)native_dpy;
pDriverContext->display_type = VA_DISPLAY_ANDROID;
drm_state = (struct drm_state*)calloc(1, sizeof(*drm_state));
if (!drm_state) {
free(pDisplayContext);
free(pDriverContext);
return NULL;
}
pDriverContext->drm_state = drm_state;
return (VADisplay)pDisplayContext;
}

213
lib/libva/va/compat_win32.h Normal file
View file

@ -0,0 +1,213 @@
/*
* Copyright © Microsoft Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef _COMPAT_WIN32_H_
#define _COMPAT_WIN32_H_
#include <windows.h>
#include <winsock.h>
#include <io.h>
#include <time.h>
// Include stdlib.h here to make sure we
// always replace MSVC getenv definition
// with the macro / _getenv inline below
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define F_OK 0
#define RTLD_NOW 0
#define RTLD_GLOBAL 0
#ifndef NTSTATUS
typedef LONG NTSTATUS;
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023)
#define NT_SUCCESS(status) (((NTSTATUS)(status)) >= 0)
#endif
typedef unsigned int __uid_t;
#if _MSC_VER
#define getenv _getenv
#define secure_getenv _getenv
#define HAVE_SECURE_GETENV
inline char* _getenv(const char *varname)
{
static char _getenv_buf[32767];
return GetEnvironmentVariableA(varname, &_getenv_buf[0], sizeof(_getenv_buf)) ? &_getenv_buf[0] : NULL;
}
#endif
#ifdef _MSC_VER
inline char* strtok_r(char *s, const char *delim, char **save_ptr)
{
return strtok_s(s, delim, save_ptr);
}
#endif
inline void* dlopen(const char *file, int mode)
{
return LoadLibrary(file);
}
inline int dlclose(void *handle)
{
return FreeLibrary(handle);
}
inline void *dlsym(void *handle, const char *name)
{
return GetProcAddress(handle, name);
}
inline static char* dlerror()
{
static char last_err_string[512];
memset(last_err_string, '\0', 512);
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), last_err_string, (512 - 1), NULL);
return last_err_string;
}
inline __uid_t geteuid()
{
return 0;
};
inline __uid_t getuid()
{
return 0;
};
typedef DWORD pid_t;
typedef CRITICAL_SECTION pthread_mutex_t;
inline void pthread_mutex_lock(pthread_mutex_t* a)
{
EnterCriticalSection(a);
}
inline void pthread_mutex_unlock(pthread_mutex_t* a)
{
LeaveCriticalSection(a);
}
inline void pthread_mutex_init(pthread_mutex_t* a, void* attr)
{
InitializeCriticalSection(a);
}
inline void pthread_mutex_destroy(pthread_mutex_t* a)
{
DeleteCriticalSection(a);
}
inline int gettimeofday(struct timeval *tv, struct timezone* tz)
{
SYSTEMTIME st;
GetSystemTime(&st);
tv->tv_sec = st.wSecond;
tv->tv_usec = st.wMilliseconds * 1000; /* milli to micro sec */
return 0;
}
#ifdef _MSC_VER
#include <d3dkmthk.h>
#include <d3dukmdt.h>
#else
//
// DDI level handle that represents a kernel mode object (allocation, device, etc)
//
typedef UINT D3DKMT_HANDLE;
typedef struct _D3DKMT_CLOSEADAPTER {
D3DKMT_HANDLE hAdapter; // in: adapter handle
} D3DKMT_CLOSEADAPTER;
typedef struct _D3DKMT_OPENADAPTERFROMLUID {
LUID AdapterLuid;
D3DKMT_HANDLE hAdapter;
} D3DKMT_OPENADAPTERFROMLUID;
typedef enum _KMTQUERYADAPTERINFOTYPE {
KMTQAITYPE_QUERYREGISTRY = 48,
} KMTQUERYADAPTERINFOTYPE;
typedef struct _D3DKMT_QUERYADAPTERINFO {
D3DKMT_HANDLE hAdapter;
KMTQUERYADAPTERINFOTYPE Type;
VOID* pPrivateDriverData;
UINT PrivateDriverDataSize;
} D3DKMT_QUERYADAPTERINFO;
typedef struct _D3DDDI_QUERYREGISTRY_FLAGS {
union {
struct {
UINT TranslatePath : 1;
UINT MutableValue : 1;
UINT Reserved : 30;
};
UINT Value;
};
} D3DDDI_QUERYREGISTRY_FLAGS;
typedef enum _D3DDDI_QUERYREGISTRY_TYPE {
D3DDDI_QUERYREGISTRY_ADAPTERKEY = 1,
} D3DDDI_QUERYREGISTRY_TYPE;
typedef enum _D3DDDI_QUERYREGISTRY_STATUS {
D3DDDI_QUERYREGISTRY_STATUS_SUCCESS = 0,
D3DDDI_QUERYREGISTRY_STATUS_BUFFER_OVERFLOW = 1,
} D3DDDI_QUERYREGISTRY_STATUS;
typedef struct _D3DDDI_QUERYREGISTRY_INFO {
D3DDDI_QUERYREGISTRY_TYPE QueryType; // In
D3DDDI_QUERYREGISTRY_FLAGS QueryFlags; // In
WCHAR ValueName[MAX_PATH]; // In
ULONG ValueType; // In
ULONG PhysicalAdapterIndex; // In
ULONG OutputValueSize; // Out. Number of bytes written to the output value or required in case of D3DDDI_QUERYREGISTRY_STATUS_BUFFER_OVERFLOW.
D3DDDI_QUERYREGISTRY_STATUS Status; // Out
union {
DWORD OutputDword; // Out
UINT64 OutputQword; // Out
WCHAR OutputString[1]; // Out. Dynamic array
BYTE OutputBinary[1]; // Out. Dynamic array
};
} D3DDDI_QUERYREGISTRY_INFO;
typedef _Check_return_ NTSTATUS(APIENTRY *PFND3DKMT_CLOSEADAPTER)(_In_ CONST D3DKMT_CLOSEADAPTER*);
typedef _Check_return_ NTSTATUS(APIENTRY *PFND3DKMT_OPENADAPTERFROMLUID)(_Inout_ D3DKMT_OPENADAPTERFROMLUID*);
typedef _Check_return_ NTSTATUS(APIENTRY *PFND3DKMT_QUERYADAPTERINFO)(_Inout_ CONST D3DKMT_QUERYADAPTERINFO*);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _COMPAT_WIN32_H_ */

View file

@ -0,0 +1,58 @@
# Copyright (C) 2012 Intel Corporation. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/va \
$(DRM_CFLAGS) \
$(NULL)
source_c = \
va_drm.c \
va_drm_auth.c \
va_drm_utils.c \
$(NULL)
source_h = \
va_drm.h \
$(NULL)
source_h_priv = \
va_drm_auth.h \
va_drm_auth_x11.h \
va_drm_utils.h \
$(NULL)
if USE_X11
source_c += va_drm_auth_x11.c
AM_CPPFLAGS += $(X11_CFLAGS)
AM_CPPFLAGS += -DLIBVA_MAJOR_VERSION=$(LIBVA_MAJOR_VERSION)
endif
noinst_LTLIBRARIES = libva_drm.la
libva_drmincludedir = ${includedir}/va
libva_drminclude_HEADERS = $(source_h)
libva_drm_la_SOURCES = $(source_c)
noinst_HEADERS = $(source_h_priv)
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in

127
lib/libva/va/drm/va_drm.c Normal file
View file

@ -0,0 +1,127 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
* Copyright (c) 2023 Emil Velikov
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sysdeps.h"
#include <xf86drm.h>
#include "va_drm.h"
#include "va_backend.h"
#include "va_internal.h"
#include "va_drmcommon.h"
#include "va_drm_auth.h"
#include "va_drm_utils.h"
static void
va_DisplayContextDestroy(VADisplayContextP pDisplayContext)
{
if (!pDisplayContext)
return;
free(pDisplayContext->pDriverContext->drm_state);
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
static VAStatus va_DisplayContextConnect(
VADisplayContextP pDisplayContext
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;
struct drm_state * const drm_state = ctx->drm_state;
drm_magic_t magic;
int ret;
/* Authentication is only needed for a legacy DRM device */
if (ctx->display_type != VA_DISPLAY_DRM_RENDERNODES) {
ret = drmGetMagic(drm_state->fd, &magic);
if (ret < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
if (!va_drm_authenticate(drm_state->fd, magic))
return VA_STATUS_ERROR_OPERATION_FAILED;
}
drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
return VA_STATUS_SUCCESS;
}
static VAStatus
va_DisplayContextGetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
unsigned *num_drivers
)
{
VADriverContextP const ctx = pDisplayContext->pDriverContext;
VAStatus status = va_DisplayContextConnect(pDisplayContext);
if (status != VA_STATUS_SUCCESS)
return status;
return VA_DRM_GetDriverNames(ctx, drivers, num_drivers);
}
VADisplay
vaGetDisplayDRM(int fd)
{
VADisplayContextP pDisplayContext = NULL;
VADriverContextP pDriverContext = NULL;
struct drm_state *drm_state = NULL;
int node_type;
if (fd < 0 || (node_type = drmGetNodeTypeFromFd(fd)) < 0)
return NULL;
/* Create new entry */
/* XXX: handle cache? */
drm_state = calloc(1, sizeof(*drm_state));
if (!drm_state)
goto error;
drm_state->fd = fd;
pDisplayContext = va_newDisplayContext();
if (!pDisplayContext)
goto error;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverNames = va_DisplayContextGetDriverNames;
pDriverContext = va_newDriverContext(pDisplayContext);
if (!pDriverContext)
goto error;
pDriverContext->native_dpy = NULL;
pDriverContext->display_type = node_type == DRM_NODE_RENDER ?
VA_DISPLAY_DRM_RENDERNODES : VA_DISPLAY_DRM;
pDriverContext->drm_state = drm_state;
return pDisplayContext;
error:
free(pDisplayContext);
free(pDriverContext);
free(drm_state);
return NULL;
}

61
lib/libva/va/drm/va_drm.h Normal file
View file

@ -0,0 +1,61 @@
/*
* va_drm.h - Raw DRM API
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_H
#define VA_DRM_H
#include <va/va.h>
/**
* \file va_drm.h
* \brief The raw DRM API
*
* This file contains the \ref api_drm "Raw DRM API".
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Returns a VA display derived from the specified DRM connection.
*
* This function returns a (possibly cached) VA display from the
* specified DRM connection @fd.
*
* @param[in] fd the DRM connection descriptor
* @return the VA display
*/
VADisplay
vaGetDisplayDRM(int fd);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DRM_H */

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sysdeps.h"
#include <unistd.h>
#include <xf86drm.h>
#include "va_drm_auth.h"
#include "va_drm_auth_x11.h"
/* Try to authenticate the DRM connection with the supplied magic id */
bool
va_drm_authenticate(int fd, uint32_t magic)
{
/* XXX: try to authenticate through Wayland, etc. */
#ifdef HAVE_VA_X11
if (va_drm_authenticate_x11(fd, magic))
return true;
#endif
/* Default: root + master privs are needed for the following call */
return drmAuthMagic(fd, magic) == 0;
}

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_AUTH_H
#define VA_DRM_AUTH_H
#include <stdint.h>
#include <stdbool.h>
DLL_HIDDEN
bool
va_drm_authenticate(int fd, uint32_t magic);
#endif /* VA_DRM_AUTH_H */

View file

@ -0,0 +1,145 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define _GNU_SOURCE 1
#include "sysdeps.h"
#include <dlfcn.h>
#include <X11/Xlib.h>
#include "va_drm_auth_x11.h"
typedef struct drm_auth_x11 DRMAuthX11;
typedef struct drm_auth_x11_vtable DRMAuthX11VTable;
typedef void (*VAGenericFunc)(void);
typedef Display *(*X11OpenDisplayFunc)(const char *display_name);
typedef int (*X11CloseDisplayFunc)(Display *display);
typedef Bool(*VADRI2AuthenticateFunc)(
Display *display, XID window, uint32_t magic);
struct drm_auth_x11_vtable {
X11OpenDisplayFunc x11_open_display;
X11CloseDisplayFunc x11_close_display;
VADRI2AuthenticateFunc va_dri2_authenticate;
};
struct drm_auth_x11 {
void *handle; /* libva-x11.so.1 */
DRMAuthX11VTable vtable;
Display *display;
Window window;
};
static bool
get_symbol(void *handle, void *func_vptr, const char *name)
{
VAGenericFunc func, *func_ptr = func_vptr;
const char *error;
dlerror();
func = (VAGenericFunc)dlsym(handle, name);
error = dlerror();
if (error) {
fprintf(stderr, "error: failed to resolve %s() function: %s\n",
name, error);
return false;
}
*func_ptr = func;
return true;
}
static bool
drm_auth_x11_init(DRMAuthX11 *auth)
{
struct drm_auth_x11_vtable *vtable;
char libva_x11_name[16];
int ret;
ret = snprintf(
libva_x11_name, sizeof(libva_x11_name),
"libva-x11.so.%d", LIBVA_MAJOR_VERSION
);
if (ret < 0 || ret >= sizeof(libva_x11_name))
return false;
auth->handle = dlopen(libva_x11_name, RTLD_LAZY | RTLD_GLOBAL);
if (!auth->handle) {
perror("open lib");
return false;
}
vtable = &auth->vtable;
if (!get_symbol(RTLD_DEFAULT, &vtable->x11_open_display, "XOpenDisplay"))
return false;
if (!get_symbol(RTLD_DEFAULT, &vtable->x11_close_display, "XCloseDisplay"))
return false;
if (!get_symbol(auth->handle, &vtable->va_dri2_authenticate,
"VA_DRI2Authenticate"))
return false;
auth->display = vtable->x11_open_display(NULL);
if (!auth->display)
return false;
auth->window = DefaultRootWindow(auth->display);
return true;
}
static void
drm_auth_x11_terminate(DRMAuthX11 *auth)
{
if (!auth)
return;
if (auth->display) {
auth->vtable.x11_close_display(auth->display);
auth->display = NULL;
auth->window = None;
}
if (auth->handle) {
dlclose(auth->handle);
auth->handle = NULL;
}
}
/* Try to authenticate the DRM connection with the supplied magic through X11 */
bool
va_drm_authenticate_x11(int fd, uint32_t magic)
{
DRMAuthX11VTable * vtable;
DRMAuthX11 auth;
bool success = false;
memset(&auth, 0, sizeof(auth));
if (!drm_auth_x11_init(&auth))
goto end;
vtable = &auth.vtable;
success = vtable->va_dri2_authenticate(auth.display, auth.window, magic);
end:
drm_auth_x11_terminate(&auth);
return success;
}

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_AUTH_X11_H
#define VA_DRM_AUTH_X11_H
#include <stdint.h>
#include <stdbool.h>
DLL_HIDDEN
bool
va_drm_authenticate_x11(int fd, uint32_t magic);
#endif /* VA_DRM_AUTH_X11_H */

View file

@ -0,0 +1,113 @@
/*
* va_drm_utils.c - VA/DRM Utilities
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
* Copyright (c) 2023 Emil Velikov
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sysdeps.h"
#include <xf86drm.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include "va_drm_utils.h"
#include "va_drmcommon.h"
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
static char *
va_DRM_GetDrmDriverName(int fd)
{
drmVersionPtr drm_version = drmGetVersion(fd);
char *driver_name;
if (!drm_version)
return NULL;
driver_name = strdup(drm_version->name);
drmFreeVersion(drm_version);
return driver_name;
}
/* Returns the VA driver names and how many they are, for the active display */
VAStatus
VA_DRM_GetDriverNames(VADriverContextP ctx, char **drivers, unsigned *num_drivers)
{
#define MAX_NAMES 2 // Adjust if needed
static const struct {
const char * const drm_driver;
const char * const va_driver[MAX_NAMES];
} map[] = {
{ "xe", { "iHD" } },
{ "i915", { "iHD", "i965" } }, // Intel Media and OTC GenX
{ "pvrsrvkm", { "pvr" } }, // Intel UMG PVR
{ "radeon", { "r600", "radeonsi" } }, // Mesa Gallium
{ "amdgpu", { "radeonsi" } }, // Mesa Gallium
{ "WSL", { "d3d12" } }, // Mesa Gallium
{ "nvidia-drm", { "nvidia" } }, // Unofficial NVIDIA
};
const struct drm_state * const drm_state = ctx->drm_state;
char *drm_driver;
unsigned count = 0;
if (!drm_state || drm_state->fd < 0)
return VA_STATUS_ERROR_INVALID_DISPLAY;
drm_driver = va_DRM_GetDrmDriverName(drm_state->fd);
if (!drm_driver)
return VA_STATUS_ERROR_UNKNOWN;
/* Map vgem to WSL2 for Windows subsystem for linux */
struct utsname sysinfo = {};
if (!strncmp(drm_driver, "vgem", 4) && uname(&sysinfo) >= 0 &&
strstr(sysinfo.release, "WSL")) {
free(drm_driver);
drm_driver = strdup("WSL");
if (!drm_driver)
return VA_STATUS_ERROR_UNKNOWN;
}
for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
if (strcmp(map[i].drm_driver, drm_driver) == 0) {
const char * const *va_drivers = map[i].va_driver;
for (; count < MAX_NAMES && va_drivers[count] && count < *num_drivers; count++)
drivers[count] = strdup(va_drivers[count]);
break;
}
}
/* Fallback to the drm driver, if there's no va equivalent in the map. */
if (!count) {
drivers[count] = drm_driver;
count++;
} else {
free(drm_driver);
}
*num_drivers = count;
return VA_STATUS_SUCCESS;
}

View file

@ -0,0 +1,55 @@
/*
* va_drm_utils.h - VA/DRM Utilities
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_UTILS_H
#define VA_DRM_UTILS_H
#include <va/va_backend.h>
/**
* \file va_drm_utils.h
* \brief VA/DRM Utilities
*
* This file contains VA/DRM utility functions. The API herein defined is
* internal to libva. Users include the VA/DRM API itself or VA/Android,
* should it be based on DRM.
*/
#ifdef __cplusplus
extern "C" {
#endif
DLL_HIDDEN
VAStatus
VA_DRM_GetDriverNames(VADriverContextP ctx, char **drivers, unsigned *num_drivers);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DRM_UTILS_H */

View file

@ -0,0 +1,50 @@
# Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/va \
-I$(top_srcdir)/va/x11 \
$(X11_CFLAGS) \
$(GLX_CFLAGS) \
$(NULL)
source_c = \
va_glx.c \
va_glx_impl.c \
$(NULL)
source_h = \
va_backend_glx.h \
va_glx.h \
$(NULL)
source_h_priv = \
va_glx_impl.h \
va_glx_private.h \
$(NULL)
noinst_LTLIBRARIES = libva_glx.la
libva_glxincludedir = ${includedir}/va
libva_glxinclude_HEADERS = $(source_h)
libva_glx_la_SOURCES = $(source_c)
noinst_HEADERS = $(source_h_priv)

View file

@ -0,0 +1,54 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_BACKEND_GLX_H
#define VA_BACKEND_GLX_H
struct VADriverContext;
struct VADriverVTableGLX {
/* Optional: create a surface used for display to OpenGL */
VAStatus(*vaCreateSurfaceGLX)(
struct VADriverContext *ctx,
unsigned int gl_target,
unsigned int gl_texture,
void **gl_surface
);
/* Optional: destroy a VA/GLX surface */
VAStatus(*vaDestroySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface
);
/* Optional: copy a VA surface to a VA/GLX surface */
VAStatus(*vaCopySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
);
};
#endif /* VA_BACKEND_GLX_H */

167
lib/libva/va/glx/va_glx.c Normal file
View file

@ -0,0 +1,167 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sysdeps.h"
#include <stdlib.h>
#include "va_glx_private.h"
#include "va_glx_impl.h"
#define INIT_CONTEXT(ctx, dpy) do { \
if (!vaDisplayIsValid(dpy)) \
return VA_STATUS_ERROR_INVALID_DISPLAY; \
\
ctx = ((VADisplayContextP)(dpy))->pDriverContext; \
if (!(ctx)) \
return VA_STATUS_ERROR_INVALID_DISPLAY; \
\
VAStatus status = va_glx_init_context(ctx); \
if (status != VA_STATUS_SUCCESS) \
return status; \
} while (0)
#define INVOKE(ctx, func, args) do { \
VADriverVTableGLXP vtable; \
vtable = &VA_DRIVER_CONTEXT_GLX(ctx)->vtable; \
if (!vtable->va##func##GLX) \
return VA_STATUS_ERROR_UNIMPLEMENTED; \
status = vtable->va##func##GLX args; \
} while (0)
// Destroy VA/GLX display context
static void va_DisplayContextDestroy(VADisplayContextP pDisplayContext)
{
VADisplayContextGLXP pDisplayContextGLX;
VADriverContextP pDriverContext;
VADriverContextGLXP pDriverContextGLX;
if (!pDisplayContext)
return;
pDriverContext = pDisplayContext->pDriverContext;
pDriverContextGLX = pDriverContext->glx;
if (pDriverContextGLX) {
free(pDriverContextGLX);
pDriverContext->glx = NULL;
}
pDisplayContextGLX = pDisplayContext->opaque;
if (pDisplayContextGLX) {
vaDestroyFunc vaDestroy = pDisplayContextGLX->vaDestroy;
free(pDisplayContextGLX);
pDisplayContext->opaque = NULL;
if (vaDestroy)
vaDestroy(pDisplayContext);
}
}
// Return a suitable VADisplay for VA API
VADisplay vaGetDisplayGLX(Display *native_dpy)
{
VADisplay dpy = NULL;
VADisplayContextP pDisplayContext = NULL;
VADisplayContextGLXP pDisplayContextGLX = NULL;
VADriverContextP pDriverContext;
VADriverContextGLXP pDriverContextGLX = NULL;
dpy = vaGetDisplay(native_dpy);
if (!dpy)
return NULL;
pDisplayContext = (VADisplayContextP)dpy;
pDriverContext = pDisplayContext->pDriverContext;
pDisplayContextGLX = calloc(1, sizeof(*pDisplayContextGLX));
if (!pDisplayContextGLX)
goto error;
pDriverContextGLX = calloc(1, sizeof(*pDriverContextGLX));
if (!pDriverContextGLX)
goto error;
pDriverContext->display_type = VA_DISPLAY_GLX;
pDisplayContextGLX->vaDestroy = pDisplayContext->vaDestroy;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->opaque = pDisplayContextGLX;
pDriverContext->glx = pDriverContextGLX;
return dpy;
error:
free(pDriverContextGLX);
free(pDisplayContextGLX);
pDisplayContext->vaDestroy(pDisplayContext);
return NULL;
}
// Create a surface used for display to OpenGL
VAStatus vaCreateSurfaceGLX(
VADisplay dpy,
GLenum target,
GLuint texture,
void **gl_surface
)
{
VADriverContextP ctx;
VAStatus status;
/* Make sure it is a valid GL texture object */
if (!glIsTexture(texture))
return VA_STATUS_ERROR_INVALID_PARAMETER;
INIT_CONTEXT(ctx, dpy);
INVOKE(ctx, CreateSurface, (ctx, target, texture, gl_surface));
return status;
}
// Destroy a VA/GLX surface
VAStatus vaDestroySurfaceGLX(
VADisplay dpy,
void *gl_surface
)
{
VADriverContextP ctx;
VAStatus status;
INIT_CONTEXT(ctx, dpy);
INVOKE(ctx, DestroySurface, (ctx, gl_surface));
return status;
}
// Copy a VA surface to a VA/GLX surface
VAStatus vaCopySurfaceGLX(
VADisplay dpy,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
)
{
VADriverContextP ctx;
VAStatus status;
INIT_CONTEXT(ctx, dpy);
INVOKE(ctx, CopySurface, (ctx, gl_surface, surface, flags));
return status;
}

109
lib/libva/va/glx/va_glx.h Normal file
View file

@ -0,0 +1,109 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_GLX_H
#define VA_GLX_H
#include <va/va.h>
#include <GL/glx.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Return a suitable VADisplay for VA API
*
* @param[in] dpy the X11 display
* @return a VADisplay
*/
VADisplay vaGetDisplayGLX(
Display *dpy
);
/**
* Create a surface used for display to OpenGL
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] target the GL target to which the texture needs to be bound
* @param[in] texture the GL texture
* @param[out] gl_surface the VA/GLX surface
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaCreateSurfaceGLX(
VADisplay dpy,
GLenum target,
GLuint texture,
void **gl_surface
);
/**
* Destroy a VA/GLX surface
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] gl_surface the VA surface
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaDestroySurfaceGLX(
VADisplay dpy,
void *gl_surface
);
/**
* Copy a VA surface to a VA/GLX surface
*
* This function will not return until the copy is completed. At this
* point, the underlying GL texture will contain the surface pixels
* in an RGB format defined by the user.
*
* The application shall maintain the live GLX context itself.
* Implementations are free to use glXGetCurrentContext() and
* glXGetCurrentDrawable() functions for internal purposes.
*
* @param[in] dpy the VA display
* @param[in] gl_surface the VA/GLX destination surface
* @param[in] surface the VA source surface
* @param[in] flags the PutSurface flags
* @return VA_STATUS_SUCCESS if successful
*/
VAStatus vaCopySurfaceGLX(
VADisplay dpy,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
);
#ifdef __cplusplus
}
#endif
#endif /* VA_GLX_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_GLX_IMPL_H
#define VA_GLX_IMPL_H
/**
* Initialize GLX driver context
*
* @param[in] ctx the VA driver context
* @return VA_STATUS_SUCCESS if successful
*/
DLL_HIDDEN
VAStatus va_glx_init_context(VADriverContextP ctx);
#endif /* VA_GLX_IMPL_H */

View file

@ -0,0 +1,86 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_GLX_PRIVATE_H
#define VA_GLX_PRIVATE_H
#include "sysdeps.h"
#include "va.h"
#include "va_backend.h"
#include "va_x11.h"
#include "va_glx.h"
#include "va_backend_glx.h"
#include <GL/glxext.h>
#if GLX_GLXEXT_VERSION < 18
typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
#endif
#if GLX_GLXEXT_VERSION < 27
/* XXX: this is not exactly that version but this is the only means to
make sure we have the correct <GL/glx.h> with those signatures */
typedef GLXPixmap(*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
#endif
typedef struct VAOpenGLVTable *VAOpenGLVTableP;
struct VAOpenGLVTable {
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers;
PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer;
PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers;
PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers;
PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer;
PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d;
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status;
};
typedef struct VADisplayContextGLX *VADisplayContextGLXP;
typedef struct VADriverContextGLX *VADriverContextGLXP;
typedef struct VASurfaceGLX *VASurfaceGLXP;
typedef struct VADriverVTableGLX *VADriverVTableGLXP;
typedef void (*vaDestroyFunc)(VADisplayContextP);
struct VADisplayContextGLX {
vaDestroyFunc vaDestroy;
};
#define VA_DRIVER_CONTEXT_GLX(ctx) ((VADriverContextGLXP)((ctx)->glx))
struct VADriverContextGLX {
struct VADriverVTableGLX vtable;
struct VAOpenGLVTable gl_vtable;
unsigned int is_initialized : 1;
};
#endif /* VA_GLX_PRIVATE_H */

87
lib/libva/va/libva.def Normal file
View file

@ -0,0 +1,87 @@
EXPORTS
vaInitialize
vaErrorStr
vaTerminate
vaQueryVendorString
vaMaxNumProfiles
vaMaxNumEntrypoints
vaQueryConfigProfiles
vaQueryConfigEntrypoints
vaGetConfigAttributes
vaProfileStr
vaEntrypointStr
vaConfigAttribTypeStr
vaAcquireBufferHandle
vaAssociateSubpicture
vaBeginPicture
vaCreateBuffer
vaCreateConfig
vaCreateContext
vaCreateImage
vaCreateSubpicture
vaCreateSurfaces
vaDeassociateSubpicture
vaDeriveImage
vaDestroyBuffer
vaDestroyConfig
vaDestroyContext
vaDestroyImage
vaDestroySubpicture
vaDestroySurfaces
vaEndPicture
vaGetDisplayAttributes
vaGetImage
vaMapBuffer
vaMapBuffer2
vaMaxNumDisplayAttributes
vaMaxNumImageFormats
vaMaxNumSubpictureFormats
vaPutImage
vaQueryDisplayAttributes
vaQueryImageFormats
vaQuerySubpictureFormats
vaQuerySurfaceAttributes
vaQuerySurfaceStatus
vaQueryVideoProcFilterCaps
vaQueryVideoProcFilters
vaQueryVideoProcPipelineCaps
vaReleaseBufferHandle
vaRenderPicture
vaSetDisplayAttributes
vaSetErrorCallback
vaSetInfoCallback
vaSetSubpictureGlobalAlpha
vaSyncSurface
vaUnmapBuffer
vaSetDriverName
vaSyncBuffer
vaQueryConfigAttributes
vaBufferSetNumElements
vaQuerySurfaceError
vaSetImagePalette
vaSetSubpictureChromakey
vaBufferInfo
vaLockSurface
vaUnlockSurface
vaCreateMFContext
vaMFAddContext
vaMFReleaseContext
vaMFSubmit
vaCreateBuffer2
vaQueryProcessingRate
vaExportSurfaceHandle
va_newDisplayContext
va_newDriverContext
vaMaxNumConfigAttributes
vaBufferTypeStr
vaAttachProtectedSession
vaCopy
vaCreateProtectedSession
vaDestroyProtectedSession
vaDetachProtectedSession
vaProtectedSessionExecute
vaSetSubpictureImage
vaStatusStr
vaSyncSurface2
vaDisplayIsValid
vaGetLibFunc

9
lib/libva/va/libva.syms Normal file
View file

@ -0,0 +1,9 @@
VA_API_0.32.0 {
local:
vaCreateSurfaces_0_32_0;
};
VA_API_0.33.0 {
global:
vaCreateSurfaces;
} VA_API_0.32.0;

View file

@ -0,0 +1,2 @@
EXPORTS
vaGetDisplayWin32

336
lib/libva/va/meson.build Normal file
View file

@ -0,0 +1,336 @@
version_cfg = configuration_data()
version_cfg.set('VA_API_MAJOR_VERSION', va_api_major_version)
version_cfg.set('VA_API_MINOR_VERSION', va_api_minor_version)
version_cfg.set('VA_API_MICRO_VERSION', va_api_micro_version)
version_cfg.set('VA_API_VERSION', va_api_version)
version_file = configure_file(
input : 'va_version.h.in',
output : 'va_version.h',
configuration : version_cfg)
libva_sources = [
'va.c',
'va_compat.c',
'va_str.c',
'va_trace.c',
]
libva_headers = [
'va.h',
'va_backend.h',
'va_backend_prot.h',
'va_backend_vpp.h',
'va_compat.h',
'va_dec_hevc.h',
'va_dec_jpeg.h',
'va_dec_vp8.h',
'va_dec_vp9.h',
'va_dec_av1.h',
'va_dec_vvc.h',
'va_drmcommon.h',
'va_egl.h',
'va_enc_hevc.h',
'va_enc_h264.h',
'va_enc_jpeg.h',
'va_enc_vp8.h',
'va_fei.h',
'va_fei_h264.h',
'va_fei_hevc.h',
'va_enc_mpeg2.h',
'va_enc_vp9.h',
'va_enc_av1.h',
'va_str.h',
'va_tpi.h',
'va_prot.h',
'va_vpp.h',
version_file,
]
# headers that have be copied for subprojects
libva_headers_subproject = []
libva_headers_priv = [
'sysdeps.h',
'va_internal.h',
'va_trace.h',
]
libva_sym = 'libva.syms'
libva_sym_arg = '-Wl,-version-script,' + '@0@/@1@'.format(meson.current_source_dir(), libva_sym)
libva_link_args = []
libva_link_depends = []
if cc.links('void vaCreateSurfaces_0_32_0(void) {} void vaCreateSurfaces() {}', name: '-Wl,--version-script', args: ['-shared', libva_sym_arg])
libva_link_args = libva_sym_arg
libva_link_depends = libva_sym
endif
install_headers(libva_headers, subdir : 'va')
libva = shared_library(
'va',
sources : libva_sources +
libva_headers +
libva_headers_priv,
vs_module_defs : 'libva.def',
soversion : host_machine.system() == 'windows' ? '' : libva_lt_current,
version : libva_lt_version,
c_args : [ '-DSYSCONFDIR="' + sysconfdir + '"'] + ['-DVA_DRIVERS_PATH="' + driverdir + '"'],
include_directories : configinc,
link_args : libva_link_args,
link_depends : libva_link_depends,
install : true,
dependencies : [ dl_dep ])
libva_dep = declare_dependency(
link_with : libva,
include_directories : configinc,
dependencies : [ dl_dep ])
if WITH_DRM
libva_drm_sources = [
'drm/va_drm.c',
'drm/va_drm_auth.c',
'drm/va_drm_utils.c',
]
libva_drm_headers = [
'drm/va_drm.h',
]
libva_headers_subproject += libva_drm_headers
libva_drm_headers_priv = [
'drm/va_drm_auth.h',
'drm/va_drm_auth_x11.h',
'drm/va_drm_utils.h',
]
deps = [ libdrm_dep ]
libva_drm_args = []
if WITH_X11
libva_drm_sources += [ 'drm/va_drm_auth_x11.c' ]
libva_drm_args += [
'-DHAVE_VA_X11',
'-DLIBVA_MAJOR_VERSION=@0@'.format(libva_major_version)
]
deps += [ x11_dep ]
endif
install_headers(libva_drm_headers, subdir : 'va')
libva_drm = shared_library(
'va-drm',
sources : libva_drm_sources +
libva_drm_headers +
libva_drm_headers_priv,
soversion : libva_lt_current,
version : libva_lt_version,
install : true,
c_args : libva_drm_args,
dependencies : deps + [ libva_dep ])
libva_drm_dep = declare_dependency(
link_with : libva_drm,
include_directories : configinc,
dependencies : deps)
endif
if WITH_X11
libva_x11_sources = [
'x11/dri2_util.c',
'x11/va_dri2.c',
'x11/va_dri3.c',
'drm/va_drm_utils.c',
'x11/va_dricommon.c',
'x11/va_fglrx.c',
'x11/va_nvctrl.c',
'x11/va_x11.c',
]
libva_dri_headers = [
'x11/va_dri2.h',
'x11/va_dri3.h',
'x11/va_dricommon.h',
]
libva_x11_headers = ['va_x11.h'] + libva_dri_headers + ['va_trace.h']
libva_headers_subproject += libva_dri_headers
libva_x11_headers_priv = [
'x11/va_dri2str.h',
'x11/va_dri2tokens.h',
'x11/va_dri3.h',
'x11/va_fglrx.h',
'x11/va_nvctrl.h',
]
install_headers(libva_x11_headers, subdir : 'va')
deps = [ libdrm_dep, x11_dep, xext_dep, xfixes_dep, x11_xcb_dep, xcb_dep, xcb_dri3_dep, libva_dep ]
libva_x11 = shared_library(
'va-x11',
sources : libva_x11_sources +
libva_x11_headers +
libva_x11_headers_priv,
soversion : libva_lt_current,
version : libva_lt_version,
install : true,
dependencies : deps)
libva_x11_dep = declare_dependency(
link_with : libva_x11,
include_directories : configinc,
dependencies : deps)
endif
if WITH_GLX
libva_glx_sources = [
'glx/va_glx.c',
'glx/va_glx_impl.c',
]
libva_glx_headers = [
'glx/va_backend_glx.h',
'glx/va_glx.h',
]
libva_headers_subproject += libva_glx_headers
libva_glx_headers_priv = [
'glx/va_glx_impl.h',
'glx/va_glx_private.h',
]
install_headers(libva_glx_headers, subdir : 'va')
deps = [ gl_dep, libva_x11_dep ]
libva_glx = shared_library(
'va-glx',
sources : libva_glx_sources +
libva_glx_headers +
libva_glx_headers_priv,
soversion : libva_lt_current,
version : libva_lt_version,
install : true,
dependencies : deps)
libva_glx_dep = declare_dependency(
link_with : libva_glx,
include_directories : configinc,
dependencies : deps)
endif
if WITH_WAYLAND
libva_wayland_sources = [
'wayland/va_wayland.c',
'wayland/va_wayland_linux_dmabuf.c',
'wayland/va_wayland_drm.c',
'wayland/va_wayland_emgd.c',
'drm/va_drm_utils.c',
]
libva_wayland_headers = [
'wayland/va_backend_wayland.h',
'wayland/va_wayland.h',
]
libva_headers_subproject += libva_wayland_headers
libva_wayland_headers_priv = [
'wayland/va_wayland_linux_dmabuf.h',
'wayland/va_wayland_drm.h',
'wayland/va_wayland_emgd.h',
'wayland/va_wayland_private.h',
]
# XXX: grab linux-dmabuf-v1.xml from wayland-protocols
protocols = {
'wayland-drm': 'wayland/wayland-drm.xml',
'linux-dmabuf-v1': 'wayland/linux-dmabuf-v1.xml',
}
protocol_files = []
foreach name, xml : protocols
protocol_files += custom_target(
name + '-client-protocol.c',
output : name + '-client-protocol.c',
input : xml,
command : [wl_scanner, 'private-code', '@INPUT@', '@OUTPUT@'])
protocol_files += custom_target(
name + '-client-protocol.h',
output : name + '-client-protocol.h',
input : xml,
command : [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])
endforeach
install_headers(libva_wayland_headers, subdir : 'va')
deps = [ libdrm_dep, wayland_dep, libva_dep ]
libva_wayland = shared_library(
'va-wayland',
sources : libva_wayland_sources +
libva_wayland_headers +
libva_wayland_headers_priv +
protocol_files,
soversion : libva_lt_current,
version : libva_lt_version,
install : true,
dependencies : deps)
libva_wayland_dep = declare_dependency(
link_with : libva_wayland,
include_directories : configinc,
dependencies : deps)
endif
fs = import('fs')
if WITH_WIN32
libva_win32_sources = [
'win32/va_win32.c',
]
libva_win32_headers = [
'win32/va_win32.h',
]
libva_headers_subproject += libva_win32_headers
deps = [ libwin32_dep, libva_dep ]
libva_win32_args = [
'-DLIBVA_MAJOR_VERSION=@0@'.format(libva_major_version)
]
install_headers(libva_win32_headers, subdir : 'va')
libva_win32 = shared_library(
'va_win32',
sources : libva_win32_sources +
libva_win32_headers,
soversion : host_machine.system() == 'windows' ? '' : libva_lt_current,
version : libva_lt_version,
install : true,
c_args : libva_win32_args,
vs_module_defs : 'libva_win32.def',
dependencies : deps)
libva_win32_dep = declare_dependency(
link_with : libva_win32,
include_directories : configinc,
dependencies : deps)
endif
foreach header : libva_headers_subproject
if meson.version().version_compare('>= 0.64')
fs.copyfile(header)
else
configure_file(output: fs.name(header), input: header, copy: true)
endif
endforeach

54
lib/libva/va/sysdeps.h Normal file
View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SYSDEPS_H
#define SYSDEPS_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
// Defines for visibility attribute
// based on https://gcc.gnu.org/wiki/Visibility
#if defined _WIN32 || defined __CYGWIN__
# define DLL_EXPORT __declspec(dllexport)
# define DLL_HIDDEN
#else
#if __GNUC__ >= 4
# define DLL_HIDDEN __attribute__((visibility("hidden")))
# define DLL_EXPORT __attribute__((visibility("default")))
#else
# define DLL_HIDDEN
# define DLL_EXPORT
#endif
#endif
#endif /* SYSDEPS_H */

2457
lib/libva/va/va.c Normal file

File diff suppressed because it is too large Load diff

5422
lib/libva/va/va.h Normal file

File diff suppressed because it is too large Load diff

49
lib/libva/va/va_android.h Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _VA_ANDROID_H_
#define _VA_ANDROID_H_
#include <va/va.h>
/** \brief Android Gralloc buffer memory type. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC 0x00100000
/** \brief Android ION buffer memory type. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION 0x00200000
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns a suitable VADisplay for VA API
*/
VADisplay vaGetDisplay(
void *android_dpy
);
#ifdef __cplusplus
}
#endif
#endif /* _VA_ANDROID_H_ */

733
lib/libva/va/va_backend.h Normal file
View file

@ -0,0 +1,733 @@
/*
* Copyright (c) 2007 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Video Decode Acceleration -Backend API
*/
#ifndef _VA_BACKEND_H_
#define _VA_BACKEND_H_
#include <va/va.h>
typedef struct VADriverContext *VADriverContextP;
typedef struct VADisplayContext *VADisplayContextP;
/** \brief VA display types. */
enum {
/** \brief Mask to major identifier for VA display type. */
VA_DISPLAY_MAJOR_MASK = 0xf0,
/** \brief VA/X11 API is used, through vaGetDisplay() entry-point. */
VA_DISPLAY_X11 = 0x10,
/** \brief VA/GLX API is used, through vaGetDisplayGLX() entry-point. */
VA_DISPLAY_GLX = (VA_DISPLAY_X11 | (1 << 0)),
/** \brief VA/Android API is used, through vaGetDisplay() entry-point. */
VA_DISPLAY_ANDROID = 0x20,
/** \brief VA/DRM API is used, through vaGetDisplayDRM() entry-point. */
VA_DISPLAY_DRM = 0x30,
/** \brief VA/DRM API is used, with a render-node device path */
VA_DISPLAY_DRM_RENDERNODES = (VA_DISPLAY_DRM | (1 << 0)),
/** \brief VA/Wayland API is used, through vaGetDisplayWl() entry-point. */
VA_DISPLAY_WAYLAND = 0x40,
/** \brief VA/Win32 API is used, through vaGetDisplayWin32() entry-point. */
VA_DISPLAY_WIN32 = 0x80,
};
struct VADriverVTable {
VAStatus(*vaTerminate)(VADriverContextP ctx);
VAStatus(*vaQueryConfigProfiles)(
VADriverContextP ctx,
VAProfile *profile_list, /* out */
int *num_profiles /* out */
);
VAStatus(*vaQueryConfigEntrypoints)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint *entrypoint_list, /* out */
int *num_entrypoints /* out */
);
VAStatus(*vaGetConfigAttributes)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list, /* in/out */
int num_attribs
);
VAStatus(*vaCreateConfig)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
);
VAStatus(*vaDestroyConfig)(
VADriverContextP ctx,
VAConfigID config_id
);
VAStatus(*vaQueryConfigAttributes)(
VADriverContextP ctx,
VAConfigID config_id,
VAProfile *profile, /* out */
VAEntrypoint *entrypoint, /* out */
VAConfigAttrib *attrib_list, /* out */
int *num_attribs /* out */
);
VAStatus(*vaCreateSurfaces)(
VADriverContextP ctx,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
);
VAStatus(*vaDestroySurfaces)(
VADriverContextP ctx,
VASurfaceID *surface_list,
int num_surfaces
);
VAStatus(*vaCreateContext)(
VADriverContextP ctx,
VAConfigID config_id,
int picture_width,
int picture_height,
int flag,
VASurfaceID *render_targets,
int num_render_targets,
VAContextID *context /* out */
);
VAStatus(*vaDestroyContext)(
VADriverContextP ctx,
VAContextID context
);
VAStatus(*vaCreateBuffer)(
VADriverContextP ctx,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
void *data, /* in */
VABufferID *buf_id
);
VAStatus(*vaBufferSetNumElements)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
unsigned int num_elements /* in */
);
VAStatus(*vaMapBuffer)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
void **pbuf /* out */
);
VAStatus(*vaUnmapBuffer)(
VADriverContextP ctx,
VABufferID buf_id /* in */
);
VAStatus(*vaDestroyBuffer)(
VADriverContextP ctx,
VABufferID buffer_id
);
VAStatus(*vaBeginPicture)(
VADriverContextP ctx,
VAContextID context,
VASurfaceID render_target
);
VAStatus(*vaRenderPicture)(
VADriverContextP ctx,
VAContextID context,
VABufferID *buffers,
int num_buffers
);
VAStatus(*vaEndPicture)(
VADriverContextP ctx,
VAContextID context
);
VAStatus(*vaSyncSurface)(
VADriverContextP ctx,
VASurfaceID render_target
);
VAStatus(*vaQuerySurfaceStatus)(
VADriverContextP ctx,
VASurfaceID render_target,
VASurfaceStatus *status /* out */
);
VAStatus(*vaQuerySurfaceError)(
VADriverContextP ctx,
VASurfaceID render_target,
VAStatus error_status,
void **error_info /*out*/
);
VAStatus(*vaPutSurface)(
VADriverContextP ctx,
VASurfaceID surface,
void* draw, /* Drawable of window system */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
VAStatus(*vaQueryImageFormats)(
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
int *num_formats /* out */
);
VAStatus(*vaCreateImage)(
VADriverContextP ctx,
VAImageFormat *format,
int width,
int height,
VAImage *image /* out */
);
VAStatus(*vaDeriveImage)(
VADriverContextP ctx,
VASurfaceID surface,
VAImage *image /* out */
);
VAStatus(*vaDestroyImage)(
VADriverContextP ctx,
VAImageID image
);
VAStatus(*vaSetImagePalette)(
VADriverContextP ctx,
VAImageID image,
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VAImage struct
*/
unsigned char *palette
);
VAStatus(*vaGetImage)(
VADriverContextP ctx,
VASurfaceID surface,
int x, /* coordinates of the upper left source pixel */
int y,
unsigned int width, /* width and height of the region */
unsigned int height,
VAImageID image
);
VAStatus(*vaPutImage)(
VADriverContextP ctx,
VASurfaceID surface,
VAImageID image,
int src_x,
int src_y,
unsigned int src_width,
unsigned int src_height,
int dest_x,
int dest_y,
unsigned int dest_width,
unsigned int dest_height
);
VAStatus(*vaQuerySubpictureFormats)(
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int *flags, /* out */
unsigned int *num_formats /* out */
);
VAStatus(*vaCreateSubpicture)(
VADriverContextP ctx,
VAImageID image,
VASubpictureID *subpicture /* out */
);
VAStatus(*vaDestroySubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture
);
VAStatus(*vaSetSubpictureImage)(
VADriverContextP ctx,
VASubpictureID subpicture,
VAImageID image
);
VAStatus(*vaSetSubpictureChromakey)(
VADriverContextP ctx,
VASubpictureID subpicture,
unsigned int chromakey_min,
unsigned int chromakey_max,
unsigned int chromakey_mask
);
VAStatus(*vaSetSubpictureGlobalAlpha)(
VADriverContextP ctx,
VASubpictureID subpicture,
float global_alpha
);
VAStatus(*vaAssociateSubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture,
VASurfaceID *target_surfaces,
int num_surfaces,
short src_x, /* upper left offset in subpicture */
short src_y,
unsigned short src_width,
unsigned short src_height,
short dest_x, /* upper left offset in surface */
short dest_y,
unsigned short dest_width,
unsigned short dest_height,
/*
* whether to enable chroma-keying or global-alpha
* see VA_SUBPICTURE_XXX values
*/
unsigned int flags
);
VAStatus(*vaDeassociateSubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture,
VASurfaceID *target_surfaces,
int num_surfaces
);
VAStatus(*vaQueryDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list, /* out */
int *num_attributes /* out */
);
VAStatus(*vaGetDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list, /* in/out */
int num_attributes
);
VAStatus(*vaSetDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list,
int num_attributes
);
/* used by va trace */
VAStatus(*vaBufferInfo)(
VADriverContextP ctx, /* in */
VABufferID buf_id, /* in */
VABufferType *type, /* out */
unsigned int *size, /* out */
unsigned int *num_elements /* out */
);
/* lock/unlock surface for external access */
VAStatus(*vaLockSurface)(
VADriverContextP ctx,
VASurfaceID surface,
unsigned int *fourcc, /* out for follow argument */
unsigned int *luma_stride,
unsigned int *chroma_u_stride,
unsigned int *chroma_v_stride,
unsigned int *luma_offset,
unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset,
unsigned int *buffer_name, /* if it is not NULL, assign the low lever
* surface buffer name
*/
void **buffer /* if it is not NULL, map the surface buffer for
* CPU access
*/
);
VAStatus(*vaUnlockSurface)(
VADriverContextP ctx,
VASurfaceID surface
);
/* DEPRECATED */
VAStatus
(*vaGetSurfaceAttributes)(
VADriverContextP dpy,
VAConfigID config,
VASurfaceAttrib *attrib_list,
unsigned int num_attribs
);
VAStatus
(*vaCreateSurfaces2)(
VADriverContextP ctx,
unsigned int format,
unsigned int width,
unsigned int height,
VASurfaceID *surfaces,
unsigned int num_surfaces,
VASurfaceAttrib *attrib_list,
unsigned int num_attribs
);
VAStatus
(*vaQuerySurfaceAttributes)(
VADriverContextP dpy,
VAConfigID config,
VASurfaceAttrib *attrib_list,
unsigned int *num_attribs
);
VAStatus
(*vaAcquireBufferHandle)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
VABufferInfo * buf_info /* in/out */
);
VAStatus
(*vaReleaseBufferHandle)(
VADriverContextP ctx,
VABufferID buf_id /* in */
);
VAStatus(*vaCreateMFContext)(
VADriverContextP ctx,
VAMFContextID *mfe_context /* out */
);
VAStatus(*vaMFAddContext)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID context
);
VAStatus(*vaMFReleaseContext)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID context
);
VAStatus(*vaMFSubmit)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID *contexts,
int num_contexts
);
VAStatus(*vaCreateBuffer2)(
VADriverContextP ctx,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int width, /* in */
unsigned int height, /* in */
unsigned int *unit_size, /* out */
unsigned int *pitch, /* out */
VABufferID *buf_id /* out */
);
VAStatus(*vaQueryProcessingRate)(
VADriverContextP ctx, /* in */
VAConfigID config_id, /* in */
VAProcessingRateParameter *proc_buf,/* in */
unsigned int *processing_rate /* out */
);
VAStatus
(*vaExportSurfaceHandle)(
VADriverContextP ctx,
VASurfaceID surface_id, /* in */
uint32_t mem_type, /* in */
uint32_t flags, /* in */
void *descriptor /* out */
);
VAStatus(*vaSyncSurface2)(
VADriverContextP ctx,
VASurfaceID surface,
uint64_t timeout_ns
);
VAStatus(*vaSyncBuffer)(
VADriverContextP ctx,
VABufferID buf_id,
uint64_t timeout_ns
);
VAStatus
(*vaCopy)(
VADriverContextP ctx, /* in */
VACopyObject *dst, /* in */
VACopyObject *src, /* in */
VACopyOption option /* in */
);
VAStatus(*vaMapBuffer2)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
void **pbuf, /* out */
uint32_t flags /* in */
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[53];
};
struct VADriverContext {
void *pDriverData;
/**
* The core VA implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTable *vtable;
/**
* The VA/GLX implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/GLX API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
struct VADriverVTableGLX *vtable_glx;
/**
* The VA/EGL implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/EGL API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
struct VADriverVTableEGL *vtable_egl;
/**
* The third-party/private implementation hooks.
*
* This structure is intended for drivers that implement the
* private API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
void *vtable_tpi;
void *native_dpy;
int x11_screen;
int version_major;
int version_minor;
int max_profiles;
int max_entrypoints;
int max_attributes;
int max_image_formats;
int max_subpic_formats;
int max_display_attributes;
const char *str_vendor;
void *handle; /* dlopen handle */
/**
* \brief DRM state.
*
* This field holds driver specific data for DRM-based
* drivers. This structure is allocated from libva with
* calloc(). Do not deallocate from within VA driver
* implementations.
*
* All structures shall be derived from struct drm_state. So, for
* instance, this field holds a dri_state structure for VA/X11
* drivers that use the DRM protocol.
*/
void *drm_state;
void *glx; /* opaque for GLX code */
/** \brief VA display type. */
unsigned long display_type;
/**
* The VA/Wayland implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/Wayland API. libVA allocates this structure with calloc()
* and owns the resulting memory.
*/
struct VADriverVTableWayland *vtable_wayland;
/**
* \brief The VA/VPP implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTableVPP *vtable_vpp;
char *override_driver_name;
void *pDisplayContext;
/**
* Error callback.
*
* This is set by libva when the driver is opened, and will not be
* changed thereafter. The driver can call it with an error message,
* which will be propagated to the API user through their error
* callbacks, or sent to a default output if no callback is available.
*
* It is expected that end users will always be able to see these
* messages, so it should be called only for serious errors. For
* example, hardware problems or fatal configuration errors.
*
* @param pDriverContext Pointer to the driver context structure
* being used by the current driver.
* @param message Message to send to the API user. This must be a
* null-terminated string.
*/
void (*error_callback)(VADriverContextP pDriverContext,
const char *message);
/**
* Info callback.
*
* This has the same behaviour as the error callback, but has its
* own set of callbacks to the API user.
*
* It should be used for informational messages which may be useful
* for an application programmer or for debugging. For example, minor
* configuration errors, or information about the reason when another
* API call generates an error return. It is not expected that end
* users will see these messages.
*
* @param pDriverContext Pointer to the driver context structure
* being used by the current driver.
* @param message Message to send to the API user. This must be a
* null-terminated string.
*/
void (*info_callback)(VADriverContextP pDriverContext,
const char *message);
/**
* \brief The VA/Protected implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTableProt *vtable_prot;
unsigned long reserved[37]; /* reserve for future add-ins, decrease the subscript accordingly */
};
#define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
struct VADisplayContext {
int vadpy_magic;
VADisplayContextP pNext;
VADriverContextP pDriverContext;
/* Deprecated */
int (*vaIsValid)(
VADisplayContextP ctx
);
void (*vaDestroy)(
VADisplayContextP ctx
);
/* Deprecated */
VAStatus(*vaGetDriverName)(
VADisplayContextP ctx,
char **driver_name
);
void *opaque; /* opaque for display extensions (e.g. GLX) */
void *vatrace; /* opaque for VA trace context */
/* Deprecated */
void *vafool; /* opaque for VA fool context */
VAMessageCallback error_callback;
void *error_callback_user_context;
VAMessageCallback info_callback;
void *info_callback_user_context;
/* Deprecated */
VAStatus(*vaGetNumCandidates)(
VADisplayContextP ctx,
int * num_candidates
);
/* Deprecated */
VAStatus(*vaGetDriverNameByIndex)(
VADisplayContextP ctx,
char **driver_name,
int candidate_index
);
/**
* \brief Callback to get an array of driver names.
*
*
* The caller must provide a num_drivers
* This structure is allocated from libva with calloc().
*
* @param drivers An num_drivers sized array of null terminated strings.
* The array is managed my the caller. The callee will
* populate the individual driver name strings and the
* caller must free them.
* @param num_driver The number of driver strings contained within drivers.
* The caller must set that to the size of the drivers
* array, where the callee will update the value to
* min(caller num_driver, num_drivers_support).
*/
VAStatus(*vaGetDriverNames)(
VADisplayContextP ctx,
char **drivers,
unsigned *num_drivers
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[29];
};
typedef VAStatus(*VADriverInit)(
VADriverContextP driver_context
);
#endif /* _VA_BACKEND_H_ */

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2020 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_BACKEND_PROT_H
#define VA_BACKEND_PROT_H
#include <va/va_prot.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \brief VTable version for VA/PROTECTION hooks. */
#define VA_DRIVER_VTABLE_PROT_VERSION 1
struct VADriverVTableProt {
unsigned int version;
VAStatus
(*vaCreateProtectedSession)(
VADriverContextP ctx,
VAConfigID config_id,
VAProtectedSessionID *protected_session
);
VAStatus
(*vaDestroyProtectedSession)(
VADriverContextP ctx,
VAProtectedSessionID protected_session
);
VAStatus
(*vaAttachProtectedSession)(
VADriverContextP ctx,
VAContextID context,
VAProtectedSessionID protected_session
);
VAStatus
(*vaDetachProtectedSession)(
VADriverContextP ctx,
VAContextID context
);
VAStatus
(*vaProtectedSessionExecute)(
VADriverContextP ctx,
VAProtectedSessionID protected_session,
VABufferID buf_id
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[VA_PADDING_MEDIUM];
};
#ifdef __cplusplus
}
#endif
#endif /* VA_BACKEND_PROT_H */

View file

@ -0,0 +1,74 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_BACKEND_VPP_H
#define VA_BACKEND_VPP_H
#include <va/va_vpp.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \brief VTable version for VA/VPP hooks. */
#define VA_DRIVER_VTABLE_VPP_VERSION 1
struct VADriverVTableVPP {
unsigned int version;
VAStatus
(*vaQueryVideoProcFilters)(
VADriverContextP ctx,
VAContextID context,
VAProcFilterType *filters,
unsigned int *num_filters
);
VAStatus
(*vaQueryVideoProcFilterCaps)(
VADriverContextP ctx,
VAContextID context,
VAProcFilterType type,
void *filter_caps,
unsigned int *num_filter_caps
);
VAStatus
(*vaQueryVideoProcPipelineCaps)(
VADriverContextP ctx,
VAContextID context,
VABufferID *filters,
unsigned int num_filters,
VAProcPipelineCaps *pipeline_caps
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[16];
};
#ifdef __cplusplus
}
#endif
#endif /* VA_BACKEND_VPP_H */

45
lib/libva/va/va_compat.c Normal file
View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define VA_COMPAT_DISABLED 1
#include "sysdeps.h"
#include "va.h"
#include "va_compat.h"
VAStatus
vaCreateSurfaces_0_32_0(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces
)
{
return vaCreateSurfaces(dpy, format, width, height, surfaces, num_surfaces,
NULL, 0);
}
#if !defined(_WIN32)
VA_CPP_HELPER_ALIAS(vaCreateSurfaces, 0, 32, 0);
#endif

116
lib/libva/va/va_compat.h Normal file
View file

@ -0,0 +1,116 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_compat.h
* \brief The Compatibility API
*
* This file contains the \ref api_compat "Compatibility API".
*/
#ifndef VA_COMPAT_H
#define VA_COMPAT_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_compat Compatibility API
*
* The Compatibility API allows older programs that are not ported to
* the current API to still build and run correctly. In particular,
* this exposes older API to allow for backwards source compatibility.
*
* @{
*/
/**
* Makes a string literal out of the macro argument
*/
#define VA_CPP_HELPER_STRINGIFY(x) \
VA_CPP_HELPER_STRINGIFY_(x)
#define VA_CPP_HELPER_STRINGIFY_(x) \
#x
/**
* Concatenates two macro arguments at preprocessing time.
*/
#define VA_CPP_HELPER_CONCAT(a, b) \
VA_CPP_HELPER_CONCAT_(a, b)
#define VA_CPP_HELPER_CONCAT_(a, b) \
a ## b
/**
* Generates the number of macro arguments at preprocessing time.
* <http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a3fb/346fc464319b1ee5>
*
* Note: this doesn't work for macros with no arguments
*/
#define VA_CPP_HELPER_N_ARGS(...) \
VA_CPP_HELPER_N_ARGS_(__VA_ARGS__, VA_CPP_HELPER_N_ARGS_LIST_REV())
#define VA_CPP_HELPER_N_ARGS_(...) \
VA_CPP_HELPER_N_ARGS_LIST(__VA_ARGS__)
#define VA_CPP_HELPER_N_ARGS_LIST(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a12, a13, a14, a15, a16, N, ...) N
#define VA_CPP_HELPER_N_ARGS_LIST_REV() \
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
/**
* Generates a versioned function alias.
*
* VA_CPP_HELPER_ALIAS(vaSomeFunction, 0,32,0) will generate
* .symber vaSomeFunction_0_32_0, vaSomeFunction@VA_API_0.32.0
*/
#define VA_CPP_HELPER_ALIAS(func, major, minor, micro) \
VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@")
#define VA_CPP_HELPER_ALIAS_DEFAULT(func, major, minor, micro) \
VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@@")
#define VA_CPP_HELPER_ALIAS_(func, major, minor, micro, binding) \
asm(".symver " #func "_" #major "_" #minor "_" #micro ", " \
#func binding "VA_API_" #major "." #minor "." #micro)
/* vaCreateSurfaces() */
#ifndef VA_COMPAT_DISABLED
#define vaCreateSurfaces(dpy, ...) \
VA_CPP_HELPER_CONCAT(vaCreateSurfaces, \
VA_CPP_HELPER_N_ARGS(dpy, __VA_ARGS__)) \
(dpy, __VA_ARGS__)
#endif
#define vaCreateSurfaces6(dpy, width, height, format, num_surfaces, surfaces) \
(vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
NULL, 0)
#define vaCreateSurfaces8(dpy, format, width, height, surfaces, num_surfaces, attribs, num_attribs) \
(vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
attribs, num_attribs)
/*@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_COMPAT_H */

695
lib/libva/va/va_dec_av1.h Normal file
View file

@ -0,0 +1,695 @@
/*
* Copyright (c) 2019 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_av1.h
* \brief The AV1 decoding API
*
* This file contains the \ref api_dec_av1 "AV1 decoding API".
*/
#ifndef VA_DEC_AV1_H
#define VA_DEC_AV1_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_av1 AV1 decoding API
*
* This AV1 decoding API supports 8-bit/10bit 420 format only.
*
* @{
*/
/** Attribute value for VAConfigAttribDecAV1Features.
*
* This attribute decribes the supported features of a AV1
* decoder configuration.
*
*/
typedef union VAConfigAttribValDecAV1Features {
struct {
/** large scale tile
*
* This conveys whether AV1 large scale tile is supported by HW.
* 0 - unsupported, 1 - supported.
*/
uint32_t lst_support : 2;
/* Reserved for future use. */
uint32_t reserved : 30;
} bits;
uint32_t value;
} VAConfigAttribValDecAV1Features;
/**
* \brief AV1 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
* App should send a surface with this data structure down to VAAPI once
* per frame.
*
*/
/** \brief Segmentation Information
*/
typedef struct _VASegmentationStructAV1 {
union {
struct {
/** Indicates whether segmentation map related syntax elements
* are present or not for current frame. If equal to 0,
* the segmentation map related syntax elements are
* not present for the current frame and the control flags of
* segmentation map related tables feature_data[][], and
* feature_mask[] are not valid and shall be ignored by accelerator.
*/
uint32_t enabled : 1;
/** Value 1 indicates that the segmentation map are updated
* during the decoding of this frame.
* Value 0 means that the segmentation map from the previous
* frame is used.
*/
uint32_t update_map : 1;
/** Value 1 indicates that the updates to the segmentation map
* are coded relative to the existing segmentation map.
* Value 0 indicates that the new segmentation map is coded
* without reference to the existing segmentation map.
*/
uint32_t temporal_update : 1;
/** Value 1 indicates that new parameters are about to be
* specified for each segment.
* Value 0 indicates that the segmentation parameters
* should keep their existing values.
*/
uint32_t update_data : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 28;
} bits;
uint32_t value;
} segment_info_fields;
/** \brief Segmentation parameters for current frame.
* feature_data[segment_id][feature_id]
* where segment_id has value range [0..7] indicating the segment id.
* and feature_id is defined as
typedef enum {
SEG_LVL_ALT_Q, // Use alternate Quantizer ....
SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane
SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane
SEG_LVL_REF_FRAME, // Optional Segment reference frame
SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
SEG_LVL_GLOBALMV,
SEG_LVL_MAX
} SEG_LVL_FEATURES;
* feature_data[][] is equivalent to variable FeatureData[][] in spec,
* which is after clip3() operation.
* Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z);
* The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = {
* 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 }
*/
int16_t feature_data[8][8];
/** \brief indicates if a feature is enabled or not.
* Each bit field itself is the feature_id. Index is segment_id.
* feature_mask[segment_id] & (1 << feature_id) equal to 1 specify that the feature of
* feature_id for segment of segment_id is enabled, otherwise disabled.
*/
uint8_t feature_mask[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASegmentationStructAV1;
/** \brief Film Grain Information
*/
typedef struct _VAFilmGrainStructAV1 {
union {
struct {
/** \brief Specify whether or not film grain is applied on current frame.
* If set to 0, all the rest parameters should be set to zero
* and ignored.
*/
uint32_t apply_grain : 1;
uint32_t chroma_scaling_from_luma : 1;
uint32_t grain_scaling_minus_8 : 2;
uint32_t ar_coeff_lag : 2;
uint32_t ar_coeff_shift_minus_6 : 2;
uint32_t grain_scale_shift : 2;
uint32_t overlap_flag : 1;
uint32_t clip_to_restricted_range : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 20;
} bits;
uint32_t value;
} film_grain_info_fields;
uint16_t grain_seed;
/* value range [0..14] */
uint8_t num_y_points;
uint8_t point_y_value[14];
uint8_t point_y_scaling[14];
/* value range [0..10] */
uint8_t num_cb_points;
uint8_t point_cb_value[10];
uint8_t point_cb_scaling[10];
/* value range [0..10] */
uint8_t num_cr_points;
uint8_t point_cr_value[10];
uint8_t point_cr_scaling[10];
/* value range [-128..127] */
int8_t ar_coeffs_y[24];
int8_t ar_coeffs_cb[25];
int8_t ar_coeffs_cr[25];
uint8_t cb_mult;
uint8_t cb_luma_mult;
uint16_t cb_offset;
uint8_t cr_mult;
uint8_t cr_luma_mult;
uint16_t cr_offset;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAFilmGrainStructAV1;
typedef enum {
/** identity transformation, 0-parameter */
VAAV1TransformationIdentity = 0,
/** translational motion, 2-parameter */
VAAV1TransformationTranslation = 1,
/** simplified affine with rotation + zoom only, 4-parameter */
VAAV1TransformationRotzoom = 2,
/** affine, 6-parameter */
VAAV1TransformationAffine = 3,
/** transformation count */
VAAV1TransformationCount
} VAAV1TransformationType;
typedef struct _VAWarpedMotionParamsAV1 {
/** \brief Specify the type of warped motion */
VAAV1TransformationType wmtype;
/** \brief Specify warp motion parameters
* wm.wmmat[] corresponds to gm_params[][] in spec.
* Details in AV1 spec section 5.9.24 or refer to libaom code
* https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c
*/
int32_t wmmat[8];
/* valid or invalid on affine set */
uint8_t invalid;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAWarpedMotionParamsAV1;
/**
* \brief AV1 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
*/
typedef struct _VADecPictureParameterBufferAV1 {
/**@{*/
/** \brief sequence level information
*/
/** \brief AV1 bit stream profile
*/
uint8_t profile;
uint8_t order_hint_bits_minus_1;
/** \brief bit depth index
* value range [0..2]
* 0 - bit depth 8;
* 1 - bit depth 10;
* 2 - bit depth 12;
*/
uint8_t bit_depth_idx;
/** \brief corresponds to AV1 spec variable of the same name. */
uint8_t matrix_coefficients;
union {
struct {
uint32_t still_picture : 1;
uint32_t use_128x128_superblock : 1;
uint32_t enable_filter_intra : 1;
uint32_t enable_intra_edge_filter : 1;
/** read_compound_tools */
uint32_t enable_interintra_compound : 1;
uint32_t enable_masked_compound : 1;
uint32_t enable_dual_filter : 1;
uint32_t enable_order_hint : 1;
uint32_t enable_jnt_comp : 1;
uint32_t enable_cdef : 1;
uint32_t mono_chrome : 1;
uint32_t color_range : 1;
uint32_t subsampling_x : 1;
uint32_t subsampling_y : 1;
va_deprecated uint32_t chroma_sample_position : 1;
uint32_t film_grain_params_present : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 16;
} fields;
uint32_t value;
} seq_info_fields;
/** \brief Picture level information
*/
/** \brief buffer description of decoded current picture
*/
VASurfaceID current_frame;
/** \brief display buffer of current picture
* Used for film grain applied decoded picture.
* Valid only when apply_grain equals 1.
*/
VASurfaceID current_display_picture;
/** \brief number of anchor frames for large scale tile
* This parameter gives the number of entries of anchor_frames_list[].
* Value range [0..128].
*/
uint8_t anchor_frames_num;
/** \brief anchor frame list for large scale tile
* For large scale tile applications, the anchor frames could come from
* previously decoded frames in current sequence (aka. internal), or
* from external sources.
* For external anchor frames, application should call API
* vaCreateBuffer() to generate frame buffers and populate them with
* pixel frames. And this process may happen multiple times.
* The array anchor_frames_list[] is used to register all the available
* anchor frames from both external and internal, up to the current
* frame instance. If a previously registerred anchor frame is no longer
* needed, it should be removed from the list. But it does not prevent
* applications from relacing the frame buffer with new anchor frames.
* Please note that the internal anchor frames may not still be present
* in the current DPB buffer. But if it is in the anchor_frames_list[],
* it should not be replaced with other frames or removed from memory
* until it is not shown in the list.
* This number of entries of the list is given by parameter anchor_frames_num.
*/
VASurfaceID *anchor_frames_list;
/** \brief Picture resolution minus 1
* Picture original resolution. If SuperRes is enabled,
* this is the upscaled resolution.
* value range [0..65535]
*/
uint16_t frame_width_minus1;
uint16_t frame_height_minus1;
/** \brief Output frame buffer size in unit of tiles
* Valid only when large_scale_tile equals 1.
* value range [0..65535]
*/
uint16_t output_frame_width_in_tiles_minus_1;
uint16_t output_frame_height_in_tiles_minus_1;
/** \brief Surface indices of reference frames in DPB.
*
* Contains a list of uncompressed frame buffer surface indices as references.
* Application needs to make sure all the entries point to valid frames
* except for intra frames by checking ref_frame_id[]. If missing frame
* is identified, application may choose to perform error recovery by
* pointing problematic index to an alternative frame buffer.
* Driver is not responsible to validate reference frames' id.
*/
VASurfaceID ref_frame_map[8];
/** \brief Reference frame indices.
*
* Contains a list of indices into ref_frame_map[8].
* It specifies the reference frame correspondence.
* The indices of the array are defined as [LAST_FRAME LAST_FRAME,
* LAST2_FRAME LAST_FRAME, , ALTREF_FRAME LAST_FRAME], where each
* symbol is defined as:
* enum{INTRA_FRAME = 0, LAST_FRAME, LAST2_FRAME, LAST3_FRAME, GOLDEN_FRAME,
* BWDREF_FRAME, ALTREF2_FRAME, ALTREF_FRAME};
*/
uint8_t ref_frame_idx[7];
/** \brief primary reference frame index
* Index into ref_frame_idx[], specifying which reference frame contains
* propagated info that should be loaded at the start of the frame.
* When value equals PRIMARY_REF_NONE (7), it indicates there is
* no primary reference frame.
* value range [0..7]
*/
uint8_t primary_ref_frame;
uint8_t order_hint;
VASegmentationStructAV1 seg_info;
VAFilmGrainStructAV1 film_grain_info;
/** \brief tile structure
* When uniform_tile_spacing_flag == 1, width_in_sbs_minus_1[] and
* height_in_sbs_minus_1[] should be ignored, which will be generated
* by driver based on tile_cols and tile_rows.
*/
uint8_t tile_cols;
uint8_t tile_rows;
/* The width/height of a tile minus 1 in units of superblocks. Though the
* maximum number of tiles is 64, since ones of the last tile are computed
* from ones of the other tiles and frame_width/height, they are not
* necessarily specified.
*/
uint16_t width_in_sbs_minus_1[63];
uint16_t height_in_sbs_minus_1[63];
/** \brief number of tiles minus 1 in large scale tile list
* Same as AV1 semantic element.
* Valid only when large_scale_tiles == 1.
*/
uint16_t tile_count_minus_1;
/* specify the tile index for context updating */
uint16_t context_update_tile_id;
union {
struct {
/** \brief flags for current picture
* same syntax and semantic as those in AV1 code
*/
/** \brief Frame Type
* 0: KEY_FRAME;
* 1: INTER_FRAME;
* 2: INTRA_ONLY_FRAME;
* 3: SWITCH_FRAME
* For SWITCH_FRAME, application shall set error_resilient_mode = 1,
* refresh_frame_flags, etc. appropriately. And driver will convert it
* to INTER_FRAME.
*/
uint32_t frame_type : 2;
uint32_t show_frame : 1;
uint32_t showable_frame : 1;
uint32_t error_resilient_mode : 1;
uint32_t disable_cdf_update : 1;
uint32_t allow_screen_content_tools : 1;
uint32_t force_integer_mv : 1;
uint32_t allow_intrabc : 1;
uint32_t use_superres : 1;
uint32_t allow_high_precision_mv : 1;
uint32_t is_motion_mode_switchable : 1;
uint32_t use_ref_frame_mvs : 1;
/* disable_frame_end_update_cdf is coded as refresh_frame_context. */
uint32_t disable_frame_end_update_cdf : 1;
uint32_t uniform_tile_spacing_flag : 1;
uint32_t allow_warped_motion : 1;
/** \brief indicate if current frame in large scale tile mode */
uint32_t large_scale_tile : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 15;
} bits;
uint32_t value;
} pic_info_fields;
/** \brief Supper resolution scale denominator.
* When use_superres=1, superres_scale_denominator must be in the range [9..16].
* When use_superres=0, superres_scale_denominator must be 8.
*/
uint8_t superres_scale_denominator;
/** \brief Interpolation filter.
* value range [0..4]
*/
uint8_t interp_filter;
/** \brief luma loop filter levels.
* value range [0..63].
*/
uint8_t filter_level[2];
/** \brief chroma loop filter levels.
* value range [0..63].
*/
uint8_t filter_level_u;
uint8_t filter_level_v;
union {
struct {
/** \brief flags for reference pictures
* same syntax and semantic as those in AV1 code
*/
uint8_t sharpness_level : 3;
uint8_t mode_ref_delta_enabled : 1;
uint8_t mode_ref_delta_update : 1;
/** \brief Reserved bytes for future use, must be zero */
uint8_t reserved : 3;
} bits;
uint8_t value;
} loop_filter_info_fields;
/** \brief The adjustment needed for the filter level based on
* the chosen reference frame.
* value range [-64..63].
*/
int8_t ref_deltas[8];
/** \brief The adjustment needed for the filter level based on
* the chosen mode.
* value range [-64..63].
*/
int8_t mode_deltas[2];
/** \brief quantization
*/
/** \brief Y AC index
* value range [0..255]
*/
uint8_t base_qindex;
/** \brief Y DC delta from Y AC
* value range [-64..63]
*/
int8_t y_dc_delta_q;
/** \brief U DC delta from Y AC
* value range [-64..63]
*/
int8_t u_dc_delta_q;
/** \brief U AC delta from Y AC
* value range [-64..63]
*/
int8_t u_ac_delta_q;
/** \brief V DC delta from Y AC
* value range [-64..63]
*/
int8_t v_dc_delta_q;
/** \brief V AC delta from Y AC
* value range [-64..63]
*/
int8_t v_ac_delta_q;
/** \brief quantization_matrix
*/
union {
struct {
uint16_t using_qmatrix : 1;
/** \brief qm level
* value range [0..15]
* Invalid if using_qmatrix equals 0.
*/
uint16_t qm_y : 4;
uint16_t qm_u : 4;
uint16_t qm_v : 4;
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved : 3;
} bits;
uint16_t value;
} qmatrix_fields;
union {
struct {
/** \brief delta_q parameters
*/
uint32_t delta_q_present_flag : 1;
uint32_t log2_delta_q_res : 2;
/** \brief delta_lf parameters
*/
uint32_t delta_lf_present_flag : 1;
uint32_t log2_delta_lf_res : 2;
/** \brief CONFIG_LOOPFILTER_LEVEL
*/
uint32_t delta_lf_multi : 1;
/** \brief read_tx_mode
* value range [0..2]
*/
uint32_t tx_mode : 2;
/* AV1 frame reference mode semantic */
uint32_t reference_select : 1;
uint32_t reduced_tx_set_used : 1;
uint32_t skip_mode_present : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 20;
} bits;
uint32_t value;
} mode_control_fields;
/** \brief CDEF parameters
*/
/* value range [0..3] */
uint8_t cdef_damping_minus_3;
/* value range [0..3] */
uint8_t cdef_bits;
/** Encode cdef strength:
*
* The cdef_y_strengths[] and cdef_uv_strengths[] are expected to be packed
* with both primary and secondary strength. The secondary strength is
* given in the lower two bits and the primary strength is given in the next
* four bits.
*
* cdef_y_strengths[] & cdef_uv_strengths[] should be derived as:
* (cdef_y_strengths[]) = (cdef_y_pri_strength[] << 2) | (cdef_y_sec_strength[] & 0x03)
* (cdef_uv_strengths[]) = (cdef_uv_pri_strength[] << 2) | (cdef_uv_sec_strength[] & 0x03)
* In which, cdef_y_pri_strength[]/cdef_y_sec_strength[]/cdef_uv_pri_strength[]/cdef_uv_sec_strength[]
* are variables defined in AV1 Spec 5.9.19. The cdef_y_strengths[] & cdef_uv_strengths[]
* are corresponding to LIBAOM variables cm->cdef_strengths[] & cm->cdef_uv_strengths[] respectively.
*/
/* value range [0..63] */
uint8_t cdef_y_strengths[8];
/* value range [0..63] */
uint8_t cdef_uv_strengths[8];
/** \brief loop restoration parameters
*/
union {
struct {
uint16_t yframe_restoration_type : 2;
uint16_t cbframe_restoration_type : 2;
uint16_t crframe_restoration_type : 2;
uint16_t lr_unit_shift : 2;
uint16_t lr_uv_shift : 1;
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved : 7;
} bits;
uint16_t value;
} loop_restoration_fields;
/** \brief global motion
*/
VAWarpedMotionParamsAV1 wm[7];
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VADecPictureParameterBufferAV1;
/**
* \brief AV1 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to bit stream data and should be
* sent once per tile.
*
* It uses the name VASliceParameterBufferAV1 to be consistent with other codec,
* but actually means VATileParameterBufferAV1.
*
* Slice data buffer of VASliceDataBufferType is used
* to send the bitstream.
*
* Please note that host decoder is responsible to parse out the
* per tile information. And the bit stream in sent to driver in per
* tile granularity.
*/
typedef struct _VASliceParameterBufferAV1 {
/**@{*/
/** \brief The byte count of current tile in the bitstream buffer,
* starting from first byte of the buffer.
* It uses the name slice_data_size to be consistent with other codec,
* but actually means tile_data_size.
*/
uint32_t slice_data_size;
/**
* offset to the first byte of the data buffer.
*/
uint32_t slice_data_offset;
/**
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
uint16_t tile_row;
uint16_t tile_column;
va_deprecated uint16_t tg_start;
va_deprecated uint16_t tg_end;
/** \brief anchor frame index for large scale tile.
* index into an array AnchorFrames of the frames that the tile uses
* for prediction.
* valid only when large_scale_tile equals 1.
*/
uint8_t anchor_frame_idx;
/** \brief tile index in the tile list.
* Valid only when large_scale_tile is enabled.
* Driver uses this field to decide the tile output location.
*/
uint16_t tile_idx_in_tile_list;
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferAV1;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_AV1_H */

616
lib/libva/va/va_dec_hevc.h Normal file
View file

@ -0,0 +1,616 @@
/*
* Copyright (c) 2014 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_hevc.h
* \brief The HEVC decoding API
*
* This file contains the \ref api_dec_hevc "HEVC decoding API".
*/
#ifndef VA_DEC_HEVC_H
#define VA_DEC_HEVC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_hevc HEVC decoding API
*
* This HEVC decoding API supports Main and Main Still Picture profiles.
* And it supports both short slice format and long slice format.
*
* @{
*/
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
*/
typedef struct _VAPictureParameterBufferHEVC {
/** \brief buffer description of decoded current picture
* only VA_PICTURE_HEVC_FIELD_PIC and VA_PICTURE_HEVC_BOTTOM_FIELD
* of "flags" fields are meaningful.
*/
VAPictureHEVC CurrPic;
/** \brief buffer description of reference frames in DPB */
VAPictureHEVC ReferenceFrames[15];
/** \brief picture width, shall be integer multiple of minimum CB size. */
uint16_t pic_width_in_luma_samples;
/** \brief picture height, shall be integer multiple of minimum CB size. */
uint16_t pic_height_in_luma_samples;
union {
struct {
/** following flags have same syntax and semantic as those in HEVC spec */
uint32_t chroma_format_idc : 2;
uint32_t separate_colour_plane_flag : 1;
uint32_t pcm_enabled_flag : 1;
uint32_t scaling_list_enabled_flag : 1;
uint32_t transform_skip_enabled_flag : 1;
uint32_t amp_enabled_flag : 1;
uint32_t strong_intra_smoothing_enabled_flag : 1;
uint32_t sign_data_hiding_enabled_flag : 1;
uint32_t constrained_intra_pred_flag : 1;
uint32_t cu_qp_delta_enabled_flag : 1;
uint32_t weighted_pred_flag : 1;
uint32_t weighted_bipred_flag : 1;
uint32_t transquant_bypass_enabled_flag : 1;
uint32_t tiles_enabled_flag : 1;
uint32_t entropy_coding_sync_enabled_flag : 1;
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
uint32_t loop_filter_across_tiles_enabled_flag : 1;
uint32_t pcm_loop_filter_disabled_flag : 1;
/** set based on sps_max_num_reorder_pics of current temporal layer. */
uint32_t NoPicReorderingFlag : 1;
/** picture has no B slices */
uint32_t NoBiPredFlag : 1;
uint32_t ReservedBits : 11;
} bits;
uint32_t value;
} pic_fields;
/** following parameters have same syntax with those in HEVC spec */
/** \brief DPB size for current temporal layer */
uint8_t sps_max_dec_pic_buffering_minus1;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t pcm_sample_bit_depth_luma_minus1;
uint8_t pcm_sample_bit_depth_chroma_minus1;
uint8_t log2_min_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_luma_coding_block_size;
uint8_t log2_min_transform_block_size_minus2;
uint8_t log2_diff_max_min_transform_block_size;
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
uint8_t max_transform_hierarchy_depth_intra;
uint8_t max_transform_hierarchy_depth_inter;
int8_t init_qp_minus26;
uint8_t diff_cu_qp_delta_depth;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
uint8_t log2_parallel_merge_level_minus2;
uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1;
/**
* when uniform_spacing_flag equals 1, application should populate
* column_width_minus[], and row_height_minus1[] with approperiate values.
*/
uint16_t column_width_minus1[19];
uint16_t row_height_minus1[21];
/**
* The Following Parameters are needed for Short Slice Format Only.
* Only format decoding can ignore them.
*/
/**
* \brief Parameters needed for parsing slice segment headers
*/
union {
struct {
/** following parameters have same syntax with those in HEVC spec */
uint32_t lists_modification_present_flag : 1;
uint32_t long_term_ref_pics_present_flag : 1;
uint32_t sps_temporal_mvp_enabled_flag : 1;
uint32_t cabac_init_present_flag : 1;
uint32_t output_flag_present_flag : 1;
uint32_t dependent_slice_segments_enabled_flag : 1;
uint32_t pps_slice_chroma_qp_offsets_present_flag : 1;
uint32_t sample_adaptive_offset_enabled_flag : 1;
uint32_t deblocking_filter_override_enabled_flag : 1;
uint32_t pps_disable_deblocking_filter_flag : 1;
uint32_t slice_segment_header_extension_present_flag : 1;
/** current picture with NUT between 16 and 21 inclusive */
uint32_t RapPicFlag : 1;
/** current picture with NUT between 19 and 20 inclusive */
uint32_t IdrPicFlag : 1;
/** current picture has only intra slices */
uint32_t IntraPicFlag : 1;
uint32_t ReservedBits : 18;
} bits;
uint32_t value;
} slice_parsing_fields;
/** following parameters have same syntax with those in HEVC spec */
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t num_short_term_ref_pic_sets;
uint8_t num_long_term_ref_pic_sps;
uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1;
int8_t pps_beta_offset_div2;
int8_t pps_tc_offset_div2;
uint8_t num_extra_slice_header_bits;
/**
* \brief number of bits that structure
* short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice
* segment header when short_term_ref_pic_set_sps_flag equals 0.
* if short_term_ref_pic_set_sps_flag equals 1, the value should be 0.
* the bit count is calculated after emulation prevention bytes are removed
* from bit streams.
* This variable is used for accelorater to skip parsing the
* short_term_ref_pic_set( num_short_term_ref_pic_sets ) structure.
*/
uint32_t st_rps_bits;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAPictureParameterBufferHEVC;
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure for Range Extension
*
* This structure conveys picture level HEVC Range Extension parameters
* and should be sent once per frame. This data structure should be sent
* together with VAPictureParameterBufferHEVC in a single buffer of
* \ref VAPictureParameterBufferHEVCExtension since each frame
* of HEVC range extension contains both picture level parameters and picture
* level range extension parameters. They should be parsed together. The buffer
* type is same as \ref VAPictureParameterBufferHEVC.
*
*/
typedef struct _VAPictureParameterBufferHEVCRext {
union {
struct {
/** \brief HEVC range extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
uint32_t transform_skip_rotation_enabled_flag : 1;
uint32_t transform_skip_context_enabled_flag : 1;
uint32_t implicit_rdpcm_enabled_flag : 1;
uint32_t explicit_rdpcm_enabled_flag : 1;
uint32_t extended_precision_processing_flag : 1;
uint32_t intra_smoothing_disabled_flag : 1;
uint32_t high_precision_offsets_enabled_flag : 1;
uint32_t persistent_rice_adaptation_enabled_flag : 1;
uint32_t cabac_bypass_alignment_enabled_flag : 1;
uint32_t cross_component_prediction_enabled_flag : 1;
uint32_t chroma_qp_offset_list_enabled_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 21;
} bits;
uint32_t value;
} range_extension_pic_fields;
/** \brief HEVC range extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len_minus1;
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
uint8_t log2_max_transform_skip_block_size_minus2;
int8_t cb_qp_offset_list[6];
int8_t cr_qp_offset_list[6];
} VAPictureParameterBufferHEVCRext;
/**
*\brief HEVC Decoding Picture Parameter Buffer Structure for
*Screen Content extension
*
*This structure conveys picture level HEVC Scc parameters
*and should be sent once per frame. This data structure should be sent
*together with VAPictureParameterBufferHEVC and VAPictureParameterBufferHEVCRext
*in a single buffer of \ref VAPictureParameterBufferHEVCExtension since each
*frame of HEVC SCC contains picture level parameters, picture level range
*extension parameters and picture level Scc parameters. They should be parsed
*together and the buffer type is same as \ref VAPictureParameterBufferHEVC.
*
*/
typedef struct _VAPictureParameterBufferHEVCScc {
union {
struct {
/** \brief HEVC Scc extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
/* indicates if intra block copy (IBC) is enabled or not. */
uint32_t pps_curr_pic_ref_enabled_flag : 1;
/* indicates if Palette Mode is enabled or not. */
uint32_t palette_mode_enabled_flag : 1;
/* controls the presence and inference of the use_integer_mv_flag syntax
* in slice segment header that specifies the resolution of motion
* vectors for inter prediction.
*/
uint32_t motion_vector_resolution_control_idc : 2;
/* specifies that the intra boundary filtering process is
* disabled or not for intra prediction.
*/
uint32_t intra_boundary_filtering_disabled_flag : 1;
/* specifies that an adaptive colour transform may be applied
* to the residual in the decoding process.
*/
uint32_t residual_adaptive_colour_transform_enabled_flag : 1;
/* specifies that slice_act_y_qp_offset, slice_act_cb_qp_offset,
* slice_act_cr_qp_offset are present in the slice header
*/
uint32_t pps_slice_act_qp_offsets_present_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 25;
} bits;
uint32_t value;
} screen_content_pic_fields;
/* specifies the maximum allowed palette size. */
uint8_t palette_max_size;
/* Correspond to HEVC syntax elements of the same names.
* It specifies the difference between the maximum allowed palette
* predictor size and the maximum allowed palette size.
* App needs to enforce that the variable PaletteMaxPredictorSize,
* which is derived as follows:
* PaletteMaxPredictorSize = palette_max_size + delta_palette_max_predictor_size
* should have a value range of [0..128].
*/
uint8_t delta_palette_max_predictor_size;
/** \brief Size of initial palette predictor.
* It is derived from pps_num_palette_predictor_initializer or
* sps_num_palette_predictor_initializer_minus1.
* Details in HEVC SCC spec section 9.3.2.3.
*/
uint8_t predictor_palette_size;
/** \brief Palette predictor initializer.
* It is derived from pps_palette_predictor_initializers[][]
* or sps_palette_predictor_initializers[][].
* Details in HEVC SCC spec section 9.3.2.3.
*/
uint16_t predictor_palette_entries[3][128];
/* are used to determine the offsets that are applied to the
* quantization parameter values for the luma, Cb and Cr
* components, respectively.
*/
int8_t pps_act_y_qp_offset_plus5;
int8_t pps_act_cb_qp_offset_plus5;
int8_t pps_act_cr_qp_offset_plus3;
} VAPictureParameterBufferHEVCScc;
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure including Extensions
*
* This structure conveys picture level HEVC parameters including basic version 1
* and range extension and screen content extension.
* The data buffer should be sent once per frame.
*
*/
typedef struct _VAPictureParameterBufferHEVCExtension {
/** \brief basic HEVC picture parameters data structure
*/
VAPictureParameterBufferHEVC base;
/** \brief HEVC range extension picture parameters data structure
*/
VAPictureParameterBufferHEVCRext rext;
/** \brief HEVC screen content picture parameters data structure
*/
VAPictureParameterBufferHEVCScc scc;
} VAPictureParameterBufferHEVCExtension;
/**
* \brief HEVC Slice Parameter Buffer Structure For Long Format
*
* VASliceParameterBufferHEVC structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVC {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice
* counting from and including NAL unit header.
*/
uint32_t slice_data_size;
/** \brief The offset to the NAL unit header for this slice */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
uint32_t slice_data_flag;
/**
* \brief Byte offset from NAL unit header to the begining of slice_data().
*
* This byte offset is relative to and includes the NAL unit header
* and represents the number of bytes parsed in the slice_header()
* after the removal of any emulation prevention bytes in
* there. However, the slice data buffer passed to the hardware is
* the original bitstream, thus including any emulation prevention
* bytes.
*/
uint32_t slice_data_byte_offset;
/** HEVC syntax element. */
uint32_t slice_segment_address;
/** \brief index into ReferenceFrames[]
* RefPicList[0][] corresponds to RefPicList0[] of HEVC variable.
* RefPicList[1][] corresponds to RefPicList1[] of HEVC variable.
* value range [0..14, 0xFF], where 0xFF indicates invalid entry.
*/
uint8_t RefPicList[2][15];
union {
uint32_t value;
struct {
/** current slice is last slice of picture. */
uint32_t LastSliceOfPic : 1;
/** HEVC syntax element. */
uint32_t dependent_slice_segment_flag : 1;
/** HEVC syntax element. */
uint32_t slice_type : 2;
/** HEVC syntax element. */
uint32_t color_plane_id : 2;
/** HEVC syntax element. */
uint32_t slice_sao_luma_flag : 1;
/** HEVC syntax element. */
uint32_t slice_sao_chroma_flag : 1;
/** HEVC syntax element. */
uint32_t mvd_l1_zero_flag : 1;
/** HEVC syntax element. */
uint32_t cabac_init_flag : 1;
/** HEVC syntax element. */
uint32_t slice_temporal_mvp_enabled_flag : 1;
/** HEVC syntax element. */
uint32_t slice_deblocking_filter_disabled_flag : 1;
/** HEVC syntax element. */
uint32_t collocated_from_l0_flag : 1;
/** HEVC syntax element. */
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
uint32_t reserved : 18;
} fields;
} LongSliceFlags;
/** HEVC syntax element. Collocated Reference Picture Index.
* index to RefPicList[0][] or RefPicList[1][].
* when slice_temporal_mvp_enabled_flag equals 0, it should take value 0xFF.
* value range [0..14, 0xFF].
*/
uint8_t collocated_ref_idx;
/** HEVC syntax element.
* if num_ref_idx_active_override_flag equals 0, host decoder should
* set its value to num_ref_idx_l0_default_active_minus1.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** HEVC syntax element.
* if num_ref_idx_active_override_flag equals 0, host decoder should
* set its value to num_ref_idx_l1_default_active_minus1.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** HEVC syntax element. */
int8_t slice_qp_delta;
/** HEVC syntax element. */
int8_t slice_cb_qp_offset;
/** HEVC syntax element. */
int8_t slice_cr_qp_offset;
/** HEVC syntax element. */
int8_t slice_beta_offset_div2;
/** HEVC syntax element. */
int8_t slice_tc_offset_div2;
/** HEVC syntax element. */
uint8_t luma_log2_weight_denom;
/** HEVC syntax element. */
int8_t delta_chroma_log2_weight_denom;
/** HEVC syntax element. */
int8_t delta_luma_weight_l0[15];
/** HEVC syntax element. */
int8_t luma_offset_l0[15];
/** HEVC syntax element. */
int8_t delta_chroma_weight_l0[15][2];
/** corresponds to HEVC spec variable of the same name. */
int8_t ChromaOffsetL0[15][2];
/** HEVC syntax element. */
int8_t delta_luma_weight_l1[15];
/** HEVC syntax element. */
int8_t luma_offset_l1[15];
/** HEVC syntax element. */
int8_t delta_chroma_weight_l1[15][2];
/** corresponds to HEVC spec variable of the same name. */
int8_t ChromaOffsetL1[15][2];
/** HEVC syntax element. */
uint8_t five_minus_max_num_merge_cand;
/** HEVC syntax element. */
uint16_t num_entry_point_offsets;
/** HEVC syntax element. */
uint16_t entry_offset_to_subset_array;
/** \brief Number of emulation prevention bytes in slice header. */
uint16_t slice_data_num_emu_prevn_bytes;
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW - 2];
} VASliceParameterBufferHEVC;
/**
* \brief HEVC Extented Slice Parameter Buffer Structure For Long Format
*
* This data structure contains extension profiles (range extension and screen content).
*
* VASliceParameterBufferHEVCRext structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice with VASliceParameterBufferHEVC in a single buffer of
* \ref VASliceParameterBufferHEVCExtension and the buffer type is same as \ref
* VASliceParameterBufferHEVC.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVCRext {
/* below four parameters are used to replace data types of the
* corresponding parameters of those in \# VASliceParameterBufferHEVC.
*/
int16_t luma_offset_l0[15];
int16_t ChromaOffsetL0[15][2];
int16_t luma_offset_l1[15];
int16_t ChromaOffsetL1[15][2];
union {
struct {
uint32_t cu_chroma_qp_offset_enabled_flag : 1;
uint32_t use_integer_mv_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 30;
} bits;
uint32_t value;
} slice_ext_flags;
/** \brief Screen Content Extension parameters.
* data range [-12..12]
*/
int8_t slice_act_y_qp_offset;
int8_t slice_act_cb_qp_offset;
int8_t slice_act_cr_qp_offset;
} VASliceParameterBufferHEVCRext;
/**
* \brief HEVC Decoding Slice Parameter Buffer Structure For Long Format including Extensions
*
* This data structure contains both baseline HEVC profiles (main, main10)
* and extension profiles (range extension and screen content).
*
* VASliceParameterBufferHEVCExtension structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice. For HEVC range extension and HEVC Scc decoding,
* application should parse both basic slice parameters and extented slice
* parameters into this buffer structure and sent it.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVCExtension {
/** \brief baseline HEVC slice parameters data structure */
VASliceParameterBufferHEVC base;
/** \brief extented HEVC slice parameters data structure */
VASliceParameterBufferHEVCRext rext;
} VASliceParameterBufferHEVCExtension;
/**
* \brief HEVC Inverse Quantization Matrix Buffer Structure
*
* This structure is sent once per frame,
* and only when scaling_list_enabled_flag = 1.
* When sps_scaling_list_data_present_flag = 0, app still
* needs to send in this structure with default matrix values.
*
* Matrix entries are in raster scan order which follows HEVC spec.
*/
typedef struct _VAIQMatrixBufferHEVC {
/**
* \brief scaling lists,
* corresponds to same HEVC spec syntax element
* ScalingList[ i ][ MatrixID ][ j ].
*
* \brief 4x4 scaling,
* correspongs i = 0, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 15, inclusive.
*/
uint8_t ScalingList4x4[6][16];
/**
* \brief 8x8 scaling,
* correspongs i = 1, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList8x8[6][64];
/**
* \brief 16x16 scaling,
* correspongs i = 2, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList16x16[6][64];
/**
* \brief 32x32 scaling,
* correspongs i = 3, MatrixID is in the range of 0 to 1,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList32x32[2][64];
/**
* \brief DC values of the 16x16 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
*/
uint8_t ScalingListDC16x16[6];
/**
* \brief DC values of the 32x32 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
*/
uint8_t ScalingListDC32x32[2];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferHEVC;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_HEVC_H */

157
lib/libva/va/va_dec_jpeg.h Normal file
View file

@ -0,0 +1,157 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_jpeg.h
* \brief The JPEG decoding API
*
* This file contains the \ref api_dec_jpeg "JPEG decoding API".
*/
#ifndef VA_DEC_JPEG_H
#define VA_DEC_JPEG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <va/va.h>
/**
* \defgroup api_dec_jpeg JPEG decoding API
*
* This JPEG decoding API supports Baseline profile only.
*
* @{
*/
/**
* \brief Picture parameter for JPEG decoding.
*
* This structure holds information from the frame header, along with
* definitions from additional segments.
*/
typedef struct _VAPictureParameterBufferJPEGBaseline {
/** \brief Picture width in pixels. */
uint16_t picture_width;
/** \brief Picture height in pixels. */
uint16_t picture_height;
struct {
/** \brief Component identifier (Ci). */
uint8_t component_id;
/** \brief Horizontal sampling factor (Hi). */
uint8_t h_sampling_factor;
/** \brief Vertical sampling factor (Vi). */
uint8_t v_sampling_factor;
/* \brief Quantization table selector (Tqi). */
uint8_t quantiser_table_selector;
} components[255];
/** \brief Number of components in frame (Nf). */
uint8_t num_components;
/** \brief Input color space 0: YUV, 1: RGB, 2: BGR, others: reserved */
uint8_t color_space;
/** \brief Set to VA_ROTATION_* for a single rotation angle reported by VAConfigAttribDecJPEG. */
uint32_t rotation;
/** \brief crop rectangle boundary in pixels */
VARectangle crop_rectangle;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM - 3];
} VAPictureParameterBufferJPEGBaseline;
/**
* \brief Quantization table for JPEG decoding.
*
* This structure holds the complete quantization tables. This is an
* aggregation of all quantization table (DQT) segments maintained by
* the application. i.e. up to 4 quantization tables are stored in
* there for baseline profile.
*
* The #load_quantization_table array can be used as a hint to notify
* the VA driver implementation about which table(s) actually changed
* since the last submission of this buffer.
*
* The #quantiser_table values are specified in zig-zag scan order.
*/
typedef struct _VAIQMatrixBufferJPEGBaseline {
/** \brief Specifies which #quantiser_table is valid. */
uint8_t load_quantiser_table[4];
/** \brief Quanziation tables indexed by table identifier (Tqi). */
uint8_t quantiser_table[4][64];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferJPEGBaseline;
/**
* \brief Slice parameter for JPEG decoding.
*
* This structure holds information from the scan header, along with
* definitions from additional segments. The associated slice data
* buffer holds all entropy coded segments (ECS) in the scan.
*/
typedef struct _VASliceParameterBufferJPEGBaseline {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice. */
uint32_t slice_data_size;
/** \brief The offset to the first byte of the first MCU. */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_xxx. */
uint32_t slice_data_flag;
/**@}*/
/** \brief Scan horizontal position. */
uint32_t slice_horizontal_position;
/** \brief Scan vertical position. */
uint32_t slice_vertical_position;
struct {
/** \brief Scan component selector (Csj). */
uint8_t component_selector;
/** \brief DC entropy coding table selector (Tdj). */
uint8_t dc_table_selector;
/** \brief AC entropy coding table selector (Taj). */
uint8_t ac_table_selector;
} components[4];
/** \brief Number of components in scan (Ns). */
uint8_t num_components;
/** \brief Restart interval definition (Ri). */
uint16_t restart_interval;
/** \brief Number of MCUs in a scan. */
uint32_t num_mcus;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferJPEGBaseline;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_JPEG_H */

249
lib/libva/va/va_dec_vp8.h Normal file
View file

@ -0,0 +1,249 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_vp8.h
* \brief VP8 decoding API
*
* This file contains the \ref api_dec_vp8 "VP8 decoding API".
*/
#ifndef VA_DEC_VP8_H
#define VA_DEC_VP8_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp8 VP8 decoding API
*
* @{
*/
/**
* \brief VPX Bool Coder Context structure
*
* This common structure is defined for potential sharing by other VP formats
*
*/
typedef struct _VABoolCoderContextVPX {
/* partition 0 "range" */
uint8_t range;
/* partition 0 "value" */
uint8_t value;
/*
* 'partition 0 number of shifts before an output byte is available'
* it is the number of remaining bits in 'value' for decoding, range [0, 7].
*/
uint8_t count;
} VABoolCoderContextVPX;
/**
* \brief VP8 Decoding Picture Parameter Buffer Structure
*
* This structure conveys frame level parameters and should be sent once
* per frame.
*
*/
typedef struct _VAPictureParameterBufferVP8 {
/* frame width in pixels */
uint32_t frame_width;
/* frame height in pixels */
uint32_t frame_height;
/* specifies the "last" reference frame */
VASurfaceID last_ref_frame;
/* specifies the "golden" reference frame */
VASurfaceID golden_ref_frame;
/* specifies the "alternate" referrence frame */
VASurfaceID alt_ref_frame;
/* specifies the out-of-loop deblocked frame, not used currently */
VASurfaceID out_of_loop_frame;
union {
struct {
/* same as key_frame in bitstream syntax, 0 means a key frame */
uint32_t key_frame : 1;
/* same as version in bitstream syntax */
uint32_t version : 3;
/* same as segmentation_enabled in bitstream syntax */
uint32_t segmentation_enabled : 1;
/* same as update_mb_segmentation_map in bitstream syntax */
uint32_t update_mb_segmentation_map : 1;
/* same as update_segment_feature_data in bitstream syntax */
uint32_t update_segment_feature_data : 1;
/* same as filter_type in bitstream syntax */
uint32_t filter_type : 1;
/* same as sharpness_level in bitstream syntax */
uint32_t sharpness_level : 3;
/* same as loop_filter_adj_enable in bitstream syntax */
uint32_t loop_filter_adj_enable : 1;
/* same as mode_ref_lf_delta_update in bitstream syntax */
uint32_t mode_ref_lf_delta_update : 1;
/* same as sign_bias_golden in bitstream syntax */
uint32_t sign_bias_golden : 1;
/* same as sign_bias_alternate in bitstream syntax */
uint32_t sign_bias_alternate : 1;
/* same as mb_no_coeff_skip in bitstream syntax */
uint32_t mb_no_coeff_skip : 1;
/* flag to indicate that loop filter should be disabled */
uint32_t loop_filter_disable : 1;
} bits;
uint32_t value;
} pic_fields;
/*
* probabilities of the segment_id decoding tree and same as
* mb_segment_tree_probs in the spec.
*/
uint8_t mb_segment_tree_probs[3];
/* Post-adjustment loop filter levels for the 4 segments */
uint8_t loop_filter_level[4];
/* loop filter deltas for reference frame based MB level adjustment */
int8_t loop_filter_deltas_ref_frame[4];
/* loop filter deltas for coding mode based MB level adjustment */
int8_t loop_filter_deltas_mode[4];
/* same as prob_skip_false in bitstream syntax */
uint8_t prob_skip_false;
/* same as prob_intra in bitstream syntax */
uint8_t prob_intra;
/* same as prob_last in bitstream syntax */
uint8_t prob_last;
/* same as prob_gf in bitstream syntax */
uint8_t prob_gf;
/*
* list of 4 probabilities of the luma intra prediction mode decoding
* tree and same as y_mode_probs in frame header
*/
uint8_t y_mode_probs[4];
/*
* list of 3 probabilities of the chroma intra prediction mode decoding
* tree and same as uv_mode_probs in frame header
*/
uint8_t uv_mode_probs[3];
/*
* updated mv decoding probabilities and same as mv_probs in
* frame header
*/
uint8_t mv_probs[2][19];
VABoolCoderContextVPX bool_coder_ctx;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAPictureParameterBufferVP8;
/**
* \brief VP8 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to data partitions and should be
* sent once per frame. Slice data buffer of VASliceDataBufferType is used
* to send the partition data.
*
*/
typedef struct _VASliceParameterBufferVP8 {
/*
* number of bytes in the slice data buffer for the partitions
*/
uint32_t slice_data_size;
/*
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/*
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/*
* offset to the first bit of MB from the first byte of partition data(slice_data_offset)
*/
uint32_t macroblock_offset;
/*
* Partitions
* (1<<log2_nbr_of_dct_partitions)+1, count both control partition (frame header) and toke partition
*/
uint8_t num_of_partitions;
/*
* partition_size[0] is remaining bytes of control partition after parsed by application.
* exclude current byte for the remaining bits in bool_coder_ctx.
* exclude the uncompress data chunk since first_part_size 'excluding the uncompressed data chunk'
*/
uint32_t partition_size[9];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP8;
/**
* \brief VP8 Coefficient Probability Data Buffer Structure
*
* Contains the contents of the token probability table, which may be
* incrementally modified in the frame header. There are four dimensions to
* the token probability array. The outermost dimension is indexed by the
* type of plane being decoded; the next dimension is selected by the
* position of the coefficient being decoded; the third dimension, * roughly
* speaking, measures the "local complexity" or extent to which nearby
* coefficients are non-zero; the fourth, and final, dimension of the token
* probability array is indexed by the position in the token tree structure,
* as are all tree probability arrays. This structure is sent once per frame.
*
*/
typedef struct _VAProbabilityDataBufferVP8 {
uint8_t dct_coeff_probs[4][8][3][11];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAProbabilityDataBufferVP8;
/**
* \brief VP8 Inverse Quantization Matrix Buffer Structure
*
* Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
* uvac(5) for each segment (0-3). When segmentation is disabled, only
* quantization_index[0][] will be used. This structure is sent once per frame.
*/
typedef struct _VAIQMatrixBufferVP8 {
/*
* array first dimensional is segment and 2nd dimensional is Q index
* all Q indexs should be clipped to be range [0, 127]
*/
uint16_t quantization_index[4][6];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferVP8;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP8_H */

312
lib/libva/va/va_dec_vp9.h Normal file
View file

@ -0,0 +1,312 @@
/*
* Copyright (c) 2014 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_vp9.h
* \brief The VP9 decoding API
*
* This file contains the \ref api_dec_vp9 "VP9 decoding API".
*/
#ifndef VA_DEC_VP9_H
#define VA_DEC_VP9_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp9 VP9 decoding API
*
* This VP9 decoding API supports 8-bit 420 format only.
*
* @{
*/
/**
* \brief VP9 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
* App should send a surface with this data structure down to VAAPI once
* per frame.
*
*/
typedef struct _VADecPictureParameterBufferVP9 {
/** \brief picture width
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_width;
/** \brief picture height
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_height;
/** \brief Surface indices of reference frames in DPB.
*
* Each entry of the list specifies the surface index of the picture
* that is referred by current picture or will be referred by any future
* picture.
* Application who calls this API should update this list based on the
* refreshing information from VP9 bitstream.
*/
VASurfaceID reference_frames[8];
union {
struct {
/** \brief flags for current picture
* same syntax and semantic as those in VP9 code
*/
uint32_t subsampling_x : 1;
uint32_t subsampling_y : 1;
uint32_t frame_type : 1;
uint32_t show_frame : 1;
uint32_t error_resilient_mode : 1;
uint32_t intra_only : 1;
uint32_t allow_high_precision_mv : 1;
uint32_t mcomp_filter_type : 3;
uint32_t frame_parallel_decoding_mode : 1;
uint32_t reset_frame_context : 2;
uint32_t refresh_frame_context : 1;
uint32_t frame_context_idx : 2;
uint32_t segmentation_enabled : 1;
/** \brief corresponds to variable temporal_update in VP9 code.
*/
uint32_t segmentation_temporal_update : 1;
/** \brief corresponds to variable update_mb_segmentation_map
* in VP9 code.
*/
uint32_t segmentation_update_map : 1;
/** \brief Index of reference_frames[] and points to the
* LAST reference frame.
* It corresponds to active_ref_idx[0] in VP9 code.
*/
uint32_t last_ref_frame : 3;
/** \brief Sign Bias of the LAST reference frame.
* It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
*/
uint32_t last_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* GOLDERN reference frame.
* It corresponds to active_ref_idx[1] in VP9 code.
*/
uint32_t golden_ref_frame : 3;
/** \brief Sign Bias of the GOLDERN reference frame.
* Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
*/
uint32_t golden_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* ALTERNATE reference frame.
* Corresponds to active_ref_idx[2] in VP9 code.
*/
uint32_t alt_ref_frame : 3;
/** \brief Sign Bias of the ALTERNATE reference frame.
* Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
*/
uint32_t alt_ref_frame_sign_bias : 1;
/** \brief Lossless Mode
* LosslessFlag = base_qindex == 0 &&
* y_dc_delta_q == 0 &&
* uv_dc_delta_q == 0 &&
* uv_ac_delta_q == 0;
* Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
* are all variables in VP9 code.
*/
uint32_t lossless_flag : 1;
} bits;
uint32_t value;
} pic_fields;
/* following parameters have same syntax with those in VP9 code */
uint8_t filter_level;
uint8_t sharpness_level;
/** \brief number of tile rows specified by (1 << log2_tile_rows).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_rows;
/** \brief number of tile columns specified by (1 << log2_tile_columns).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_columns;
/** \brief Number of bytes taken up by the uncompressed frame header,
* which corresponds to byte length of function
* read_uncompressed_header() in VP9 code.
* Specifically, it is the byte count from bit stream buffer start to
* the last byte of uncompressed frame header.
* If there are other meta data in the buffer before uncompressed header,
* its size should be also included here.
*/
uint8_t frame_header_length_in_bytes;
/** \brief The byte count of compressed header the bitstream buffer,
* which corresponds to syntax first_partition_size in code.
*/
uint16_t first_partition_size;
/** These values are segment probabilities with same names in VP9
* function setup_segmentation(). They should be parsed directly from
* bitstream by application.
*/
uint8_t mb_segment_tree_probs[7];
uint8_t segment_pred_probs[3];
/** \brief VP9 Profile definition
* value range [0..3].
*/
uint8_t profile;
/** \brief VP9 bit depth per sample
* same for both luma and chroma samples.
*/
uint8_t bit_depth;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VADecPictureParameterBufferVP9;
/**
* \brief VP9 Segmentation Parameter Data Structure
*
* This structure conveys per segment parameters.
* 8 of this data structure will be included in VASegmentationParameterBufferVP9
* and sent to API in a single buffer.
*
*/
typedef struct _VASegmentParameterVP9 {
union {
struct {
/** \brief Indicates if per segment reference frame indicator
* is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_enabled : 1;
/** \brief Specifies per segment reference indication.
* 0: reserved
* 1: Last ref
* 2: golden
* 3: altref
* Value can be derived from variable data when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference : 2;
/** \brief Indicates if per segment skip feature is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_skipped : 1;
} fields;
uint16_t value;
} segment_flags;
/** \brief Specifies the filter level information per segment.
* The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
* where m is [ref], and n is [mode] in FilterLevel[m][n].
*/
uint8_t filter_level[4][2];
/** \brief Specifies per segment Luma AC quantization scale.
* Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_ac_quant_scale;
/** \brief Specifies per segment Luma DC quantization scale.
* Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_dc_quant_scale;
/** \brief Specifies per segment Chroma AC quantization scale.
* Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_ac_quant_scale;
/** \brief Specifies per segment Chroma DC quantization scale.
* Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_dc_quant_scale;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASegmentParameterVP9;
/**
* \brief VP9 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to segmentation data and should be
* sent once per frame.
*
* When segmentation is disabled, only SegParam[0] has valid values,
* all other entries should be populated with 0.
* Otherwise, all eight entries should be valid.
*
* Slice data buffer of VASliceDataBufferType is used
* to send the bitstream which should include whole or part of partition 0
* (at least compressed header) to the end of frame.
*
*/
typedef struct _VASliceParameterBufferVP9 {
/** \brief The byte count of current frame in the bitstream buffer,
* starting from first byte of the buffer.
* It uses the name slice_data_size to be consitent with other codec,
* but actually means frame_data_size.
*/
uint32_t slice_data_size;
/**
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/**
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/**
* \brief per segment information
*/
VASegmentParameterVP9 seg_param[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP9;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP9_H */

688
lib/libva/va/va_dec_vvc.h Normal file
View file

@ -0,0 +1,688 @@
/*
* Copyright (c) 2024 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_vvc.h
* \brief The VVC decoding API
*
* This file contains the \ref api_dec_vvc "VVC decoding API".
*/
#ifndef VA_DEC_VVC_H
#define VA_DEC_VVC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vvc VVC decoding API
*
* This VVC decoding API supports Main 10 profile and Multilayer Main 10 profile.
* And it supports only long slice format.
*
* @{
*/
/**
* \brief Weighted Prediction Parameters.
*/
typedef struct _VAWeightedPredInfo {
/** \brief Weighted Prediction parameters.
* All the parameters except reserved bytes are VVC syntax.
*/
uint8_t luma_log2_weight_denom;
int8_t delta_chroma_log2_weight_denom;
uint8_t num_l0_weights;
uint8_t luma_weight_l0_flag[15];
uint8_t chroma_weight_l0_flag[15];
int8_t delta_luma_weight_l0[15];
int8_t luma_offset_l0[15];
int8_t delta_chroma_weight_l0[15][2];
int16_t delta_chroma_offset_l0[15][2];
uint8_t num_l1_weights;
uint8_t luma_weight_l1_flag[15];
uint8_t chroma_weight_l1_flag[15];
int8_t delta_luma_weight_l1[15];
int8_t luma_offset_l1[15];
int8_t delta_chroma_weight_l1[15][2];
int16_t delta_chroma_offset_l1[15][2];
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b;
uint32_t reserved32b;
} VAWeightedPredInfo;
/**
* \brief VVC Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
* Host decoder is required to send in a buffer of VAPictureParameterBufferVVC
* as the first va buffer for each frame.
*
*/
typedef struct _VAPictureParameterBufferVVC {
/** \brief buffer description of decoded current picture
*/
VAPictureVVC CurrPic;
/** \brief buffer description of reference frames in DPB */
VAPictureVVC ReferenceFrames[15];
/** \brief picture width, shall be integer multiple of Max(8, MinCbSizeY). */
uint16_t pps_pic_width_in_luma_samples;
/** \brief picture height, shall be integer multiple of Max(8, MinCbSizeY). */
uint16_t pps_pic_height_in_luma_samples;
/** \brief sequence level parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint16_t sps_num_subpics_minus1;
uint8_t sps_chroma_format_idc;
uint8_t sps_bitdepth_minus8;
uint8_t sps_log2_ctu_size_minus5;
uint8_t sps_log2_min_luma_coding_block_size_minus2;
uint8_t sps_log2_transform_skip_max_size_minus2;
/** \brief chroma QP mapping table.
* ChromaQpTable[][] corresponds to VVC spec variable with the same name.
* It is derived according to formula (57) in VVC spec section 7.4.3.4.
*/
int8_t ChromaQpTable[3][111];
uint8_t sps_six_minus_max_num_merge_cand;
uint8_t sps_five_minus_max_num_subblock_merge_cand;
uint8_t sps_max_num_merge_cand_minus_max_num_gpm_cand;
uint8_t sps_log2_parallel_merge_level_minus2;
uint8_t sps_min_qp_prime_ts;
uint8_t sps_six_minus_max_num_ibc_merge_cand;
uint8_t sps_num_ladf_intervals_minus2;
int8_t sps_ladf_lowest_interval_qp_offset;
int8_t sps_ladf_qp_offset[4];
uint16_t sps_ladf_delta_threshold_minus1[4];
/** \brief Reserved for future use, must be zero */
uint32_t reserved32b01[VA_PADDING_LOW - 2];
union {
struct {
uint64_t sps_subpic_info_present_flag : 1;
uint64_t sps_independent_subpics_flag : 1;
uint64_t sps_subpic_same_size_flag : 1;
uint64_t sps_entropy_coding_sync_enabled_flag : 1;
uint64_t sps_qtbtt_dual_tree_intra_flag : 1;
uint64_t sps_max_luma_transform_size_64_flag : 1;
uint64_t sps_transform_skip_enabled_flag : 1;
uint64_t sps_bdpcm_enabled_flag : 1;
uint64_t sps_mts_enabled_flag : 1;
uint64_t sps_explicit_mts_intra_enabled_flag : 1;
uint64_t sps_explicit_mts_inter_enabled_flag : 1;
uint64_t sps_lfnst_enabled_flag : 1;
uint64_t sps_joint_cbcr_enabled_flag : 1;
uint64_t sps_same_qp_table_for_chroma_flag : 1;
uint64_t sps_sao_enabled_flag : 1;
uint64_t sps_alf_enabled_flag : 1;
uint64_t sps_ccalf_enabled_flag : 1;
uint64_t sps_lmcs_enabled_flag : 1;
uint64_t sps_sbtmvp_enabled_flag : 1;
uint64_t sps_amvr_enabled_flag : 1;
uint64_t sps_smvd_enabled_flag : 1;
uint64_t sps_mmvd_enabled_flag : 1;
uint64_t sps_sbt_enabled_flag : 1;
uint64_t sps_affine_enabled_flag : 1;
uint64_t sps_6param_affine_enabled_flag : 1;
uint64_t sps_affine_amvr_enabled_flag : 1;
uint64_t sps_affine_prof_enabled_flag : 1;
uint64_t sps_bcw_enabled_flag : 1;
uint64_t sps_ciip_enabled_flag : 1;
uint64_t sps_gpm_enabled_flag : 1;
uint64_t sps_isp_enabled_flag : 1;
uint64_t sps_mrl_enabled_flag : 1;
uint64_t sps_mip_enabled_flag : 1;
uint64_t sps_cclm_enabled_flag : 1;
uint64_t sps_chroma_horizontal_collocated_flag : 1;
uint64_t sps_chroma_vertical_collocated_flag : 1;
uint64_t sps_palette_enabled_flag : 1;
uint64_t sps_act_enabled_flag : 1;
uint64_t sps_ibc_enabled_flag : 1;
uint64_t sps_ladf_enabled_flag : 1;
uint64_t sps_explicit_scaling_list_enabled_flag : 1;
uint64_t sps_scaling_matrix_for_lfnst_disabled_flag : 1;
uint64_t sps_scaling_matrix_for_alternative_colour_space_disabled_flag : 1;
uint64_t sps_scaling_matrix_designated_colour_space_flag : 1;
uint64_t sps_virtual_boundaries_enabled_flag : 1;
uint64_t sps_virtual_boundaries_present_flag : 1;
/** \brief Reserved for future use, must be zero */
uint64_t reserved : 18;
} bits;
uint64_t value;
} sps_flags;
/** \brief picture level parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
/** \brief number of vertical virtual boundaries on the picture.
* NumVerVirtualBoundaries corresponds to VVC spec variable with the same name.
* It is derived according to formula (78) in VVC spec section 7.4.3.8.
*/
uint8_t NumVerVirtualBoundaries;
/** \brief number of horizontal virtual boundaries on the picture.
* NumHorVirtualBoundaries corresponds to VVC spec variable with the same name.
* It is derived according to formula (80) in VVC spec section 7.4.3.8.
*/
uint8_t NumHorVirtualBoundaries;
/** \brief location of the vertical virtual boundary in units of luma samples.
* VirtualBoundaryPosX[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (79) in VVC spec section 7.4.3.8.
*/
uint16_t VirtualBoundaryPosX[3];
/** \brief location of the horizontal virtual boundary in units of luma samples.
* VirtualBoundaryPosY[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (81) in VVC spec section 7.4.3.8.
*/
uint16_t VirtualBoundaryPosY[3];
int32_t pps_scaling_win_left_offset;
int32_t pps_scaling_win_right_offset;
int32_t pps_scaling_win_top_offset;
int32_t pps_scaling_win_bottom_offset;
int8_t pps_num_exp_tile_columns_minus1;
uint16_t pps_num_exp_tile_rows_minus1;
uint16_t pps_num_slices_in_pic_minus1;
uint16_t pps_pic_width_minus_wraparound_offset;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
int8_t pps_joint_cbcr_qp_offset_value;
uint8_t pps_chroma_qp_offset_list_len_minus1;
int8_t pps_cb_qp_offset_list[6];
int8_t pps_cr_qp_offset_list[6];
int8_t pps_joint_cbcr_qp_offset_list[6];
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b01;
uint32_t reserved32b02[VA_PADDING_LOW - 2];
union {
struct {
uint32_t pps_loop_filter_across_tiles_enabled_flag : 1;
uint32_t pps_rect_slice_flag : 1;
uint32_t pps_single_slice_per_subpic_flag : 1;
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
uint32_t pps_weighted_pred_flag : 1;
uint32_t pps_weighted_bipred_flag : 1;
uint32_t pps_ref_wraparound_enabled_flag : 1;
uint32_t pps_cu_qp_delta_enabled_flag : 1;
uint32_t pps_cu_chroma_qp_offset_list_enabled_flag : 1;
uint32_t pps_deblocking_filter_override_enabled_flag : 1;
uint32_t pps_deblocking_filter_disabled_flag : 1;
uint32_t pps_dbf_info_in_ph_flag : 1;
uint32_t pps_sao_info_in_ph_flag : 1;
uint32_t pps_alf_info_in_ph_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 18;
} bits;
uint32_t value;
} pps_flags;
/** \brief picture header parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t ph_lmcs_aps_id;
uint8_t ph_scaling_list_aps_id;
uint8_t ph_log2_diff_min_qt_min_cb_intra_slice_luma;
uint8_t ph_max_mtt_hierarchy_depth_intra_slice_luma;
uint8_t ph_log2_diff_max_bt_min_qt_intra_slice_luma;
uint8_t ph_log2_diff_max_tt_min_qt_intra_slice_luma;
uint8_t ph_log2_diff_min_qt_min_cb_intra_slice_chroma;
uint8_t ph_max_mtt_hierarchy_depth_intra_slice_chroma;
uint8_t ph_log2_diff_max_bt_min_qt_intra_slice_chroma;
uint8_t ph_log2_diff_max_tt_min_qt_intra_slice_chroma;
uint8_t ph_cu_qp_delta_subdiv_intra_slice;
uint8_t ph_cu_chroma_qp_offset_subdiv_intra_slice;
uint8_t ph_log2_diff_min_qt_min_cb_inter_slice;
uint8_t ph_max_mtt_hierarchy_depth_inter_slice;
uint8_t ph_log2_diff_max_bt_min_qt_inter_slice;
uint8_t ph_log2_diff_max_tt_min_qt_inter_slice;
uint8_t ph_cu_qp_delta_subdiv_inter_slice;
uint8_t ph_cu_chroma_qp_offset_subdiv_inter_slice;
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b02;
uint32_t reserved32b03[VA_PADDING_LOW - 2];
union {
struct {
uint32_t ph_non_ref_pic_flag : 1;
uint32_t ph_alf_enabled_flag : 1;
uint32_t ph_alf_cb_enabled_flag : 1;
uint32_t ph_alf_cr_enabled_flag : 1;
uint32_t ph_alf_cc_cb_enabled_flag : 1;
uint32_t ph_alf_cc_cr_enabled_flag : 1;
uint32_t ph_lmcs_enabled_flag : 1;
uint32_t ph_chroma_residual_scale_flag : 1;
uint32_t ph_explicit_scaling_list_enabled_flag : 1;
uint32_t ph_virtual_boundaries_present_flag : 1;
uint32_t ph_temporal_mvp_enabled_flag : 1;
uint32_t ph_mmvd_fullpel_only_flag : 1;
uint32_t ph_mvd_l1_zero_flag : 1;
uint32_t ph_bdof_disabled_flag : 1;
uint32_t ph_dmvr_disabled_flag : 1;
uint32_t ph_prof_disabled_flag : 1;
uint32_t ph_joint_cbcr_sign_flag : 1;
uint32_t ph_sao_luma_enabled_flag : 1;
uint32_t ph_sao_chroma_enabled_flag : 1;
uint32_t ph_deblocking_filter_disabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 12;
} bits;
uint32_t value;
} ph_flags;
/** \brief Reserved for future use, must be zero */
uint32_t reserved32b04;
union {
struct {
/** \brief Flag to indicate if current picture is an intra picture.
* Takes value 1 when all slices of current picture are intra slices.
* Takes value 0 when some slices of current picture may not be
* intra slices.
*/
uint32_t IntraPicFlag : 1; // [0..1]
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 31;
} fields;
uint32_t value;
} PicMiscFlags;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved32b[VA_PADDING_HIGH + 1];
} VAPictureParameterBufferVVC;
/**
* \brief VVC Slice Parameter Buffer Structure
*
* VASliceParameterBufferVVC structure should be accompanied by a
* slice data buffer, which holds the whole packed slice NAL unit bit stream
* with emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice header and should
* be sent once per slice.
*/
typedef struct _VASliceParameterBufferVVC {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice
* counting from and including NAL unit header.
*/
uint32_t slice_data_size;
/** \brief The offset to the NAL unit header for this slice */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
uint32_t slice_data_flag;
/**
* \brief Byte offset from NAL unit header to the beginning of slice_data().
*
* This byte offset is relative to and includes the NAL unit header
* and represents the number of bytes parsed in the slice_header()
* after the removal of any emulation prevention bytes in
* there. However, the slice data buffer passed to the hardware is
* the original bitstream, thus including any emulation prevention
* bytes.
*/
uint32_t slice_data_byte_offset;
/** \brief index into ReferenceFrames[]
* RefPicList[][] corresponds to VVC spec variable with the same name.
* Value range [0..14, 0xFF], where 0xFF indicates invalid entry.
*/
uint8_t RefPicList[2][15];
/**
* \brief the subpicture ID of the subpicture that contains the slice.
* The value of the variable CurrSubpicIdx
* is derived to be such that SubpicIdVal[CurrSubpicIdx] is equal
* to sh_subpic_id. CurrSubpicIdx is the index of array VASubPicArrayBufferVVC.SubPicSet[].
* And it is the spec variable with the same name.
*/
uint16_t sh_subpic_id;
/* parameters below are VVC syntax or spec variables. */
uint16_t sh_slice_address;
uint16_t sh_num_tiles_in_slice_minus1;
uint8_t sh_slice_type;
uint8_t sh_num_alf_aps_ids_luma;
uint8_t sh_alf_aps_id_luma[7];
uint8_t sh_alf_aps_id_chroma;
uint8_t sh_alf_cc_cb_aps_id;
uint8_t sh_alf_cc_cr_aps_id;
/**
* \brief NumRefIdxActive[i] - 1 specifies the maximum reference index
* for RPL i that may be used to decode the slice. When NumRefIdxActive[i]
* is equal to 0, no reference index for RPL i is used to decode the slice.
* NumRefIdxActive[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (138) in VVC spec section 7.4.8.
*/
uint8_t NumRefIdxActive[2];
uint8_t sh_collocated_ref_idx;
/**
* \brief initial value of the QpY quantization parameter for the slice.
* SliceQpY corresponds to VVC spec variable with the same name.
* It is derived according to formula (86) in VVC spec section 7.4.3.8
* and formula (139) in VVC Spec section 7.4.8.
*/
int8_t SliceQpY;
/* parameters below are VVC syntax. */
int8_t sh_cb_qp_offset;
int8_t sh_cr_qp_offset;
int8_t sh_joint_cbcr_qp_offset;
int8_t sh_luma_beta_offset_div2;
int8_t sh_luma_tc_offset_div2;
int8_t sh_cb_beta_offset_div2;
int8_t sh_cb_tc_offset_div2;
int8_t sh_cr_beta_offset_div2;
int8_t sh_cr_tc_offset_div2;
/** \brief Reserved bytes for future use, must be zero */
uint8_t reserved8b[VA_PADDING_LOW - 1];
uint32_t reserved32b;
// weighted prediction info
VAWeightedPredInfo WPInfo;
union {
struct {
/* flags below are VVC syntax. */
uint32_t sh_alf_enabled_flag : 1;
uint32_t sh_alf_cb_enabled_flag : 1;
uint32_t sh_alf_cr_enabled_flag : 1;
uint32_t sh_alf_cc_cb_enabled_flag : 1;
uint32_t sh_alf_cc_cr_enabled_flag : 1;
uint32_t sh_lmcs_used_flag : 1;
uint32_t sh_explicit_scaling_list_used_flag : 1;
uint32_t sh_cabac_init_flag : 1;
uint32_t sh_collocated_from_l0_flag : 1;
uint32_t sh_cu_chroma_qp_offset_enabled_flag : 1;
uint32_t sh_sao_luma_used_flag : 1;
uint32_t sh_sao_chroma_used_flag : 1;
uint32_t sh_deblocking_filter_disabled_flag : 1;
uint32_t sh_dep_quant_used_flag : 1;
uint32_t sh_sign_data_hiding_used_flag : 1;
uint32_t sh_ts_residual_coding_disabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 16;
} bits;
uint32_t value;
} sh_flags;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VASliceParameterBufferVVC;
/**
* \brief VVC Scaling List Data Structure
*
* Host decoder sends in an array of VVC Scaling Lists through one or multiple
* buffers which may contain 1 to 8 VAScalingListVVC data structures in total.
* Each buffer contains an integer number of VAScalingListVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same scaling list data for each frame. When a VAScalingListVVC
* structure carries a same value of aps_adaptation_parameter_set_id
* as a previously stored structure, driver should override the old structure
* with values in the new structure.
* VAIQMatrixBufferType is used to send this buffer.
*/
typedef struct _VAScalingListVVC {
/** \brief VVC syntax to specify the identifier for the APS.*/
uint8_t aps_adaptation_parameter_set_id;
/** \brief Reserved for future use, must be zero */
uint8_t reserved8b;
/**
* \brief Specifies the spec variable ScalingMatrixDCRec[id14],
* where id = [14..27].
*/
uint8_t ScalingMatrixDCRec[14];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [0..1]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec2x2[2][2][2];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [2..7]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec4x4[6][4][4];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [8..27]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec8x8[20][8][8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAScalingListVVC;
/**
* \brief VVC Adaptive Loop Filter Data Structure
*
* Host decoder sends in an array of VVC ALF sets through one or multiple
* buffers which may contain 1 to 8 VAAlfDataVVC data structures in total.
* Each buffer contains an integer number of VAAlfDataVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same ALF data for each frame. When a VAAlfDataVVC structure
* carries a same value of aps_adaptation_parameter_set_id as a previously
* stored structure, driver should override the old structure
* with values in the new structure.
* VAAlfBufferType is used to send this buffer.
*/
typedef struct _VAAlfDataVVC {
/**
* \brief VVC Adaptive Loop Filter parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t aps_adaptation_parameter_set_id;
uint8_t alf_luma_num_filters_signalled_minus1;
uint8_t alf_luma_coeff_delta_idx[25];
int8_t filtCoeff[25][12];
uint8_t alf_luma_clip_idx[25][12];
uint8_t alf_chroma_num_alt_filters_minus1;
int8_t AlfCoeffC[8][6];
uint8_t alf_chroma_clip_idx[8][6];
uint8_t alf_cc_cb_filters_signalled_minus1;
int8_t CcAlfApsCoeffCb[4][7];
uint8_t alf_cc_cr_filters_signalled_minus1;
int8_t CcAlfApsCoeffCr[4][7];
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved16b;
uint32_t reserved32b;
union {
struct {
uint32_t alf_luma_filter_signal_flag : 1;
uint32_t alf_chroma_filter_signal_flag : 1;
uint32_t alf_cc_cb_filter_signal_flag : 1;
uint32_t alf_cc_cr_filter_signal_flag : 1;
uint32_t alf_luma_clip_flag : 1;
uint32_t alf_chroma_clip_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 26;
} bits;
uint32_t value;
} alf_flags;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAAlfDataVVC;
/**
* \brief VVC Luma Mapping with Chroma Scaling Data Structure
*
* Host decoder sends in an array of VVC LMCS sets through one or multiple
* buffers which may contain 1 to 4 VALmcsDataVVC data structures in total.
* Each buffer contains an integer number of VALmcsDataVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same LMCS data for each frame. When a VALmcsDataVVC structure
* carries a same value of aps_adaptation_parameter_set_id as a previously
* stored structure, driver should override the old structure
* with values in the new structure.
* VALmcsBufferType is used to send this buffer.
*/
typedef struct _VALmcsDataVVC {
/**
* \brief VVC Luma Mapping with Chroma Scaling parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t aps_adaptation_parameter_set_id;
uint8_t lmcs_min_bin_idx;
uint8_t lmcs_delta_max_bin_idx;
int16_t lmcsDeltaCW[16];
int8_t lmcsDeltaCrs;
/** \brief Reserved for future use, must be zero */
uint8_t reserved8b[VA_PADDING_LOW - 1];
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VALmcsDataVVC;
/**
* \brief VVC SubPicture Data Structure
*
* Host decoder sends in an array of VVC SubPic sets through one or
* multiple buffers which contain sps_num_subpics_minus1 + 1
* VASubPicVVC data structures in total. Each buffer contains
* an integer number of VASubPicVVC data structures with no gap in between.
* The Subpic sets are sent sequentially in the order of indices
* from 0 to sps_num_subpics_minus1 according to the bitstream.
* VASubPicBufferType is used to send this buffer.
*/
typedef struct _VASubPicVVC {
/**
* \brief VVC SubPicture layout parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint16_t sps_subpic_ctu_top_left_x;
uint16_t sps_subpic_ctu_top_left_y;
uint16_t sps_subpic_width_minus1;
uint16_t sps_subpic_height_minus1;
/** \brief the subpicture ID of the i-th subpicture.
* It is same variable as in VVC spec.
*/
uint16_t SubpicIdVal;
union {
struct {
uint16_t sps_subpic_treated_as_pic_flag : 1;
uint16_t sps_loop_filter_across_subpic_enabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint16_t reserved : 14;
} bits;
uint16_t value;
} subpic_flags;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASubPicVVC;
/**
* \brief data buffer of tile widths and heights.
* VATileBufferType is used to send this buffer.
*
* Host decoder sends in number of pps_num_exp_tile_columns_minus1 + 1
* tile column widths of pps_tile_column_width_minus1[i], followed by
* number of pps_num_exp_tile_rows_minus1 + 1 of tile row heights of
* pps_tile_row_height_minus1[i], through one or multiple buffers.
* Each tile width or height is formatted as
uint16_t tile_dimension;
* Each buffer contains an integer number of tile_dimension with
* no gap in between.
* The buffers with type VATileBufferType should be submitted for each
* picture. And driver will derive the tile structure from it.
* When pps_num_exp_tile_columns_minus1 + pps_num_exp_tile_rows_minus1 equals 0,
* this buffer is still submitted by app to driver.
*/
/**
* \brief VVC SliceStruct Data Structure
*
* Host decoder sends in an array of SliceStruct sets through one or multiple
* buffers. These SliceStruct sets contain only the "explicit" slices parsed
* from PPS header.
* Each SliceStruct set is described by VASliceStructVVC data structure.
* Each buffer contains an integer number of VASliceStructVVC data structures,
* which are laid out sequentially in the order of
* ascending slice indices according to the spec with no gap in between.
*
* When pps_rect_slice_flag equals 0 or there are no explicit slices,
* this buffer is not submitted by app to driver. Otherwise, for each picture,
* this buffer should be submitted.
*
* Note: When pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1
* equals 0, if the sum of pps_exp_slice_height_in_ctus_minus1 + 1 of all those
* slices with same SliceTopLeftTileIdx value is less than the height of tile
* SliceTopLeftTileIdx in unit of CTUs, driver should derive the rest slices in
* that tile according to equation (21) in spec section 6.5.1. And VASliceStructVVC
* for these (derived) slices are not passed in to LibVA by App.
*
* App should populate the data entries regardless of values of
* pps_single_slice_per_subpic_flag or sps_subpic_info_present_flag.
*
* VASliceStructBufferType is used to send this buffer.
*/
typedef struct _VASliceStructVVC {
/** \brief the tile index of which the starting CTU (top-left) of
* the slice belongs to. The tile index is in raster scan order.
* Same syntax variable as in VVC spec.
*/
uint16_t SliceTopLeftTileIdx;
/* plus 1 specifies the width of the rectangular slice in units
* of tile columns.
*/
uint16_t pps_slice_width_in_tiles_minus1;
/* plus 1 specifies the height of the rectangular slice in units
* of tile rows. If the slice does not cover the whole tile,
* pps_slice_height_in_tiles_minus1 shall be 0.
*/
uint16_t pps_slice_height_in_tiles_minus1;
/* plus 1 specifies the height of the rectangular slice in units
* of CTU rows.
* If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 > 0,
* set this value to 0.
* If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 == 0,
* and if there is only one slice in tile, set this value to the number of
* CTU rows of the tile minus 1, otherwise, set the value equal to
* corresponding pps_exp_slice_height_in_ctus_minus1 from bitstream.
*/
uint16_t pps_exp_slice_height_in_ctus_minus1;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceStructVVC;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VVC_H */

234
lib/libva/va/va_drmcommon.h Normal file
View file

@ -0,0 +1,234 @@
/*
* va_drmcommon.h - Common utilities for DRM-based drivers
*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_DRM_COMMON_H
#define VA_DRM_COMMON_H
#include <stdint.h>
#include <va/va.h>
/** \brief DRM authentication type. */
enum {
/** \brief Disconnected. */
VA_DRM_AUTH_NONE = 0,
/**
* \brief Connected. Authenticated with DRI1 protocol.
*
* @deprecated
* This is a deprecated authentication type. All DRI-based drivers have
* been migrated to use the DRI2 protocol. Newly written drivers shall
* use DRI2 protocol only, or a custom authentication means. e.g. opt
* for authenticating on the VA driver side, instead of libva side.
*/
VA_DRM_AUTH_DRI1 = 1,
/**
* \brief Connected. Authenticated with DRI2 protocol.
*
* This is only useful to VA/X11 drivers. The libva-x11 library provides
* a helper function VA_DRI2Authenticate() for authenticating the
* connection. However, DRI2 conformant drivers don't need to call that
* function since authentication happens on the libva side, implicitly.
*/
VA_DRM_AUTH_DRI2 = 2,
/**
* \brief Connected. Authenticated with some alternate raw protocol.
*
* This authentication mode is mainly used in non-VA/X11 drivers.
* Authentication happens through some alternative method, at the
* discretion of the VA driver implementation.
*/
VA_DRM_AUTH_CUSTOM = 3
};
/** \brief Base DRM state. */
struct drm_state {
/** \brief DRM connection descriptor. */
int fd;
/** \brief DRM authentication type. */
int auth_type;
/** \brief Reserved bytes for future use, must be zero */
int va_reserved[8];
};
/** \brief Kernel DRM buffer memory type. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
/** \brief DRM PRIME memory type (old version)
*
* This supports only single objects with restricted memory layout.
* Used with VASurfaceAttribExternalBuffers.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
/** \brief DRM PRIME memory type
*
* Used with VADRMPRIMESurfaceDescriptor.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
/** \brief DRM PRIME3 memory type
*
* Used with VADRMPRIME3SurfaceDescriptor.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 0x08000000
/**
* \brief External buffer descriptor for a DRM PRIME surface.
*
* For export, call vaExportSurfaceHandle() with mem_type set to
* VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
* instance of this structure to fill.
* If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
* layer will contain exactly one plane. For example, an NV12
* surface will be exported as two layers, one of DRM_FORMAT_R8 and
* one of DRM_FORMAT_GR88.
* If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
* there will be exactly one layer.
*
* For import, call vaCreateSurfaces() with the MemoryType attribute
* set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the
* ExternalBufferDescriptor attribute set to point to an array of
* num_surfaces instances of this structure.
* The number of planes which need to be provided for a given layer
* is dependent on both the format and the format modifier used for
* the objects containing it. For example, the format DRM_FORMAT_RGBA
* normally requires one plane, but with the format modifier
* I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first
* being the main data plane and the second containing the color
* control surface.
* Note that a given driver may only support a subset of possible
* representations of a particular format. For example, it may only
* support NV12 surfaces when they are contained within a single DRM
* object, and therefore fail to create such surfaces if the two
* planes are in different DRM objects.
* Note that backend driver will retrieve the resource represent by fd,
* and a valid surface ID is generated. Backend driver will not close
* the file descriptor. Application should handle the release of the fd.
* releasing the fd will not impact the existence of the surface.
*/
typedef struct _VADRMPRIMESurfaceDescriptor {
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
uint32_t fourcc;
/** Width of the surface in pixels. */
uint32_t width;
/** Height of the surface in pixels. */
uint32_t height;
/** Number of distinct DRM objects making up the surface. */
uint32_t num_objects;
/** Description of each object. */
struct {
/** DRM PRIME file descriptor for this object. */
int fd;
/** Total size of this object (may include regions which are
* not part of the surface). */
uint32_t size;
/** Format modifier applied to this object. */
uint64_t drm_format_modifier;
} objects[4];
/** Number of layers making up the surface. */
uint32_t num_layers;
/** Description of each layer in the surface. */
struct {
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
uint32_t drm_format;
/** Number of planes in this layer. */
uint32_t num_planes;
/** Index in the objects array of the object containing each
* plane. */
uint32_t object_index[4];
/** Offset within the object of each plane. */
uint32_t offset[4];
/** Pitch of each plane. */
uint32_t pitch[4];
} layers[4];
} VADRMPRIMESurfaceDescriptor;
/**
* \brief External buffer descriptor for a DRM PRIME surface with flags
*
* This structure is an extention for VADRMPRIMESurfaceDescriptor,
* it has the same behavior as if used with VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2.
*
* The field "flags" is added, see "Surface external buffer descriptor flags".
* To use this structure, use VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 instead.
*/
typedef struct _VADRMPRIME3SurfaceDescriptor {
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
uint32_t fourcc;
/** Width of the surface in pixels. */
uint32_t width;
/** Height of the surface in pixels. */
uint32_t height;
/** Number of distinct DRM objects making up the surface. */
uint32_t num_objects;
/** Description of each object. */
struct {
/** DRM PRIME file descriptor for this object. */
int fd;
/** Total size of this object (may include regions which are
* not part of the surface). */
uint32_t size;
/** Format modifier applied to this object. */
uint64_t drm_format_modifier;
} objects[4];
/** Number of layers making up the surface. */
uint32_t num_layers;
/** Description of each layer in the surface. */
struct {
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
uint32_t drm_format;
/** Number of planes in this layer. */
uint32_t num_planes;
/** Index in the objects array of the object containing each
* plane. */
uint32_t object_index[4];
/** Offset within the object of each plane. */
uint32_t offset[4];
/** Pitch of each plane. */
uint32_t pitch[4];
} layers[4];
/** \brief flags. See "Surface external buffer descriptor flags". */
uint32_t flags;
/** reserved bytes, must be zero */
uint32_t reserved[VA_PADDING_MEDIUM - 1];
} VADRMPRIME3SurfaceDescriptor;
/**
* \brief List of DRM format modifiers.
*
* To allocate surfaces with one of the modifiers specified in the array, call
* vaCreateSurfaces() with the VASurfaceAttribDRMFormatModifiers attribute set
* to point to an array of num_surfaces instances of this structure. The driver
* will select the optimal modifier in the list.
*
* DRM format modifiers are defined in drm_fourcc.h in the Linux kernel.
*/
typedef struct _VADRMFormatModifierList {
/** Number of modifiers. */
uint32_t num_modifiers;
/** Array of modifiers. */
uint64_t *modifiers;
} VADRMFormatModifierList;
#endif /* VA_DRM_COMMON_H */

29
lib/libva/va/va_egl.h Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2007 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _VA_EGL_H_
#define _VA_EGL_H_
#warning The APIs / data structures included in this file are deprecated
#endif /* _VA_EGL_H_ */

1011
lib/libva/va/va_enc_av1.h Normal file

File diff suppressed because it is too large Load diff

659
lib/libva/va/va_enc_h264.h Normal file
View file

@ -0,0 +1,659 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_h264.h
* \brief The H.264 encoding API
*
* This file contains the \ref api_enc_h264 "H.264 encoding API".
*/
#ifndef VA_ENC_H264_H
#define VA_ENC_H264_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_h264 H.264 encoding API
*
* @{
*/
/**
* @name Picture flags
*
* Those flags flags are meant to signal when a picture marks the end
* of a sequence, a stream, or even both at once.
*
* @{
*/
/**
* \brief Marks the last picture in the sequence.
*
* i.e. the driver appends \c end_of_seq() NAL unit to the encoded frame.
*/
#define H264_LAST_PICTURE_EOSEQ 0x01
/**
* \brief Marks the last picture in the stream.
*
* i.e. the driver appends \c end_of_stream() NAL unit to the encoded frame.
*/
#define H264_LAST_PICTURE_EOSTREAM 0x02
/**@}*/
/**
* \brief Packed header types specific to H.264 encoding.
*
* Types of packed headers generally used for H.264 encoding. Each
* associated packed header data buffer shall contain the start code
* prefix 0x000001 followed by the complete NAL unit, thus also
* including the \c nal_unit_type.
*
* Note: the start code prefix can contain an arbitrary number of leading
* zeros. The driver will skip them for emulation prevention bytes insertion,
* if necessary.
*/
typedef enum {
/**
* \brief Packed Sequence Parameter Set (SPS).
*
* The corresponding packed header data buffer shall contain the
* complete seq_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 7.
*/
VAEncPackedHeaderH264_SPS = VAEncPackedHeaderSequence,
/**
* \brief Packed Picture Parameter Set (PPS).
*
* The corresponding packed header data buffer shall contain the
* complete pic_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 8.
*/
VAEncPackedHeaderH264_PPS = VAEncPackedHeaderPicture,
/**
* \brief Packed slice header.
*
* The corresponding packed header data buffer shall contain the
* \c slice_header() syntax element only, along with any start
* code prefix and NAL unit type preceeding it. i.e. this means
* that the buffer does not contain any of the \c slice_data() or
* the \c rbsp_slice_trailing_bits().
*
* Note: packed \c nal_unit_type shall be equal to 1 (non-IDR
* picture), or 5 (IDR picture).
*/
VAEncPackedHeaderH264_Slice = VAEncPackedHeaderSlice,
/**
* \brief Packed Supplemental Enhancement Information (SEI).
*
* The corresponding packed header data buffer shall contain the
* complete sei_rbsp() syntax element, thus including several
* sei_message() elements if necessary.
*
* Note: packed \c nal_unit_type shall be equal to 6.
*
* @deprecated
* This is a deprecated packed header flag, All applications can use
* \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
* SEI header data buffer to the driver
*/
VAEncPackedHeaderH264_SEI va_deprecated_enum = (0x80000000 | 1),
} VAEncPackedHeaderTypeH264;
/**
* \brief Sequence parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds information for \c seq_parameter_set_data() as
* defined by the H.264 specification.
*
* If packed sequence headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c seq_scaling_matrix_present_flag is set to \c 1, then a
* #VAIQMatrixBufferH264 buffer shall also be provided within the same
* \c vaRenderPicture() call as this sequence parameter buffer.
*/
typedef struct _VAEncSequenceParameterBufferH264 {
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t seq_parameter_set_id;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t level_idc;
/** \brief Period between I frames. */
uint32_t intra_period;
/** \brief Period between IDR frames. */
uint32_t intra_idr_period;
/** \brief Period between I/P frames. */
uint32_t ip_period;
/**
* \brief Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* The bitrate can be modified later on through
* #VAEncMiscParameterRateControl buffers.
*/
uint32_t bits_per_second;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t max_num_ref_frames;
/** \brief Picture width in macroblocks. */
uint16_t picture_width_in_mbs;
/** \brief Picture height in macroblocks. */
uint16_t picture_height_in_mbs;
union {
struct {
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t chroma_format_idc : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_mbs_only_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t mb_adaptive_frame_field_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t seq_scaling_matrix_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t direct_8x8_inference_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t log2_max_frame_num_minus4 : 4;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_order_cnt_type : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t log2_max_pic_order_cnt_lsb_minus4 : 4;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t delta_pic_order_always_zero_flag : 1;
} bits;
uint32_t value;
} seq_fields;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t bit_depth_luma_minus8;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t bit_depth_chroma_minus8;
/** if pic_order_cnt_type == 1 */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_non_ref_pic;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_top_to_bottom_field;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_ref_frame[256];
/**@}*/
/** @name Cropping (optional) */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t frame_cropping_flag;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_left_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_right_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_top_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_bottom_offset;
/**@}*/
/** @name VUI parameters (optional) */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t vui_parameters_present_flag;
union {
struct {
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t aspect_ratio_info_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t timing_info_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t bitstream_restriction_flag : 1;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_horizontal : 5;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_vertical : 5;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t fixed_frame_rate_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t low_delay_hrd_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t motion_vectors_over_pic_boundaries_flag: 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 16;
} bits;
uint32_t value;
} vui_fields;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t aspect_ratio_idc;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t sar_width;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t sar_height;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t num_units_in_tick;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t time_scale;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
/**@}*/
} VAEncSequenceParameterBufferH264;
/**
* \brief Picture parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds information for \c pic_parameter_set_rbsp() as
* defined by the H.264 specification.
*
* If packed picture headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c pic_scaling_matrix_present_flag is set to \c 1, then a
* #VAIQMatrixBufferH264 buffer shall also be provided within the same
* \c vaRenderPicture() call as this picture parameter buffer.
*/
typedef struct _VAEncPictureParameterBufferH264 {
/**
* \brief Information about the picture to be encoded.
*
* See #VAPictureH264 for further description of each field.
* Note that CurrPic.picture_id represents the reconstructed
* (decoded) picture. User provides a scratch VA surface ID here.
*/
VAPictureH264 CurrPic;
/**
* \brief Decoded Picture Buffer (DPB).
*
* This array represents the list of reconstructed (decoded)
* frames used as reference. It is important to keep track of
* reconstructed frames so that they can be used later on as
* reference for P or B-frames encoding.
*/
VAPictureH264 ReferenceFrames[16];
/**
* \brief Output encoded bitstream.
*
* \ref coded_buf has type #VAEncCodedBufferType. It should be
* large enough to hold the compressed NAL slice and possibly SPS
* and PPS NAL units.
*/
VABufferID coded_buf;
/** \brief The picture parameter set referred to in the slice header. */
uint8_t pic_parameter_set_id;
/** \brief The active sequence parameter set. Range: 0 to 31, inclusive. */
uint8_t seq_parameter_set_id;
/**
* \brief OR'd flags describing whether the picture is the last one or not.
*
* This fields holds 0 if the picture to be encoded is not the last
* one in the stream or sequence. Otherwise, it is a combination of
* \ref H264_LAST_PICTURE_EOSEQ or \ref H264_LAST_PICTURE_EOSTREAM.
*/
uint8_t last_picture;
/** \brief The picture identifier.
* Range: 0 to \f$2^{log2\_max\_frame\_num\_minus4 + 4} - 1\f$, inclusive.
*/
uint16_t frame_num;
/** \brief \c pic_init_qp_minus26 + 26. */
uint8_t pic_init_qp;
/** \brief Maximum reference index for reference picture list 0.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** \brief Range: -12 to 12, inclusive. */
int8_t chroma_qp_index_offset;
/** \brief Range: -12 to 12, inclusive. */
int8_t second_chroma_qp_index_offset;
union {
struct {
/** \brief Is picture an IDR picture? */
uint32_t idr_pic_flag : 1;
/** \brief Is picture a reference picture? */
uint32_t reference_pic_flag : 2;
/** \brief Selects CAVLC (0) or CABAC (1) entropy coding mode. */
uint32_t entropy_coding_mode_flag : 1;
/** \brief Is weighted prediction applied to P slices? */
uint32_t weighted_pred_flag : 1;
/** \brief Range: 0 to 2, inclusive. */
uint32_t weighted_bipred_idc : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t constrained_intra_pred_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t transform_8x8_mode_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t deblocking_filter_control_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t redundant_pic_cnt_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_order_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_scaling_matrix_present_flag : 1;
} bits;
uint32_t value;
} pic_fields;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPictureParameterBufferH264;
typedef struct _VAEncQPBufferH264 {
/*
* \brief This structure holds QP per 16x16 macroblock. Buffer size shall be
* sufficient to fit the slice or frame to be encoded depending on if it is a
* slice level or frame level encoding.
*/
uint8_t qp;
} VAEncQPBufferH264;
/**
* \brief Slice parameter for H.264 encoding in baseline, main & high profiles.
*
* This structure holds information for \c
* slice_layer_without_partitioning_rbsp() as defined by the H.264
* specification.
*
* If packed slice headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SLICE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSlice ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If per-macroblock encoder configuration is needed, \c macroblock_info
* references a buffer of type #VAEncMacroblockParameterBufferH264. This
* buffer is not passed to vaRenderPicture() and it can be re-used
* without re-allocating the whole buffer.
*/
typedef struct _VAEncSliceParameterBufferH264 {
/** \brief Starting MB address for this slice. */
uint32_t macroblock_address;
/** \brief Number of macroblocks in this slice. */
uint32_t num_macroblocks;
/**
* \brief Per-MB encoder configuration buffer, or \c VA_INVALID_ID.
*
* If per-MB encoder configuration is needed, then \ref macroblock_info
* references a buffer of type #VAEncMacroblockParameterBufferH264
* (\c VAEncMacroblockParameterBufferType). Otherwise, buffer id
* is set to \c VA_INVALID_ID and per-MB configuration is derived
* from this slice parameter.
*
* The \c macroblock_info buffer must hold \ref num_macroblocks
* elements.
*/
VABufferID macroblock_info;
/** \brief Slice type.
* Range: 0..2, 5..7, i.e. no switching slices.
*/
uint8_t slice_type;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t pic_parameter_set_id;
/** \brief Same as the H.264 bitstream syntax element. */
uint16_t idr_pic_id;
/** @name If pic_order_cnt_type == 0 */
/**@{*/
/** \brief The picture order count modulo MaxPicOrderCntLsb. */
uint16_t pic_order_cnt_lsb;
/** \brief Valid if \c pic_order_present_flag and this is a bottom field. */
int32_t delta_pic_order_cnt_bottom;
/**@}*/
/** @name If pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag */
/**@{*/
/** \brief [0]: top, [1]: bottom. */
int32_t delta_pic_order_cnt[2];
/**@}*/
/** @name If slice_type == B */
/**@{*/
uint8_t direct_spatial_mv_pred_flag;
/**@}*/
/** @name If slice_type == P */
/**@{*/
/** \brief Specifies if
* \ref _VAEncPictureParameterBufferH264::num_ref_idx_l0_active_minus1 or
* \ref _VAEncPictureParameterBufferH264::num_ref_idx_l1_active_minus1 are
* overriden by the values for this slice.
*/
uint8_t num_ref_idx_active_override_flag;
/** \brief Maximum reference index for reference picture list 0.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** \brief Reference picture list 0 (for P slices). */
VAPictureH264 RefPicList0[32];
/** \brief Reference picture list 1 (for B slices). */
VAPictureH264 RefPicList1[32];
/**@}*/
/** @name pred_weight_table() */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_log2_weight_denom;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_log2_weight_denom;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_weight_l0_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_weight_l0[32];
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_offset_l0[32];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_weight_l0_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_weight_l0[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_offset_l0[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_weight_l1_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_weight_l1[32];
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_offset_l1[32];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_weight_l1_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_weight_l1[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_offset_l1[32][2];
/**@}*/
/** \brief Range: 0 to 2, inclusive. */
uint8_t cabac_init_idc;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_qp_delta;
/** @name If deblocking_filter_control_present_flag */
/**@{*/
/** \brief Range: 0 to 2, inclusive. */
uint8_t disable_deblocking_filter_idc;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_alpha_c0_offset_div2;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_beta_offset_div2;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
/**@}*/
} VAEncSliceParameterBufferH264;
/**
* @name Macroblock neighbour availability bits
*
* \anchor api_enc_h264_mb_pred_avail_bits
* Definitions for macroblock neighbour availability bits used in
* intra prediction mode (non MBAFF only).
*
* @{
*/
/** \brief References macroblock in the top-left corner. */
#define VA_MB_PRED_AVAIL_TOP_LEFT (1 << 2)
/** \brief References macroblock above the current macroblock. */
#define VA_MB_PRED_AVAIL_TOP (1 << 4)
/** \brief References macroblock in the top-right corner. */
#define VA_MB_PRED_AVAIL_TOP_RIGHT (1 << 3)
/** \brief References macroblock on the left of the current macroblock. */
#define VA_MB_PRED_AVAIL_LEFT (1 << 6)
/**@}*/
/**
* \brief Macroblock parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds per-macroblock information. The buffer must be
* allocated with as many elements (macroblocks) as necessary to fit
* the slice to be encoded. Besides, the per-macroblock records must
* be written in a strict raster order and with no gap. i.e. every
* macroblock, regardless of its type, shall have an entry.
*/
typedef struct _VAEncMacroblockParameterBufferH264 {
/**
* \brief Quantization parameter.
*
* Requested quantization parameter. Range: 0 to 51, inclusive.
* If \ref qp is set to 0xff, then the actual value is derived
* from the slice-level value: \c pic_init_qp + \c slice_qp_delta.
*/
uint8_t qp;
union {
/** @name Data for intra macroblock */
/**@{*/
union {
struct {
/**
* \brief Flag specified to override MB neighbour
* availability bits from VME stage.
*
* This flag specifies that macroblock neighbour
* availability bits from the VME stage are overriden
* by the \ref pred_avail_flags hereunder.
*/
uint32_t pred_avail_override_flag : 1;
/**
* \brief Bitwise representation of which macroblocks
* are available for intra prediction.
*
* If the slice is intra-coded, this field represents
* the macroblocks available for intra prediction.
* See \ref api_enc_h264_mb_pred_avail_bits
* "macroblock neighbour availability" bit definitions.
*/
uint32_t pred_avail_flags : 8;
} bits;
uint32_t value;
} intra_fields;
/**@}*/
/** @name Data for inter macroblock */
/**@{*/
union {
struct {
uint32_t reserved;
} bits;
uint32_t value;
} inter_fields;
/**@}*/
} info;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMacroblockParameterBufferH264;
/**
* \brief MB partition modes and 1/2 1/4 motion search configuration
*
* Specifies MB partition modes that are disabled. Specifies Half-pel
* mode and Quarter-pel mode searching
*/
typedef struct _VAEncMiscParameterSubMbPartPelH264 {
uint32_t disable_inter_sub_mb_partition;
union {
struct {
uint32_t disable_16x16_inter_mb_partition : 1;
uint32_t disable_16x8_inter_mb_partition : 1;
uint32_t disable_8x16_inter_mb_partition : 1;
uint32_t disable_8x8_inter_mb_partition : 1;
uint32_t disable_8x4_inter_mb_partition : 1;
uint32_t disable_4x8_inter_mb_partition : 1;
uint32_t disable_4x4_inter_mb_partition : 1;
uint32_t reserved : 1;
} bits;
uint8_t value;
} inter_sub_mb_partition_mask;
/**
* \brief Precison of motion search
* 0:Integer mode searching
* 1:Half-pel mode searching
* 2:Reserved
* 3:Quarter-pel mode searching
*/
uint32_t enable_sub_pel_mode;
uint8_t sub_pel_mode;
uint8_t reserved[3];
} VAEncMiscParameterSubMbPartPelH264;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_H264_H */

958
lib/libva/va/va_enc_hevc.h Normal file
View file

@ -0,0 +1,958 @@
/*
* Copyright (c) 2007-2014 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_hevc.h
* \brief The HEVC encoding API
*
* This file contains the \ref api_enc_hevc "HEVC encoding API".
*
*/
#ifndef VA_ENC_HEVC_H
#define VA_ENC_HEVC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* \defgroup api_enc_hevc HEVC encoding API
*
* @{
*/
/** Attribute value for VAConfigAttribEncHEVCFeatures.
*
* This attribute decribes the supported features of an HEVC/H.265
* encoder configuration.
*
* All of the field values in this attribute are VA_FEATURE_* values,
* indicating support for the corresponding feature.
*/
typedef union VAConfigAttribValEncHEVCFeatures {
struct {
/** Separate colour planes.
*
* Allows setting separate_colour_plane_flag in the SPS.
*/
uint32_t separate_colour_planes : 2;
/** Scaling lists.
*
* Allows scaling_list() elements to be present in both the SPS
* and the PPS. The decoded form of the scaling lists must also
* be supplied in a VAQMatrixBufferHEVC buffer when scaling lists
* are enabled.
*/
uint32_t scaling_lists : 2;
/** Asymmetric motion partitions.
*
* Allows setting amp_enabled_flag in the SPS.
*/
uint32_t amp : 2;
/** Sample adaptive offset filter.
*
* Allows setting slice_sao_luma_flag and slice_sao_chroma_flag
* in slice headers.
*/
uint32_t sao : 2;
/** PCM sample blocks.
*
* Allows setting pcm_enabled_flag in the SPS. When enabled
* PCM parameters must be supplied with the sequence parameters,
* including block sizes which may be further constrained as
* noted in the VAConfigAttribEncHEVCBlockSizes attribute.
*/
uint32_t pcm : 2;
/** Temporal motion vector Prediction.
*
* Allows setting slice_temporal_mvp_enabled_flag in slice
* headers.
*/
uint32_t temporal_mvp : 2;
/** Strong intra smoothing.
*
* Allows setting strong_intra_smoothing_enabled_flag in the SPS.
*/
uint32_t strong_intra_smoothing : 2;
/** Dependent slices.
*
* Allows setting dependent_slice_segment_flag in slice headers.
*/
uint32_t dependent_slices : 2;
/** Sign data hiding.
*
* Allows setting sign_data_hiding_enable_flag in the PPS.
*/
uint32_t sign_data_hiding : 2;
/** Constrained intra prediction.
*
* Allows setting constrained_intra_pred_flag in the PPS.
*/
uint32_t constrained_intra_pred : 2;
/** Transform skipping.
*
* Allows setting transform_skip_enabled_flag in the PPS.
*/
uint32_t transform_skip : 2;
/** QP delta within coding units.
*
* Allows setting cu_qp_delta_enabled_flag in the PPS.
*/
uint32_t cu_qp_delta : 2;
/** Weighted prediction.
*
* Allows setting weighted_pred_flag and weighted_bipred_flag in
* the PPS. The pred_weight_table() data must be supplied with
* every slice header when weighted prediction is enabled.
*/
uint32_t weighted_prediction : 2;
/** Transform and quantisation bypass.
*
* Allows setting transquant_bypass_enabled_flag in the PPS.
*/
uint32_t transquant_bypass : 2;
/** Deblocking filter disable.
*
* Allows setting slice_deblocking_filter_disabled_flag.
*/
uint32_t deblocking_filter_disable : 2;
/* Reserved,should not be used, avoid conflict with VA_ATTRIB_NOT_SUPPORTED. */
uint32_t reserved : 2;
} bits;
uint32_t value;
} VAConfigAttribValEncHEVCFeatures;
/** Attribute value for VAConfigAttribEncHEVCBlockSizes.
*
* This attribute describes the supported coding tree and transform block
* sizes of an HEVC/H.265 encoder configuration
*/
typedef union VAConfigAttribValEncHEVCBlockSizes {
struct {
/** Largest supported size of coding tree blocks.
*
* CtbLog2SizeY must not be larger than this.
*/
uint32_t log2_max_coding_tree_block_size_minus3 : 2;
/** Smallest supported size of coding tree blocks.
*
* CtbLog2SizeY must not be smaller than this.
*
* This may be the same as the maximum size, indicating that only
* one CTB size is supported.
*/
uint32_t log2_min_coding_tree_block_size_minus3 : 2;
/** Smallest supported size of luma coding blocks.
*
* MinCbLog2SizeY must not be smaller than this.
*/
uint32_t log2_min_luma_coding_block_size_minus3 : 2;
/** Largest supported size of luma transform blocks.
*
* MaxTbLog2SizeY must not be larger than this.
*/
uint32_t log2_max_luma_transform_block_size_minus2 : 2;
/** Smallest supported size of luma transform blocks.
*
* MinTbLog2SizeY must not be smaller than this.
*/
uint32_t log2_min_luma_transform_block_size_minus2 : 2;
/** Largest supported transform hierarchy depth in inter
* coding units.
*
* max_transform_hierarchy_depth_inter must not be larger
* than this.
*/
uint32_t max_max_transform_hierarchy_depth_inter : 2;
/** Smallest supported transform hierarchy depth in inter
* coding units.
*
* max_transform_hierarchy_depth_inter must not be smaller
* than this.
*/
uint32_t min_max_transform_hierarchy_depth_inter : 2;
/** Largest supported transform hierarchy depth in intra
* coding units.
*
* max_transform_hierarchy_depth_intra must not be larger
* than this.
*/
uint32_t max_max_transform_hierarchy_depth_intra : 2;
/** Smallest supported transform hierarchy depth in intra
* coding units.
*
* max_transform_hierarchy_depth_intra must not be smaller
* than this.
*/
uint32_t min_max_transform_hierarchy_depth_intra : 2;
/** Largest supported size of PCM coding blocks.
*
* Log2MaxIpcmCbSizeY must not be larger than this.
*/
uint32_t log2_max_pcm_coding_block_size_minus3 : 2;
/** Smallest supported size of PCM coding blocks.
*
* Log2MinIpcmCbSizeY must not be smaller than this.
*/
uint32_t log2_min_pcm_coding_block_size_minus3 : 2;
/** Reserved for future use. */
uint32_t reserved : 10;
} bits;
uint32_t value;
} VAConfigAttribValEncHEVCBlockSizes;
/**
* @name Picture flags
*
* Those flags flags are meant to signal when a picture marks the end
* of a sequence, a stream, or even both at once.
*
* @{
*/
/**
* \brief Marks the last picture in the sequence.
*
* i.e. the driver appends \c end_of_seq() NAL unit to the encoded frame.
*/
#define HEVC_LAST_PICTURE_EOSEQ 0x01
/**
* \brief Marks the last picture in the stream.
*
* i.e. the driver appends \c end_of_stream() NAL unit to the encoded frame.
*/
#define HEVC_LAST_PICTURE_EOSTREAM 0x02
/**@}*/
/**
* \brief Packed header types specific to HEVC encoding.
*
* Types of packed headers generally used for HEVC encoding. Each
* associated packed header data buffer shall contain the start code
* prefix 0x000001 followed by the complete NAL unit, thus also
* including the \c nal_unit_type.
*
* Note: the start code prefix can contain an arbitrary number of leading
* zeros. The driver will skip them for emulation prevention bytes insertion,
* if necessary.
*/
typedef enum {
/**
* \brief Packed Video Parameter Set (VPS).
*
* The corresponding packed header data buffer shall contain the
* complete video_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 32.
*/
VAEncPackedHeaderHEVC_VPS = VAEncPackedHeaderSequence,
/**
* \brief Packed Sequence Parameter Set (SPS).
*
* The corresponding packed header data buffer shall contain the
* complete seq_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 33.
*/
VAEncPackedHeaderHEVC_SPS = VAEncPackedHeaderSequence,
/**
* \brief Packed Picture Parameter Set (PPS).
*
* The corresponding packed header data buffer shall contain the
* complete pic_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 34.
*/
VAEncPackedHeaderHEVC_PPS = VAEncPackedHeaderPicture,
/**
* \brief Packed slice header.
*
* The corresponding packed header data buffer shall contain the
* \c slice_header() syntax element only, along with any start
* code prefix and NAL unit type preceeding it. i.e. this means
* that the buffer does not contain any of the \c slice_data() or
* the \c rbsp_slice_trailing_bits().
*
* Note: packed \c nal_unit_type shall be equal to 0 to 9 (non-IRAP
* picture), or 16 to 21 (IRAP picture).
*/
VAEncPackedHeaderHEVC_Slice = VAEncPackedHeaderSlice,
/**
* \brief Packed Supplemental Enhancement Information (SEI).
*
* The corresponding packed header data buffer shall contain the
* complete sei_rbsp() syntax element, thus including several
* sei_message() elements if necessary.
*
* Note: packed \c nal_unit_type shall be equal to 39 or 40.
*
* @deprecated
* This is a deprecated packed header flag, All applications can use
* \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
* SEI header data buffer to the driver
*/
VAEncPackedHeaderHEVC_SEI va_deprecated_enum = (0x80000000 | 1),
} VAEncPackedHeaderTypeHEVC;
/**
* \brief Sequence parameter for HEVC encoding in main & main 10
* profiles.
*
* This structure holds information for \c seq_parameter_set_data() as
* defined by the HEVC specification.
*
* If packed sequence headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c seq_scaling_matrix_present_flag is set to \c 1, then a
* #VAQMatrixBufferHEVC buffer shall also be provided within the same
* \c vaRenderPicture() call as this sequence parameter buffer.
*/
typedef struct _VAEncSequenceParameterBufferHEVC {
/** \brief Same as the HEVC bitstream syntax element.
* value range [1..2].
*/
uint8_t general_profile_idc;
/** \brief Same as the HEVC bitstream syntax element.
* general_level_idc shall be set equal to a value of 30 times the level
* numbers allowed [1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2]
*/
uint8_t general_level_idc;
/** \brief Same as the HEVC bitstream syntax element.
* Only value 0 is allowed for level value below 4, exclusive.
*/
uint8_t general_tier_flag;
/** \brief Period between I frames. */
uint32_t intra_period;
/** \brief Period between IDR frames. */
uint32_t intra_idr_period;
/** \brief Period between I/P frames. */
uint32_t ip_period;
/**
* \brief Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* The bitrate can be modified later on through
* #VAEncMiscParameterRateControl buffers.
*/
uint32_t bits_per_second;
/** \brief Picture width in pixel samples.
* Its value must be multiple of min CU size.
*/
uint16_t pic_width_in_luma_samples;
/** \brief Picture height in pixel samples.
* Its value must be multiple of min CU size.
*/
uint16_t pic_height_in_luma_samples;
union {
struct {
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t chroma_format_idc : 2;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t separate_colour_plane_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t bit_depth_luma_minus8 : 3;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t bit_depth_chroma_minus8 : 3;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t scaling_list_enabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t strong_intra_smoothing_enabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t amp_enabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t sample_adaptive_offset_enabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t pcm_enabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t pcm_loop_filter_disabled_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t sps_temporal_mvp_enabled_flag : 1;
/** \brief Indicates whether or not the encoding is in low delay mode.
* 0 normal sequence
* 1 no random access B will be coded . and the coding type could be only I, P or LDB
* this flag only indicates the frame coding type of the sequence.
*/
uint32_t low_delay_seq : 1;
/** \brief Indicates whether or not the encoding is in dyadic hierarchical GOP structure
* the default value 0, BRC would treat is as flat structure. if HierachicalFlag == 1,
* application would enable Qp Modulation
*/
uint32_t hierachical_flag : 1;
/** \brief keep for future , should be set to 0 */
uint32_t reserved_bits : 14;
} bits;
uint32_t value;
} seq_fields;
/** \brief Same as the HEVC bitstream syntax element.
* value range [0..3]
*/
uint8_t log2_min_luma_coding_block_size_minus3;
/** \brief Same as the HEVC bitstream syntax element.
*/
uint8_t log2_diff_max_min_luma_coding_block_size;
/** \brief Same as the HEVC bitstream syntax element.
* value range [0..3]
*/
uint8_t log2_min_transform_block_size_minus2;
/** \brief Same as the HEVC bitstream syntax element.
*/
uint8_t log2_diff_max_min_transform_block_size;
/** \brief Same as the HEVC bitstream syntax element.
* value range [2]
*/
uint8_t max_transform_hierarchy_depth_inter;
/** \brief Same as the HEVC bitstream syntax element.
* value range [2]
*/
uint8_t max_transform_hierarchy_depth_intra;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t pcm_sample_bit_depth_luma_minus1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t pcm_sample_bit_depth_chroma_minus1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t log2_min_pcm_luma_coding_block_size_minus3;
/** \brief Derived from the HEVC bitstream syntax element.
* log2_min_pcm_luma_coding_block_size_minus3 +
* log2_diff_max_min_pcm_luma_coding_block_size
*/
uint32_t log2_max_pcm_luma_coding_block_size_minus3;
/** @name VUI parameters (optional) */
/**@{*/
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t vui_parameters_present_flag;
union {
struct {
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t aspect_ratio_info_present_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t neutral_chroma_indication_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t field_seq_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t vui_timing_info_present_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t bitstream_restriction_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t tiles_fixed_structure_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t motion_vectors_over_pic_boundaries_flag : 1;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t restricted_ref_pic_lists_flag : 1;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_horizontal : 5;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_vertical : 5;
} bits;
uint32_t value;
} vui_fields;
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t aspect_ratio_idc;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t sar_width;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t sar_height;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t vui_num_units_in_tick;
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t vui_time_scale;
/** \brief Same as the HEVC bitstream syntax element. */
uint16_t min_spatial_segmentation_idc;
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t max_bytes_per_pic_denom;
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t max_bits_per_min_cu_denom;
/** \brief SCC flags to enable/disable features, including IBC and palette mode at present.*/
union {
struct {
/** \brief Same as the HEVC bitstream syntax element. */
uint32_t palette_mode_enabled_flag : 1;
/** \brief Reserved bits for future use, must be zero */
uint32_t reserved : 31;
} bits;
uint32_t value;
} scc_fields;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM - 1];
/**@}*/
} VAEncSequenceParameterBufferHEVC;
/****************************
* HEVC data structures
****************************/
/**
* \brief Picture parameter for HEVC encoding in main & main 10
* profiles.
*
* This structure holds information for \c pic_parameter_set_rbsp() as
* defined by the HEVC specification.
*
* If packed picture headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c pic_scaling_matrix_present_flag is set to \c 1, then a
* #VAQMatrixBufferHEVC buffer shall also be provided within the same
* \c vaRenderPicture() call as this picture parameter buffer.
*/
typedef struct _VAEncPictureParameterBufferHEVC {
/**
* \brief Information about the picture to be encoded.
*
* See #VAPictureHEVC for further description of each field.
* Note that decoded_curr_pic.picture_id represents the reconstructed
* (decoded) picture. User provides a scratch VA surface ID here.
* Long term reference and RPS related fields should be set to 0
* and ignored.
*/
VAPictureHEVC decoded_curr_pic;
/**
* \brief Decoded Picture Buffer (DPB).
*
* This array represents the list of reconstructed (decoded)
* frames used as reference. It is important to keep track of
* reconstructed frames so that they can be used later on as
* reference for P or B-frames encoding.
*/
VAPictureHEVC reference_frames[15];
/**
* \brief Output encoded bitstream.
*
* \ref coded_buf has type #VAEncCodedBufferType. It should be
* large enough to hold the compressed NAL slice and possibly VPS, SPS
* and PPS NAL units, and other NAL units such as SEI.
*/
VABufferID coded_buf;
/** \brief collocated reference picture buffer index of ReferenceFrames[].
* Please note it is different from HEVC syntac element collocated_ref_idx.
* When the HEVC syntax element slice_temporal_mvp_enable_flag takes value 0,
* collocated_ref_pic_index should take value 0xFF. .
* Range: [0..14, 0xFF]
*/
uint8_t collocated_ref_pic_index;
/**
* \brief OR'd flags describing whether the picture is the last one or not.
*
* This fields holds 0 if the picture to be encoded is not the last
* one in the stream or sequence. Otherwise, it is a combination of
* \ref HEVC_LAST_PICTURE_EOSEQ or \ref HEVC_LAST_PICTURE_EOSTREAM.
*/
uint8_t last_picture;
/** \brief \c init_qp_minus26 + 26. */
uint8_t pic_init_qp;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t diff_cu_qp_delta_depth;
/** \brief Corresponds to HEVC syntax element of the same name. */
int8_t pps_cb_qp_offset;
/** \brief Corresponds to HEVC syntax element of the same name. */
int8_t pps_cr_qp_offset;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t num_tile_columns_minus1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t num_tile_rows_minus1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t column_width_minus1[19];
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t row_height_minus1[21];
/** \brief Corresponds to HEVC syntax element of the same name. */
uint8_t log2_parallel_merge_level_minus2;
/** \brief Application may set the CTU bit size limit based on
* spec requirement (A.3.2), or other value for special purpose.
* If the value is set 0, no bit size limit is checked.
*/
uint8_t ctu_max_bitsize_allowed;
/** \brief Maximum reference index for reference picture list 0.
* value range: [0..14].
*/
uint8_t num_ref_idx_l0_default_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* value range: [0..14].
*/
uint8_t num_ref_idx_l1_default_active_minus1;
/** \brief PPS header
* Used by GPU to generate new slice headers in slice size control.
* value range: [0..63].
*/
uint8_t slice_pic_parameter_set_id;
/** \brief NAL unit type
* Used by GPU to generate new slice headers in slice size control.
* value range: [0..63].
*/
uint8_t nal_unit_type;
union {
struct {
/** \brief Is picture an IDR picture? */
uint32_t idr_pic_flag : 1;
/** \brief Picture type.
* I - 1;
* P - 2;
* B - 3;
* B1 - 4;
* B2 - 5;
* B1 and B2 are frame types for hierachical B, explanation
* can refer to num_b_in_gop[].
*/
uint32_t coding_type : 3;
/** \brief Is picture a reference picture? */
uint32_t reference_pic_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t dependent_slice_segments_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t sign_data_hiding_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t constrained_intra_pred_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t transform_skip_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t cu_qp_delta_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t weighted_pred_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t weighted_bipred_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t transquant_bypass_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t tiles_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t entropy_coding_sync_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t loop_filter_across_tiles_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
/** \brief A combination of HEVC syntax element of
* sps_scaling_list_data_present_flag and
* pps_scaling_list_data_present_flag
* when scaling_list_enable_flag is 0, it must be 0.
*/
uint32_t scaling_list_data_present_flag : 1;
/** \brief indicate the current picture contains significant
* screen contents (text, characters, etc.) or animated image.
* GPU may want to treat them differently from normal video.
* For example, encoder may choose a small transform unit size
* and may use transform skip mode.
*/
uint32_t screen_content_flag : 1;
/**
* When either weighted_pred_flag or weighted_bipred_flag is
* turned on, the flag enable_gpu_weighted_prediction requests
* GPU to determine weighted prediction factors. In this case,
* the following parameters in slice control data structure
* shall be ignored:
* luma_log2_weight_denom, delta_chroma_log2_weight_denom,
* luma_offset_l0[15], luma_offset_l1[15],
* delta_luma_weight_l0[15], delta_luma_weight_l1[15],
* chroma_offset_l0[15][2], chroma_offset_l1[15][2],
* and delta_chroma_weight_l0[15][2], delta_chroma_weight_l1[15][2].
*/
uint32_t enable_gpu_weighted_prediction : 1;
/** \brief HEVC syntax element in slice segment header
* GPU uses it to generate new slice headers in slice size control.
*/
uint32_t no_output_of_prior_pics_flag : 1;
uint32_t reserved : 11;
} bits;
uint32_t value;
} pic_fields;
/** \brief When hierachical_level_plus1 > 0, hierachical_level_plus1-1 indicates
*the current frame's level.when it > 0. B1, B2 setting in CodingType can be treated as B,
*hirachical level is determined by this variable.When hierachical_level_plus1 == 0,
*hierarchical level information still comes from coding_type.
*/
uint8_t hierarchical_level_plus1;
/** \brief Reserved bytes for future use, must be zero */
uint8_t va_byte_reserved;
/** \brief SCC flags to enable/disable feature, only IBC at present.*/
union {
struct {
/** \brief Same as the HEVC bitstream syntax element. */
uint16_t pps_curr_pic_ref_enabled_flag : 1;
/** \brief Reserved bits for future use, must be zero */
uint16_t reserved : 15;
} bits;
uint16_t value;
} scc_fields;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_HIGH - 1];
} VAEncPictureParameterBufferHEVC;
/**
* \brief Slice parameter for HEVC encoding in main & main 10 profiles.
*
* This structure holds information for \c
* slice_segment_layer_rbsp() as defined by the HEVC
* specification.
*
* If packed slice headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SLICE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSlice ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
*/
typedef struct _VAEncSliceParameterBufferHEVC {
/** \brief Starting CTU address for this slice. */
uint32_t slice_segment_address;
/** \brief Number of CTUs in this slice. */
uint32_t num_ctu_in_slice;
/** \brief Slice type.
* Corresponds to HEVC syntax element of the same name.
*/
uint8_t slice_type;
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t slice_pic_parameter_set_id;
/** \brief Maximum reference index for reference picture list 0.
* Range: 0 to 14, inclusive.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* Range: 0 to 14, inclusive.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** \brief Reference picture list 0 (for P slices). */
VAPictureHEVC ref_pic_list0[15];
/** \brief Reference picture list 1 (for B slices). */
VAPictureHEVC ref_pic_list1[15];
/**@}*/
/** @name pred_weight_table() */
/**@{*/
/** \brief Same as the HEVC bitstream syntax element. */
uint8_t luma_log2_weight_denom;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t delta_chroma_log2_weight_denom;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t delta_luma_weight_l0[15];
/** \brief Same as the HEVC bitstream syntax element. */
int8_t luma_offset_l0[15];
/** \brief Same as the HEVC bitstream syntax element. */
int8_t delta_chroma_weight_l0[15][2];
/** \brief Same as the HEVC spec variable ChromaOffsetL0[]. */
int8_t chroma_offset_l0[15][2];
/** \brief Same as the HEVC bitstream syntax element. */
int8_t delta_luma_weight_l1[15];
/** \brief Same as the HEVC bitstream syntax element. */
int8_t luma_offset_l1[15];
/** \brief Same as the HEVC bitstream syntax element. */
int8_t delta_chroma_weight_l1[15][2];
/** \brief Same as the HEVC spec variable ChromaOffsetL1[]. */
int8_t chroma_offset_l1[15][2];
/**@}*/
/** \brief Corresponds to HEVC spec variable MaxNumMergeCand.
* Range: [1..5].
*/
uint8_t max_num_merge_cand;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t slice_qp_delta;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t slice_cb_qp_offset;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t slice_cr_qp_offset;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t slice_beta_offset_div2;
/** \brief Same as the HEVC bitstream syntax element. */
int8_t slice_tc_offset_div2;
union {
struct {
/** \brief Indicates if current slice is the last one in picture */
uint32_t last_slice_of_pic_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name */
uint32_t dependent_slice_segment_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name */
uint32_t colour_plane_id : 2;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t slice_temporal_mvp_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t slice_sao_luma_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t slice_sao_chroma_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name.
* if this flag is set to 0, num_ref_idx_l0_active_minus1 should be
* equal to num_ref_idx_l0_default_active_minus1
* as well as for that for l1.
*/
uint32_t num_ref_idx_active_override_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t mvd_l1_zero_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t cabac_init_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t slice_deblocking_filter_disabled_flag : 2;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
/** \brief Corresponds to HEVC syntax element of the same name. */
uint32_t collocated_from_l0_flag : 1;
} bits;
uint32_t value;
} slice_fields;
/**
* \brief bit offset of syntax element pred_weight_table() in slice segment header.
* It aligns with the starting position of the current packed slice header.
* It is used when encoder prefers to override the weighted prediction parameters passed in
* from application.
* Please refer to enable_gpu_weighted_prediction in VAEncPictureParameterBufferHEVC.
*/
uint32_t pred_weight_table_bit_offset;
/**
* \brief bit length of syntax element pred_weight_table() in slice segment header.
* It is used when encoder prefers to override the weighted prediction parameters passed in
* from application.
* Please refer to enable_gpu_weighted_prediction in VAEncPictureParameterBufferHEVC.
*/
uint32_t pred_weight_table_bit_length;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM - 2];
/**@}*/
} VAEncSliceParameterBufferHEVC;
/**
* \brief HEVC Quantization Matrix Buffer Structure
*
* This structure is sent once per frame,
* and only when scaling_list_enabled_flag = 1 and scaling_list_data_present_flag = 1.
* Only when scaling_list_data_present_flag = 1, app still
* needs to send in this structure. When scaling_list_enabled_flag = 1 and
* scaling_list_data_present_flag = 0, driver is responsible to generate
* the default scaling list values.
*
* Matrix entries are in raster scan order which follows HEVC spec.
*/
typedef struct _VAQMatrixBufferHEVC {
/**
* \brief scaling lists,
* corresponds to same HEVC spec syntax element
* ScalingList[ i ][ MatrixID ][ j ].
*
* \brief 4x4 scaling,
*/
uint8_t scaling_lists_4x4[3][2][16];
/**
* \brief 8x8 scaling,
*/
uint8_t scaling_lists_8x8[3][2][64];
/**
* \brief 16x16 scaling,
* correspongs i = 2, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t scaling_lists_16x16[3][2][64];
/**
* \brief 32x32 scaling,
* correspongs i = 3, MatrixID is in the range of 0 to 1,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t scaling_lists_32x32[2][64];
/**
* \brief DC values of the 16x16 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
*/
uint8_t scaling_list_dc_16x16[3][2];
/**
* \brief DC values of the 32x32 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
*/
uint8_t scaling_list_dc_32x32[2];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAQMatrixBufferHEVC;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_HEVC_H */

162
lib/libva/va/va_enc_jpeg.h Normal file
View file

@ -0,0 +1,162 @@
/*
* Copyright (c) 2007-2013 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_jpeg.h
* \brief JPEG encoding API
*
* This file contains the \ref api_enc_jpeg "JPEG encoding API".
*/
#ifndef VA_ENC_JPEG_H
#define VA_ENC_JPEG_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_jpeg JPEG encoding API
*
* @{
*/
/**
* \brief JPEG Encoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
*
*/
typedef struct _VAEncPictureParameterBufferJPEG {
/** \brief holds reconstructed picture. */
VASurfaceID reconstructed_picture;
/** \brief picture width. */
uint16_t picture_width;
/** \brief picture height. */
uint16_t picture_height;
/** \brief holds coded data. */
VABufferID coded_buf;
/**
* \brief pic_flags
*
*/
union {
struct {
/**
* \brief profile:
* 0 - Baseline, 1 - Extended, 2 - Lossless, 3 - Hierarchical
*/
uint32_t profile : 2;
/**
* \brief progressive:
* 0 - sequential, 1 - extended, 2 - progressive
*/
uint32_t progressive : 1;
/**
* \brief huffman:
* 0 - arithmetic, 1 - huffman
*/
uint32_t huffman : 1;
/**
* \brief interleaved:
* 0 - non interleaved, 1 - interleaved
*/
uint32_t interleaved : 1;
/**
* \brief differential:
* 0 - non differential, 1 - differential
*/
uint32_t differential : 1;
} bits;
uint32_t value;
} pic_flags;
/** \brief number of bits per sample. */
uint8_t sample_bit_depth;
/** \brief total number of scans in image. */
uint8_t num_scan;
/** \brief number of image components in frame. */
uint16_t num_components;
/** \brief Component identifier (Ci). */
uint8_t component_id[4];
/** \brief Quantization table selector (Tqi). */
uint8_t quantiser_table_selector[4];
/** \brief number from 1 to 100 that specifies quality of image. */
uint8_t quality;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPictureParameterBufferJPEG;
/**
* \brief Slice parameter for JPEG encoding.
*
* This structure conveys slice (scan) level parameters.
*
*/
typedef struct _VAEncSliceParameterBufferJPEG {
/** \brief Restart interval definition (Ri). */
uint16_t restart_interval;
/** \brief number of image components in a scan. */
uint16_t num_components;
struct {
/** \brief Scan component selector (Csj). */
uint8_t component_selector;
/** \brief DC entropy coding table selector (Tdj). */
uint8_t dc_table_selector;
/** \brief AC entropy coding table selector (Taj). */
uint8_t ac_table_selector;
} components[4];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSliceParameterBufferJPEG;
/**
* \brief Quantization table for JPEG encoding.
*
*/
typedef struct _VAQMatrixBufferJPEG {
/** \brief load luma quantization table. */
int32_t load_lum_quantiser_matrix;
/** \brief load chroma quantization table. */
int32_t load_chroma_quantiser_matrix;
/** \brief luma quantization table. */
uint8_t lum_quantiser_matrix[64];
/** \brief chroma quantization table. */
uint8_t chroma_quantiser_matrix[64];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAQMatrixBufferJPEG;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_JPEG_H */

308
lib/libva/va/va_enc_mpeg2.h Normal file
View file

@ -0,0 +1,308 @@
/*
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_mpeg2.h
* \brief The MPEG-2 encoding API
*
* This file contains the \ref api_enc_mpeg2 "MPEG-2 encoding API".
*/
#ifndef _VA_ENC_MPEG2_H_
#define _VA_ENC_MPEG2_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_mpeg2 MPEG-2 encoding API
*
* @{
*/
/**
* \brief MPEG-2 Quantization Matrix Buffer
*
*/
typedef VAIQMatrixBufferMPEG2 VAQMatrixBufferMPEG2;
/**
* \brief Packed header types specific to MPEG-2 encoding.
*
* Types of packed headers generally used for MPEG-2 encoding.
*/
typedef enum {
/**
* \brief Packed Sequence Parameter Set (SPS).
*
*/
VAEncPackedHeaderMPEG2_SPS = VAEncPackedHeaderSequence,
/**
* \brief Packed Picture Parameter Set (PPS).
*
*/
VAEncPackedHeaderMPEG2_PPS = VAEncPackedHeaderPicture,
/**
* \brief Packed slice header.
*
*/
VAEncPackedHeaderMPEG2_Slice = VAEncPackedHeaderSlice,
} VAEncPackedHeaderTypeMPEG2;
/**
* \brief Sequence parameter for MPEG-2 encoding
*
* This structure holds information for \c sequence_header() and
* sequence_extension().
*
* If packed sequence headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
*/
typedef struct _VAEncSequenceParameterBufferMPEG2 {
/** \brief Period between I frames. */
uint32_t intra_period;
/** \brief Period between I/P frames. */
uint32_t ip_period;
/** \brief Picture width.
*
* A 14bits unsigned inter, the lower 12bits
* is horizontal_size_value, and the upper
* 2bits is \c horizontal_size_extension
*
*/
uint16_t picture_width;
/** \brief Picture height.
*
* A 14bits unsigned inter, the lower 12bits
* is vertical_size_value, and the upper 2bits is
* vertical_size_size_extension
*
*/
uint16_t picture_height;
/**
* \brief Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* bits_per_second may be derived from bit_rate.
*
*/
uint32_t bits_per_second;
/**
* \brief Frame rate
*
* Derived from frame_rate_value, frame_rate_extension_n and
* frame_rate_extension_d
*
*/
float frame_rate;
/** \brief Same as the element in sequence_header() */
uint16_t aspect_ratio_information;
/** \brief Define the size of VBV */
uint32_t vbv_buffer_size;
union {
struct {
/** \brief Same as the element in Sequence extension() */
uint32_t profile_and_level_indication : 8;
/** \brief Same as the element in Sequence extension() */
uint32_t progressive_sequence : 1;
/** \brief Same as the element in Sequence extension() */
uint32_t chroma_format : 2;
/** \brief Same as the element in Sequence extension() */
uint32_t low_delay : 1;
/** \brief Same as the element in Sequence extension() */
uint32_t frame_rate_extension_n : 2;
/** \brief Same as the element in Sequence extension() */
uint32_t frame_rate_extension_d : 5;
} bits;
uint32_t value;
} sequence_extension;
/** \brief Flag to indicate the following GOP header are being updated */
uint32_t new_gop_header;
union {
struct {
/** \brief Time code */
uint32_t time_code : 25;
/** \brief Same as the element in GOP header */
uint32_t closed_gop : 1;
/** \brief SAme as the element in GOP header */
uint32_t broken_link : 1;
} bits;
uint32_t value;
} gop_header;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSequenceParameterBufferMPEG2;
/**
* \brief Picture parameter for MPEG-2 encoding
*
* This structure holds information for picture_header() and
* picture_coding_extension()
*
* If packed picture headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
*/
typedef struct _VAEncPictureParameterBufferMPEG2 {
/** \brief Forward reference picture */
VASurfaceID forward_reference_picture;
/** \brief Backward reference picture */
VASurfaceID backward_reference_picture;
/** \brief Reconstructed(decoded) picture */
VASurfaceID reconstructed_picture;
/**
* \brief Output encoded bitstream.
*
* \ref coded_buf has type #VAEncCodedBufferType. It should be
* large enough to hold the compressed NAL slice and possibly SPS
* and PPS NAL units.
*/
VABufferID coded_buf;
/**
* \brief Flag to indicate the picture is the last one or not.
*
* This fields holds 0 if the picture to be encoded is not
* the last one in the stream. Otherwise, it
* is \ref MPEG2_LAST_PICTURE_EOSTREAM.
*/
uint8_t last_picture;
/** \brief Picture type */
VAEncPictureType picture_type;
/** \brief Same as the element in picture_header() */
uint32_t temporal_reference;
/** \brief Same as the element in picture_header() */
uint32_t vbv_delay;
/** \brief Same as the element in Picture coding extension */
uint8_t f_code[2][2];
union {
struct {
/** \brief Same as the element in Picture coding extension */
uint32_t intra_dc_precision : 2;
/** \brief Same as the element in Picture coding extension */
uint32_t picture_structure : 2;
/** \brief Same as the element in Picture coding extension */
uint32_t top_field_first : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t frame_pred_frame_dct : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t concealment_motion_vectors : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t q_scale_type : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t intra_vlc_format : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t alternate_scan : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t repeat_first_field : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t progressive_frame : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t composite_display_flag : 1;
} bits;
uint32_t value;
} picture_coding_extension;
/* \brief Parameters for composite display
*
* Valid only when omposite_display_flag is 1
*/
union {
struct {
/** \brief Same as the element in Picture coding extension */
uint32_t v_axis : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t field_sequence : 3;
/** \brief Same as the element in Picture coding extension */
uint32_t sub_carrier : 1;
/** \brief Same as the element in Picture coding extension */
uint32_t burst_amplitude : 7;
/** \brief Same as the element in Picture coding extension */
uint32_t sub_carrier_phase : 8;
} bits;
uint32_t value;
} composite_display;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPictureParameterBufferMPEG2;
/**
* \brief Slice parameter for MPEG-2 encoding
*
*/
typedef struct _VAEncSliceParameterBufferMPEG2 {
/** \brief Starting MB address for this slice. */
uint32_t macroblock_address;
/** \brief Number of macroblocks in this slice. */
uint32_t num_macroblocks;
/** \brief Same as the element in slice() */
int32_t quantiser_scale_code;
/** \brief Flag to indicate intra slice */
int32_t is_intra_slice;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSliceParameterBufferMPEG2;
typedef struct _VAEncMiscParameterExtensionDataSeqDisplayMPEG2 {
/** should always be 0x02 to identify it is Sequence Display Extension ISO-13818 */
uint8_t extension_start_code_identifier;
/** these field should follow ISO-13818 6.3.6 */
uint8_t video_format;
uint8_t colour_description;
uint8_t colour_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
uint16_t display_horizontal_size;
uint16_t display_vertical_size;
} VAEncMiscParameterExtensionDataSeqDisplayMPEG2;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* _VA_ENC_MPEG2_H_ */

350
lib/libva/va/va_enc_vp8.h Normal file
View file

@ -0,0 +1,350 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_vp8.h
* \brief VP8 encoding API
*
* This file contains the \ref api_enc_vp8 "VP8 encoding API".
*/
#ifndef VA_ENC_VP8_H
#define VA_ENC_VP8_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_vp8 VP8 encoding API
*
* @{
*/
/**
* \brief VP8 Encoding Sequence Parameter Buffer Structure
*
* This structure conveys sequence level parameters.
*
*/
typedef struct _VAEncSequenceParameterBufferVP8 {
/* frame width in pixels */
uint32_t frame_width;
/* frame height in pixels */
uint32_t frame_height;
/* horizontal scale */
uint32_t frame_width_scale;
/* vertical scale */
uint32_t frame_height_scale;
/* whether to enable error resilience features */
uint32_t error_resilient;
/* auto keyframe placement, non-zero means enable auto keyframe placement */
uint32_t kf_auto;
/* keyframe minimum interval */
uint32_t kf_min_dist;
/* keyframe maximum interval */
uint32_t kf_max_dist;
/* RC related fields. RC modes are set with VAConfigAttribRateControl */
/* For VP8, CBR implies HRD conformance and VBR implies no HRD conformance */
/**
* Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* The bitrate can be modified later on through
* #VAEncMiscParameterRateControl buffers.
*/
uint32_t bits_per_second;
/* Period between I frames. */
uint32_t intra_period;
/* reference and reconstructed frame buffers
* Used for driver auto reference management when configured through
* VAConfigAttribEncAutoReference.
*/
VASurfaceID reference_frames[4];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSequenceParameterBufferVP8;
/**
* \brief VP8 Encoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
*
*/
typedef struct _VAEncPictureParameterBufferVP8 {
/* surface to store reconstructed frame */
VASurfaceID reconstructed_frame;
/*
* surfaces to store reference frames in non auto reference mode
* VA_INVALID_SURFACE can be used to denote an invalid reference frame.
*/
VASurfaceID ref_last_frame;
VASurfaceID ref_gf_frame;
VASurfaceID ref_arf_frame;
/* buffer to store coded data */
VABufferID coded_buf;
union {
struct {
/* force this frame to be a keyframe */
uint32_t force_kf : 1;
/* don't reference the last frame */
uint32_t no_ref_last : 1;
/* don't reference the golden frame */
uint32_t no_ref_gf : 1;
/* don't reference the alternate reference frame */
uint32_t no_ref_arf : 1;
/* The temporal id the frame belongs to. */
uint32_t temporal_id : 8;
/**
* following two flags indicate the reference order
* LastRef is specified by 01b;
* GoldRef is specified by 10b;
* AltRef is specified by 11b;
* first_ref specifies the reference frame which is searched first.
* second_ref specifies the reference frame which is searched second
* if there is.
*/
uint32_t first_ref : 2;
uint32_t second_ref : 2;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 16;
} bits;
uint32_t value;
} ref_flags;
union {
struct {
/* version */
uint32_t frame_type : 1;
uint32_t version : 3;
/* show_frame */
uint32_t show_frame : 1;
/* color_space */
uint32_t color_space : 1;
/* 0: bicubic, 1: bilinear, other: none */
uint32_t recon_filter_type : 2;
/* 0: no loop fitler, 1: simple loop filter */
uint32_t loop_filter_type : 2;
/* 0: disabled, 1: normal, 2: simple */
uint32_t auto_partitions : 1;
/* same as log2_nbr_of_dct_partitions in frame header syntax */
uint32_t num_token_partitions : 2;
/**
* The following fields correspond to the same VP8 syntax elements
* in the frame header.
*/
/**
* 0: clamping of reconstruction pixels is disabled,
* 1: clamping enabled.
*/
uint32_t clamping_type : 1;
/* indicate segmentation is enabled for the current frame. */
uint32_t segmentation_enabled : 1;
/**
* Determines if the MB segmentation map is updated in the current
* frame.
*/
uint32_t update_mb_segmentation_map : 1;
/**
* Indicates if the segment feature data is updated in the current
* frame.
*/
uint32_t update_segment_feature_data : 1;
/**
* indicates if the MB level loop filter adjustment is enabled for
* the current frame (0 off, 1 on).
*/
uint32_t loop_filter_adj_enable : 1;
/**
* Determines whether updated token probabilities are used only for
* this frame or until further update.
* It may be used by application to enable error resilient mode.
* In this mode probability updates are allowed only at Key Frames.
*/
uint32_t refresh_entropy_probs : 1;
/**
* Determines if the current decoded frame refreshes the golden frame.
*/
uint32_t refresh_golden_frame : 1;
/**
* Determines if the current decoded frame refreshes the alternate
* reference frame.
*/
uint32_t refresh_alternate_frame : 1;
/**
* Determines if the current decoded frame refreshes the last frame
* reference buffer.
*/
uint32_t refresh_last : 1;
/**
* Determines if the golden reference is replaced by another reference.
*/
uint32_t copy_buffer_to_golden : 2;
/**
* Determines if the alternate reference is replaced by another reference.
*/
uint32_t copy_buffer_to_alternate : 2;
/**
* Controls the sign of motion vectors when the golden frame is referenced.
*/
uint32_t sign_bias_golden : 1;
/**
* Controls the sign of motion vectors when the alternate frame is
* referenced.
*/
uint32_t sign_bias_alternate : 1;
/**
* Enables or disables the skipping of macroblocks containing no
* non-zero coefficients.
*/
uint32_t mb_no_coeff_skip : 1;
/**
* Enforces unconditional per-MB loop filter delta update setting frame
* header flags mode_ref_lf_delta_update, all mb_mode_delta_update_flag[4],
* and all ref_frame_delta_update_flag[4] to 1.
* Since loop filter deltas are not automatically refreshed to default
* values at key frames, dropped frame with delta update may prevent
* correct decoding from the next key frame.
* Encoder application is advised to set this flag to 1 at key frames.
*/
uint32_t forced_lf_adjustment : 1;
uint32_t reserved : 2;
} bits;
uint32_t value;
} pic_flags;
/**
* Contains a list of 4 loop filter level values (updated value if applicable)
* controlling the deblocking filter strength. Each entry represents a segment.
* When segmentation is disabled, use entry 0.
* When loop_filter_level is 0, loop filter shall be disabled.
*/
int8_t loop_filter_level[4];
/**
* Contains a list of 4 delta values for reference frame based MB-level
* loop filter adjustment.
* If no update, then set to 0.
*/
int8_t ref_lf_delta[4];
/**
* Contains a list of 4 delta values for coding mode based MB-level loop
* filter adjustment.
* If no update, then set to 0.
*/
int8_t mode_lf_delta[4];
/**
* Controls the deblocking filter sensitivity.
* Corresponds to the same VP8 syntax element in frame header.
*/
uint8_t sharpness_level;
/**
* Application supplied maximum clamp value for Qindex used in quantization.
* Qindex will not be allowed to exceed this value.
* It has a valid range [0..127] inclusive.
*/
uint8_t clamp_qindex_high;
/**
* Application supplied minimum clamp value for Qindex used in quantization.
* Qindex will not be allowed to be lower than this value.
* It has a valid range [0..127] inclusive.
* Condition clamp_qindex_low <= clamp_qindex_high must be guaranteed,
* otherwise they are ignored.
*/
uint8_t clamp_qindex_low;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPictureParameterBufferVP8;
/**
* \brief VP8 MB Segmentation ID Buffer
*
* application provides buffer containing the initial segmentation id for each
* MB, in raster scan order. Rate control may reassign it.
* For an 640x480 video, the buffer has 1200 entries.
* the value of each entry should be in the range [0..3], inclusive.
* If segmentation is not enabled, application does not need to provide it.
*/
typedef struct _VAEncMBMapBufferVP8 {
/**
* number of MBs in the frame.
* It is also the number of entries of mb_segment_id[];
*/
uint32_t num_mbs;
/**
* per MB Segmentation ID Buffer
*/
uint8_t *mb_segment_id;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMBMapBufferVP8;
/**
* \brief VP8 Quantization Matrix Buffer Structure
*
* Contains quantization index for yac(0-3) for each segment and quantization
* index deltas, ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied
* to all segments. When segmentation is disabled, only quantization_index[0]
* will be used. This structure is sent once per frame.
*/
typedef struct _VAQMatrixBufferVP8 {
uint16_t quantization_index[4];
int16_t quantization_index_delta[5];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAQMatrixBufferVP8;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_VP8_H */

603
lib/libva/va/va_enc_vp9.h Normal file
View file

@ -0,0 +1,603 @@
/*
* Copyright (c) 2007-2015 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_enc_vp9.h
* \brief VP9 encoding API
*
* This file contains the \ref api_enc_vp9 "VP9 encoding API".
*
*/
#ifndef VA_ENC_VP9_H
#define VA_ENC_VP9_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_vp9 VP9 encoding API
*
* @{
*/
/**
* \brief VP9 Encoding Status Data Buffer Structure
*
* This structure is used to convey status data from encoder to application.
* Driver allocates VACodedBufferVP9Status as a private data buffer.
* Driver encapsulates the status buffer with a VACodedBufferSegment,
* and sets VACodedBufferSegment.status to be VA_CODED_BUF_STATUS_CODEC_SPECIFIC.
* And driver associates status data segment to the bit stream buffer segment
* by setting VACodedBufferSegment.next of coded_buf (bit stream) to the private
* buffer segment of status data.
* Application accesses it by calling VAMapBuffer() with VAEncCodedBufferType.
*/
typedef struct _VACodedBufferVP9Status {
/** Final quantization index used (yac), determined by BRC.
* Application is providing quantization index deltas
* ydc(0), y2dc(1), y2ac(2), uvdc(3), uvac(4) that are applied to all segments
* and segmentation qi deltas, they will not be changed by BRC.
*/
uint16_t base_qp_index;
/** Final loopfilter levels for the frame, if segmentation is disabled only
* index 0 is used.
* If loop_filter_level is 0, it indicates loop filter is disabled.
*/
uint8_t loop_filter_level;
/**
* Long term reference frame indication from BRC. BRC recommends the
* current frame that is being queried is a good candidate for a long
* term reference.
*/
uint8_t long_term_indication;
/* suggested next frame width */
uint16_t next_frame_width;
/* suggested next frame height */
uint16_t next_frame_height;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VACodedBufferVP9Status;
/**
* \brief VP9 Encoding Sequence Parameter Buffer Structure
*
* This structure conveys sequence level parameters.
*
*/
typedef struct _VAEncSequenceParameterBufferVP9 {
/** \brief Frame size note:
* Picture resolution may change frame by frame.
* Application needs to allocate surfaces and frame buffers based on
* max frame resolution in case resolution changes for later frames.
* The source and recon surfaces allocated should be 64x64(SB) aligned
* on both horizontal and vertical directions.
* But buffers on the surfaces need to be aligned to CU boundaries.
*/
/* maximum frame width in pixels for the whole sequence */
uint32_t max_frame_width;
/* maximum frame height in pixels for the whole sequence */
uint32_t max_frame_height;
/* auto keyframe placement, non-zero means enable auto keyframe placement */
uint32_t kf_auto;
/* keyframe minimum interval */
uint32_t kf_min_dist;
/* keyframe maximum interval */
uint32_t kf_max_dist;
/* RC related fields. RC modes are set with VAConfigAttribRateControl */
/* For VP9, CBR implies HRD conformance and VBR implies no HRD conformance */
/**
* Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* The bitrate can be modified later on through
* #VAEncMiscParameterRateControl buffers.
*/
uint32_t bits_per_second;
/* Period between key frames */
uint32_t intra_period;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSequenceParameterBufferVP9;
/**
* \brief VP9 Encoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
*
*/
typedef struct _VAEncPictureParameterBufferVP9 {
/** VP9 encoder may support dynamic scaling function.
* If enabled (enable_dynamic_scaling is set), application may request
* GPU encodes picture with a different resolution from the raw source.
* GPU should handle the scaling process of source and
* all reference frames.
*/
/* raw source frame width in pixels */
uint32_t frame_width_src;
/* raw source frame height in pixels */
uint32_t frame_height_src;
/* to be encoded frame width in pixels */
uint32_t frame_width_dst;
/* to be encoded frame height in pixels */
uint32_t frame_height_dst;
/* surface to store reconstructed frame, not used for enc only case */
VASurfaceID reconstructed_frame;
/** \brief reference frame buffers
* Each entry of the array specifies the surface index of the picture
* that is referred by current picture or will be referred by any future
* picture. The valid entries take value from 0 to 127, inclusive.
* Non-valid entries, those do not point to pictures which are referred
* by current picture or future pictures, should take value 0xFF.
* Other values are not allowed.
*
* Application should update this array based on the refreshing
* information expected.
*/
VASurfaceID reference_frames[8];
/* buffer to store coded data */
VABufferID coded_buf;
union {
struct {
/* force this frame to be a keyframe */
uint32_t force_kf : 1;
/** \brief Indiates which frames to be used as reference.
* (Ref_frame_ctrl & 0x01) ? 1: last frame as reference frame, 0: not.
* (Ref_frame_ctrl & 0x02) ? 1: golden frame as reference frame, 0: not.
* (Ref_frame_ctrl & 0x04) ? 1: alt frame as reference frame, 0: not.
* L0 is for forward prediction.
* L1 is for backward prediction.
*/
uint32_t ref_frame_ctrl_l0 : 3;
uint32_t ref_frame_ctrl_l1 : 3;
/** \brief Last Reference Frame index
* Specifies the index to RefFrameList[] which points to the LAST
* reference frame. It corresponds to active_ref_idx[0] in VP9 code.
*/
uint32_t ref_last_idx : 3;
/** \brief Specifies the Sign Bias of the LAST reference frame.
* It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
*/
uint32_t ref_last_sign_bias : 1;
/** \brief GOLDEN Reference Frame index
* Specifies the index to RefFrameList[] which points to the Golden
* reference frame. It corresponds to active_ref_idx[1] in VP9 code.
*/
uint32_t ref_gf_idx : 3;
/** \brief Specifies the Sign Bias of the GOLDEN reference frame.
* It corresponds to ref_frame_sign_bias[GOLDEN_FRAME] in VP9 code.
*/
uint32_t ref_gf_sign_bias : 1;
/** \brief Alternate Reference Frame index
* Specifies the index to RefFrameList[] which points to the Alternate
* reference frame. It corresponds to active_ref_idx[2] in VP9 code.
*/
uint32_t ref_arf_idx : 3;
/** \brief Specifies the Sign Bias of the ALTERNATE reference frame.
* It corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
*/
uint32_t ref_arf_sign_bias : 1;
/* The temporal id the frame belongs to */
uint32_t temporal_id : 8;
uint32_t reserved : 5;
} bits;
uint32_t value;
} ref_flags;
union {
struct {
/**
* Indicates if the current frame is a key frame or not.
* Corresponds to the same VP9 syntax element in frame tag.
*/
uint32_t frame_type : 1;
/** \brief show_frame
* 0: current frame is not for display
* 1: current frame is for display
*/
uint32_t show_frame : 1;
/**
* The following fields correspond to the same VP9 syntax elements
* in the frame header.
*/
uint32_t error_resilient_mode : 1;
/** \brief Indicate intra-only for inter pictures.
* Must be 0 for key frames.
* 0: inter frame use both intra and inter blocks
* 1: inter frame use only intra blocks.
*/
uint32_t intra_only : 1;
/** \brief Indicate high precision mode for Motion Vector prediction
* 0: normal mode
* 1: high precision mode
*/
uint32_t allow_high_precision_mv : 1;
/** \brief Motion Compensation Filter type
* 0: eight-tap (only this mode is supported now.)
* 1: eight-tap-smooth
* 2: eight-tap-sharp
* 3: bilinear
* 4: switchable
*/
uint32_t mcomp_filter_type : 3;
uint32_t frame_parallel_decoding_mode : 1;
uint32_t reset_frame_context : 2;
uint32_t refresh_frame_context : 1;
uint32_t frame_context_idx : 2;
uint32_t segmentation_enabled : 1;
/* corresponds to variable temporal_update in VP9 code.
* Indicates whether Segment ID is from bitstream or from previous
* frame.
* 0: Segment ID from bitstream
* 1: Segment ID from previous frame
*/
uint32_t segmentation_temporal_update : 1;
/* corresponds to variable update_mb_segmentation_map in VP9 code.
* Indicates how hardware determines segmentation ID
* 0: intra block - segment id is 0;
* inter block - segment id from previous frame
* 1: intra block - segment id from bitstream (app or GPU decides)
* inter block - depends on segmentation_temporal_update
*/
uint32_t segmentation_update_map : 1;
/** \brief Specifies if the picture is coded in lossless mode.
*
* lossless_mode = base_qindex == 0 && y_dc_delta_q == 0 \
* && uv_dc_delta_q == 0 && uv_ac_delta_q == 0;
* Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
* are all variables in VP9 code.
*
* When enabled, tx_mode needs to be set to 4x4 only and all
* tu_size in CU record set to 4x4 for entire frame.
* Software also has to program such that final_qindex=0 and
* final_filter_level=0 following the Quant Scale and
* Filter Level Table in Segmentation State section.
* Hardware forces Hadamard Tx when this bit is set.
* When lossless_mode is on, BRC has to be turned off.
* 0: normal mode
* 1: lossless mode
*/
uint32_t lossless_mode : 1;
/** \brief MV prediction mode. Corresponds to VP9 variable with same name.
* comp_prediction_mode = 0: single prediction ony,
* comp_prediction_mode = 1: compound prediction,
* comp_prediction_mode = 2: hybrid prediction
*
* Not mandatory. App may suggest the setting based on power or
* performance. Kernal may use it as a guildline and decide the proper
* setting on its own.
*/
uint32_t comp_prediction_mode : 2;
/** \brief Indicate how segmentation is specified
* 0 application specifies segmentation partitioning and
* relevant parameters.
* 1 GPU may decide on segmentation. If application already
* provides segmentation information, GPU may choose to
* honor it and further split into more levels if possible.
*/
uint32_t auto_segmentation : 1;
/** \brief Indicate super frame syntax should be inserted
* 0 current frame is not encapsulated in super frame structure
* 1 current fame is to be encapsulated in super frame structure.
* super frame index syntax will be inserted by encoder at
* the end of current frame.
*/
uint32_t super_frame_flag : 1;
uint32_t reserved : 10;
} bits;
uint32_t value;
} pic_flags;
/** \brief indicate which frames in DPB should be refreshed.
* same syntax and semantic as in VP9 code.
*/
uint8_t refresh_frame_flags;
/** \brief Base Q index in the VP9 term.
* Added with per segment delta Q index to get Q index of Luma AC.
*/
uint8_t luma_ac_qindex;
/**
* Q index delta from base Q index in the VP9 term for Luma DC.
*/
int8_t luma_dc_qindex_delta;
/**
* Q index delta from base Q index in the VP9 term for Chroma AC.
*/
int8_t chroma_ac_qindex_delta;
/**
* Q index delta from base Q index in the VP9 term for Chroma DC.
*/
int8_t chroma_dc_qindex_delta;
/** \brief filter level
* Corresponds to the same VP9 syntax element in frame header.
*/
uint8_t filter_level;
/**
* Controls the deblocking filter sensitivity.
* Corresponds to the same VP9 syntax element in frame header.
*/
uint8_t sharpness_level;
/** \brief Loop filter level reference delta values.
* Contains a list of 4 delta values for reference frame based block-level
* loop filter adjustment.
* If no update, set to 0.
* value range [-63..63]
*/
int8_t ref_lf_delta[4];
/** \brief Loop filter level mode delta values.
* Contains a list of 4 delta values for coding mode based MB-level loop
* filter adjustment.
* If no update, set to 0.
* value range [-63..63]
*/
int8_t mode_lf_delta[2];
/**
* Offset from starting position of output bitstream in bits where
* ref_lf_delta[] should be inserted. This offset should cover any metadata
* ahead of uncompressed header in inserted bit stream buffer (the offset
* should be same as that for final output bitstream buffer).
*
* In BRC mode, always insert ref_lf_delta[] (This implies uncompressed
* header should have mode_ref_delta_enabled=1 and mode_ref_delta_update=1).
*/
uint16_t bit_offset_ref_lf_delta;
/**
* Offset from starting position of output bitstream in bits where
* mode_lf_delta[] should be inserted.
*
* In BRC mode, always insert mode_lf_delta[] (This implies uncompressed
* header should have mode_ref_delta_enabled=1 and mode_ref_delta_update=1).
*/
uint16_t bit_offset_mode_lf_delta;
/**
* Offset from starting position of output bitstream in bits where (loop)
* filter_level should be inserted.
*/
uint16_t bit_offset_lf_level;
/**
* Offset from starting position of output bitstream in bits where
* Base Qindex should be inserted.
*/
uint16_t bit_offset_qindex;
/**
* Offset from starting position of output bitstream in bits where
* First Partition Size should be inserted.
*/
uint16_t bit_offset_first_partition_size;
/**
* Offset from starting position of output bitstream in bits where
* segmentation_enabled is located in bitstream. When auto_segmentation
* is enabled, GPU uses this offset to locate and update the
* segmentation related information.
*/
uint16_t bit_offset_segmentation;
/** \brief length in bit of segmentation portion from the location
* in bit stream where segmentation_enabled syntax is coded.
* When auto_segmentation is enabled, GPU uses this bit size to locate
* and update the information after segmentation.
*/
uint16_t bit_size_segmentation;
/** \brief log2 of number of tile rows
* Corresponds to the same VP9 syntax element in frame header.
* value range [0..2]
*/
uint8_t log2_tile_rows;
/** \brief log2 of number of tile columns
* Corresponds to the same VP9 syntax element in frame header.
* value range [0..6]
*/
uint8_t log2_tile_columns;
/** \brief indicate frame-skip happens
* Application may choose to drop/skip one or mulitple encoded frames or
* to-be-encoded frame due to various reasons such as insufficient
* bandwidth.
* Application uses the following three flags to inform GPU about frame-skip.
*
* value range of skip_frame_flag: [0..2]
* 0 - encode as normal, no skip;
* 1 - one or more frames were skipped by application prior to the
* current frame. Encode the current frame as normal. The driver
* will pass the number_skip_frames and skip_frames_size
* to bit rate control for adjustment.
* 2 - the current frame is to be skipped. Do not encode it but encrypt
* the packed header contents. This is for the secure encoding case
* where application generates a frame of all skipped blocks.
* The packed header will contain the skipped frame.
*/
uint8_t skip_frame_flag;
/** \brief The number of frames skipped prior to the current frame.
* It includes only the skipped frames that were not counted before,
* and does not include the frame with skip_frame_flag == 2.
* Valid when skip_frame_flag = 1.
*/
uint8_t number_skip_frames;
/** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.
* It includes only the skipped frames that were not counted before,
* and does not include the frame size with skip_frame_flag = 2.
* When skip_frame_flag = 2, it is the size of the current skipped frame
* that is to be encrypted.
*/
uint32_t skip_frames_size;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAEncPictureParameterBufferVP9;
/**
* \brief Per segment parameters
*/
typedef struct _VAEncSegParamVP9 {
union {
struct {
/** \brief Indicates if per segment reference frame indicator is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint8_t segment_reference_enabled : 1;
/** \brief Specifies per segment reference indication.
* 0: reserved
* 1: Last ref
* 2: golden
* 3: altref
* Value can be derived from variable data when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
* value range: [0..3]
*/
uint8_t segment_reference : 2;
/** \brief Indicates if per segment skip mode is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
*/
uint8_t segment_reference_skipped : 1;
uint8_t reserved : 4;
} bits;
uint8_t value;
} seg_flags;
/** \brief Specifies per segment Loop Filter Delta.
* Must be 0 when segmentation_enabled == 0.
* value range: [-63..63]
*/
int8_t segment_lf_level_delta;
/** \brief Specifies per segment QIndex Delta.
* Must be 0 when segmentation_enabled == 0.
* value range: [-255..255]
*/
int16_t segment_qindex_delta;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncSegParamVP9;
/**
* Structure to convey all segment related information.
* If segmentation is disabled, this data structure is still required.
* In this case, only seg_data[0] contains valid data.
* This buffer is sent once per frame.
*
* The buffer is created with VABufferType VAQMatrixBufferType.
*
*/
typedef struct _VAEncMiscParameterTypeVP9PerSegmantParam {
/**
* Parameters for 8 segments.
*/
VAEncSegParamVP9 seg_data[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMiscParameterTypeVP9PerSegmantParam;
/**
* \brief VP9 Block Segmentation ID Buffer
*
* The application provides a buffer of VAEncMacroblockMapBufferType containing
* the initial segmentation id for each 8x8 block, one byte each, in raster scan order.
* Rate control may reassign it. For example, a 640x480 video, the buffer has 4800 entries.
* The value of each entry should be in the range [0..7], inclusive.
* If segmentation is not enabled, the application does not need to provide it.
*/
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_VP9_H */

170
lib/libva/va/va_fei.h Normal file
View file

@ -0,0 +1,170 @@
/*
* Copyright (c) 2007-2017 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_fei.h
* \brief The FEI encoding common API
*/
#ifndef VA_FEI_H
#define VA_FEI_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* \defgroup api_fei FEI encoding common API
*
* @{
*/
/**
* \brief FEI specific attribute definitions
*/
/** @name Attribute values for VAConfigAttribFEIFunctionType
*
* This is only for VAEntrypointFEI
* The desired type should be passed to driver when creating the configuration.
* If VA_FEI_FUNCTION_ENC_PAK is set, VA_FEI_FUNCTION_ENC and VA_FEI_FUNCTION_PAK
* will be ignored if set also. Combination of VA_FEI_FUNCTION_ENC and VA_FEI_FUNCTION_PAK
* is not valid. If VA_FEI_FUNCTION_ENC is set, there will be no bitstream output.
* If VA_FEI_FUNCTION_PAK is set, two extra input buffers for PAK are needed:
* VAEncFEIMVBufferType and VAEncFEIMBCodeBufferType.
* VA_FEI_FUNCTION_ENC_PAK is recommended for best performance.
*
**/
/**@{*/
/** \brief ENC only is supported */
#define VA_FEI_FUNCTION_ENC 0x00000001
/** \brief PAK only is supported */
#define VA_FEI_FUNCTION_PAK 0x00000002
/** \brief ENC_PAK is supported */
#define VA_FEI_FUNCTION_ENC_PAK 0x00000004
/**@}*/
/** \brief Attribute value for VAConfigAttribStats */
typedef union _VAConfigAttribValStats {
struct {
/** \brief Max number of past reference frames that are supported. */
uint32_t max_num_past_references : 4;
/** \brief Max number of future reference frames that are supported. */
uint32_t max_num_future_references : 4;
/** \brief Number of supported output buffers for VAStatsStatisticsParameter->outputs */
uint32_t num_outputs : 3;
/** \brief Interlaced content is supported */
uint32_t interlaced : 1;
uint32_t reserved : 20;
} bits;
uint32_t value;
} VAConfigAttribValStats;
typedef struct _VAPictureStats {
VASurfaceID picture_id;
/*
* see flags below.
*/
uint32_t flags;
} VAPictureStats;
/* flags in VAPictureStats could be one of the following */
#define VA_PICTURE_STATS_INVALID 0x00000001
#define VA_PICTURE_STATS_PROGRESSIVE 0x00000000
#define VA_PICTURE_STATS_TOP_FIELD 0x00000002
#define VA_PICTURE_STATS_BOTTOM_FIELD 0x00000004
/** \brief picutre surface content updated indicator.
* The picture surface content is updated, it means temporary buffer like downscaled pixel data in driver
* internal needs be forced freshing
**/
#define VA_PICTURE_STATS_CONTENT_UPDATED 0x00000010
/** \brief Motion Vector and Statistics frame level controls.
* common part VAStatsStatisticsParameterBufferType for a MB or CTB
**/
typedef struct _VAStatsStatisticsParameter {
/** \brief Source surface ID. */
VAPictureStats input;
/** \brief Past reference surface ID pointer. */
VAPictureStats *past_references;
/** \brief Past reference surface number */
uint32_t num_past_references;
/** \brief Statistics output for past reference surface.
* Only enabling statistics output for past reference picture when *past_ref_stat_buf is a valid
* VABufferID, it is needed in case app wants statistics data of both reference and current pictures
* in very special use cases for better performance.
* The output layout is defined by VAStatsStatisticsBufferType(for progressive and top field of
* interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case), only
* pixel_average_16x16/pixel_average_8x8 and variance_16x16/variance_8x8 data are valid.
**/
VABufferID *past_ref_stat_buf;
/** \brief Future reference surface ID pointer. */
VAPictureStats *future_references;
/** \brief Future reference surface number */
uint32_t num_future_references;
/** \brief Statistics output for future reference surface.
* Only enabling statistics output for future reference picture when *past_ref_stat_buf is a valid
* VABufferID, it is needed in case app wants statistics data of both reference and current pictures
* in very special use cases for better performance.
* The output layout is defined by VAStatsStatisticsBufferType(for progressive and top field of
* interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case), only
* pixel_average_16x16/pixel_average_8x8 and variance_16x16/variance_8x8 data are valid.
**/
VABufferID *future_ref_stat_buf;
/** \brief ID of the output buffer.
* The number of outputs is determined by below DisableMVOutput and DisableStatisticsOutput.
* The output layout is defined by VAStatsMVBufferType, VAStatsStatisticsBufferType(for progressive and
* top field of interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case).
**/
VABufferID *outputs;
/** \brief MV predictor. It is valid only when mv_predictor_ctrl is not 0.
* Each block has a pair of MVs, one for past and one for future reference
* as defined by VAMotionVector. The block is in raster scan order.
* Buffer size shall not be less than the number of blocks multiplied by sizeof(VAMotionVector).
**/
VABufferID mv_predictor;
/** \brief QP input buffer. It is valid only when mb_qp is set to 1.
* The data in this buffer correspond to the input source.
* One QP per MB or CTB block in raster scan order, each QP is a signed char (8-bit) value.
**/
VABufferID qp;
} VAStatsStatisticsParameter;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_FEI_H */

505
lib/libva/va/va_fei_h264.h Normal file
View file

@ -0,0 +1,505 @@
/*
* Copyright (c) 2007-2017 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_fei_h264.h
* \brief The FEI encoding H264 special API
*/
#ifndef VA_FEI_H264_H
#define VA_FEI_H264_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "va_fei.h"
/**
* \defgroup api_fei_h264 H.264 FEI encoding API
*
* @{
*/
/** \brief FEI frame level control buffer for H.264 */
typedef struct _VAEncMiscParameterFEIFrameControlH264 {
uint32_t function; /* one of the VAConfigAttribFEIFunctionType values */
/** \brief MB (16x16) control input buffer. It is valid only when (mb_input | mb_size_ctrl)
* is set to 1. The data in this buffer correspond to the input source. 16x16 MB is in raster scan order,
* each MB control data structure is defined by VAEncFEIMBControlH264.
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAEncFEIMBControlH264).
* Note: if mb_qp is set, VAEncQPBufferH264 is expected.
*/
VABufferID mb_ctrl;
/** \brief distortion output of MB ENC or ENC_PAK.
* Each 16x16 block has one distortion data with VAEncFEIDistortionH264 layout
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAEncFEIDistortionH264).
*/
VABufferID distortion;
/** \brief MVs data output of MB ENC.
* Each 16x16 block has one MVs data with layout VAMotionVector
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAMotionVector) * 16.
*/
VABufferID mv_data;
/** \brief MBCode data output of MB ENC.
* Each 16x16 block has one MB Code data with layout VAEncFEIMBCodeH264
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAEncFEIMBCodeH264).
*/
VABufferID mb_code_data;
/** \brief QP input buffer with layout VAEncQPBufferH264. It is valid only when mb_qp is set to 1.
* The data in this buffer correspond to the input source.
* One QP per 16x16 block in raster scan order, each QP is a signed char (8-bit) value.
**/
VABufferID qp;
/** \brief MV predictor. It is valid only when mv_predictor_enable is set to 1.
* Each 16x16 block has one or more pair of motion vectors and the corresponding
* reference indexes as defined by VAEncFEIMVPredictorH264. 16x16 block is in raster scan order.
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAEncFEIMVPredictorH264). */
VABufferID mv_predictor;
/** \brief number of MV predictors. It must not be greater than maximum supported MV predictor. */
uint32_t num_mv_predictors_l0 : 16;
uint32_t num_mv_predictors_l1 : 16;
/** \brief motion search method definition
* 0: default value, diamond search
* 1: full search
* 2: diamond search
**/
uint32_t search_path : 8;
/** \brief maximum number of Search Units, valid range is [1, 63]
* 0 is treated as 1. reference search locations are grouped in a predefined pattern,
* and all locations within the same group must be either all are chosen or all are skipped.
* These predefined groups are called search unit (SU).*/
uint32_t len_sp : 8;
uint32_t reserved0 : 16;
/** \brief defines the bit-mask for disabling sub-partition
* The lower 4 bits are for the major partitions (sub-macroblock) and the higher 3 bits for minor partitions (with sub-partition for 4x(8x8) sub-macroblocks.
* xxxxxx1 : 16x16 sub-macroblock disabled
* xxxxx1x : 2x(16x8) sub-macroblock within 16x16 disabled
* xxxx1xx : 2x(8x16) sub-macroblock within 16x16 disabled
* xxx1xxx : 1x(8x8) sub-partition for 4x(8x8) within 16x16 disabled
* xx1xxxx : 2x(8x4) sub-partition for 4x(8x8) within 16x16 disabled
* x1xxxxx : 2x(4x8) sub-partition for 4x(8x8) within 16x16 disabled
* 1xxxxxx : 4x(4x4) sub-partition for 4x(8x8) within 16x16 disabled
* 1111111 : Invalid
* 0000000 : default value */
uint32_t sub_mb_part_mask : 7;
/** specifies which Luma Intra partition is enabled/disabled for intra mode decision.
* xxxx1: luma_intra_16x16 disabled
* xxx1x: luma_intra_8x8 disabled
* xx1xx: luma_intra_4x4 disabled
* xx111: intra prediction is disabled */
uint32_t intra_part_mask : 5;
/** when set to 1, neighbor MV will be used as predictor; when set to 0, no neighbor MV will be used as predictor.*/
uint32_t multi_pred_l0 : 1;
/** when set to 1, neighbor MV will be used as predictor; when set to 0, no neighbor MV will be used as predictor.*/
uint32_t multi_pred_l1 : 1;
/**defines the half/quarter pel modes. The mode is inclusive, ie., higher precision mode samples lower precision locations.
* 00b: integer mode searching
* 01b: half-pel mode searching
* 10b: reserved
* 11b: quarter-pel mode searching */
uint32_t sub_pel_mode : 2;
/** specifies distortion measure adjustments used for the inter motion search SAD comparison.
* 00b: none
* 10b: Haar transform adjusted*/
uint32_t inter_sad : 2;
/** specifies distortion measure adjustments used for the intra motion search SAD comparison.
* 00b: none
* 10b: Haar transform adjusted*/
uint32_t intra_sad : 2;
/** specifies if the output distortion is the raw distortion or cost adjusted distortion.
* 0: Raw Distortion without Cost
* 1: Distortion with added Cost */
uint32_t distortion_type : 1;
/** when set to 1, enables the additional calls on Fraction & Bidirectional Refinement*/
uint32_t repartition_check_enable : 1;
/** defines whether adaptive searching is enabled for IME(Integer Motion Estimation).
* 0: disable
* 1: enable */
uint32_t adaptive_search : 1;
/** enables using the motion vector as an extra predictor provided by the host. If it is set,
* host needs to provide a buffer with motion vectors and the associated reference index for
* each 16x16 block as defined . The host can call processing function to get motion vectors and use as predictor.
* 0: MV predictor disabled
* 1: MV predictor enabled */
uint32_t mv_predictor_enable : 1;
/** enables using the QP buffer to set the QP for each block*/
uint32_t mb_qp : 1;
/** enable mb_ctrl buffer to handle MB*/
uint32_t mb_input : 1;
/** when this flag is set, mb_ctrl must be set too and a buffer with per MB input
* needs to be provided and MaxSizeInWord and */
uint32_t mb_size_ctrl : 1;
/** when this flag is set, extra distortion between the current MB and co-located MB is provided.
* Extra distortion output has performance impact, set it only when it is needed.*/
uint32_t colocated_mb_distortion : 1;
uint32_t reserved1 : 4;
/** \brief motion search window(ref_width * ref_height) */
uint32_t ref_width : 8;
uint32_t ref_height : 8;
/** \brief predefined motion search windows. If selected, len_sp, window(ref_width * ref_eight)
* and search_path setting are ignored.
* 0: not use predefined search window
* 1: Tiny, len_sp=4, 24x24 window and diamond search
* 2: Small, len_sp=9, 28x28 window and diamond search
* 3: Diamond, len_sp=16, 48x40 window and diamond search
* 4: Large Diamond, len_sp=32, 48x40 window and diamond search
* 5: Exhaustive, len_sp=48, 48x40 window and full search
* 6: Extend Diamond, len_sp=16, 64x40 window and diamond search
* 7: Extend Large Diamond, len_sp=32, 64x40 window and diamond search
* 8: Extend Exhaustive, len_sp=48, 64x40 window and full search
**/
uint32_t search_window : 4;
uint32_t reserved2 : 12;
/** \brief max frame size control with multi passes QP setting */
uint32_t max_frame_size;
/** \brief number of passes, every pass has different QP */
uint32_t num_passes;
/** \brief delta QP list for every pass */
uint8_t *delta_qp;
uint32_t reserved3[VA_PADDING_LOW];
} VAEncMiscParameterFEIFrameControlH264;
/** \brief FEI MB level control data structure */
typedef struct _VAEncFEIMBControlH264 {
/** \brief when set, correposndent MB is coded as intra */
uint32_t force_to_intra : 1;
/** \brief when set, correposndent MB is coded as skip */
uint32_t force_to_skip : 1;
/** \brief specifies whether this macroblock should be coded as a non-skipped macroblock. */
uint32_t force_to_nonskip : 1;
uint32_t enable_direct_bias_adjustment : 1;
uint32_t enable_motion_bias_adjustment : 1;
uint32_t ext_mv_cost_scaling_factor : 3;
uint32_t reserved0 : 24;
uint32_t reserved1;
uint32_t reserved2;
uint32_t reserved3 : 16;
/** \brief when mb_size_ctrl is set, size here is used to budget accumulatively. Set to 0xFF if don't care. */
uint32_t target_size_in_word : 8;
/** \brief specifies the max size of each MB */
uint32_t max_size_in_word : 8;
} VAEncFEIMBControlH264;
/** \brief Application can use this definition as reference to allocate the buffer
* based on MaxNumPredictor returned from attribute VAConfigAttribFEIMVPredictors query.
**/
typedef struct _VAEncFEIMVPredictorH264 {
/** \brief Reference index corresponding to the entry of RefPicList0 & RefPicList1 in VAEncSliceParameterBufferH264.
* Note that RefPicList0 & RefPicList1 needs to be the same for all slices.
* ref_idx_l0_x : index to RefPicList0; ref_idx_l1_x : index to RefPicList1; x : 0 - MaxNumPredictor.
**/
struct {
uint8_t ref_idx_l0 : 4;
uint8_t ref_idx_l1 : 4;
} ref_idx[4]; /* index is predictor number */
uint32_t reserved;
/** \brief MV. MaxNumPredictor must be the returned value from attribute VAConfigAttribFEIMVPredictors query.
* Even application doesn't use the maximum predictors, the VAFEIMVPredictorH264 structure size
* has to be defined as maximum so each MB can be at a fixed location.
* Note that 0x8000 must be used for correspondent intra block.
**/
VAMotionVector mv[4]; /* MaxNumPredictor is 4 */
} VAEncFEIMVPredictorH264;
/** \brief FEI output */
/**
* Motion vector output is per 4x4 block. For each 4x4 block there is a pair of MVs
* for RefPicList0 and RefPicList1 and each MV is 4 bytes including horizontal and vertical directions.
* Depending on Subblock partition, for the shape that is not 4x4, the MV is replicated
* so each 4x4 block has a pair of MVs. The 16x16 block has 32 MVs (128 bytes).
* 0x8000 is used for correspondent intra block. The 16x16 block is in raster scan order,
* within the 16x16 block, each 4x4 block MV is ordered as below in memory.
* The buffer size shall be greater than or equal to the number of 16x16 blocks multiplied by 128 bytes.
* Note that, when separate ENC and PAK is enabled, the exact layout of this buffer is needed for PAK input.
* App can reuse this buffer, or copy to a different buffer as PAK input.
* Layout is defined as Generic motion vector data structure VAMotionVector
* 16x16 Block
* -----------------------------------------
* | 1 | 2 | 5 | 6 |
* -----------------------------------------
* | 3 | 4 | 7 | 8 |
* -----------------------------------------
* | 9 | 10 | 13 | 14 |
* -----------------------------------------
* | 11 | 12 | 15 | 16 |
* -----------------------------------------
**/
/** \brief VAEncFEIMBCodeH264 defines the data structure for VAEncFEIMBCodeBufferType per 16x16 MB block.
* it is output buffer of ENC and ENC_PAK modes, it's also input buffer of PAK mode.
* The 16x16 block is in raster scan order. Buffer size shall not be less than the number of 16x16 blocks
* multiplied by sizeof(VAEncFEIMBCodeH264). Note that, when separate ENC and PAK is enabled,
* the exact layout of this buffer is needed for PAK input. App can reuse this buffer,
* or copy to a different buffer as PAK input, reserved elements must not be modified when used as PAK input.
**/
typedef struct _VAEncFEIMBCodeH264 {
//DWORD 0~2
uint32_t reserved0[3];
//DWORD 3
uint32_t inter_mb_mode : 2;
uint32_t mb_skip_flag : 1;
uint32_t reserved1 : 1;
uint32_t intra_mb_mode : 2;
uint32_t reserved2 : 1;
uint32_t field_mb_polarity_flag : 1;
uint32_t mb_type : 5;
uint32_t intra_mb_flag : 1;
uint32_t field_mb_flag : 1;
uint32_t transform8x8_flag : 1;
uint32_t reserved3 : 1;
uint32_t dc_block_coded_cr_flag : 1;
uint32_t dc_block_coded_cb_flag : 1;
uint32_t dc_block_coded_y_flag : 1;
uint32_t reserved4 : 12;
//DWORD 4
uint32_t horz_origin : 8;
uint32_t vert_origin : 8;
uint32_t cbp_y : 16;
//DWORD 5
uint32_t cbp_cb : 16;
uint32_t cbp_cr : 16;
//DWORD 6
uint32_t qp_prime_y : 8;
uint32_t reserved5 : 17;
uint32_t mb_skip_conv_disable : 1;
uint32_t is_last_mb : 1;
uint32_t enable_coefficient_clamp : 1;
uint32_t direct8x8_pattern : 4;
//DWORD 7 8 and 9
union {
/* Intra MBs */
struct {
uint32_t luma_intra_pred_modes0 : 16;
uint32_t luma_intra_pred_modes1 : 16;
uint32_t luma_intra_pred_modes2 : 16;
uint32_t luma_intra_pred_modes3 : 16;
uint32_t chroma_intra_pred_mode : 2;
uint32_t intra_pred_avail_flag : 5;
uint32_t intra_pred_avail_flagF : 1;
uint32_t reserved6 : 24;
} intra_mb;
/* Inter MBs */
struct {
uint32_t sub_mb_shapes : 8;
uint32_t sub_mb_pred_modes : 8;
uint32_t reserved7 : 16;
uint32_t ref_idx_l0_0 : 8;
uint32_t ref_idx_l0_1 : 8;
uint32_t ref_idx_l0_2 : 8;
uint32_t ref_idx_l0_3 : 8;
uint32_t ref_idx_l1_0 : 8;
uint32_t ref_idx_l1_1 : 8;
uint32_t ref_idx_l1_2 : 8;
uint32_t ref_idx_l1_3 : 8;
} inter_mb;
} mb_mode;
//DWORD 10
uint32_t reserved8 : 16;
uint32_t target_size_in_word : 8;
uint32_t max_size_in_word : 8;
//DWORD 11~14
uint32_t reserved9[4];
//DWORD 15
uint32_t reserved10;
} VAEncFEIMBCodeH264; // 64 bytes
/** \brief VAEncFEIDistortionH264 defines the data structure for VAEncFEIDistortionBufferType per 16x16 MB block.
* It is output buffer of ENC and ENC_PAK modes, The 16x16 block is in raster scan order.
* Buffer size shall not be less than the number of 16x16 blocks multiple by sizeof(VAEncFEIDistortionH264).
**/
typedef struct _VAEncFEIDistortionH264 {
/** \brief Inter-prediction-distortion associated with motion vector i (co-located with subblock_4x4_i).
* Its meaning is determined by sub-shape. It must be zero if the corresponding sub-shape is not chosen.
**/
uint16_t inter_distortion[16];
uint32_t best_inter_distortion : 16;
uint32_t best_intra_distortion : 16;
uint32_t colocated_mb_distortion : 16;
uint32_t reserved0 : 16;
uint32_t reserved1[2];
} VAEncFEIDistortionH264; // 48 bytes
/** \brief Motion Vector and Statistics frame level controls.
* VAStatsStatisticsParameterBufferType for H264 16x16 block
**/
typedef struct _VAStatsStatisticsParameterH264 {
VAStatsStatisticsParameter stats_params;
uint32_t frame_qp : 8;
/** \brief length of search path */
uint32_t len_sp : 8;
/** \brief motion search method definition
* 0: default value, diamond search
* 1: full search
* 2: diamond search
**/
uint32_t search_path : 8;
uint32_t reserved0 : 8;
uint32_t sub_mb_part_mask : 7;
/** \brief sub pixel mode definition
* 00b: integer mode searching
* 01b: half-pel mode searching
* 10b: reserved
* 11b: quarter-pel mode searching
**/
uint32_t sub_pel_mode : 2;
/** \brief distortion measure adjustment for inter search SAD comparison
* 00b: none
* 01b: reserved
* 10b: Haar transform adjusted
* 11b: reserved
**/
uint32_t inter_sad : 2;
/** \brief distortion measure adjustment for intra search SAD comparison
* 00b: none
* 01b: reserved
* 10b: Haar transform adjusted
* 11b: reserved
**/
uint32_t intra_sad : 2;
uint32_t adaptive_search : 1;
/** \brief indicate if future or/and past MV in mv_predictor buffer is valid.
* 0: MV predictor disabled
* 1: MV predictor enabled for past reference
* 2: MV predictor enabled for future reference
* 3: MV predictor enabled for both past and future references
**/
uint32_t mv_predictor_ctrl : 3;
uint32_t mb_qp : 1;
/** \brief forward transform enable
* 0: disable
* 1: enable, needs frame_qp or mb_qp input for transform
**/
uint32_t ft_enable : 1;
/** \brief luma intra mode partition mask
* xxxx1: luma_intra_16x16 disabled
* xxx1x: luma_intra_8x8 disabled
* xx1xx: luma_intra_4x4 disabled
* xx111: intra prediction is disabled
**/
uint32_t intra_part_mask : 5;
uint32_t reserved1 : 8;
/** \brief motion search window(ref_width * ref_height) */
uint32_t ref_width : 8;
uint32_t ref_height : 8;
/** \brief predefined motion search windows. If selected, len_sp, window(ref_width * ref_eight)
* and search_path setting are ignored.
* 0: not use predefined search window
* 1: Tiny, len_sp=4, 24x24 window and diamond search
* 2: Small, len_sp=9, 28x28 window and diamond search
* 3: Diamond, len_sp=16, 48x40 window and diamond search
* 4: Large Diamond, len_sp=32, 48x40 window and diamond search
* 5: Exhaustive, len_sp=48, 48x40 window and full search
* 6: Extend Diamond, len_sp=16, 64x40 window and diamond search
* 7: Extend Large Diamond, len_sp=32, 64x40 window and diamond search
* 8: Extend Exhaustive, len_sp=48, 64x40 window and full search
**/
uint32_t search_window : 4;
uint32_t reserved2 : 12;
/** \brief MVOutput. When set to 1, MV output is NOT provided */
uint32_t disable_mv_output : 1;
/** \brief StatisticsOutput. When set to 1, Statistics output is NOT provided. */
uint32_t disable_statistics_output : 1;
/** \brief block 8x8 data enabling in statistics output */
uint32_t enable_8x8_statistics : 1;
uint32_t reserved3 : 29;
uint32_t reserved4[2];
} VAStatsStatisticsParameterH264;
/** \brief VAStatsStatisticsH264. H264 Statistics buffer layout for VAStatsStatisticsBufferType
* and VAStatsStatisticsBottomFieldBufferType(for interlaced only).
* Statistics output is per 16x16 block. Data structure per 16x16 block is defined below.
* The 16x16 block is in raster scan order. The buffer size shall be greater than or equal to
* the number of 16x16 blocks multiplied by sizeof(VAStatsStatisticsH264).
**/
typedef struct _VAStatsStatisticsH264 {
/** \brief past reference */
uint32_t best_inter_distortion0 : 16;
uint32_t inter_mode0 : 16;
/** \brief future reference */
uint32_t best_inter_distortion1 : 16;
uint32_t inter_mode1 : 16;
uint32_t best_intra_distortion : 16;
uint32_t intra_mode : 16;
uint32_t num_non_zero_coef : 16;
uint32_t reserved0 : 16;
uint32_t sum_coef;
/** \brief DWORD 5 flat info **/
uint32_t mb_is_flat : 1;
uint32_t reserved1 : 31;
/** \brief DWORD 6 variance for block16x16**/
uint32_t variance_16x16;
/** \brief DWORD 7 ~ 10, variance for block8x8 **/
uint32_t variance_8x8[4];
/** \brief DWORD 11 pixel_average for block16x16 **/
uint32_t pixel_average_16x16;
/** \brief DWORD 12 ~ 15, pixel_average for block8x8 **/
uint32_t pixel_average_8x8[4];
} VAStatsStatisticsH264; // 64 bytes
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_FEI_H264_H */

254
lib/libva/va/va_fei_hevc.h Normal file
View file

@ -0,0 +1,254 @@
/*
* Copyright (c) 2007-2017 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_fei_hevc.h
* \brief The FEI encoding HEVC special API
*/
#ifndef __VA_FEI_HEVC_H__
#define __VA_FEI_HEVC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "va_fei.h"
/**
* \defgroup api_fei_hevc HEVC FEI encoding API
*
* @{
*/
/** \brief FEI frame level control buffer for HEVC */
typedef struct _VAEncMiscParameterFEIFrameControlHEVC {
/* one of the VAConfigAttribFEIFunctionType values */
uint32_t function;
/** \brief CTB control input buffer. It is valid only when per_ctb_input
* is set to 1. The data in this buffer correspond to the input source. CTB is in raster scan order,
* each CTB control data structure is defined by VAEncFEICTBControlHEVC.
* Buffer size shall not be less than the number of CTBs multiplied by
* sizeof(VAEncFEICTBControlHEVC).
*/
VABufferID ctb_ctrl;
/** \brief CTB cmd per CTB data output of ENC
* it is reserved for CTB level information
* it should include CU split information and other CTB datas .
* Each CTB block has one CTB cmd data.
*/
VABufferID ctb_cmd;
/** \brief CU record data output of ENC
* it is reserved for CU level information
* it should include CU detail data. include mode,MV, reference etc.
* Each CTB block has one CU record data.
*/
VABufferID cu_record;
/** \brief distortion output of ENC or ENC_PAK.
* Each CTB has one distortion data with VAEncFEIDistortionHevc
* Buffer size shall not be less than the number of CTBs multiplied by
* sizeof(VAEncFEIDistortionHevc).
*/
VABufferID distortion;
/** \brief Qp input buffer. It is valid only when per_block_qp is set to 1.
* The data in this buffer correspond to the input source.
* One Qp per block block is in raster scan order, each Qp is a signed char (8-bit) value.
**/
VABufferID qp;
/** \brief MV predictor. It is valid only when mv_predictor_input is set to non-zero.
* Each CTB block has one or more pair of motion vectors and the corresponding
* reference indexes as defined by VAEncFEIMVPredictorHEVC. 32x32 block is in raster scan order.
* Buffer size shall not be less than the number of 16x16 blocks multiplied by
* sizeof(VAEncFEIMVPredictorHEVC). */
VABufferID mv_predictor;
/** \brief number of MV predictors L0 and L1. the maximum number of motion vector predictor for a 16x16, 32x32 or
* 64x64 block is four, it must not be greater than maximum supported MV predictor,
**/
uint32_t num_mv_predictors_l0 : 16;
uint32_t num_mv_predictors_l1 : 16;
/** \brief control parameters */
uint32_t search_path : 8;
uint32_t len_sp : 8;
uint32_t reserved0 : 16;
/** \brief multi pred l0/1
* 0000: no internal MV predictor will be used
* 0001: spatial MV predictors
* 0100/1000: Reserved
**/
uint32_t multi_pred_l0 : 4;
uint32_t multi_pred_l1 : 4;
/** \brief defines the motion vector precision, like integer/half/quarter pel.
* 00b: integer pel
* 01b: half-pel
* 10b: reserved
* 11b: quarter-pel
*/
uint32_t sub_pel_mode : 2;
uint32_t adaptive_search : 1;
/** \brief mv_predictor_input
* 000: MV predictor disabled
* 001: MV predictor enabled per 16x16 block
* 010: MV predictor enabled per 32x32 block
* 011: MV predictor enabled per 64x64 block
* 111: MV predictor enabled, block size can vary and is determined by BlockSize in motion vector predictor buffer
* 100/101/110: Reserved
**/
uint32_t mv_predictor_input : 3;
/** \brief enables per CTB or CU qp */
uint32_t per_block_qp : 1;
/** \brief enables the per CTB input , if 1, need ctb_ctrl to be a real surface ID*/
uint32_t per_ctb_input : 1;
/** when this flag is set, extra distortion between current CTB and co-located CTB is provided.
* Extra distortion output has performance impact, set it only when it is needed */
uint32_t colocated_ctb_distortion : 1;
/** brief specifies whether this CTB should be forced to split to remove Inter big LCU: do not check Inter 32x32
* PUs. Every 32x32 LCU is split at least once. It can be used to improved performance.
* 0: ENC determined block type
* 1: Force to split
**/
uint32_t force_lcu_split : 1;
/** \brief enables CU64x64 check */
uint32_t enable_cu64_check : 1;
/** \brief enables CU64x64 asymmetric motion partition check */
uint32_t enable_cu64_amp_check : 1;
/** \brief specifies if check the 64x64 merge candidate
* 0: after skip check,
* 1: only skip check for 64x64
Default: 0. This field is used by LCU64 bi-directional.
**/
uint32_t cu64_skip_check_only : 1;
uint32_t reserved1 : 11;
/** specifies the search region width in pixels.
* When bidirectional search is enabled, this applies to both search regions */
uint32_t ref_width : 8;
/** specifies the reference region height in pixels. When bidirectional search is enabled,
* this applies to both search regions. */
uint32_t ref_height : 8;
/** \brief search window similar for AVC
* defines predefined search windows. If it is selected, RefWidth, RefHeight, LenSP and SearchPath are ignored.
* 0 : not use predefined search window
* 1 : Tiny (4 SUs) 24x24 window diamond search
* 2 : Small (9 SUs) 28x28 window diamond search
* 3 : Diamond (16 SUs) 48x40 window diamond search
* 4 : Large Diamond (32 SUs) 48x40 window diamond search
* 5 : Exhaustive 48x40 window full search
* 6 : (64 SUs) 64x64 window full search
* Note: option 1, 2, 3 and 4 are valid only when CAP parameter SearchWindow64Support is 0.
* And option 6 is valid only when SearchWindow64Support is 1.*/
uint32_t search_window : 8;
/** \brief number of internal MV predictors for IME searches */
uint32_t max_num_ime_search_center : 3;
/** \brief fast intra prediction enabling bit. It is used as a trade-off between speed and quality.
* The flag will be ignored if it's unsupported in the driver*/
uint32_t fast_intra_mode : 1;
uint32_t reserved2 : 4;
/** \brief specifies number of splits that encoder could be run concurrently
* 1: level 1, default value
* 2: level 2
* 4: level 3
**/
uint32_t num_concurrent_enc_frame_partition : 8;
uint32_t reserved3 : 24;
/** \brief max frame size control with multi passes QP setting */
uint32_t max_frame_size;
/** \brief number of passes, every pass has different QP */
uint32_t num_passes;
/** \brief delta QP list for every pass */
uint8_t *delta_qp;
uint32_t reserved4[2];
} VAEncMiscParameterFEIFrameControlHEVC;
/** \brief Application can use this definition as reference to allocate the buffer
* based on MaxNumPredictor returned from attribute VAConfigAttribFEIMVPredictors query.
* this buffer allocation is always based on 16x16 block even block size is indicated as 32x32 or 64x64, and buffer
* layout is always in 32x32 block raster scan order even block size is 16x16 or 64x64. If 32x32 block size is set,
* only the data in the first 16x16 block (block 0) is used for 32x32 block. If 64x64 block size is set
* MV layout is still in 32x32 raster scan order, the same as 32x32 and the first 16x16
* block within each 32x32 block needs to have intended MV data (four 32x32 blocks will have the same MV data in the
* correspondent first 16x16 block). Data structure for each 16x16 block is defined as below (same as AVC except
* BlockSize/Reserved bits).
**/
typedef struct _VAEncFEIMVPredictorHEVC {
/** \brief Feference index corresponding to the entry of RefPicList0 & RefPicList1 in slice header (final reference
* list). Note that RefPicList0 & RefPicList1 needs to be the same for all slices.
* Ref0xIndex RefPicList0; Ref1xIndex RefPicList1; x 0 ~ MaxNumPredictor */
struct {
uint8_t ref_idx_l0 : 4;
uint8_t ref_idx_l1 : 4;
} ref_idx[4]; /* index is predictor number */
/** \brief Valid only when MVPredictor is set to 011 for HEVC. Only valid in the first 16x16 block.
* 00: MV predictor disabled for this 32x32 block
* 01: MV predictor enabled per 16x16 block for this 32x32 block
* 10: MV predictor enabled per 32x32 block, the rest of 16x16 block data within this 32x32 block are ignored
* 11: Reserved */
uint32_t block_size : 2;
uint32_t reserved : 30;
VAMotionVector mv[4]; /* MaxNumPredictor is 4 */
} VAEncFEIMVPredictorHEVC; //40 bytes
/** \brief FEI CTB level control data structure */
typedef struct _VAEncFEICTBControlHEVC {
// DWORD 0
uint32_t force_to_intra : 1;
uint32_t force_to_inter : 1;
uint32_t force_to_skip : 1;
/** \brief force all coeff to zero */
uint32_t force_to_zero_coeff : 1;
uint32_t reserved0 : 28;
// DWORD 1
uint32_t reserved1;
// DWORD 2
uint32_t reserved2;
// DWORD 3
uint32_t reserved3;
} VAEncFEICTBControlHEVC;
/** \brief VAEncFEIDistortionHevc defines the data structure for VAEncFEIDistortionBufferType per CTB block.
* It is output buffer of ENC and ENC_PAK modes, The CTB block is in raster scan order.
* Buffer size shall not be less than the number of CTB blocks multiple by sizeof(VAEncFEIDistortionHevc).
**/
typedef struct _VAEncFEIDistortionHevc {
/** best CTB distortion */
uint32_t best_distortion;
/** only when colocated_ctb_distortion in VAEncMiscParameterFEIFrameControlHEVC is set */
uint32_t colocated_ctb_distortion;
} VAEncFEIDistortionHevc;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more