Skip to content

Commit f30191d

Browse files
committed
wip: benchmarking intel vaapi
1 parent 59da775 commit f30191d

File tree

3 files changed

+66
-18
lines changed

3 files changed

+66
-18
lines changed

skia/skia/setupUI.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "setupUI.h"
2+
#include <sys/time.h>
23
#include "imgui_internal.h"
34
#include "tracy/Tracy.hpp"
45

@@ -52,6 +53,22 @@ void ImZeroSkiaSetupUI::render(SaveFormatE &saveFormat, VectorCmdSkiaRenderer &v
5253
size_t skpBytes, size_t svgBytes, size_t pngBytes, int windowW, int windowH
5354
) { ZoneScoped;
5455
ImGui::Text("gitCommit=\"%s\",dirty=%s",buildinfo::gitCommit,buildinfo::gitDirty ? "yes" : "no");
56+
{
57+
struct timeval tv;
58+
struct timezone tz;
59+
60+
gettimeofday(&tv, &tz);
61+
62+
char buf[sizeof "9999-12-31T23:59:59.999+0000000"];
63+
size_t bufsize = sizeof buf;
64+
size_t off = 0;
65+
struct tm *local = localtime(&tv.tv_sec);
66+
off = strftime(buf, bufsize, "%FT%T", local); // same as "%Y-%m-%dT%H:%M:%S"
67+
off += snprintf(buf+off, bufsize-off, ".%06ld", tv.tv_usec);
68+
off += strftime(buf+off, bufsize-off, "%z", local);
69+
70+
ImGui::TextUnformatted(buf);
71+
}
5572

5673
if(ImGui::CollapsingHeader("Skia Backend")) {
5774
auto renderMode = vectorCmdSkiaRenderer.getRenderMode();

skia/video.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,33 @@ mkfifo transferRawFrames
5454
## -f nut -i "pipe:0"
5555

5656
# needs apt install intel-media-va-driver-non-free
57+
# see https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding
5758

58-
#./imgui_skia_exe -fffiInterpreter off -ttfFilePath ./SauceCodeProNerdFontPropo-Regular.ttf -backdropFilter off -videoRawFramesFile transferRawFrames -videoResolutionWidth 1024 -videoResolutionHeight 768 &
59-
./run_pipe.sh &
59+
resW=1920
60+
resH=1080
61+
62+
./imgui_skia_exe -fffiInterpreter off -ttfFilePath ./SauceCodeProNerdFontPropo-Regular.ttf -backdropFilter off -videoRawFramesFile transferRawFrames -videoResolutionWidth $resW -videoResolutionHeight $resH &
6063
pid=$!
64+
#-c:a aac -ar 48000 -b:a 96k \
65+
#-loglevel debug \
6166
ffmpeg -hide_banner \
62-
-loglevel debug \
6367
-re -fflags +genpts \
6468
-f image2pipe -i transferRawFrames \
6569
-flags +global_header -r 30000/1001 \
70+
-an \
6671
-vaapi_device /dev/dri/renderD128 \
67-
-vf 'format=nv12,hwupload,scale_vaapi=w=1920:h=1080' \
68-
-c:v h264_vaapi -qp:v 26 -bf 0 -tune zerolatency \
69-
-c:a aac -ar 48000 -b:a 96k \
70-
-f nut "pipe:1" | \
71-
mpv --no-cache --untimed --no-demuxer-thread --video-sync=audio \
72-
--vd-lavc-threads=1 -
72+
-vf "format=nv12,hwupload,scale_vaapi=w=$resW:h=$resH" \
73+
-c:v h264_vaapi -qp:v 26 -bf 0 -qp:v 26 -bf 0 -async_depth 4 \
74+
-f nut "pipe:1" | tee out.nut | \
75+
ffplay -hide_banner \
76+
-threads 1 -filter_threads 1 \
77+
-probesize 32 -sync ext \
78+
-fpsprobesize 0 -framedrop -fast -infbuf \
79+
-f nut -fflags '+nobuffer' -flags2 '+fast' -i "pipe:0" \
80+
-vf "drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=red:y=(main_h/2)+text_h"
81+
82+
#mpv --no-cache --untimed --no-demuxer-thread --video-sync=audio \
83+
# --vd-lavc-threads=1 -
7384
kill $pid
7485

7586
#ffplay -hide_banner \

skia/videotest.sh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,36 @@
2626

2727
# see https://gist.github.com/Brainiarc7/4636a162ef7dc2e8c9c4c1d4ae887c0e
2828

29-
ffmpeg -hide_banner \
30-
-threads 1 -filter_threads 1 \
31-
-f lavfi \
32-
-i "testsrc=size=hd1080:rate=60,drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=yellow:y=(main_h/2)-text_h,format=pix_fmts=yuv420p" \
33-
-threads 0 -frame_drop_threshold -1 -g 1 \
34-
-vaapi_device /dev/dri/renderD128 -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' \
35-
-c:v h264_vaapi -qp:v 19 -bf 4 -threads 4 -aspect 16:9 \
36-
-loglevel debug \
37-
-f nut "pipe:1" #| \
29+
#ffmpeg -hide_banner \
30+
# -threads 1 -filter_threads 1 \
31+
# -f lavfi \
32+
# -i "testsrc=size=hd1080:rate=60,drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=yellow:y=(main_h/2)-text_h,format=pix_fmts=yuv420p" \
33+
# -threads 0 -frame_drop_threshold -1 -g 1 \
34+
# -vaapi_device /dev/dri/renderD128 -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' \
35+
# -c:v h264_vaapi -qp:v 19 -bf 4 -threads 4 -aspect 16:9 \
36+
# -loglevel debug \
37+
# -f nut "pipe:1" | \
3838
#ffplay -hide_banner \
3939
# -threads 1 -filter_threads 1 \
4040
# -probesize 32 -sync ext \
4141
# -fpsprobesize 0 -framedrop -fast -infbuf -f nut -fflags '+nobuffer' -flags2 '+fast' -i "pipe:0" -vf "drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=red:y=(main_h/2)+text_h"
42+
#-c:v h264_vaapi -qp:v 19 -bf 4 -threads 4 -aspect 16:9 \
43+
#-vf "format=nv12,hwupload,scale_vaapi=w=1920:h=1080" \
44+
#-vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' \
45+
#-c:v h264_vaapi -qp:v 26 -bf 0 \
46+
ffmpeg -hide_banner \
47+
-threads 1 -filter_threads 1 \
48+
-f lavfi \
49+
-i "testsrc=size=hd1080:rate=60,drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=yellow:y=(main_h/2)-text_h,format=pix_fmts=yuv420p" \
50+
-threads 0 -frame_drop_threshold -1 -g 1 \
51+
-vaapi_device /dev/dri/renderD128 \
52+
-c:v h264_vaapi -qp:v 26 -bf 0 \
53+
-async_depth 4 \
54+
-vf "format=nv12,hwupload,scale_vaapi=w=1920:h=1080" \
55+
-f nut "pipe:1" | \
56+
ffplay -hide_banner \
57+
-threads 1 -filter_threads 1 \
58+
-probesize 32 -sync ext \
59+
-fpsprobesize 0 -framedrop -fast -infbuf \
60+
-f nut -fflags '+nobuffer' -flags2 '+fast' -i "pipe:0" \
61+
-vf "drawtext=text='%{localtime\:%S-%6N}':fontsize=144:box=1:boxcolor=black:fontcolor=red:y=(main_h/2)+text_h"

0 commit comments

Comments
 (0)