Skip to content

Commit

Permalink
Merge pull request #274 from nyanmisaka/next
Browse files Browse the repository at this point in the history
[6.0] Sync intel D3D11VA textures before mapping to OpenCL
  • Loading branch information
nyanmisaka authored Aug 29, 2023
2 parents e8c0aed + cbce6a2 commit a2ed32c
Show file tree
Hide file tree
Showing 35 changed files with 385 additions and 56 deletions.
2 changes: 1 addition & 1 deletion build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# We just wrap `build` so this is really it
name: "jellyfin-ffmpeg"
version: "6.0-5"
version: "6.0-6"
packages:
- buster-amd64
- buster-armhf
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/20-libxml2.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/GNOME/libxml2.git"
SCRIPT_COMMIT="58de9d31da4d0e8cb6bcf7f5e99714f9df2c4411"
SCRIPT_COMMIT="d39f78069dff496ec865c73aa44d7110e429bce9"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/20-zlib.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/madler/zlib.git"
SCRIPT_COMMIT="04f42ceca40f73e2978b50e93806c2a18c1281fc"
SCRIPT_COMMIT="79a0e447a0dfa32979420cb21cfb96d684b2c9d5"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/25-fftw3f.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/FFTW/fftw3.git"
SCRIPT_COMMIT="69f6c1a6ebd7ac5af33e7074134fb79fbc729c3d"
SCRIPT_COMMIT="38ea230e25e69e7a3f35b957b815bac4f9aa22b0"

