Credit Andrew with x265 needed patch + update x265 library to 4.0
authorGood Guy <good1.2guy@gmail.com>
Wed, 9 Oct 2024 16:15:00 +0000 (10:15 -0600)
committerGood Guy <good1.2guy@gmail.com>
Wed, 9 Oct 2024 16:15:00 +0000 (10:15 -0600)
cinelerra-5.1/configure.ac
cinelerra-5.1/thirdparty/src/ffmpeg-7.0.patch6 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/x265_4.0.patch1 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/x265_4.0.patch2 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/x265_4.0.patch3 [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/x265_4.0.tar.gz [new file with mode: 0644]

index 5d7007a30efe39796a4fbba0912dcb571061f673..a12be997ec53838a900a11bea624da9a708a0d61 100644 (file)
@@ -423,7 +423,7 @@ PKG_3RD([x264],[auto],
   [ . ])
 
 PKG_3RD([x265],[auto],
-  [x265_3.517122023],
+  [x265_4.0],
   [ libx265.a ],
   [ . source ])
 
diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-7.0.patch6 b/cinelerra-5.1/thirdparty/src/ffmpeg-7.0.patch6
new file mode 100644 (file)
index 0000000..e3dcff7
--- /dev/null
@@ -0,0 +1,77 @@
+--- a/libavcodec/libx265.c
++++ b/libavcodec/libx265.c
+@@ -646,7 +646,13 @@
+ {
+     libx265Context *ctx = avctx->priv_data;
+     x265_picture x265pic;
+-    x265_picture x265pic_out = { 0 };
++#if X265_BUILD >= 210
++    x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS];
++    x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS];
++#else
++    x265_picture x265pic_solo_out = { 0 };
++#endif
++    x265_picture* x265pic_out;
+     x265_nal *nal;
+     x265_sei *sei;
+     uint8_t *dst;
+@@ -764,8 +770,16 @@
+         }
+     }
++#if X265_BUILD >= 210
++    for (i = 0; i < MAX_SCALABLE_LAYERS; i++)
++        x265pic_lyrptr_out[i] = &x265pic_layers_out[i];
++
++    ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
++                                   pic ? &x265pic : NULL, x265pic_lyrptr_out);
++#else
+     ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
+-                                   pic ? &x265pic : NULL, &x265pic_out);
++                                   pic ? &x265pic : NULL, &x265pic_solo_out);
++#endif
+     for (i = 0; i < sei->numPayloads; i++)
+         av_free(sei->payloads[i].payload);
+@@ -795,10 +809,16 @@
+             pkt->flags |= AV_PKT_FLAG_KEY;
+     }
+-    pkt->pts = x265pic_out.pts;
+-    pkt->dts = x265pic_out.dts;
++#if X265_BUILD >= 210
++    x265pic_out = x265pic_lyrptr_out[0];
++#else
++    x265pic_out = &x265pic_solo_out;
++#endif
++
++    pkt->pts = x265pic_out->pts;
++    pkt->dts = x265pic_out->dts;
+-    switch (x265pic_out.sliceType) {
++    switch (x265pic_out->sliceType) {
+     case X265_TYPE_IDR:
+     case X265_TYPE_I:
+         pict_type = AV_PICTURE_TYPE_I;
+@@ -816,16 +836,16 @@
+     }
+ #if X265_BUILD >= 130
+-    if (x265pic_out.sliceType == X265_TYPE_B)
++    if (x265pic_out->sliceType == X265_TYPE_B)
+ #else
+-    if (x265pic_out.frameData.sliceType == 'b')
++    if (x265pic_out->frameData.sliceType == 'b')
+ #endif
+         pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
+-    ff_side_data_set_encoder_stats(pkt, x265pic_out.frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
++    ff_side_data_set_encoder_stats(pkt, x265pic_out->frameData.qp * FF_QP2LAMBDA, NULL, 0, pict_type);
+-    if (x265pic_out.userData) {
+-        int idx = (int)(intptr_t)x265pic_out.userData - 1;
++    if (x265pic_out->userData) {
++        int idx = (int)(intptr_t)x265pic_out->userData - 1;
+         ReorderedData *rd = &ctx->rd[idx];
+         pkt->duration           = rd->duration;
diff --git a/cinelerra-5.1/thirdparty/src/x265_4.0.patch1 b/cinelerra-5.1/thirdparty/src/x265_4.0.patch1
new file mode 100644 (file)
index 0000000..23d7e84
--- /dev/null
@@ -0,0 +1,4 @@
+--- /dev/null  2020-03-14 06:02:18.586124011 +0300
++++ ./configure        2020-03-18 00:04:59.360807192 +0300
+@@ -0,0 +1 @@
++/bin/true
diff --git a/cinelerra-5.1/thirdparty/src/x265_4.0.patch2 b/cinelerra-5.1/thirdparty/src/x265_4.0.patch2
new file mode 100644 (file)
index 0000000..72459e6
--- /dev/null
@@ -0,0 +1,7 @@
+--- /dev/null  2020-03-14 06:02:18.586124011 +0300
++++ ./Makefile 2020-03-18 00:04:59.388807329 +0300
+@@ -0,0 +1,4 @@
++#$(shell cd build/linux ; ./multilib.sh)
++.NOTPARALLEL:
++all:
++      $(shell ./multilib.sh ; cp 8bit/libx265.a . ; cp 8bit/x265.pc . ; cp 8bit/x265_config.h .)
diff --git a/cinelerra-5.1/thirdparty/src/x265_4.0.patch3 b/cinelerra-5.1/thirdparty/src/x265_4.0.patch3
new file mode 100644 (file)
index 0000000..e97af1d
--- /dev/null
@@ -0,0 +1,57 @@
+--- /dev/null  2020-07-19 09:07:01.788494015 +0300
++++ ./multilib.sh      2020-08-02 02:34:58.444933214 +0300
+@@ -0,0 +1,54 @@
++#!/bin/sh
++
++mkdir -p 8bit 10bit 12bit
++
++
++cd 12bit
++if [ $(uname -m) == 'x86_64' ]; then
++  # 64-bit stuff here
++cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
++else
++  # 32-bit stuff here
++cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
++fi
++make
++
++cd ../10bit
++if [ $(uname -m) == 'x86_64' ]; then
++  # 64-bit stuff here
++cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
++else
++  # 32-bit stuff here
++cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
++fi
++make
++
++cd ../8bit
++ln -sf ../10bit/libx265.a libx265_main10.a
++ln -sf ../12bit/libx265.a libx265_main12.a
++cmake ../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DENABLE_SHARED=OFF -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DENABLE_CLI=OFF
++make
++
++# rename the 8bit library, then combine all three into libx265.a
++mv libx265.a libx265_main.a
++
++uname=`uname`
++if [ "$uname" = "Linux" ]
++then
++
++# On Linux, we use GNU ar to combine the static libraries together
++ar -M <<EOF
++CREATE libx265.a
++ADDLIB libx265_main.a
++ADDLIB libx265_main10.a
++ADDLIB libx265_main12.a
++SAVE
++END
++EOF
++
++else
++
++# Mac/BSD libtool
++libtool -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a 2>/dev/null
++
++fi
diff --git a/cinelerra-5.1/thirdparty/src/x265_4.0.tar.gz b/cinelerra-5.1/thirdparty/src/x265_4.0.tar.gz
new file mode 100644 (file)
index 0000000..2204a12
Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x265_4.0.tar.gz differ