Skip to content

Commit

Permalink
Merge pull request #187 from nyanmisaka/ff5.1.2
Browse files Browse the repository at this point in the history
New upstream version 5.1.2 and enable SVT-AV1 encoder
  • Loading branch information
nyanmisaka authored Oct 5, 2022
2 parents cc9b763 + dca1dc2 commit e25e53d
Show file tree
Hide file tree
Showing 53 changed files with 484 additions and 256 deletions.
46 changes: 46 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.

version 5.1.2:
- avcodec/dstdec: Check for overflow in build_filter()
- avformat/spdifdec: Use 64bit to compute bit rate
- avformat/rpl: Use 64bit for duration computation
- avformat/xwma: Use av_rescale() for duration computation
- avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
- avformat/sbgdec: Check ts_int in genrate_intervals
- avformat/sbgdec: clamp end_ts
- avformat/rmdec: check tag_size
- avformat/nutdec: Check fields
- avformat/flvdec: Use 64bit for sum_flv_tag_size
- avformat/jacosubdec: Fix overflow in get_shift()
- avformat/genh: Check nb_channels for IMA ADPCM
- avformat/dxa: avoid bpc overflows
- avformat/dhav: Use 64bit seek_back
- avformat/cafdec: Check that nb_frasmes fits within 64bit
- avformat/asfdec_o: Limit packet offset
- avformat/apm: Use 64bit for bit_rate computation
- avformat/ape: Check frames size
- avformat/icodec: Check nb_pal
- avformat/aiffdec: Use 64bit for block_duration use
- avformat/aiffdec: Check block_duration
- avformat/mxfdec: only probe max run in
- avformat/mxfdec: Check run_in is within 65536
- avcodec/mjpegdec: Check for unsupported bayer case
- avcodec/apedec: Fix integer overflow in filter_3800()
- avcodec/tta: Check 24bit scaling for overflow
- avcodec/mobiclip: Check quantizer for overflow
- avcodec/exr: Check preview psize
- avcodec/tiff: Fix loop detection
- libavformat/hls: Free keys
- avcodec/fmvc: Move frame allocation to a later stage
- avfilter/vf_showinfo: remove backspaces
- avcodec/speedhq: Check width
- avcodec/bink: disallow odd positioned scaled blocks
- avformat/cafenc: derive Opus frame size from the relevant stream parameters
- avformat/dashdec: Fix crash on invalid input/ENOMEM, fix leak
- lavc/videotoolbox: do not pass AVCodecContext to decoder output callback
- lavc/pthread_frame: always transfer stashed hwaccel state
- avcodec/arm/sbcenc: avoid callee preserved vfp registers
- avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout
- avfilter/vf_scale: overwrite the width and height expressions with the original values
- lavc/pthread_frame: avoid leaving stale hwaccel state in worker threads
- avutil/tests/.gitignore: Add channel_layout testtool


version 5.1.1:
- avformat/asfdec_o: limit recursion depth in asf_read_unknown()
- avformat/mov: Check count sums in build_open_gop_key_points()
Expand Down
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.1
5.1.2
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.1
5.1.2
4 changes: 2 additions & 2 deletions build-win64
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ for dep in docker make; do
done

# Use the latest distro for toolchains
distro="ubuntu:jammy"
ffrevison="2"
distro="ubuntu:kinetic"
ffrevison="1"
image_name="jellyfin-ffmpeg-build-windows-win64"
package_temporary_dir="$( mktemp -d )"
current_user="$( whoami )"
Expand Down
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: "5.1.1-2"
version: "5.1.2-1"
packages:
- buster-amd64
- buster-armhf
Expand Down
10 changes: 10 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
jellyfin-ffmpeg (5.1.2-1) unstable; urgency=medium

* New upstream version 5.1.2
* Enable SVT-AV1 encoder for amd64
* Remove unneeded assertion from AMF encoder
* Disable reshape if DOVI require an EL
* Update dependencies

-- nyanmisaka <[email protected]> Fri, 30 Sep 2022 22:35:03 +0800

