From 43e33fadf3f1465f8e8f63d1e669742e9297bc2a Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sat, 21 May 2022 23:20:42 +0800 Subject: [PATCH 1/2] A tiny fix for hwmap patch --- ...dd-a-hack-for-opencl-reverse-mapping.patch | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/debian/patches/0011-add-a-hack-for-opencl-reverse-mapping.patch b/debian/patches/0011-add-a-hack-for-opencl-reverse-mapping.patch index 4d5afe239..a93395041 100644 --- a/debian/patches/0011-add-a-hack-for-opencl-reverse-mapping.patch +++ b/debian/patches/0011-add-a-hack-for-opencl-reverse-mapping.patch @@ -14,38 +14,26 @@ Index: jellyfin-ffmpeg/libavfilter/opencl.c =================================================================== --- jellyfin-ffmpeg.orig/libavfilter/opencl.c +++ jellyfin-ffmpeg/libavfilter/opencl.c -@@ -45,6 +45,7 @@ static int opencl_filter_set_device(AVFi - int ff_opencl_filter_config_input(AVFilterLink *inlink) - { - AVFilterContext *avctx = inlink->dst; -+ AVFilterLink *outlink = avctx->outputs[0]; - OpenCLFilterContext *ctx = avctx->priv; - AVHWFramesContext *input_frames; - int err; -@@ -75,12 +76,15 @@ int ff_opencl_filter_config_input(AVFilt +@@ -75,6 +75,9 @@ int ff_opencl_filter_config_input(AVFilt if (!ctx->output_height) ctx->output_height = inlink->h; -+ outlink->fixed_pool_size = inlink->fixed_pool_size; ++ if (avctx->nb_outputs > 0) ++ avctx->outputs[0]->fixed_pool_size = inlink->fixed_pool_size; + return 0; } - int ff_opencl_filter_config_output(AVFilterLink *outlink) - { - AVFilterContext *avctx = outlink->src; -+ AVFilterLink *inlink = avctx->inputs[0]; - OpenCLFilterContext *ctx = avctx->priv; - AVBufferRef *output_frames_ref = NULL; - AVHWFramesContext *output_frames; -@@ -122,6 +126,7 @@ int ff_opencl_filter_config_output(AVFil - outlink->hw_frames_ctx = output_frames_ref; +@@ -123,6 +126,9 @@ int ff_opencl_filter_config_output(AVFil outlink->w = ctx->output_width; outlink->h = ctx->output_height; -+ outlink->fixed_pool_size = inlink->fixed_pool_size; ++ if (avctx->nb_inputs > 0) ++ outlink->fixed_pool_size = avctx->inputs[0]->fixed_pool_size; ++ return 0; fail: + av_buffer_unref(&output_frames_ref); Index: jellyfin-ffmpeg/libavfilter/vf_hwmap.c =================================================================== --- jellyfin-ffmpeg.orig/libavfilter/vf_hwmap.c From cfd5c018063ffa7162d042d8c6ff80fcd5162add Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sun, 22 May 2022 01:15:30 +0800 Subject: [PATCH 2/2] Fix the issue that SPS/PPS are lost on AMD VCN H264 encoder --- ...6-add-amf-refactor-and-hevc-10-bit-encoding.patch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/patches/0006-add-amf-refactor-and-hevc-10-bit-encoding.patch b/debian/patches/0006-add-amf-refactor-and-hevc-10-bit-encoding.patch index 1f5d7d257..6fb04aedc 100644 --- a/debian/patches/0006-add-amf-refactor-and-hevc-10-bit-encoding.patch +++ b/debian/patches/0006-add-amf-refactor-and-hevc-10-bit-encoding.patch @@ -1300,12 +1300,14 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c ctx->hwsurfaces_in_queue++; frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer); } -@@ -690,13 +563,9 @@ int ff_amf_receive_packet(AVCodecContext +@@ -690,13 +563,11 @@ int ff_amf_receive_packet(AVCodecContext switch (avctx->codec->id) { case AV_CODEC_ID_H264: - AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_AUD, !!ctx->aud); - break; ++ AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_SPS, 1); ++ AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_PPS, 1); + AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_INSERT_AUD, !!ctx->aud); break; case AV_CODEC_ID_HEVC: - AMF_ASSIGN_PROPERTY_INT64(res, surface, AMF_VIDEO_ENCODER_HEVC_INSERT_AUD, !!ctx->aud); @@ -1316,7 +1318,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c } // submit surface -@@ -707,16 +576,14 @@ int ff_amf_receive_packet(AVCodecContext +@@ -707,16 +578,14 @@ int ff_amf_receive_packet(AVCodecContext } else { int64_t pts = frame->pts; surface->pVtbl->Release(surface); @@ -1335,7 +1337,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c do { block_and_wait = 0; // poll data -@@ -733,14 +600,14 @@ int ff_amf_receive_packet(AVCodecContext +@@ -733,14 +602,14 @@ int ff_amf_receive_packet(AVCodecContext if (data->pVtbl->HasProperty(data, L"av_frame_ref")) { AMFBuffer *frame_ref_storage_buffer; res = amf_get_property_buffer(data, L"av_frame_ref", &frame_ref_storage_buffer); @@ -1352,7 +1354,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c if (ctx->delayed_surface != NULL) { // try to resubmit frame res = ctx->encoder->pVtbl->SubmitInput(ctx->encoder, (AMFData*)ctx->delayed_surface); -@@ -749,11 +616,10 @@ int ff_amf_receive_packet(AVCodecContext +@@ -749,11 +618,10 @@ int ff_amf_receive_packet(AVCodecContext ctx->delayed_surface->pVtbl->Release(ctx->delayed_surface); ctx->delayed_surface = NULL; av_frame_unref(ctx->delayed_frame); @@ -1366,7 +1368,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c } else { av_log(avctx, AV_LOG_WARNING, "Data acquired but delayed frame submission got AMF_INPUT_FULL- should not happen\n"); } -@@ -762,24 +628,26 @@ int ff_amf_receive_packet(AVCodecContext +@@ -762,24 +630,26 @@ int ff_amf_receive_packet(AVCodecContext if (res != AMF_INPUT_FULL) { ctx->delayed_drain = 0; ctx->eof = 1; // drain started