f_acontrast seems to work on 5.1 with those patches too ...
From 84482e141d4498d841c041079c8d18ce45e18c08 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Wed, 1 Mar 2023 22:25:17 +0300 Subject: [PATCH 2/8] Fix build in pluginfclient.C with ffmpeg 6.0
--- cinelerra-5.1/cinelerra/pluginfclient.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cinelerra-5.1/cinelerra/pluginfclient.C b/cinelerra-5.1/cinelerra/pluginfclient.C index d188eb39..afb88c7a 100644 --- a/cinelerra-5.1/cinelerra/pluginfclient.C +++ b/cinelerra-5.1/cinelerra/pluginfclient.C @@ -37,6 +37,8 @@ #include "vframe.h" #include "filexml.h" +#include "libavfilter/version.h" + #ifdef FFMPEG3 #define av_filter_iterate(p) ((*(const AVFilter**)(p))=avfilter_next(*(const AVFilter **)(p))) #endif @@ -660,13 +662,22 @@ PluginFClient::~PluginFClient() } bool PluginFClient::is_audio(const AVFilter *fp) + { if( !fp->outputs ) return 0; +#if LIBAVFILTER_VERSION_MINOR > 2 + if( avfilter_filter_pad_count(fp, 1) > 1 ) return 0; +#else if( avfilter_pad_count(fp->outputs) > 1 ) return 0; +#endif if( !avfilter_pad_get_name(fp->outputs, 0) ) return 0; if( avfilter_pad_get_type(fp->outputs, 0) != AVMEDIA_TYPE_AUDIO ) return 0; if( !fp->inputs ) return 1; +#if LIBAVFILTER_VERSION_MINOR > 2 + if( avfilter_filter_pad_count(fp, 0) > 1 ) return 0; +#else if( avfilter_pad_count(fp->inputs) > 1 ) return 0; +#endif if( !avfilter_pad_get_name(fp->inputs, 0) ) return 0; if( avfilter_pad_get_type(fp->inputs, 0) != AVMEDIA_TYPE_AUDIO ) return 0; return 1; @@ -674,11 +685,19 @@ bool PluginFClient::is_audio(const AVFilter *fp) bool PluginFClient::is_video(const AVFilter *fp) { if( !fp->outputs ) return 0; +#if LIBAVFILTER_VERSION_MINOR > 2 + if( avfilter_filter_pad_count(fp, 1) > 1 ) return 0; +#else if( avfilter_pad_count(fp->outputs) > 1 ) return 0; +#endif if( !avfilter_pad_get_name(fp->outputs, 0) ) return 0; if( avfilter_pad_get_type(fp->outputs, 0) != AVMEDIA_TYPE_VIDEO ) return 0; if( !fp->inputs ) return 1; +#if LIBAVFILTER_VERSION_MINOR > 2 + if( avfilter_filter_pad_count(fp, 0) > 1 ) return 0; +#else if( avfilter_pad_count(fp->inputs) > 1 ) return 0; +#endif if( !avfilter_pad_get_name(fp->inputs, 0) ) return 0; if( avfilter_pad_get_type(fp->inputs, 0) != AVMEDIA_TYPE_VIDEO ) return 0; return 1; -- 2.35.7
From aaa2557165353df28963ed5b9f53b23f1545bf1e Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 16:39:49 +0300 Subject: [PATCH 4/8] Rework libav version string print a bit --- cinelerra-5.1/cinelerra/aboutprefs.C | 6 ++++-- cinelerra-5.1/cinelerra/main.C | 3 +++ cinelerra-5.1/cinelerra/versioninfo.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cinelerra-5.1/cinelerra/aboutprefs.C b/cinelerra-5.1/cinelerra/aboutprefs.C index 8242eee2..a8de327b 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.C +++ b/cinelerra-5.1/cinelerra/aboutprefs.C @@ -28,13 +28,12 @@ #include "vframe.h" #include "versioninfo.h" -#include <libavcodec/avcodec.h> #ifndef COMPILEDATE #define COMPILEDATE "built: " __DATE__ " " __TIME__ #endif const char *AboutPrefs::build_timestamp = COMPILEDATE; -const char *AboutPrefs::ffmpeg_version = " Libav version: " LIBAVCODEC_IDENT; +const char *AboutPrefs::ffmpeg_version = CINELERRA_LIBAV_VERSION; AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) @@ -129,8 +128,11 @@ void AboutPrefs::create_objects() draw_text(x, y, build_timestamp); x += get_text_width(MEDIUMFONT, build_timestamp); + draw_text(x,y, " "); + x += get_text_width(MEDIUMFONT, " "); draw_text(x,y, ffmpeg_version); x -= get_text_width(MEDIUMFONT, build_timestamp); + x -= get_text_width(MEDIUMFONT, " "); #if defined(REPOMAINTXT) y += get_text_height(MEDIUMFONT, build_timestamp); draw_text(x, y, REPOMAINTXT); diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index ed403d9e..cd26a973 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -312,6 +312,9 @@ int main(int argc, char *argv[]) fprintf(stderr, "%s %s - %s\n%s", PROGRAM_NAME,CINELERRA_VERSION, AboutPrefs::build_timestamp, REPOMAINTXT COPYRIGHTTEXT1 COPYRIGHTTEXT2); + fprintf(stderr,"\n"); + fprintf(stderr, "%s \n", AboutPrefs::ffmpeg_version); + fprintf(stderr,"\n"); fprintf(stderr, "%s is free software, covered by the GNU General Public License,\n" "and you are welcome to change it and/or distribute copies of it under\n" "certain conditions. There is absolutely no warranty for %s.\n\n", diff --git a/cinelerra-5.1/cinelerra/versioninfo.h b/cinelerra-5.1/cinelerra/versioninfo.h index d6e20b7c..0281b8fc 100644 --- a/cinelerra-5.1/cinelerra/versioninfo.h +++ b/cinelerra-5.1/cinelerra/versioninfo.h @@ -1,6 +1,8 @@ #ifndef __VERSIONINFO_H__ #define __VERSIONINFO_H__ +#include <libavcodec/avcodec.h> +#define CINELERRA_LIBAV_VERSION "Libav version: " LIBAVCODEC_IDENT; #define CINELERRA_VERSION "Infinity" #define REPOMAINTXT "git://git.cinelerra-gg.org/goodguy/cinelerra.git\n" #define COPYRIGHT_DATE "2019" -- 2.35.7
From 78214633469814927a2a1ff5892550ce01c7633c Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 17:14:34 +0300 Subject: [PATCH 5/8] Add Cinelerra-Cv team copyright --- cinelerra-5.1/cinelerra/aboutprefs.C | 11 ++++------- cinelerra-5.1/cinelerra/main.C | 5 +++++ cinelerra-5.1/cinelerra/versioninfo.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cinelerra-5.1/cinelerra/aboutprefs.C b/cinelerra-5.1/cinelerra/aboutprefs.C index a8de327b..54ee612b 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.C +++ b/cinelerra-5.1/cinelerra/aboutprefs.C @@ -53,11 +53,6 @@ void AboutPrefs::create_objects() int x, y; BC_Resources *resources = BC_WindowBase::get_resources(); -// add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x, -// mwindow->theme->preferencestitle_y, -// _("About"),http://mirrors.pdp-11.ru/ -// LARGEFONT, -// resources->text_default)); x = mwindow->theme->preferencesoptions_x; y = mwindow->theme->preferencesoptions_y + @@ -74,7 +69,9 @@ void AboutPrefs::create_objects() COPYRIGHTTEXT2 #endif ); - y += get_text_height(MEDIUMFONT) * 3; + y += 2*get_text_height(MEDIUMFONT); + draw_text(x,y, COPYRIGHTTEXT3); + y += get_text_height(MEDIUMFONT) * 2; const char *cfg_path = File::get_cindat_path(); @@ -101,7 +98,7 @@ void AboutPrefs::create_objects() about.append(new BC_ListBoxItem(msg)); } BC_ListBox *listbox; - add_subwindow(listbox = new BC_ListBox(x, y, xS(450), yS(280), + add_subwindow(listbox = new BC_ListBox(x, y, xS(450), yS(270), LISTBOX_TEXT, &about, 0, 0, 1)); y += listbox->get_h() + get_text_height(LARGEFONT) + yS(10); } diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index cd26a973..8fbb189d 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -309,9 +309,14 @@ int main(int argc, char *argv[]) #ifndef COPYRIGHTTEXT2 #define COPYRIGHTTEXT2 "" #endif +#ifndef COPYRIGHTTEXT3 +#define COPYRIGHTTEXT3 "" +#endif + fprintf(stderr, "%s %s - %s\n%s", PROGRAM_NAME,CINELERRA_VERSION, AboutPrefs::build_timestamp, REPOMAINTXT COPYRIGHTTEXT1 COPYRIGHTTEXT2); + fprintf(stderr, "%s", COPYRIGHTTEXT3); fprintf(stderr,"\n"); fprintf(stderr, "%s \n", AboutPrefs::ffmpeg_version); fprintf(stderr,"\n"); diff --git a/cinelerra-5.1/cinelerra/versioninfo.h b/cinelerra-5.1/cinelerra/versioninfo.h index 0281b8fc..02a2f2c7 100644 --- a/cinelerra-5.1/cinelerra/versioninfo.h +++ b/cinelerra-5.1/cinelerra/versioninfo.h @@ -8,6 +8,7 @@ #define COPYRIGHT_DATE "2019" #define COPYRIGHTTEXT1 "(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams\n" #define COPYRIGHTTEXT2 "2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy\n" +#define COPYRIGHTTEXT3 "2003-2017 mods for Cinelerra-CV by CinelerraCV team\n" #undef COMPILEDATE #endif -- 2.35.7
From 528db6f1ae603723e0cb1552bdd3ea8adfd524e8 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 15:22:21 +0300 Subject: [PATCH 3/8] Add libav build info to aboutprefs.C --- cinelerra-5.1/cinelerra/aboutprefs.C | 8 +++++++- cinelerra-5.1/cinelerra/aboutprefs.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/aboutprefs.C b/cinelerra-5.1/cinelerra/aboutprefs.C index 03a6f9d0..8242eee2 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.C +++ b/cinelerra-5.1/cinelerra/aboutprefs.C @@ -28,10 +28,13 @@ #include "vframe.h" #include "versioninfo.h" +#include <libavcodec/avcodec.h> + #ifndef COMPILEDATE #define COMPILEDATE "built: " __DATE__ " " __TIME__ #endif const char *AboutPrefs::build_timestamp = COMPILEDATE; +const char *AboutPrefs::ffmpeg_version = " Libav version: " LIBAVCODEC_IDENT; AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) @@ -53,7 +56,7 @@ void AboutPrefs::create_objects() // add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x, // mwindow->theme->preferencestitle_y, -// _("About"), +// _("About"),http://mirrors.pdp-11.ru/ // LARGEFONT, // resources->text_default)); @@ -125,6 +128,9 @@ void AboutPrefs::create_objects() y += get_text_height(MEDIUMFONT, license3); draw_text(x, y, build_timestamp); + x += get_text_width(MEDIUMFONT, build_timestamp); + draw_text(x,y, ffmpeg_version); + x -= get_text_width(MEDIUMFONT, build_timestamp); #if defined(REPOMAINTXT) y += get_text_height(MEDIUMFONT, build_timestamp); draw_text(x, y, REPOMAINTXT); diff --git a/cinelerra-5.1/cinelerra/aboutprefs.h b/cinelerra-5.1/cinelerra/aboutprefs.h index ee87dcf1..1b50374c 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.h +++ b/cinelerra-5.1/cinelerra/aboutprefs.h @@ -32,6 +32,7 @@ public: ~AboutPrefs(); static const char *build_timestamp; + static const char *ffmpeg_version; void create_objects(); ArrayList<BC_ListBoxItem*> about; }; -- 2.35.7
From e551a790b6ec65c6409b899304d083ffa8445275 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 20:07:28 +0300 Subject: [PATCH 8/8] Possible fix internal ffmpeg 5.1 build with binutils 2.41 on x86-64? --- .../thirdparty/src/ffmpeg-5.1.patch999 | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch999 diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch999 b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch999 new file mode 100644 index 00000000..19021779 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-5.1.patch999 @@ -0,0 +1,62 @@ +X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/blobdiff_plain/ccc684993276248d64c328a810fb7714af2f4c70..effadce6c756247ea8bae32dc13bb3e6f464f0eb:/libavcodec/x86/mathops.h + +diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h +index 6298f5ed19..ca7e2dffc1 100644 +--- a/libavcodec/x86/mathops.h ++++ b/libavcodec/x86/mathops.h +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ __asm__ volatile(\ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + -- 2.35.7
From 55af487ef138e1cba24a4d08ff0e1025ee94d6cb Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 19:03:16 +0300 Subject: [PATCH 7/8] Add selectable vaapi devices --- cinelerra-5.1/cinelerra/ffmpeg.C | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 4923eded..e95cc87e 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -1160,7 +1160,14 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type) if( hw_pix_fmt >= 0 ) { hw_pixfmt = hw_pix_fmt; avctx->get_format = get_hw_format; + const char *drm_node = getenv("CIN_DRM_DEC"); + if(drm_node && type==AV_HWDEVICE_TYPE_VAAPI) { + ret = av_hwdevice_ctx_create(&hw_device_ctx, type, drm_node, 0, 0); + } + else { ret = av_hwdevice_ctx_create(&hw_device_ctx, type, 0, 0, 0); + } + if( ret >= 0 ) { avctx->hw_device_ctx = av_buffer_ref(hw_device_ctx); ret = 1; @@ -1176,6 +1183,7 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type) AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev) { + const char *drm_node_enc = getenv("CIN_DRM_ENC"); AVBufferRef *hw_device_ctx = 0; AVBufferRef *hw_frames_ref = 0; AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; @@ -1187,7 +1195,12 @@ AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev) } } if( type != AV_HWDEVICE_TYPE_NONE ) { - int ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, 0, 0, 0); + int ret = 0; + if (drm_node_enc) { + ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, drm_node_enc, 0, 0); + } else { + ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, 0, 0, 0); + } if( ret < 0 ) { ff_err(ret, "Failed to create a HW device.\n"); type = AV_HWDEVICE_TYPE_NONE; -- 2.35.7
From a909b1db2f55701b7397ff367a7f9822b9afc182 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Sun, 27 Aug 2023 17:51:42 +0300 Subject: [PATCH 6/8] Add COPYRIGHT4 string about our team --- cinelerra-5.1/cinelerra/aboutprefs.C | 5 ++++- cinelerra-5.1/cinelerra/main.C | 1 + cinelerra-5.1/cinelerra/versioninfo.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cinelerra-5.1/cinelerra/aboutprefs.C b/cinelerra-5.1/cinelerra/aboutprefs.C index 54ee612b..0ffb8072 100644 --- a/cinelerra-5.1/cinelerra/aboutprefs.C +++ b/cinelerra-5.1/cinelerra/aboutprefs.C @@ -71,6 +71,9 @@ void AboutPrefs::create_objects() ); y += 2*get_text_height(MEDIUMFONT); draw_text(x,y, COPYRIGHTTEXT3); + y += get_text_height(MEDIUMFONT); + draw_text(x,y, COPYRIGHTTEXT4); + y += get_text_height(MEDIUMFONT) * 2; @@ -98,7 +101,7 @@ void AboutPrefs::create_objects() about.append(new BC_ListBoxItem(msg)); } BC_ListBox *listbox; - add_subwindow(listbox = new BC_ListBox(x, y, xS(450), yS(270), + add_subwindow(listbox = new BC_ListBox(x, y, xS(450), yS(250), LISTBOX_TEXT, &about, 0, 0, 1)); y += listbox->get_h() + get_text_height(LARGEFONT) + yS(10); } diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 8fbb189d..b1f1fb69 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -317,6 +317,7 @@ int main(int argc, char *argv[]) PROGRAM_NAME,CINELERRA_VERSION, AboutPrefs::build_timestamp, REPOMAINTXT COPYRIGHTTEXT1 COPYRIGHTTEXT2); fprintf(stderr, "%s", COPYRIGHTTEXT3); + fprintf(stderr, "%s", COPYRIGHTTEXT4); fprintf(stderr,"\n"); fprintf(stderr, "%s \n", AboutPrefs::ffmpeg_version); fprintf(stderr,"\n"); diff --git a/cinelerra-5.1/cinelerra/versioninfo.h b/cinelerra-5.1/cinelerra/versioninfo.h index 02a2f2c7..7e2a528f 100644 --- a/cinelerra-5.1/cinelerra/versioninfo.h +++ b/cinelerra-5.1/cinelerra/versioninfo.h @@ -9,6 +9,8 @@ #define COPYRIGHTTEXT1 "(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams\n" #define COPYRIGHTTEXT2 "2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy\n" #define COPYRIGHTTEXT3 "2003-2017 mods for Cinelerra-CV by CinelerraCV team\n" +#define COPYRIGHTTEXT4 "2015-2023 mods for Cinelerra-GG by Cinelerra-GG team\n" + #undef COMPILEDATE #endif -- 2.35.7
-- Cin mailing list Cin@lists.cinelerra-gg.org https://lists.cinelerra-gg.org/mailman/listinfo/cin