ffbuild_enabled() {
# Dependency of GPL-Only librubberband
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/25-freetype.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/freetype/freetype.git"
SCRIPT_COMMIT="95a872085e5a79cf710acf6389dbd55b6e728aac"
SCRIPT_COMMIT="d42679b93d5e77fe769591cd1d04522225940556"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/35-fontconfig.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/fontconfig/fontconfig.git"
SCRIPT_COMMIT="2fb3419a92156569bc1ec707401258c922cd0d99"
SCRIPT_COMMIT="e0eb855462791cbe217adc368d156733b2b2c13a"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-harfbuzz.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/harfbuzz/harfbuzz.git"
SCRIPT_COMMIT="1d665c2b521512cdd56964138fc601debd1f1177"
SCRIPT_COMMIT="f380a32825a1b2c51bbe21dc7acb9b3cc0921f69"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-x11/10-xcbproto.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/xorg/proto/xcbproto.git"
SCRIPT_COMMIT="b016df100111b56d7c1a2c63ea6791b2287a83e4"
SCRIPT_COMMIT="98eeebfc2d7db5377b85437418fb942ea30ffc0d"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-x11/20-libxau.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/xorg/lib/libxau.git"
SCRIPT_COMMIT="68e74d37b99f56bbd1a5f2fb8cb4ad6116f27bd3"
SCRIPT_COMMIT="aec9d7266777e0b9243ef0f112fe0e07256bd446"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-x11/30-libxcb.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/xorg/lib/libxcb.git"
SCRIPT_COMMIT="038636786ad1914f3daf3503ae9611f40dffbb8f"
SCRIPT_COMMIT="453115f7eeb694de9f41ea842a29bbb31b90c8dd"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-x11/40-libx11.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/xorg/lib/libx11.git"
SCRIPT_COMMIT="b2c3fb7b4dd4c4c7b9d28c7af7776cccc8e0a98b"
SCRIPT_COMMIT="44f908d9283710ffc75b22d2ae7a8948119b3e61"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/45-x11/50-libxi.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/xorg/lib/libxi.git"
SCRIPT_COMMIT="3a7503ec7703f10de17c622ea22b7bff736cea74"
SCRIPT_COMMIT="09f3eb570fe79bfc0c430b6059d7b4acaf371c24"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-amf.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git"
SCRIPT_COMMIT="68f2396f1a55a5b12767f5433411bb4093ea65ed"
SCRIPT_COMMIT="2f326350e849894a929296854f5290e66197c97c"

ffbuild_enabled() {
[[ $TARGET == *arm64 ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-dav1d.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://code.videolan.org/videolan/dav1d.git"
SCRIPT_COMMIT="e58afe4dd9057591882a01c31382c203e8a61c92"
SCRIPT_COMMIT="97becd73726c3d4c4bb8793d2215f846da8795af"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-libass.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/libass/libass.git"
SCRIPT_COMMIT="91422bdb9497e8484b3248f5ae7eb50d41e2555d"
SCRIPT_COMMIT="5c15c883a4783641f7e71a6a1f440209965eb64f"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-libvpx.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://chromium.googlesource.com/webm/libvpx"
SCRIPT_COMMIT="5556ebd894a9a9b07908c3c7fd0a7a87732a7635"
SCRIPT_COMMIT="e052ada7801c458f9fc0c2818f1be814f86e94a4"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-libwebp.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://chromium.googlesource.com/webm/libwebp"
SCRIPT_COMMIT="dd7364c3cefe0f5c0b3c18c3b1887d353f90fc1f"
SCRIPT_COMMIT="943b932a7ec6ac71737e1ea0af907c5439ca6ef0"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-openmpt.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://source.openmpt.org/svn/openmpt/trunk/OpenMPT"
SCRIPT_REV="19561"
SCRIPT_REV="19588"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-srt.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/Haivision/srt.git"
SCRIPT_COMMIT="88ca9ccca4984dbf61a5e1a06ac551b4dead5304"
SCRIPT_COMMIT="51e3d0d50ba281ce985a1712785b5cb34f447b92"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-svtav1.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.com/AOMediaCodec/SVT-AV1.git"
SCRIPT_COMMIT="903ff3add82744d586295c37ec1241dc51dab16e"
SCRIPT_COMMIT="6d5f2b4e1f04db677cdd4ab2b0d6831ab06a849c"

ffbuild_enabled() {
[[ $TARGET == win32 ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-vaapi/40-libdrm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://gitlab.freedesktop.org/mesa/drm.git"
SCRIPT_COMMIT="c6013245ce9ce287bb86d327f9b6420a320a08e6"
SCRIPT_COMMIT="7bdb135f0c8e6ae2c0ed6d4bd6a8423eb1df5c26"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-vaapi/50-libva.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/intel/libva.git"
SCRIPT_COMMIT="7d6c7d482b9d2330b1f3a8bac13a6a3205f33382"
SCRIPT_COMMIT="b4870fdfe2d41b579036dae280dfc7a5e732127f"

ffbuild_enabled() {
[[ $TARGET != linux* ]] && return -1
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-vulkan/45-vulkan.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/KhronosGroup/Vulkan-Headers.git"
SCRIPT_COMMIT="v1.3.260"
SCRIPT_COMMIT="v1.3.261"
SCRIPT_TAGFILTER="v?.*.*"

ffbuild_enabled() {
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-vulkan/50-shaderc.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/google/shaderc.git"
SCRIPT_COMMIT="4d98dac61ee4857ea0691a2b9a48aee44eb409db"
SCRIPT_COMMIT="5b892551dd02bbf8704adbc3fcde2fd645f333b2"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-vulkan/55-spirv-cross.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://github.com/KhronosGroup/SPIRV-Cross.git"
SCRIPT_COMMIT="bccaa94db814af33d8ef05c153e7c34d8bd4d685"
SCRIPT_COMMIT="acf51c1b9f9f872b741ab369cb047898c9cc300b"

ffbuild_enabled() {
return 0
Expand Down
2 changes: 1 addition & 1 deletion builder/scripts.d/50-x265.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT_REPO="https://bitbucket.org/multicoreware/x265_git.git"
SCRIPT_COMMIT="8f18e3ad32684eee95e885e718655f93951128c3"
SCRIPT_COMMIT="59ff5e7b4840b3aac91fbc514a4c86a8722ce5e1"

ffbuild_enabled() {
[[ $VARIANT == lgpl* ]] && return -1
Expand Down
9 changes: 9 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
jellyfin-ffmpeg (6.0-6) unstable; urgency=medium

* Sync intel D3D11VA textures before mapping to OpenCL
* Tune the default param of QSV AV1e
* Backport upstream QSV fixes
* Update dependencies

-- nyanmisaka <nst799610810@gmail.com> Sat, 26 Aug 2023 01:19:34 +0800

jellyfin-ffmpeg (6.0-5) unstable; urgency=medium

* Add VUI info to the seq header of HEVC VA-API encoder
Expand Down
26 changes: 19 additions & 7 deletions debian/patches/0021-add-code-polishing-to-qsv-filters.patch
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,19 @@ Index: jellyfin-ffmpeg/libavfilter/vf_vpp_qsv.c
static int config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
@@ -504,12 +528,21 @@ static int config_output(AVFilterLink *o
@@ -358,7 +382,10 @@ static int config_output(AVFilterLink *o
outlink->w = vpp->out_width;
outlink->h = vpp->out_height;
outlink->frame_rate = vpp->framerate;
- outlink->time_base = av_inv_q(vpp->framerate);
+ if (vpp->framerate.num == 0 || vpp->framerate.den == 0)
+ outlink->time_base = inlink->time_base;
+ else
+ outlink->time_base = av_inv_q(vpp->framerate);

param.filter_frame = NULL;
param.num_ext_buf = 0;
@@ -504,12 +531,21 @@ static int config_output(AVFilterLink *o

if (inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) {
if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) {
Expand All @@ -203,7 +215,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_vpp_qsv.c

INIT_MFX_EXTBUF(scale_conf, MFX_EXTBUFF_VPP_SCALING);
SET_MFX_PARAM_FIELD(scale_conf, ScalingMode, mode);
@@ -582,6 +615,11 @@ static int activate(AVFilterContext *ctx
@@ -582,6 +618,11 @@ static int activate(AVFilterContext *ctx
if (in->pts != AV_NOPTS_VALUE)
in->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);

Expand All @@ -215,15 +227,15 @@ Index: jellyfin-ffmpeg/libavfilter/vf_vpp_qsv.c
ret = ff_filter_frame(outlink, in);
if (ret < 0)
return ret;
@@ -602,6 +640,7 @@ not_ready:
@@ -602,6 +643,7 @@ not_ready:
return FFERROR_NOT_READY;

eof:
+ pts = av_rescale_q(pts, inlink->time_base, outlink->time_base);
ff_outlink_set_status(outlink, status, pts);
return 0;
}
@@ -685,20 +724,14 @@ static const AVOption vpp_options[] = {
@@ -685,20 +727,14 @@ static const AVOption vpp_options[] = {
{ "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
{ "height", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
Expand All @@ -246,15 +258,15 @@ Index: jellyfin-ffmpeg/libavfilter/vf_vpp_qsv.c

{ "rate", "Generate output at frame rate or field rate, available only for deinterlace mode",
OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" },
@@ -707,6 +740,7 @@ static const AVOption vpp_options[] = {
@@ -707,6 +743,7 @@ static const AVOption vpp_options[] = {
{ "field", "Output at field rate (one frame of output for each field)",
0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },

+ { "passthrough", "Apply pass through mode if possible.", OFFSET(has_passthrough), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, .flags = FLAGS },
{ NULL }
};

@@ -751,19 +785,14 @@ static const AVOption qsvscale_options[]
@@ -751,19 +788,14 @@ static const AVOption qsvscale_options[]
{ "h", "Output video height(0=input video height, -1=keep input video aspect)", OFFSET(oh), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },

Expand All @@ -276,7 +288,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_vpp_qsv.c
{ NULL },
};

@@ -788,6 +817,7 @@ static const AVOption qsvdeint_options[]
@@ -788,6 +820,7 @@ static const AVOption qsvdeint_options[]
{ "bob", "bob algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_BOB}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},
{ "advanced", "Motion adaptive algorithm", 0, AV_OPT_TYPE_CONST, {.i64 = MFX_DEINTERLACING_ADVANCED}, MFX_DEINTERLACING_BOB, MFX_DEINTERLACING_ADVANCED, FLAGS, "mode"},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,3 @@ Index: jellyfin-ffmpeg/libavutil/hwcontext_d3d11va.h
} AVD3D11VADeviceContext;

/**
Index: jellyfin-ffmpeg/libavutil/hwcontext_opencl.c
===================================================================
--- jellyfin-ffmpeg.orig/libavutil/hwcontext_opencl.c
+++ jellyfin-ffmpeg/libavutil/hwcontext_opencl.c
@@ -1371,7 +1371,7 @@ static int opencl_device_derive(AVHWDevi
CL_CONTEXT_D3D11_DEVICE_KHR,
(intptr_t)src_hwctx->device,
CL_CONTEXT_INTEROP_USER_SYNC,
- CL_TRUE,
+ (src_hwctx->device_desc.VendorId != 0x8086 || src_hwctx->is_uma),
0,
};
OpenCLDeviceSelector selector = {
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ Index: jellyfin-ffmpeg/libavcodec/qsvenc_av1.c
===================================================================
--- jellyfin-ffmpeg.orig/libavcodec/qsvenc_av1.c
+++ jellyfin-ffmpeg/libavcodec/qsvenc_av1.c
@@ -130,7 +130,7 @@ static const AVClass class = {
@@ -130,8 +130,8 @@ static const AVClass class = {

static const FFCodecDefault qsv_enc_defaults[] = {
{ "b", "1M" },
- { "g", "-1" },
- { "bf", "-1" },
+ { "g", "250" },
{ "bf", "-1" },
+ { "bf", "3" },
{ "refs", "0" },
{ NULL },
};
Index: jellyfin-ffmpeg/libavcodec/qsvenc_h264.c
===================================================================
--- jellyfin-ffmpeg.orig/libavcodec/qsvenc_h264.c
Expand Down
9 changes: 9 additions & 0 deletions debian/patches/0052-backport-upstream-qsvenc-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ Index: jellyfin-ffmpeg/libavcodec/qsvenc.c
if (ret < 0)
return ret;
}
@@ -2579,7 +2638,7 @@ int ff_qsv_encode(AVCodecContext *avctx,
pict_type = AV_PICTURE_TYPE_P;
else if (qpkt.bs->FrameType & MFX_FRAMETYPE_B || qpkt.bs->FrameType & MFX_FRAMETYPE_xB)
pict_type = AV_PICTURE_TYPE_B;
- else if (qpkt.bs->FrameType == MFX_FRAMETYPE_UNKNOWN) {
+ else if (qpkt.bs->FrameType == MFX_FRAMETYPE_UNKNOWN && qpkt.bs->DataLength) {
pict_type = AV_PICTURE_TYPE_NONE;
av_log(avctx, AV_LOG_WARNING, "Unknown FrameType, set pict_type to AV_PICTURE_TYPE_NONE.\n");
} else {
Index: jellyfin-ffmpeg/libavutil/hwcontext_qsv.c
===================================================================
--- jellyfin-ffmpeg.orig/libavutil/hwcontext_qsv.c
Expand Down
Loading

0 comments on commit a2ed32c

Please sign in to comment.