SlideShare a Scribd company logo
1 of 31
Download to read offline
GSTREAMER-VAAPI
HARDWARE-ACCELERATED
ENCODING AND DECODING
ON INTEL® HARDWARE
Victor Jaquez
GStreamer Conference 2015 / 8-9 October (Dublin)
VA-API
VIDEO ACCELERATION
—
APPLICATION PROGRAMMING INTERFACE
WHAT IS VA-API?
An API specification
A library implementation
Open Source MIT license
WHAT DOES IT DO?
1. Enables hardware accelerated video decode and encode.
Entry-points: VLD, IDCT, Motion Compensation, etc.
Codecs: MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264,
VC-1/VMW3, JPEG, VP8, VP9.
2. Sub-picture blending and rendering
3. Video post processing:
Color balance, skin tone enhancement, de-interlace,
scaling, etc.
HOW'S THE IMPLEMENTATION?
libva
http://cgit.freedesktop.org/vaapi/libva/
It is a front-end
Opens and registers a backend
WHICH BACKENDS?
i965_drv_video.so (HD Intel driver)
vdpau_drv_video.so (VDPAU —noveau/nvidia/s3g— bridge)
xvba_drv_video.so (XvBA —fglrx— bridge)
pvr_drv_video.so (PVR bridge)
gallium_drv_video.so (Gallium bridge!)
hybrid_drv_video.so
(another HD Intel driver, does decoding and encoding using either CPU and GPU)
vainfo
libva info: VA-API version 0.38.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /opt/gnome/jh/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.2.pre1)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile -
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
vainfo
libva info: VA-API version 0.38.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /home/ceyusa/jh/lib/dri//nvidia_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.2.pre1)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API -
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG4Simple : VAEntrypointVLD
VAProfileMPEG4AdvancedSimple : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
HOW'S THE API?
VADisplay
X11, DRM, Wayland, Android, etc.
VAConfigID
VLD for requested codec.
VAContexID
"Virtual" video processing pipeline.
VASurfaceID
Render targets.
Not accessible to the client.
VABufferID
data, parameters, quantization matrix, slice info, etc.
MPEG2 DECODE
INITIALIZATION
dpy = vaGetDisplay(x11_display);
vaCreateConfig(dpy, VAProfileMPEG2Main, VAEntrypointVLD,
&attr, 1, &cfg);
vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, w, h, &surface, 1,
NULL, 0);
vaCreateContext(dpy, cfg, w, h, VA_PROGRESSIVE, &surface, 1,
&ctxt);
MPEG2 DECODE
FILL DATA
vaCreateBuffer(dpy, ctxt, VAPictureParameterBufferType,
sizeof(VAPictureParameterBufferMPEG2), 1,
&pic_param, &pic_param_buf);
vaCreateBuffer(dpy, ctxt, VAIQMatrixBufferType,
sizeof(VAIQMatrixBufferMPEG2), 1,
&iq_matrix, &iqmatrix_buf);
vaCreateBuffer(dpy, ctxt, VASliceParameterBufferType,
sizeof(VASliceParameterBufferMPEG2), 1,
&slice_param, &slice_param_buf);
vaCreateBuffer(dpy, ctxt, VASliceDataBufferType,
slice_size, 1, slice_data, &slice_data_buf);
MPEG2 DECODE
DECODE AND DISPLAY
vaBeginPicture(dpy, ctxt, surface);
vaRenderPicture(dpy, ctxt, &pic_param_buf, 1);
vaRenderPicture(dpy, ctxt, &iqmatrix_buf, 1);
vaRenderPicture(dpy, ctxt, &slice_param_buf, 1);
vaRenderPicture(dpy, ctxt, &slice_data_buf, 1);
vaEndPicture(dpy, ctxt);
vaSyncSurface(dpy, surface);
vaPutSurface(dpy, surface, x11_window, sx, sy, sw, sh, dx, dy, dw, dh, NULL,
WHAT IS GSTREAMER-VAAPI?
A helper library (libgstvaapi)
A set of GStreamer elements
Supports from GStreamer-1.2 to 1.6
LIBRARY
Wraps almost all VA-API concepts
ENCODER H264
INITIALIZATION
dpy = gst_vaapi_display_x11_new(NULL);
enc = gst_vaapi_encoder_h264_new(dpy);
st = new_gst_video_codec_state(w, h, fps_n, fps_d);
gst_vaapi_encoder_set_codec_data(enc, st);
ENCODER H264
FILL DATA
img = gst_vaapi_image_new(dpy, GST_VIDEO_FORMAT_I420, w, h);
gst_vaapi_image_map(img);
load_raw_image(img);
gst_vaapi_image_unmap(img);
gst_video_info_set_format(&vinfo, GST_VIDEO_FORMAT_ENCODED, w, h);
pool = gst_vaapi_surface_pool_new_full(dpy, &vinfo, 0);
proxy = gst_vaapi_surface_proxy_new_from_pool (pool);
surface = gst_vaapi_surface_proxy_get_surface (proxy);
gst_vaapi_surface_put_image(surface, img);
ENCODER H264
ENCODE
frame = g_slice_new0(GstVideoCodecFrame);
gst_video_codec_frame_set_user_data(frame,
gst_vaapi_surface_proxy_ref(proxy),
gst_vaapi_surface_proxy_unref);
gst_vaapi_encoder_put_frame(encoder, frame);
gst_vaapi_encoder_get_buffer_with_timeout(enc, &encbuf, 5000);
buf = gst_buffer_new_and_alloc(gst_vaapi_coded_buffer_get_size(encbuf))
gst_vaapi_coded_buffer_copy_into(buf, encbuf);
LIBRARY
Implements video codec parsers.
OpenGL helpers (EGL and GLX).
Windowing protocol helpers (DRM, Wayland, X11).
SPLIT LIBRARIES
libgstvaapi
libgstvaapi-drm
libgstvaapi-x11
libgstvaapi-glx
libgstvaapi-egl
libgstvaapi-wayland
GStreamer elements
vaapidecode: VA-API decoder
vaapisink: VA-API sink
 
vaapipostproc: VA-API video post-processing
vaapidecodebin: VA-API decode bin
GStreamer elements
Encoders
vaapiencode_h264: VA-API H.264 encoder
vaapiencode_mpeg2: VA-API MPEG-2 encoder
vaapiencode_jpeg: VA-API JPEG encoder
vaapiencode_vp8: VA-API VP8 encoder
vaapiencode_h265: VA-API H.265 encoder
GStreamer elements
Parsers
vaapiparse_h264: H.264 parser
vaapiparse_h265: H.265 parser
CHALLENGES
THOU SHALL NOT PARSE TWICE
— codecparsers: add GstMetas to pass parsing
results downstream
— Add mpeg2 slice header information to
GstMpegVideoMeta
691712
704865
THOU SHALL AUTO-PLUG HW VIDEO
FILTERS (DE-INTERLACERS)
— playbin: autoplugging s/w and h/w accelerated
deinterlacers
Remove vaapidecodebin
687182
THOU SHALL REVERSE PLAY-BACK
— videodecoder: reverse playback in non-
packetized decoders
Handle when the number of buffers in the GOP is bigger
than the maximum buffers in the video buffer pool.
747574
THOU SHALL SUPPORT DMABUF
— vaapi: expose memory:dmabuf capsfeature755072
THOU SHALL SUPPORT OPENGL /
OPENGL3 / OPENGL-ES
— [metabug] GL bugs755406
THOU SHALL NOT CACHE THE
DISPLAY
— Remove display cache
— Using multiple instances of vaapisink in one
application cause problems
747946
754820
QUESTIONS?
 
THANK YOU!
Twitter:
Mail: vjaquez at igalia dot com
Blog:
@ceyusa
http://blogs.igalia.com/vjaquez

More Related Content

What's hot

What's hot (20)

Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOS
 
Ixgbe internals
Ixgbe internalsIxgbe internals
Ixgbe internals
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
 
How to write a TableGen backend
How to write a TableGen backendHow to write a TableGen backend
How to write a TableGen backend
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
 
linux device driver
linux device driverlinux device driver
linux device driver
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
 
The basic concept of Linux FIleSystem
The basic concept of Linux FIleSystemThe basic concept of Linux FIleSystem
The basic concept of Linux FIleSystem
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Securing your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security featuresSecuring your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security features
 
Understanding DPDK
Understanding DPDKUnderstanding DPDK
Understanding DPDK
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 
Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals
 
BPF Internals (eBPF)
BPF Internals (eBPF)BPF Internals (eBPF)
BPF Internals (eBPF)
 
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
Kernel Recipes 2015: Linux Kernel IO subsystem - How it works and how can I s...
 
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
XPDS13: Xen in OSS based In–Vehicle Infotainment Systems - Artem Mygaiev, Glo...
 

Viewers also liked

Viewers also liked (20)

U2 product For Wiseeco
U2 product For WiseecoU2 product For Wiseeco
U2 product For Wiseeco
 
Global mobile market report
Global mobile market reportGlobal mobile market report
Global mobile market report
 
Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기
 
Pure Function and Honest Design
Pure Function and Honest DesignPure Function and Honest Design
Pure Function and Honest Design
 
Pitfalls of Object Oriented Programming by SONY
Pitfalls of Object Oriented Programming by SONYPitfalls of Object Oriented Programming by SONY
Pitfalls of Object Oriented Programming by SONY
 
2017 k8s and OpenStack-Helm
2017 k8s and OpenStack-Helm2017 k8s and OpenStack-Helm
2017 k8s and OpenStack-Helm
 
1, 빅데이터 시대의 인공지능 문동선 v2
1, 빅데이터 시대의 인공지능 문동선 v21, 빅데이터 시대의 인공지능 문동선 v2
1, 빅데이터 시대의 인공지능 문동선 v2
 
클라우드 네트워킹과 SDN 그리고 OpenStack
클라우드 네트워킹과 SDN 그리고 OpenStack클라우드 네트워킹과 SDN 그리고 OpenStack
클라우드 네트워킹과 SDN 그리고 OpenStack
 
java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰
 
141118 최창원 웹크롤러제작
141118 최창원 웹크롤러제작141118 최창원 웹크롤러제작
141118 최창원 웹크롤러제작
 
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
[OpenStack Days Korea 2016] Track4 - Deep Drive: k8s with Docker
 
세션4. 예제로 배우는 스마트 컨트랙트 프로그래밍
세션4. 예제로 배우는 스마트 컨트랙트 프로그래밍세션4. 예제로 배우는 스마트 컨트랙트 프로그래밍
세션4. 예제로 배우는 스마트 컨트랙트 프로그래밍
 
세션5. web3.js와 Node.js 를 사용한 dApp 개발
세션5. web3.js와 Node.js 를 사용한 dApp 개발세션5. web3.js와 Node.js 를 사용한 dApp 개발
세션5. web3.js와 Node.js 를 사용한 dApp 개발
 
[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...
[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...
[OpenStack Days Korea 2016] Track3 - VDI on OpenStack with LeoStream Connecti...
 
[OpenStack Days Korea 2016] Track2 - 아리스타 OpenStack 연동 및 CloudVision 솔루션 소개
[OpenStack Days Korea 2016] Track2 - 아리스타 OpenStack 연동 및 CloudVision 솔루션 소개[OpenStack Days Korea 2016] Track2 - 아리스타 OpenStack 연동 및 CloudVision 솔루션 소개
[OpenStack Days Korea 2016] Track2 - 아리스타 OpenStack 연동 및 CloudVision 솔루션 소개
 
[2017년 5월 정기세미나] Network with OpenStack - OpenStack Summit Boston Post
[2017년 5월 정기세미나] Network with OpenStack - OpenStack Summit Boston Post[2017년 5월 정기세미나] Network with OpenStack - OpenStack Summit Boston Post
[2017년 5월 정기세미나] Network with OpenStack - OpenStack Summit Boston Post
 
[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람
[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람
[OpenStack Days Korea 2016] Track2 - 데이터센터에 부는 오픈 소스 하드웨어 바람
 
Bitcoin 2.0(blockchain technology 2)
Bitcoin 2.0(blockchain technology 2)Bitcoin 2.0(blockchain technology 2)
Bitcoin 2.0(blockchain technology 2)
 
[OpenStack Days Korea 2016] Track4 - OpenStack with Kubernetes
[OpenStack Days Korea 2016] Track4 - OpenStack with Kubernetes[OpenStack Days Korea 2016] Track4 - OpenStack with Kubernetes
[OpenStack Days Korea 2016] Track4 - OpenStack with Kubernetes
 
[OpenStack Days Korea 2016] Track3 - Powered by OpenStack, Power to do more w...
[OpenStack Days Korea 2016] Track3 - Powered by OpenStack, Power to do more w...[OpenStack Days Korea 2016] Track3 - Powered by OpenStack, Power to do more w...
[OpenStack Days Korea 2016] Track3 - Powered by OpenStack, Power to do more w...
 

Similar to GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware (GStreamer Conference 2015)

EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
Videoguy
 
Generic and Automatic Specman Based Verification Environment
Generic and Automatic Specman Based Verification EnvironmentGeneric and Automatic Specman Based Verification Environment
Generic and Automatic Specman Based Verification Environment
DVClub
 
Video Gateway Installation and configuration
Video Gateway Installation and configurationVideo Gateway Installation and configuration
Video Gateway Installation and configuration
sreeharsha43
 

Similar to GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware (GStreamer Conference 2015) (20)

DPDK Summit 2015 - Intel - Keith Wiles
DPDK Summit 2015 - Intel - Keith WilesDPDK Summit 2015 - Intel - Keith Wiles
DPDK Summit 2015 - Intel - Keith Wiles
 
FFmpeg
FFmpegFFmpeg
FFmpeg
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for Microcontrollers
 
Video Compression Standards - History & Introduction
Video Compression Standards - History & IntroductionVideo Compression Standards - History & Introduction
Video Compression Standards - History & Introduction
 
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
 
[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래
 
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
 
A smart front end real-time detection and tracking
A smart front end real-time detection and trackingA smart front end real-time detection and tracking
A smart front end real-time detection and tracking
 
MaxEye DAB/DAB+/DMB Receiver Test Solution - Application Note
MaxEye DAB/DAB+/DMB Receiver Test Solution - Application NoteMaxEye DAB/DAB+/DMB Receiver Test Solution - Application Note
MaxEye DAB/DAB+/DMB Receiver Test Solution - Application Note
 
Dpdk applications
Dpdk applicationsDpdk applications
Dpdk applications
 
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
 
Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1Ese 2008 RTSC Draft1
Ese 2008 RTSC Draft1
 
EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
EXPERIENCES WITH HIGH DEFINITION INTERACTIVE VIDEO ...
 
Simplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual CloudSimplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual Cloud
 
Generic and Automatic Specman Based Verification Environment
Generic and Automatic Specman Based Verification EnvironmentGeneric and Automatic Specman Based Verification Environment
Generic and Automatic Specman Based Verification Environment
 
Motion Vector Recovery for Real-time H.264 Video Streams
Motion Vector Recovery for Real-time H.264 Video StreamsMotion Vector Recovery for Real-time H.264 Video Streams
Motion Vector Recovery for Real-time H.264 Video Streams
 
Using Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network SystemsUsing Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network Systems
 
Video Gateway Installation and configuration
Video Gateway Installation and configurationVideo Gateway Installation and configuration
Video Gateway Installation and configuration
 
Resume marky20181025
Resume marky20181025Resume marky20181025
Resume marky20181025
 

More from Igalia

Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
Igalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
Igalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Igalia
 

More from Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

GStreamer-VAAPI: Hardware-accelerated encoding and decoding on Intel hardware (GStreamer Conference 2015)

  • 1. GSTREAMER-VAAPI HARDWARE-ACCELERATED ENCODING AND DECODING ON INTEL® HARDWARE Victor Jaquez GStreamer Conference 2015 / 8-9 October (Dublin)
  • 3. WHAT IS VA-API? An API specification A library implementation Open Source MIT license
  • 4. WHAT DOES IT DO? 1. Enables hardware accelerated video decode and encode. Entry-points: VLD, IDCT, Motion Compensation, etc. Codecs: MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, VC-1/VMW3, JPEG, VP8, VP9. 2. Sub-picture blending and rendering 3. Video post processing: Color balance, skin tone enhancement, de-interlace, scaling, etc.
  • 6. WHICH BACKENDS? i965_drv_video.so (HD Intel driver) vdpau_drv_video.so (VDPAU —noveau/nvidia/s3g— bridge) xvba_drv_video.so (XvBA —fglrx— bridge) pvr_drv_video.so (PVR bridge) gallium_drv_video.so (Gallium bridge!) hybrid_drv_video.so (another HD Intel driver, does decoding and encoding using either CPU and GPU)
  • 7. vainfo libva info: VA-API version 0.38.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /opt/gnome/jh/lib/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_38 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.38 (libva 1.6.2.pre1) vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Simple : VAEntrypointEncSlice VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointEncSlice VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice
  • 8. vainfo libva info: VA-API version 0.38.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /home/ceyusa/jh/lib/dri//nvidia_drv_video.so libva info: Found init function __vaDriverInit_0_38 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.38 (libva 1.6.2.pre1) vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileMPEG4Simple : VAEntrypointVLD VAProfileMPEG4AdvancedSimple : VAEntrypointVLD VAProfileH264Baseline : VAEntrypointVLD VAProfileH264Main : VAEntrypointVLD VAProfileH264High : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD
  • 9. HOW'S THE API? VADisplay X11, DRM, Wayland, Android, etc. VAConfigID VLD for requested codec. VAContexID "Virtual" video processing pipeline. VASurfaceID Render targets. Not accessible to the client. VABufferID data, parameters, quantization matrix, slice info, etc.
  • 10. MPEG2 DECODE INITIALIZATION dpy = vaGetDisplay(x11_display); vaCreateConfig(dpy, VAProfileMPEG2Main, VAEntrypointVLD, &attr, 1, &cfg); vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, w, h, &surface, 1, NULL, 0); vaCreateContext(dpy, cfg, w, h, VA_PROGRESSIVE, &surface, 1, &ctxt);
  • 11. MPEG2 DECODE FILL DATA vaCreateBuffer(dpy, ctxt, VAPictureParameterBufferType, sizeof(VAPictureParameterBufferMPEG2), 1, &pic_param, &pic_param_buf); vaCreateBuffer(dpy, ctxt, VAIQMatrixBufferType, sizeof(VAIQMatrixBufferMPEG2), 1, &iq_matrix, &iqmatrix_buf); vaCreateBuffer(dpy, ctxt, VASliceParameterBufferType, sizeof(VASliceParameterBufferMPEG2), 1, &slice_param, &slice_param_buf); vaCreateBuffer(dpy, ctxt, VASliceDataBufferType, slice_size, 1, slice_data, &slice_data_buf);
  • 12. MPEG2 DECODE DECODE AND DISPLAY vaBeginPicture(dpy, ctxt, surface); vaRenderPicture(dpy, ctxt, &pic_param_buf, 1); vaRenderPicture(dpy, ctxt, &iqmatrix_buf, 1); vaRenderPicture(dpy, ctxt, &slice_param_buf, 1); vaRenderPicture(dpy, ctxt, &slice_data_buf, 1); vaEndPicture(dpy, ctxt); vaSyncSurface(dpy, surface); vaPutSurface(dpy, surface, x11_window, sx, sy, sw, sh, dx, dy, dw, dh, NULL,
  • 13. WHAT IS GSTREAMER-VAAPI? A helper library (libgstvaapi) A set of GStreamer elements Supports from GStreamer-1.2 to 1.6
  • 14. LIBRARY Wraps almost all VA-API concepts
  • 15. ENCODER H264 INITIALIZATION dpy = gst_vaapi_display_x11_new(NULL); enc = gst_vaapi_encoder_h264_new(dpy); st = new_gst_video_codec_state(w, h, fps_n, fps_d); gst_vaapi_encoder_set_codec_data(enc, st);
  • 16. ENCODER H264 FILL DATA img = gst_vaapi_image_new(dpy, GST_VIDEO_FORMAT_I420, w, h); gst_vaapi_image_map(img); load_raw_image(img); gst_vaapi_image_unmap(img); gst_video_info_set_format(&vinfo, GST_VIDEO_FORMAT_ENCODED, w, h); pool = gst_vaapi_surface_pool_new_full(dpy, &vinfo, 0); proxy = gst_vaapi_surface_proxy_new_from_pool (pool); surface = gst_vaapi_surface_proxy_get_surface (proxy); gst_vaapi_surface_put_image(surface, img);
  • 17. ENCODER H264 ENCODE frame = g_slice_new0(GstVideoCodecFrame); gst_video_codec_frame_set_user_data(frame, gst_vaapi_surface_proxy_ref(proxy), gst_vaapi_surface_proxy_unref); gst_vaapi_encoder_put_frame(encoder, frame); gst_vaapi_encoder_get_buffer_with_timeout(enc, &encbuf, 5000); buf = gst_buffer_new_and_alloc(gst_vaapi_coded_buffer_get_size(encbuf)) gst_vaapi_coded_buffer_copy_into(buf, encbuf);
  • 18. LIBRARY Implements video codec parsers. OpenGL helpers (EGL and GLX). Windowing protocol helpers (DRM, Wayland, X11).
  • 20. GStreamer elements vaapidecode: VA-API decoder vaapisink: VA-API sink   vaapipostproc: VA-API video post-processing vaapidecodebin: VA-API decode bin
  • 21. GStreamer elements Encoders vaapiencode_h264: VA-API H.264 encoder vaapiencode_mpeg2: VA-API MPEG-2 encoder vaapiencode_jpeg: VA-API JPEG encoder vaapiencode_vp8: VA-API VP8 encoder vaapiencode_h265: VA-API H.265 encoder
  • 22. GStreamer elements Parsers vaapiparse_h264: H.264 parser vaapiparse_h265: H.265 parser
  • 24. THOU SHALL NOT PARSE TWICE — codecparsers: add GstMetas to pass parsing results downstream — Add mpeg2 slice header information to GstMpegVideoMeta 691712 704865
  • 25. THOU SHALL AUTO-PLUG HW VIDEO FILTERS (DE-INTERLACERS) — playbin: autoplugging s/w and h/w accelerated deinterlacers Remove vaapidecodebin 687182
  • 26. THOU SHALL REVERSE PLAY-BACK — videodecoder: reverse playback in non- packetized decoders Handle when the number of buffers in the GOP is bigger than the maximum buffers in the video buffer pool. 747574
  • 27. THOU SHALL SUPPORT DMABUF — vaapi: expose memory:dmabuf capsfeature755072
  • 28. THOU SHALL SUPPORT OPENGL / OPENGL3 / OPENGL-ES — [metabug] GL bugs755406
  • 29. THOU SHALL NOT CACHE THE DISPLAY — Remove display cache — Using multiple instances of vaapisink in one application cause problems 747946 754820
  • 31.   THANK YOU! Twitter: Mail: vjaquez at igalia dot com Blog: @ceyusa http://blogs.igalia.com/vjaquez