jellyfin-ffmpeg (5.1.1-2) unstable; urgency=medium

* Add fixes for VAAPI render node enumeration
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Jellyfin Packaging Team <[email protected]>
Uploaders: Jellyfin Packaging Team <[email protected]>
Rules-Requires-Root: no
Homepage: https://ffmpeg.org/
Standards-Version: 5.1.1
Standards-Version: 4.2.1
Vcs-Git: https://github.com/jellyfin/jellyfin-ffmpeg.git
Vcs-Browser: https://github.com/jellyfin/jellyfin-ffmpeg
Build-Depends:
Expand Down
24 changes: 14 additions & 10 deletions debian/patches/0005-add-cuda-tonemap-impl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_cuda.c
===================================================================
--- /dev/null
+++ jellyfin-ffmpeg/libavfilter/vf_tonemap_cuda.c
@@ -0,0 +1,1032 @@
@@ -0,0 +1,1036 @@
+/*
+ * This file is part of FFmpeg.
+ *
Expand Down Expand Up @@ -2385,15 +2385,19 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_cuda.c
+
+ if (dovi_sd) {
+ const AVDOVIMetadata *metadata = (AVDOVIMetadata *) dovi_sd->data;
+ struct DoviMetadata *dovi = av_malloc(sizeof(*dovi));
+ s->dovi = dovi;
+ if (!s->dovi)
+ goto fail;
+
+ ff_map_dovi_metadata(s->dovi, metadata);
+ in->color_trc = AVCOL_TRC_SMPTE2084;
+ in->colorspace = AVCOL_SPC_UNSPECIFIED;
+ in->color_primaries = AVCOL_PRI_BT2020;
+ const AVDOVIRpuDataHeader *rpu = av_dovi_get_header(metadata);
+ // only map dovi rpus that don't require an EL
+ if (rpu->disable_residual_flag) {
+ struct DoviMetadata *dovi = av_malloc(sizeof(*dovi));
+ s->dovi = dovi;
+ if (!s->dovi)
+ goto fail;
+
+ ff_map_dovi_metadata(s->dovi, metadata);
+ in->color_trc = AVCOL_TRC_SMPTE2084;
+ in->colorspace = AVCOL_SPC_UNSPECIFIED;
+ in->color_primaries = AVCOL_PRI_BT2020;
+ }
+ }
+
+ if (!s->cu_func ||
Expand Down
36 changes: 21 additions & 15 deletions debian/patches/0006-add-amf-refactor-and-hevc-10-bit-encoding.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c

if (ctx->delayed_surface) {
ctx->delayed_surface->pVtbl->Release(ctx->delayed_surface);
@@ -384,34 +272,33 @@ int av_cold ff_amf_encode_close(AVCodecC
@@ -384,34 +272,34 @@ int av_cold ff_amf_encode_close(AVCodecC
ctx->encoder = NULL;
}

Expand All @@ -1045,7 +1045,8 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
- ctx->context = NULL;
- }
+ amf_unload_library(amfctx);
+ av_freep(&amfctx);
+ if (amfctx)
+ av_freep(&amfctx);
+
+ ctx->delayed_drain = 0;
av_buffer_unref(&ctx->hw_device_ctx);
Expand Down Expand Up @@ -1089,7 +1090,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
{
AMFPlane *plane;
uint8_t *dst_data[4];
@@ -427,38 +314,37 @@ static int amf_copy_surface(AVCodecConte
@@ -427,38 +315,37 @@ static int amf_copy_surface(AVCodecConte
dst_data[i] = plane->pVtbl->GetNative(plane);
dst_linesize[i] = plane->pVtbl->GetHPitch(plane);
}
Expand Down Expand Up @@ -1137,7 +1138,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
break;
default:
break;
@@ -468,44 +354,27 @@ static int amf_copy_buffer(AVCodecContex
@@ -468,44 +355,27 @@ static int amf_copy_buffer(AVCodecContex

pkt->pts = var.int64Value; // original pts

Expand Down Expand Up @@ -1189,7 +1190,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
{
AMF_RESULT res;
AMFVariantStruct var;
@@ -519,15 +388,16 @@ static AMF_RESULT amf_set_property_buffe
@@ -519,15 +389,16 @@ static AMF_RESULT amf_set_property_buffe
res = AMFVariantAssignInterface(&var, amf_interface);
amf_interface->pVtbl->Release(amf_interface);
}
Expand All @@ -1209,7 +1210,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
{
AMF_RESULT res;
AMFVariantStruct var;
@@ -575,9 +445,60 @@ static void amf_release_buffer_with_fram
@@ -575,9 +446,60 @@ static void amf_release_buffer_with_fram
frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
}

Expand Down Expand Up @@ -1271,7 +1272,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
AMFSurface *surface;
AMF_RESULT res;
int ret;
@@ -604,10 +525,9 @@ int ff_amf_receive_packet(AVCodecContext
@@ -604,10 +526,9 @@ int ff_amf_receive_packet(AVCodecContext
if (res == AMF_INPUT_FULL) {
ctx->delayed_drain = 1; // input queue is full: resubmit Drain() in ff_amf_receive_packet
} else {
Expand All @@ -1284,8 +1285,13 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
}
}
}
@@ -628,8 +548,8 @@ int ff_amf_receive_packet(AVCodecContext
@@ -623,13 +544,10 @@ int ff_amf_receive_packet(AVCodecContext
ID3D11Texture2D *texture = (ID3D11Texture2D*)frame->data[0]; // actual texture
int index = (intptr_t)frame->data[1]; // index is a slice in texture array is - set to tell AMF which slice to use

- av_assert0(frame->hw_frames_ctx && ctx->hw_frames_ctx &&
- frame->hw_frames_ctx->data == ctx->hw_frames_ctx->data);
-
texture->lpVtbl->SetPrivateData(texture, &AMFTextureArrayIndexGUID, sizeof(index), &index);

- res = ctx->context->pVtbl->CreateSurfaceFromDX11Native(ctx->context, texture, &surface, NULL); // wrap to AMF surface
Expand All @@ -1295,7 +1301,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c

hw_surface = 1;
}
@@ -640,8 +560,8 @@ int ff_amf_receive_packet(AVCodecContext
@@ -640,8 +558,8 @@ int ff_amf_receive_packet(AVCodecContext
{
IDirect3DSurface9 *texture = (IDirect3DSurface9 *)frame->data[3]; // actual texture

Expand All @@ -1306,7 +1312,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c

hw_surface = 1;
}
@@ -649,8 +569,8 @@ int ff_amf_receive_packet(AVCodecContext
@@ -649,8 +567,8 @@ int ff_amf_receive_packet(AVCodecContext
#endif
default:
{
Expand All @@ -1317,7 +1323,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
amf_copy_surface(avctx, frame, surface);
}
break;
@@ -662,27 +582,46 @@ int ff_amf_receive_packet(AVCodecContext
@@ -662,27 +580,46 @@ int ff_amf_receive_packet(AVCodecContext
// input HW surfaces can be vertically aligned by 16; tell AMF the real size
surface->pVtbl->SetCrop(surface, 0, 0, frame->width, frame->height);

Expand Down Expand Up @@ -1373,7 +1379,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c
}

// submit surface
@@ -693,7 +632,7 @@ int ff_amf_receive_packet(AVCodecContext
@@ -693,7 +630,7 @@ int ff_amf_receive_packet(AVCodecContext
} else {
int64_t pts = frame->pts;
surface->pVtbl->Release(surface);
Expand All @@ -1382,15 +1388,15 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c

av_frame_unref(frame);
ret = av_fifo_write(ctx->timestamp_list, &pts, 1);
@@ -702,7 +641,6 @@ int ff_amf_receive_packet(AVCodecContext
@@ -702,7 +639,6 @@ int ff_amf_receive_packet(AVCodecContext
}
}

-
do {
block_and_wait = 0;
// poll data
@@ -719,23 +657,35 @@ int ff_amf_receive_packet(AVCodecContext
@@ -719,23 +655,35 @@ 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);
Expand Down Expand Up @@ -1429,7 +1435,7 @@ Index: jellyfin-ffmpeg/libavcodec/amfenc.c

ret = av_fifo_write(ctx->timestamp_list, &pts, 1);
if (ret < 0)
@@ -748,24 +698,26 @@ int ff_amf_receive_packet(AVCodecContext
@@ -748,24 +696,26 @@ int ff_amf_receive_packet(AVCodecContext
if (res != AMF_INPUT_FULL) {
ctx->delayed_drain = 0;
ctx->eof = 1; // drain started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c
if (ctx->trc != -1)
output->color_trc = ctx->trc;
if (ctx->primaries != -1)
@@ -385,72 +783,80 @@ static int tonemap_opencl_filter_frame(A
@@ -385,72 +783,84 @@ static int tonemap_opencl_filter_frame(A
ctx->range_out = output->color_range;
ctx->chroma_loc = output->chroma_location;

Expand Down Expand Up @@ -1650,15 +1650,19 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c

+ if (dovi_sd) {
+ const AVDOVIMetadata *metadata = (AVDOVIMetadata *) dovi_sd->data;
+ struct DoviMetadata *dovi = av_malloc(sizeof(*dovi));
+ ctx->dovi = dovi;
+ if (!ctx->dovi)
+ goto fail;
+ const AVDOVIRpuDataHeader *rpu = av_dovi_get_header(metadata);
+ // only map dovi rpus that don't require an EL
+ if (rpu->disable_residual_flag) {
+ struct DoviMetadata *dovi = av_malloc(sizeof(*dovi));
+ ctx->dovi = dovi;
+ if (!ctx->dovi)
+ goto fail;
+
+ ff_map_dovi_metadata(ctx->dovi, metadata);
+ ctx->trc_in = AVCOL_TRC_SMPTE2084;
+ ctx->colorspace_in = AVCOL_SPC_UNSPECIFIED;
+ ctx->primaries_in = AVCOL_PRI_BT2020;
+ ff_map_dovi_metadata(ctx->dovi, metadata);
+ ctx->trc_in = AVCOL_TRC_SMPTE2084;
+ ctx->colorspace_in = AVCOL_SPC_UNSPECIFIED;
+ ctx->primaries_in = AVCOL_PRI_BT2020;
+ }
+ }
+
+ if (!ctx->initialised) {
Expand Down Expand Up @@ -1732,7 +1736,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c
av_frame_free(&input);
av_frame_free(&output);
return err;
@@ -461,8 +867,22 @@ static av_cold void tonemap_opencl_unini
@@ -461,8 +871,22 @@ static av_cold void tonemap_opencl_unini
TonemapOpenCLContext *ctx = avctx->priv;
cl_int cle;

Expand All @@ -1757,7 +1761,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c
if (ctx->kernel) {
cle = clReleaseKernel(ctx->kernel);
if (cle != CL_SUCCESS)
@@ -470,6 +890,13 @@ static av_cold void tonemap_opencl_unini
@@ -470,6 +894,13 @@ static av_cold void tonemap_opencl_unini
"kernel: %d.\n", cle);
}

Expand All @@ -1771,7 +1775,7 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c
if (ctx->command_queue) {
cle = clReleaseCommandQueue(ctx->command_queue);
if (cle != CL_SUCCESS)
@@ -483,37 +910,44 @@ static av_cold void tonemap_opencl_unini
@@ -483,37 +914,44 @@ static av_cold void tonemap_opencl_unini
#define OFFSET(x) offsetof(TonemapOpenCLContext, x)
#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption tonemap_opencl_options[] = {
Expand Down
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ CONFIG_ARM64 := ${CONFIG_ARM_COMMON} \
--cross-prefix=/usr/bin/aarch64-linux-gnu- \

CONFIG_x86 := --arch=amd64 \
--enable-libsvtav1 \
--enable-libshaderc \
--enable-libplacebo \
--enable-vulkan \
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 5.1.1
PROJECT_NUMBER = 5.1.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Loading

0 comments on commit e25e53d

Please sign in to comment.