Re: [FFmpeg-devel] Hardware purchase request: AVX512-capable laptop

2024-01-17 Thread Lynne
Jan 18, 2024, 04:29 by mich...@niedermayer.cc:

> On Wed, Jan 17, 2024 at 04:39:21PM +0100, Lynne wrote:
>
>> Jan 17, 2024, 14:37 by mich...@niedermayer.cc:
>>
> [...]
>
>> > also what exactly are your requirements for the new machiene
>> > and what are the "nice to have" things ?
>> >
>> > also what is the expected lifetime of this, how long will the
>> > new machiene be sufficient?
>> >
>>
>> I run things until they don't, and then keep them running anyway.
>>
>> I also have a second broken laptop, an XPS 15 from 2016.
>> Its internals are working, but it's missing a battery, a display,
>> and it's got a broken keyboard and a fan that's broken.
>>
>
> Thats a lot of broken things.
>

It's what happens to portable machines.
The 2mm machined aluminium body did protect the internals though.


>> I'm not sure I have the skills to replace the keyboard, but I can try.
>>
>
> Well, if the notebook is broken, theres not that much you would loose
>
> I suggest, to look at youtube there are some videos for many notebook
> disassembly and reassembly.
> Also make sure you have a well lit space, space for each screw, no stress
> and MUCH more time than you expect. If someone on youtube does it in 30min
> you will need 3 hours.
> Also (maybe less when theres a video as reference) but i tend to take
> picture after each step of disassembly so i can check how things where
> exactly before disassembly.
> Also make sure you have the right tools, a screwdriver that doesnt fit
> exactly can mess up screws, similarly all these funky tools to pry things
> apart.
> Also expect that some parts will have fewer plastic hooks afterwards.
>
> If you get stuck somewhere, like with some connector notz comming loose
> or something, just take a break and ask / sleep over it.
> I remember stubborn connectors on my notebook, so far they all came loose
> before they broke
>
>
>> It's a high-spec 4-core machine with 16Gb of RAM, and still very
>> usable these days, but it'll take around 400 dollars to repair,
>> as a new original screen is expensive (290), battery isn't cheap (60),
>> and parts are in general in demand as it's out of support by now.
>>
>
> well i would certainly support ffmpeg-SPI paying for these parts
> if it helps you.
>

Right, thanks. But would the main two currently objecting agree?
I don't think they monitor this thread anymore, but their objections stand.


> thx
>
> PS: replacment parts from china are not always working after shipment
> ive had some problem with a new fan for a notebook once.
>

Yeah, the screen in particular is rare, and most of it is sold by
93% approved users on ebay. May be tricky, but it's worth a try.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] configure doesn't seem to use pkg-config flags?

2024-01-17 Thread Roger Pack
Hello.
After compiling libx265 as a "static library" (mingw cross compiling
targeting win64)

$ pkg-config --libs --static x265
-L/home/rdp/new/sandbox/win64_static/build_files/lib -lx265
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a -lgcc

I get this failure at configure time:

./configure --enable-libx265 --arch=x86_64 --target-os=mingw32
--cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config
--pkg-config-flags=--static

ERROR: x265 not found using pkg-config

config.log (sorry it's verbose, first compile passes, second one fails linking)

...
require_pkg_config libx265 x265 x265.h x265_api_get
check_pkg_config libx265 x265 x265.h x265_api_get
test_pkg_config libx265 x265 x265.h x265_api_get
pkg-config --exists --print-errors x265
check_func_headers x265.h x265_api_get
-I/home/rdp/new/sandbox/win64_static/build_files/include
-L/home/rdp/new/sandbox/win64_static/build_files/lib -lx265
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a -lgcc
test_ld cc -I/home/rdp/new/sandbox/win64_static/build_files/include
-L/home/rdp/new/sandbox/win64_static/build_files/lib -lx265
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a -lgcc
test_cc -I/home/rdp/new/sandbox/win64_static/build_files/include
-L/home/rdp/new/sandbox/win64_static/build_files/lib
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a
BEGIN /tmp/ffconf.L9GhKESq/test.c
1   #include 
2   #include 
3   long check_x265_api_get(void) { return (long) x265_api_get; }
4   int main(void) { int ret = 0;
5ret |= ((intptr_t)check_x265_api_get) & 0x;
6   return ret; }
END /tmp/ffconf.L9GhKESq/test.c
x86_64-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
-D__printf__=__gnu_printf__ -D_WIN32_WINNT=0x0600
-D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -std=c11
-fomit-frame-pointer
-I/home/rdp/new/sandbox/win64_static/build_files/include
-L/home/rdp/new/sandbox/win64_static/build_files/lib
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a -c -o
/tmp/ffconf.L9GhKESq/test.o /tmp/ffconf.L9GhKESq/test.c
/tmp/ffconf.L9GhKESq/test.c: In function 'check_x265_api_get':
/tmp/ffconf.L9GhKESq/test.c:3:40: warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]
3 | long check_x265_api_get(void) { return (long) x265_api_get; }
  |^
x86_64-w64-mingw32-gcc: warning:
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a: linker input
file unused because linking not done
x86_64-w64-mingw32-gcc -Wl,--nxcompat,--dynamicbase
-Wl,--high-entropy-va -Wl,--as-needed -Wl,--image-base,0x14000
-I/home/rdp/new/sandbox/win64_static/build_files/include
-L/home/rdp/new/sandbox/win64_static/build_files/lib
/usr/lib/gcc/x86_64-w64-mingw32/10-win32/libstdc++.a -o
/tmp/ffconf.L9GhKESq/test.exe /tmp/ffconf.L9GhKESq/test.o -lx265 -lgcc
/usr/bin/x86_64-w64-mingw32-ld:
/home/rdp/new/sandbox/win64_static/build_files/lib/libx265.a(api.cpp.obj):api.cpp:(.text+0xfb5):
undefined reference to `operator new(unsigned long long)'
/usr/bin/x86_64-w64-mingw32-ld:
/home/rdp/new/sandbox/win64_static/build_files/lib/libx265.a(api.cpp.obj):api.cpp:(.text+0x1303):
undefined reference to `operator delete(void*)'
...

So it seems to be linking it not using the output of pkg-config --libs
--static for linking or something?

Workaround is  --extra-libs=-lstdc++ but something seems confusing to me here.
Advice welcome.  Or if I should file something let me know, thank you :)

-=roger
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Hardware purchase request: AVX512-capable laptop

2024-01-17 Thread Michael Niedermayer
On Wed, Jan 17, 2024 at 04:39:21PM +0100, Lynne wrote:
> Jan 17, 2024, 14:37 by mich...@niedermayer.cc:
[...]
> > also what exactly are your requirements for the new machiene
> > and what are the "nice to have" things ?
> >
> > also what is the expected lifetime of this, how long will the
> > new machiene be sufficient?
> >
> 
> I run things until they don't, and then keep them running anyway.
> 
> I also have a second broken laptop, an XPS 15 from 2016.
> Its internals are working, but it's missing a battery, a display,
> and it's got a broken keyboard and a fan that's broken.

Thats a lot of broken things.


> I'm not sure I have the skills to replace the keyboard, but I can try.

Well, if the notebook is broken, theres not that much you would loose

I suggest, to look at youtube there are some videos for many notebook
disassembly and reassembly.
Also make sure you have a well lit space, space for each screw, no stress
and MUCH more time than you expect. If someone on youtube does it in 30min
you will need 3 hours.
Also (maybe less when theres a video as reference) but i tend to take
picture after each step of disassembly so i can check how things where
exactly before disassembly.
Also make sure you have the right tools, a screwdriver that doesnt fit
exactly can mess up screws, similarly all these funky tools to pry things
apart.
Also expect that some parts will have fewer plastic hooks afterwards.

If you get stuck somewhere, like with some connector notz comming loose
or something, just take a break and ask / sleep over it.
I remember stubborn connectors on my notebook, so far they all came loose
before they broke


> It's a high-spec 4-core machine with 16Gb of RAM, and still very
> usable these days, but it'll take around 400 dollars to repair,
> as a new original screen is expensive (290), battery isn't cheap (60),
> and parts are in general in demand as it's out of support by now.

well i would certainly support ffmpeg-SPI paying for these parts
if it helps you.

thx

PS: replacment parts from china are not always working after shipment
ive had some problem with a new fan for a notebook once.


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format

2024-01-17 Thread Connor Worley
Signed-off-by: Connor Worley 
---
 Changelog |   1 +
 configure |   1 +
 doc/general_contents.texi |   3 +-
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/dxvenc.c   | 358 ++
 libavcodec/version.h  |   2 +-
 7 files changed, 365 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/dxvenc.c

diff --git a/Changelog b/Changelog
index 5b2899d05b..224d84664a 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :
+- DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
 - EVC encoding using external library libxeve
diff --git a/configure b/configure
index c8ae0a061d..21663000f8 100755
--- a/configure
+++ b/configure
@@ -2851,6 +2851,7 @@ dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
 dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
+dxv_encoder_select="texturedspenc"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
 eamad_decoder_select="aandcttables blockdsp bswapdsp"
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 8b48fed060..f269cbd1a9 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -670,7 +670,8 @@ library:
 @item Redirector@tab   @tab X
 @item RedSpark  @tab   @tab X
 @item Renderware TeXture Dictionary @tab   @tab X
-@item Resolume DXV  @tab   @tab X
+@item Resolume DXV  @tab X @tab X
+@tab Encoding is only supported for the DXT1 (Normal Quality, No Alpha) 
texture format.
 @item RF64  @tab   @tab X
 @item RL2   @tab   @tab X
 @tab Audio and video format used in some games by Entertainment Software 
Partners.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index bb42095165..96361ac794 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -341,6 +341,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o 
dvdata.o
 OBJS-$(CONFIG_DXA_DECODER) += dxa.o
 OBJS-$(CONFIG_DXTORY_DECODER)  += dxtory.o
 OBJS-$(CONFIG_DXV_DECODER) += dxv.o
+OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o
 OBJS-$(CONFIG_EAC3_DECODER)+= eac3_data.o
 OBJS-$(CONFIG_EAC3_ENCODER)+= eac3enc.o eac3_data.o
 OBJS-$(CONFIG_EACMV_DECODER)   += eacmv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 93ce8e3224..ef8c3a6d7d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder;
 extern const FFCodec ff_dvvideo_decoder;
 extern const FFCodec ff_dxa_decoder;
 extern const FFCodec ff_dxtory_decoder;
+extern const FFCodec ff_dxv_encoder;
 extern const FFCodec ff_dxv_decoder;
 extern const FFCodec ff_eacmv_decoder;
 extern const FFCodec ff_eamad_decoder;
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
new file mode 100644
index 00..33080fa1c9
--- /dev/null
+++ b/libavcodec/dxvenc.c
@@ -0,0 +1,358 @@
+/*
+ * Resolume DXV encoder
+ * Copyright (C) 2015 Vittorio Giovara 
+ * Copyright (C) 2015 Tom Butterworth 
+ * Copyright (C) 2018 Paul B Mahol
+ * Copyright (C) 2024 Connor Worley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/crc.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "encode.h"
+#include "texturedsp.h"
+
+#define LOOKBACK_HT_ELEMS 0x4
+#define LOOKBACK_WORDS0x20202
+
+enum DXVTextureFormat {
+DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'),
+};
+
+typedef struct HTEntry {
+uint32_t key;
+uint32_t pos;
+} HTEntry;
+
+static void ht_init(HTEntry *ht)
+{
+for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
+ht[i].pos = -1;
+}
+}
+
+static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
+uint32_t key, uint32_t pos)
+{
+uint32_t ret = -1;
+size_t hash = av_crc(hash_ctx, 0, (uint8_t*), 4) % LOOKBACK_HT_ELEMS;
+

Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format

2024-01-17 Thread Connor Worley

On 1/17/24 08:55, Connor Worley wrote:


Signed-off-by: Connor Worley 
---
 Changelog |   1 +
 configure |   1 +
 doc/general_contents.texi |   3 +-
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c    |   1 +
 libavcodec/dxvenc.c   | 362 ++
 libavcodec/version.h  |   2 +-
 7 files changed, 369 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/dxvenc.c

diff --git a/Changelog b/Changelog
index 5b2899d05b..224d84664a 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.

 version :
+- DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
 - EVC encoding using external library libxeve
diff --git a/configure b/configure
index c8ae0a061d..21663000f8 100755
--- a/configure
+++ b/configure
@@ -2851,6 +2851,7 @@ dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
 dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
+dxv_encoder_select="texturedspenc"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
 eamad_decoder_select="aandcttables blockdsp bswapdsp"
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 8b48fed060..f269cbd1a9 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -670,7 +670,8 @@ library:
 @item Redirector    @tab   @tab X
 @item RedSpark  @tab   @tab X
 @item Renderware TeXture Dictionary @tab   @tab X
-@item Resolume DXV  @tab   @tab X
+@item Resolume DXV  @tab X @tab X
+    @tab Encoding is only supported for the DXT1 (Normal Quality, No Alpha) 
texture format.
 @item RF64  @tab   @tab X
 @item RL2   @tab   @tab X
 @tab Audio and video format used in some games by Entertainment Software 
Partners.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index bb42095165..96361ac794 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -341,6 +341,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o 
dvdata.o
 OBJS-$(CONFIG_DXA_DECODER) += dxa.o
 OBJS-$(CONFIG_DXTORY_DECODER)  += dxtory.o
 OBJS-$(CONFIG_DXV_DECODER) += dxv.o
+OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o
 OBJS-$(CONFIG_EAC3_DECODER)    += eac3_data.o
 OBJS-$(CONFIG_EAC3_ENCODER)    += eac3enc.o eac3_data.o
 OBJS-$(CONFIG_EACMV_DECODER)   += eacmv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 93ce8e3224..ef8c3a6d7d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder;
 extern const FFCodec ff_dvvideo_decoder;
 extern const FFCodec ff_dxa_decoder;
 extern const FFCodec ff_dxtory_decoder;
+extern const FFCodec ff_dxv_encoder;
 extern const FFCodec ff_dxv_decoder;
 extern const FFCodec ff_eacmv_decoder;
 extern const FFCodec ff_eamad_decoder;
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
new file mode 100644
index 00..36ee06699d
--- /dev/null
+++ b/libavcodec/dxvenc.c
@@ -0,0 +1,362 @@
+/*
+ * Resolume DXV encoder
+ * Copyright (C) 2015 Vittorio Giovara 
+ * Copyright (C) 2015 Tom Butterworth 
+ * Copyright (C) 2018 Paul B Mahol
+ * Copyright (C) 2024 Connor Worley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/crc.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "mathops.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "encode.h"
+#include "lzf.h"
+#include "texturedsp.h"
+#include "thread.h"
+
+#define LOOKBACK_HT_ELEMS 0x4
+#define LOOKBACK_WORDS    0x20202
+
+enum DXVTextureFormat {
+    DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'),
+};
+
+typedef struct HTEntry {
+    uint32_t key;
+    uint32_t pos;
+} HTEntry;
+
+static void ht_init(HTEntry *ht)
+{
+    for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
+    ht[i].pos = -1;
+    }
+}
+
+static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
+    uint32_t 

[FFmpeg-devel] [PATCH 2/2] avformat: add a Tile Grid stream group type

2024-01-17 Thread James Almer
This will be used to support tiled image formats like HEIF.

Signed-off-by: James Almer 
---
 libavformat/avformat.c |  5 +
 libavformat/avformat.h |  3 +++
 libavformat/dump.c | 36 
 libavformat/options.c  |  9 +
 4 files changed, 53 insertions(+)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 882927f7b1..a7bd959db5 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/samplefmt.h"
+#include "libavutil/tile.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/codec.h"
 #include "libavcodec/bsf.h"
@@ -100,6 +101,10 @@ void ff_free_stream_group(AVStreamGroup **pstg)
 av_iamf_mix_presentation_free(>params.iamf_mix_presentation);
 break;
 }
+case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
+av_tile_grid_free(>params.tile_grid);
+break;
+}
 default:
 break;
 }
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 5d0fe82250..f259ad1367 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1022,10 +1022,12 @@ enum AVStreamGroupParamsType {
 AV_STREAM_GROUP_PARAMS_NONE,
 AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT,
 AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION,
+AV_STREAM_GROUP_PARAMS_TILE_GRID,
 };
 
 struct AVIAMFAudioElement;
 struct AVIAMFMixPresentation;
+struct AVTileGrid;
 
 typedef struct AVStreamGroup {
 /**
@@ -1062,6 +1064,7 @@ typedef struct AVStreamGroup {
 union {
 struct AVIAMFAudioElement *iamf_audio_element;
 struct AVIAMFMixPresentation *iamf_mix_presentation;
+struct AVTileGrid *tile_grid;
 } params;
 
 /**
diff --git a/libavformat/dump.c b/libavformat/dump.c
index aff51b43f6..84884121a1 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/display.h"
 #include "libavutil/iamf.h"
@@ -35,6 +36,7 @@
 #include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/timecode.h"
+#include "libavutil/tile.h"
 
 #include "libavcodec/avcodec.h"
 
@@ -720,6 +722,40 @@ static void dump_stream_group(const AVFormatContext *ic, 
uint8_t *printed,
 }
 }
 break;
+case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
+const AVTileGrid *tile_grid = stg->params.tile_grid;
+AVCodecContext *avctx = avcodec_alloc_context3(NULL);
+const char *ptr = NULL;
+av_log(NULL, AV_LOG_INFO, " Tile Grid:");
+dump_metadata(NULL, stg->metadata, "", AV_LOG_INFO);
+if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, 
ic->streams[0]->codecpar)) {
+avctx->width  = tile_grid->output_width;
+avctx->height = tile_grid->output_height;
+avctx->coded_width  = FFALIGN(tile_grid->output_width,  
tile_grid->w.tile_width);
+avctx->coded_height = FFALIGN(tile_grid->output_height, 
tile_grid->h.tile_height);
+if (ic->dump_separator)
+av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
+buf[0] = 0;
+avcodec_string(buf, sizeof(buf), avctx, is_output);
+ptr = av_stristr(buf, " ");
+}
+avcodec_free_context();
+if (ptr) {
+ptr++;
+av_log(NULL, AV_LOG_INFO, " %s", ptr);
+av_log(NULL, AV_LOG_VERBOSE, ",");
+}
+av_log(NULL, AV_LOG_VERBOSE, " %d rows, %d columns, tile size %dx%d",
+   tile_grid->tile_rows, tile_grid->tile_cols,
+   tile_grid->w.tile_width, tile_grid->h.tile_height);
+av_log(NULL, AV_LOG_INFO, "\n");
+for (int i = 0; i < stg->nb_streams; i++) {
+const AVStream *st = stg->streams[i];
+dump_stream_format(ic, st->index, i, index, is_output, 
AV_LOG_VERBOSE);
+printed[st->index] = 1;
+}
+break;
+}
 }
 default:
 break;
diff --git a/libavformat/options.c b/libavformat/options.c
index e79ae221d9..dd33ea3470 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -30,6 +30,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intmath.h"
 #include "libavutil/opt.h"
+#include "libavutil/tile.h"
 
 /**
  * @file
@@ -367,6 +368,9 @@ static const AVClass *stream_group_child_iterate(void 
**opaque)
 case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION:
 ret = av_iamf_mix_presentation_get_class();
 break;
+case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+ret = av_tile_grid_get_class();
+break;
 default:
 break;
 }
@@ -427,6 +431,11 @@ AVStreamGroup 
*avformat_stream_group_create(AVFormatContext *s,
 if (!stg->params.iamf_mix_presentation)
 goto fail;
 break;
+case AV_STREAM_GROUP_PARAMS_TILE_GRID:
+  

[FFmpeg-devel] [PATCH 1/2] avutil: add a Tile Grid API

2024-01-17 Thread James Almer
This includes a struct and helpers. It will be used to support container level
tiled image formats like HEIF, but should be generic enough for general usage.

Signed-off-by: James Almer 
---
 libavutil/Makefile |   2 +
 libavutil/tile.c   |  72 +
 libavutil/tile.h   | 132 +
 3 files changed, 206 insertions(+)
 create mode 100644 libavutil/tile.c
 create mode 100644 libavutil/tile.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index e7709b97d0..380d706cfe 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -82,6 +82,7 @@ HEADERS = adler32.h   
  \
   spherical.h   \
   stereo3d.h\
   threadmessage.h   \
+  tile.h\
   time.h\
   timecode.h\
   timestamp.h   \
@@ -172,6 +173,7 @@ OBJS = adler32.o
\
spherical.o  \
stereo3d.o   \
threadmessage.o  \
+   tile.o   \
time.o   \
timecode.o   \
tree.o   \
diff --git a/libavutil/tile.c b/libavutil/tile.c
new file mode 100644
index 00..d6a95d85ed
--- /dev/null
+++ b/libavutil/tile.c
@@ -0,0 +1,72 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+
+#include "log.h"
+#include "mem.h"
+#include "opt.h"
+#include "tile.h"
+
+#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+#define OFFSET(x) offsetof(AVTileGrid, x)
+static const AVOption tile_grid_options[] = {
+{ "type", NULL, OFFSET(type), AV_OPT_TYPE_INT,
+{ .i64 = AV_TILE_DIMENSION_TYPE_UNIFORM },
+AV_TILE_DIMENSION_TYPE_UNIFORM, AV_TILE_DIMENSION_TYPE_VARIABLE, 
FLAGS, "type" },
+{ "uniform",  NULL, 0, AV_OPT_TYPE_CONST,
+   { .i64 = AV_TILE_DIMENSION_TYPE_UNIFORM },  .unit = "type" 
},
+{ "variable", NULL, 0, AV_OPT_TYPE_CONST,
+   { .i64 = AV_TILE_DIMENSION_TYPE_VARIABLE }, .unit = "type" 
},
+{ "tile_rows", NULL, OFFSET(tile_rows), AV_OPT_TYPE_INT64, { .i64 = 0 }, 
0, UINT_MAX, FLAGS },
+{ "tile_cols", NULL, OFFSET(tile_cols), AV_OPT_TYPE_INT64, { .i64 = 0 }, 
0, UINT_MAX, FLAGS },
+{ "output_size", "size of the output image", OFFSET(output_width), 
AV_OPT_TYPE_IMAGE_SIZE,
+{ .str = NULL }, 0, INT_MAX, FLAGS },
+{ NULL },
+};
+
+static const AVClass tile_grid_class = {
+.class_name  = "AVTileGrid",
+.version = LIBAVUTIL_VERSION_INT,
+.option  = tile_grid_options,
+};
+
+const AVClass *av_tile_grid_get_class(void)
+{
+return _grid_class;
+}
+
+AVTileGrid *av_tile_grid_alloc(void)
+{
+return av_mallocz(sizeof(AVTileGrid));
+}
+
+void av_tile_grid_free(AVTileGrid **ptile_grid)
+{
+AVTileGrid *tile_grid = *ptile_grid;
+
+if (!tile_grid)
+return;
+
+if (tile_grid->type == AV_TILE_DIMENSION_TYPE_VARIABLE) {
+av_freep(_grid->w.tile_widths);
+av_freep(_grid->h.tile_heights);
+}
+av_freep(ptile_grid);
+}
diff --git a/libavutil/tile.h b/libavutil/tile.h
new file mode 100644
index 00..fb8af0d56f
--- /dev/null
+++ b/libavutil/tile.h
@@ -0,0 +1,132 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 

[FFmpeg-devel] [PATCH] avformat/dump: only print streams within a group in verbose levels

2024-01-17 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/dump.c | 278 +++--
 1 file changed, 143 insertions(+), 135 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index cc179f284f..aff51b43f6 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -122,53 +122,55 @@ void av_pkt_dump_log2(void *avcl, int level, const 
AVPacket *pkt, int dump_paylo
 }
 
 
-static void print_fps(double d, const char *postfix)
+static void print_fps(double d, const char *postfix, int log_level)
 {
 uint64_t v = lrintf(d * 100);
 if (!v)
-av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
+av_log(NULL, log_level, "%1.4f %s", d, postfix);
 else if (v % 100)
-av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
+av_log(NULL, log_level, "%3.2f %s", d, postfix);
 else if (v % (100 * 1000))
-av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
+av_log(NULL, log_level, "%1.0f %s", d, postfix);
 else
-av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
+av_log(NULL, log_level, "%1.0fk %s", d / 1000, postfix);
 }
 
 static void dump_dictionary(void *ctx, const AVDictionary *m,
-const char *name, const char *indent)
+const char *name, const char *indent,
+int log_level)
 {
 const AVDictionaryEntry *tag = NULL;
 
 if (!m)
 return;
 
-av_log(ctx, AV_LOG_INFO, "%s%s:\n", indent, name);
+av_log(ctx, log_level, "%s%s:\n", indent, name);
 while ((tag = av_dict_iterate(m, tag)))
 if (strcmp("language", tag->key)) {
 const char *p = tag->value;
-av_log(ctx, AV_LOG_INFO,
+av_log(ctx, log_level,
"%s  %-16s: ", indent, tag->key);
 while (*p) {
 size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
-av_log(ctx, AV_LOG_INFO, "%.*s", (int)(FFMIN(255, len)), p);
+av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p);
 p += len;
-if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
-if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s  %-16s: ", 
indent, "");
+if (*p == 0xd) av_log(ctx, log_level, " ");
+if (*p == 0xa) av_log(ctx, log_level, "\n%s  %-16s: ", indent, 
"");
 if (*p) p++;
 }
-av_log(ctx, AV_LOG_INFO, "\n");
+av_log(ctx, log_level, "\n");
 }
 }
 
-static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
+static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent,
+  int log_level)
 {
 if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0)))
-dump_dictionary(ctx, m, "Metadata", indent);
+dump_dictionary(ctx, m, "Metadata", indent, log_level);
 }
 
 /* param change side data*/
-static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
+static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int 
log_level)
 {
 int size = sd->size;
 const uint8_t *data = sd->data;
@@ -193,7 +195,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 channels = AV_RL32(data);
 data += 4;
 size -= 4;
-av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
+av_log(ctx, log_level, "channel count %"PRIu32", ", channels);
 }
 if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
 if (size < 8)
@@ -201,7 +203,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 layout = AV_RL64(data);
 data += 8;
 size -= 8;
-av_log(ctx, AV_LOG_INFO,
+av_log(ctx, log_level,
"channel layout: %s, ", av_get_channel_name(layout));
 }
 FF_ENABLE_DEPRECATION_WARNINGS
@@ -212,7 +214,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 sample_rate = AV_RL32(data);
 data += 4;
 size -= 4;
-av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
+av_log(ctx, log_level, "sample_rate %"PRIu32", ", sample_rate);
 }
 if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
 if (size < 8)
@@ -223,7 +225,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 height = AV_RL32(data);
 data += 4;
 size -= 4;
-av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, 
height);
+av_log(ctx, log_level, "width %"PRIu32" height %"PRIu32, width, 
height);
 }
 
 return;
@@ -232,27 +234,27 @@ fail:
 }
 
 /* replaygain side data*/
-static void print_gain(void *ctx, const char *str, int32_t gain)
+static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
 {
-av_log(ctx, AV_LOG_INFO, "%s - ", str);
+av_log(ctx, log_level, "%s - ", str);
 if (gain == INT32_MIN)
-av_log(ctx, AV_LOG_INFO, "unknown");
+av_log(ctx, log_level, "unknown");
 else
-av_log(ctx, 

Re: [FFmpeg-devel] [PATCH 7/7] fftools/ffplay: support applying container level cropping

2024-01-17 Thread Dmitrii Ovchinnikov
I tested these patches with the AMF AV1 encoder(by adding
AV_PKT_DATA_FRAME_CROPPING)
It works fine.

I suggest a small change to the code for better safety. Change this part:
>>if (sd->data && sd->size == sizeof(uint32_t) * 4) {
to:
if (sd && sd->data && sd->size == sizeof(uint32_t) * 4) {

This change helps avoid crashes when the cropping data isn't filled in.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format

2024-01-17 Thread Connor Worley

Signed-off-by: Connor Worley 
---
 Changelog |   1 +
 configure |   1 +
 doc/general_contents.texi |   3 +-
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/dxvenc.c   | 362 ++
 libavcodec/version.h  |   2 +-
 7 files changed, 369 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/dxvenc.c

diff --git a/Changelog b/Changelog
index 5b2899d05b..224d84664a 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version :

+- DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
 - EVC encoding using external library libxeve
diff --git a/configure b/configure
index c8ae0a061d..21663000f8 100755
--- a/configure
+++ b/configure
@@ -2851,6 +2851,7 @@ dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
 dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
+dxv_encoder_select="texturedspenc"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
 eamad_decoder_select="aandcttables blockdsp bswapdsp"
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 8b48fed060..f269cbd1a9 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -670,7 +670,8 @@ library:
 @item Redirector@tab   @tab X
 @item RedSpark  @tab   @tab X
 @item Renderware TeXture Dictionary @tab   @tab X
-@item Resolume DXV  @tab   @tab X
+@item Resolume DXV  @tab X @tab X
+@tab Encoding is only supported for the DXT1 (Normal Quality, No Alpha) 
texture format.
 @item RF64  @tab   @tab X
 @item RL2   @tab   @tab X
 @tab Audio and video format used in some games by Entertainment Software 
Partners.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index bb42095165..96361ac794 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -341,6 +341,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o 
dvdata.o
 OBJS-$(CONFIG_DXA_DECODER) += dxa.o
 OBJS-$(CONFIG_DXTORY_DECODER)  += dxtory.o
 OBJS-$(CONFIG_DXV_DECODER) += dxv.o
+OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o
 OBJS-$(CONFIG_EAC3_DECODER)+= eac3_data.o
 OBJS-$(CONFIG_EAC3_ENCODER)+= eac3enc.o eac3_data.o
 OBJS-$(CONFIG_EACMV_DECODER)   += eacmv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 93ce8e3224..ef8c3a6d7d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder;
 extern const FFCodec ff_dvvideo_decoder;
 extern const FFCodec ff_dxa_decoder;
 extern const FFCodec ff_dxtory_decoder;
+extern const FFCodec ff_dxv_encoder;
 extern const FFCodec ff_dxv_decoder;
 extern const FFCodec ff_eacmv_decoder;
 extern const FFCodec ff_eamad_decoder;
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
new file mode 100644
index 00..36ee06699d
--- /dev/null
+++ b/libavcodec/dxvenc.c
@@ -0,0 +1,362 @@
+/*
+ * Resolume DXV encoder
+ * Copyright (C) 2015 Vittorio Giovara 
+ * Copyright (C) 2015 Tom Butterworth 
+ * Copyright (C) 2018 Paul B Mahol
+ * Copyright (C) 2024 Connor Worley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+#include "libavutil/crc.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "mathops.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "encode.h"
+#include "lzf.h"
+#include "texturedsp.h"
+#include "thread.h"
+
+#define LOOKBACK_HT_ELEMS 0x4
+#define LOOKBACK_WORDS0x20202
+
+enum DXVTextureFormat {
+DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'),
+};
+
+typedef struct HTEntry {
+uint32_t key;
+uint32_t pos;
+} HTEntry;
+
+static void ht_init(HTEntry *ht)
+{
+for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
+ht[i].pos = -1;
+}
+}
+
+static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
+uint32_t key, uint32_t pos)
+{
+uint32_t ret = 

Re: [FFmpeg-devel] Hardware purchase request: AVX512-capable laptop

2024-01-17 Thread Lynne
Jan 17, 2024, 14:37 by mich...@niedermayer.cc:

> On Tue, Jan 16, 2024 at 03:59:43PM +0100, Lynne wrote:
>
>> Jan 16, 2024, 11:06 by kier...@obe.tv:
>>
>> >>
>> >> A ticket doesn't have durability.
>> >>
>> >
>> > A Ryzen 5 vs Ryzen 7 in the same laptop chassis doesn't change its
>> > durability, it only doubles the laptop's price.
>> >
>>
>> It doubles the number of registers and expands the number
>> of instructions available. The price isn't doubled.
>>
>
> Is there some reference which lists which chip supports what ?
> iam really loosing track of this, this was simpler years ago
> i assumed there was no difference between zen 4 chips in instruction
> set support
>

https://en.wikipedia.org/wiki/List_of_AMD_Ryzen_processors#Phoenix_(7040_series,_Zen_4/RDNA3_based)


> also what exactly are your requirements for the new machiene
> and what are the "nice to have" things ?
>
> also what is the expected lifetime of this, how long will the
> new machiene be sufficient?
>

I run things until they don't, and then keep them running anyway.

I also have a second broken laptop, an XPS 15 from 2016.
Its internals are working, but it's missing a battery, a display,
and it's got a broken keyboard and a fan that's broken.
I'm not sure I have the skills to replace the keyboard, but I can try.
It's a high-spec 4-core machine with 16Gb of RAM, and still very
usable these days, but it'll take around 400 dollars to repair,
as a new original screen is expensive (290), battery isn't cheap (60),
and parts are in general in demand as it's out of support by now.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/8] fftools/cmdutils: add a flag for per-stream options

2024-01-17 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-01-17 14:01:49)
> On Wed, Jan 17, 2024 at 01:40:29PM +0100, Anton Khirnov wrote:
> > Not all OPT_SPEC options are per-stream, this will allow identifying
> > those that are, which will be useful in following commits.
> > ---
> >  fftools/cmdutils.h   |  13 +++--
> >  fftools/ffmpeg_opt.c | 118 +--
> >  2 files changed, 68 insertions(+), 63 deletions(-)
> 
> Seems git doesnt like applying this

As for the other one, this is on top of the previous set. Or see branch
ffmpeg_opt_help in my tree.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/6] fftools/cmdutils: add option syntax for loading arbitrary arguments from a file

2024-01-17 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-01-17 14:08:29)
> On Wed, Jan 17, 2024 at 10:22:31AM +0100, Anton Khirnov wrote:
> > Aligned with analogous feature for filter options in ffmpeg CLI.
> > ---
> >  Changelog|  2 +
> >  doc/fftools-common-opts.texi |  9 
> >  fftools/cmdutils.c   | 99 ++--
> >  fftools/cmdutils.h   |  3 ++
> >  fftools/ffmpeg.h |  1 -
> >  fftools/ffmpeg_opt.c | 26 --
> >  6 files changed, 97 insertions(+), 43 deletions(-)
> 
> git is unsable to apply this as well

Sorry, forgot to mention that this is on top of my pending BSF set.
You can also look at the branch ffmpeg_opt_file in my tree.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Hardware purchase request: AVX512-capable laptop

2024-01-17 Thread Michael Niedermayer
On Tue, Jan 16, 2024 at 03:59:43PM +0100, Lynne wrote:
> Jan 16, 2024, 11:06 by kier...@obe.tv:
> 
> >>
> >> A ticket doesn't have durability.
> >>
> >
> > A Ryzen 5 vs Ryzen 7 in the same laptop chassis doesn't change its
> > durability, it only doubles the laptop's price.
> >
> 
> It doubles the number of registers and expands the number
> of instructions available. The price isn't doubled.

Is there some reference which lists which chip supports what ?
iam really loosing track of this, this was simpler years ago
i assumed there was no difference between zen 4 chips in instruction
set support

also what exactly are your requirements for the new machiene
and what are the "nice to have" things ?

also what is the expected lifetime of this, how long will the
new machiene be sufficient?

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format

2024-01-17 Thread Michael Niedermayer
On Wed, Jan 17, 2024 at 12:27:40AM -0800, Connor Worley wrote:
> Signed-off-by: Connor Worley 
> ---
>  Changelog |   1 +
>  configure |   1 +
>  doc/general_contents.texi |   3 +-
>  libavcodec/Makefile   |   1 +
>  libavcodec/allcodecs.c|   1 +
>  libavcodec/dxvenc.c   | 362 ++
>  libavcodec/version.h  |   2 +-
>  7 files changed, 369 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/dxvenc.c
> 
> diff --git a/Changelog b/Changelog
> index 5b2899d05b..224d84664a 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest
> within each release,
>  releases are sorted from youngest to oldest.
>   version :
> +- DXV DXT1 encoder
>  - LEAD MCMP decoder
>  - EVC decoding using external library libxevd
>  - EVC encoding using external library libxeve

please resend without extra linebreaks

Applying: Add DXV encoder with support for DXT1 texture format
error: corrupt patch at line 23

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/6] fftools/cmdutils: add option syntax for loading arbitrary arguments from a file

2024-01-17 Thread Michael Niedermayer
On Wed, Jan 17, 2024 at 10:22:31AM +0100, Anton Khirnov wrote:
> Aligned with analogous feature for filter options in ffmpeg CLI.
> ---
>  Changelog|  2 +
>  doc/fftools-common-opts.texi |  9 
>  fftools/cmdutils.c   | 99 ++--
>  fftools/cmdutils.h   |  3 ++
>  fftools/ffmpeg.h |  1 -
>  fftools/ffmpeg_opt.c | 26 --
>  6 files changed, 97 insertions(+), 43 deletions(-)

git is unsable to apply this as well

Applying: fftools/cmdutils: add option syntax for loading arbitrary arguments 
from a file
error: sha1 information is lacking or useless (Changelog).
error: could not build fake ancestor
Patch failed at 0001 fftools/cmdutils: add option syntax for loading arbitrary 
arguments from a file
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/8] fftools/cmdutils: add a flag for per-stream options

2024-01-17 Thread Michael Niedermayer
On Wed, Jan 17, 2024 at 01:40:29PM +0100, Anton Khirnov wrote:
> Not all OPT_SPEC options are per-stream, this will allow identifying
> those that are, which will be useful in following commits.
> ---
>  fftools/cmdutils.h   |  13 +++--
>  fftools/ffmpeg_opt.c | 118 +--
>  2 files changed, 68 insertions(+), 63 deletions(-)

Seems git doesnt like applying this

Applying: fftools/cmdutils: add a flag for per-stream options
error: sha1 information is lacking or useless (fftools/cmdutils.h).
error: could not build fake ancestor
Patch failed at 0001 fftools/cmdutils: add a flag for per-stream options
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 8/8] fftools/ffmpeg_opt: improve wording in option descriptions

2024-01-17 Thread Anton Khirnov
---
 fftools/ffmpeg_opt.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bdb71d4283..6ff1cb229d 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1476,7 +1476,7 @@ const OptionDef options[] = {
 CMDUTILS_COMMON_OPTIONS
 { "f",  OPT_TYPE_STRING, OPT_OFFSET | OPT_INPUT | 
OPT_OUTPUT,
 { .off   = OFFSET(format) },
-"force format", "fmt" },
+"force container format (auto-detected otherwise)", "fmt" },
 { "y",  OPT_TYPE_BOOL, 0,
 {  _overwrite },
 "overwrite output files" },
@@ -1494,11 +1494,11 @@ const OptionDef options[] = {
 "allow recasting stream type in order to force a decoder of different 
media type" },
 { "c",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | 
OPT_OUTPUT | OPT_HAS_CANON,
 { .off   = OFFSET(codec_names) },
-"codec name", "codec",
+"select encoder/decoder ('copy' to copy stream without reencoding)", 
"codec",
 .u1.name_canon = "codec", },
 { "codec",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | 
OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
 { .off   = OFFSET(codec_names) },
-"codec name", "codec",
+"alias for -c (select encoder/decoder)", "codec",
 .u1.names_alt = alt_codec, },
 { "pre",OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | 
OPT_EXPERT | OPT_HAS_ALT,
 { .off   = OFFSET(presets) },
@@ -1517,17 +1517,18 @@ const OptionDef options[] = {
 "set chapters mapping", "input_file_index" },
 { "t",  OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | 
OPT_OUTPUT,
 { .off = OFFSET(recording_time) },
-"record or transcode \"duration\" seconds of audio/video",
+"stop transcoding after specified duration",
 "duration" },
 { "to", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | 
OPT_OUTPUT,
 { .off = OFFSET(stop_time) },
-"record or transcode stop time", "time_stop" },
+"stop transcoding after specified time is reached",
+"time_stop" },
 { "fs", OPT_TYPE_INT64, OPT_OFFSET | OPT_OUTPUT | 
OPT_EXPERT,
 { .off = OFFSET(limit_filesize) },
 "set the limit file size in bytes", "limit_size" },
 { "ss", OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | 
OPT_OUTPUT,
 { .off = OFFSET(start_time) },
-"set the start time offset", "time_off" },
+"start transcoding at specified time", "time_off" },
 { "sseof",  OPT_TYPE_TIME, OPT_OFFSET | OPT_INPUT | 
OPT_EXPERT,
 { .off = OFFSET(start_time_eof) },
 "set the start time offset relative to EOF", "time_off" },
@@ -1551,7 +1552,7 @@ const OptionDef options[] = {
 "set the recording timestamp ('now' to set the current time)", "time" 
},
 { "metadata",   OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
 { .off = OFFSET(metadata) },
-"add metadata", "string=string" },
+"add metadata", "key=value" },
 { "program",OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | 
OPT_OUTPUT,
 { .off = OFFSET(program) },
 "add program with specified streams", "title=string:st=number..." },
@@ -1659,7 +1660,7 @@ const OptionDef options[] = {
 "set profile", "profile" },
 { "filter", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | 
OPT_HAS_ALT,
 { .off = OFFSET(filters) },
-"set stream filtergraph", "filter_graph",
+"apply specified filters to audio/video", "filter_graph",
 .u1.names_alt = alt_filter, },
 { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
 { .func_arg = opt_filter_threads },
@@ -1751,7 +1752,7 @@ const OptionDef options[] = {
 .u1.name_canon = "frames", },
 { "r",  OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM 
| OPT_INPUT | OPT_OUTPUT,
 { .off = OFFSET(frame_rates) },
-"set frame rate (Hz value, fraction or abbreviation)", "rate" },
+"override input framerate/convert to given output framerate (Hz value, 
fraction or abbreviation)", "rate" },
 { "fpsmax", OPT_TYPE_STRING, OPT_VIDEO | OPT_PERSTREAM 
| OPT_OUTPUT | OPT_EXPERT,
 { .off = OFFSET(max_frame_rates) },
 "set max frame rate (Hz value, fraction or abbreviation)", "rate" },
@@ -1784,7 +1785,7 @@ const OptionDef options[] = {
 "rate control override for specific intervals", "override" },
 { "vcodec", OPT_TYPE_FUNC,   OPT_VIDEO | OPT_FUNC_ARG 
| OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_HAS_CANON,
 { .func_arg = opt_video_codec },
-"force video codec ('copy' to copy stream)", "codec",
+"alias for -c:v (select encoder/decoder 

[FFmpeg-devel] [PATCH 4/8] fftools/ffmpeg_opt: add more structure to long help output

2024-01-17 Thread Anton Khirnov
Split the "Per-file main options" section into
* per-file input and output
* per-file input-only
* per-file output-only
* per-stream
---
 fftools/ffmpeg_opt.c | 43 ++-
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 919e1eae46..4abdd457d3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1209,12 +1209,45 @@ void show_help_default(const char *opt, const char *arg)
 show_help_options(options, "Advanced global options:", OPT_EXPERT,
   OPT_PERFILE | OPT_EXIT);
 
-show_help_options(options, "Per-file main options:", OPT_PERFILE,
-  OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA |
-  OPT_EXIT);
+show_help_options(options, "Per-file options (input and output):",
+  OPT_PERFILE | OPT_INPUT | OPT_OUTPUT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM | OPT_EXPERT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
 if (show_advanced)
-show_help_options(options, "Advanced per-file options:",
-  OPT_EXPERT | OPT_PERFILE, OPT_AUDIO | OPT_VIDEO | 
OPT_SUBTITLE);
+show_help_options(options, "Advanced per-file options (input and 
output):",
+  OPT_PERFILE | OPT_INPUT | OPT_OUTPUT | OPT_EXPERT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+
+show_help_options(options, "Per-file options (input-only):",
+  OPT_PERFILE | OPT_INPUT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM | OPT_OUTPUT | OPT_EXPERT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+if (show_advanced)
+show_help_options(options, "Advanced per-file options (input-only):",
+  OPT_PERFILE | OPT_INPUT | OPT_EXPERT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM | OPT_OUTPUT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+
+show_help_options(options, "Per-file options (output-only):",
+  OPT_PERFILE | OPT_OUTPUT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM | OPT_INPUT | OPT_EXPERT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+if (show_advanced)
+show_help_options(options, "Advanced per-file options (output-only):",
+  OPT_PERFILE | OPT_OUTPUT | OPT_EXPERT,
+  OPT_EXIT | OPT_FLAG_PERSTREAM | OPT_INPUT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+
+show_help_options(options, "Per-stream options:",
+  OPT_FLAG_PERSTREAM,
+  OPT_EXIT | OPT_EXPERT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
+if (show_advanced)
+show_help_options(options, "Advanced per-stream options:",
+  OPT_FLAG_PERSTREAM | OPT_EXPERT,
+  OPT_EXIT |
+  OPT_VIDEO | OPT_AUDIO | OPT_SUBTITLE | OPT_DATA);
 
 show_help_options(options, "Video options:",
   OPT_VIDEO, OPT_EXPERT | OPT_AUDIO | OPT_SUBTITLE | 
OPT_DATA);
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 6/8] fftools/ffmpeg_opt: briefly mention stream specifier syntax in help output

2024-01-17 Thread Anton Khirnov
---
 fftools/ffmpeg_opt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 4abdd457d3..bdb71d4283 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1194,6 +1194,9 @@ void show_help_default(const char *opt, const char *arg)
"-h full -- print all options (including all format and codec 
specific options, very long)\n"
"-h type=name -- print all options for the named 
decoder/encoder/demuxer/muxer/filter/bsf/protocol\n"
"See man %s for detailed description of the options.\n"
+   "\n"
+   "Per-stream options can be followed by : to apply that 
option to specific streams only. "
+   " can be a stream index, or v/a/s for 
video/audio/subtitle (see manual for full syntax).\n"
"\n", program_name);
 
 show_help_options(options, "Print help / information / capabilities:",
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/8] fftools/cmdutils: add a flag for per-stream options

2024-01-17 Thread Anton Khirnov
Not all OPT_SPEC options are per-stream, this will allow identifying
those that are, which will be useful in following commits.
---
 fftools/cmdutils.h   |  13 +++--
 fftools/ffmpeg_opt.c | 118 +--
 2 files changed, 68 insertions(+), 63 deletions(-)

diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 8fa5ad4fc7..0c3b475876 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -158,17 +158,22 @@ typedef struct OptionDef {
Always use as OPT_SPEC in option definitions. */
 #define OPT_FLAG_SPEC   (1 << 9)
 #define OPT_SPEC(OPT_FLAG_SPEC | OPT_OFFSET)
+
+/* Option applies per-stream (implies OPT_SPEC). */
+#define OPT_FLAG_PERSTREAM  (1 << 10)
+#define OPT_PERSTREAM   (OPT_FLAG_PERSTREAM | OPT_SPEC)
+
 /* ffmpeg-only - specifies whether an OPT_PERFILE option applies to input,
  * output, or both. */
-#define OPT_INPUT   (1 << 10)
-#define OPT_OUTPUT  (1 << 11)
+#define OPT_INPUT   (1 << 11)
+#define OPT_OUTPUT  (1 << 12)
 
 /* This option is a "canonical" form, to which one or more alternatives
  * exist. These alternatives are listed in u1.names_alt. */
-#define OPT_HAS_ALT (1 << 12)
+#define OPT_HAS_ALT (1 << 13)
 /* This option is an alternative form of some other option, whose
  * name is stored in u1.name_canon */
-#define OPT_HAS_CANON   (1 << 13)
+#define OPT_HAS_CANON   (1 << 14)
 
  union {
 void *dst_ptr;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 6b16d92a87..4a0d126aca 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1456,15 +1456,15 @@ const OptionDef options[] = {
 { "recast_media",   OPT_TYPE_BOOL, OPT_EXPERT,
 {  _media },
 "allow recasting stream type in order to force a decoder of different 
media type" },
-{ "c",  OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | 
OPT_OUTPUT | OPT_HAS_CANON,
+{ "c",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | 
OPT_OUTPUT | OPT_HAS_CANON,
 { .off   = OFFSET(codec_names) },
 "codec name", "codec",
 .u1.name_canon = "codec", },
-{ "codec",  OPT_TYPE_STRING, OPT_SPEC | OPT_INPUT | 
OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
+{ "codec",  OPT_TYPE_STRING, OPT_PERSTREAM | OPT_INPUT | 
OPT_OUTPUT | OPT_EXPERT | OPT_HAS_ALT,
 { .off   = OFFSET(codec_names) },
 "codec name", "codec",
 .u1.names_alt = alt_codec, },
-{ "pre",OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT | 
OPT_EXPERT | OPT_HAS_ALT,
+{ "pre",OPT_TYPE_STRING, OPT_PERSTREAM | OPT_OUTPUT | 
OPT_EXPERT | OPT_HAS_ALT,
 { .off   = OFFSET(presets) },
 "preset name", "preset",
 .u1.names_alt = alt_pre, },
@@ -1507,7 +1507,7 @@ const OptionDef options[] = {
 { "itsoffset",  OPT_TYPE_TIME, OPT_OFFSET | OPT_EXPERT | 
OPT_INPUT,
 { .off = OFFSET(input_ts_offset) },
 "set the input ts offset", "time_off" },
-{ "itsscale",   OPT_TYPE_DOUBLE, OPT_SPEC | OPT_EXPERT | 
OPT_INPUT,
+{ "itsscale",   OPT_TYPE_DOUBLE, OPT_PERSTREAM | OPT_EXPERT | 
OPT_INPUT,
 { .off = OFFSET(ts_scale) },
 "set the input ts scale", "scale" },
 { "timestamp",  OPT_TYPE_FUNC,   OPT_FUNC_ARG | OPT_PERFILE | 
OPT_EXPERT | OPT_OUTPUT,
@@ -1581,7 +1581,7 @@ const OptionDef options[] = {
 { "bitexact",   OPT_TYPE_BOOL, OPT_EXPERT | OPT_OFFSET | 
OPT_OUTPUT | OPT_INPUT,
 { .off = OFFSET(bitexact) },
 "bitexact mode" },
-{ "apad",   OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | 
OPT_OUTPUT,
+{ "apad",   OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | 
OPT_OUTPUT,
 { .off = OFFSET(apad) },
 "audio pad", "" },
 { "dts_delta_threshold",OPT_TYPE_FLOAT, OPT_EXPERT,
@@ -1596,21 +1596,21 @@ const OptionDef options[] = {
 { "abort_on",   OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
 { .func_arg = opt_abort_on },
 "abort on the specified condition flags", "flags" },
-{ "copyinkf",   OPT_TYPE_BOOL, OPT_EXPERT | OPT_SPEC | 
OPT_OUTPUT,
+{ "copyinkf",   OPT_TYPE_BOOL, OPT_EXPERT | OPT_PERSTREAM | 
OPT_OUTPUT,
 { .off = OFFSET(copy_initial_nonkeyframes) },
 "copy initial non-keyframes" },
-{ "copypriorss",OPT_TYPE_INT, OPT_EXPERT | OPT_SPEC | 
OPT_OUTPUT,
+{ "copypriorss",OPT_TYPE_INT, OPT_EXPERT | OPT_PERSTREAM | 
OPT_OUTPUT,
 { .off = OFFSET(copy_prior_start) },
 "copy or discard frames before start time" },
-{ "frames", OPT_TYPE_INT64, OPT_SPEC | OPT_OUTPUT | 
OPT_EXPERT | OPT_HAS_ALT,
+{ "frames", OPT_TYPE_INT64, OPT_PERSTREAM | OPT_OUTPUT | 
OPT_EXPERT | OPT_HAS_ALT,
 { .off = OFFSET(max_frames) },
 "set the number of frames to 

[FFmpeg-devel] [PATCH 7/8] fftools/cmdutils: surround option arguments by <> in help output

2024-01-17 Thread Anton Khirnov
Makes it more clear that they are placeholders for actual values.
---
 fftools/cmdutils.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f652820184..daf7673adb 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -132,10 +132,9 @@ void show_help_options(const OptionDef *options, const 
char *msg, int req_flags,
 else if (po->flags & OPT_FLAG_SPEC)
 av_strlcat(buf, "[:]", sizeof(buf));
 
-if (po->argname) {
-av_strlcat(buf, " ", sizeof(buf));
-av_strlcat(buf, po->argname, sizeof(buf));
-}
+if (po->argname)
+av_strlcatf(buf, sizeof(buf), " <%s>", po->argname);
+
 printf("-%-17s  %s\n", buf, po->help);
 }
 printf("\n");
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 5/8] fftools/cmdutils: indicate specifiers in option syntax in help output

2024-01-17 Thread Anton Khirnov
---
 fftools/cmdutils.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index be01372743..f652820184 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -126,6 +126,12 @@ void show_help_options(const OptionDef *options, const 
char *msg, int req_flags,
 first = 0;
 }
 av_strlcpy(buf, po->name, sizeof(buf));
+
+if (po->flags & OPT_FLAG_PERSTREAM)
+av_strlcat(buf, "[:]", sizeof(buf));
+else if (po->flags & OPT_FLAG_SPEC)
+av_strlcat(buf, "[:]", sizeof(buf));
+
 if (po->argname) {
 av_strlcat(buf, " ", sizeof(buf));
 av_strlcat(buf, po->argname, sizeof(buf));
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/8] fftools/cmdutils: hide some information listing options from basic help

2024-01-17 Thread Anton Khirnov
They are for advanced usage only and should not clutter basic output.
---
 fftools/ffmpeg_opt.c |  7 +--
 fftools/opt_common.h | 24 
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 1978f438fe..6b16d92a87 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1197,7 +1197,10 @@ void show_help_default(const char *opt, const char *arg)
"\n", program_name);
 
 show_help_options(options, "Print help / information / capabilities:",
-  OPT_EXIT, 0, 0);
+  OPT_EXIT, OPT_EXPERT, 0);
+if (show_advanced)
+show_help_options(options, "Advanced information / capabilities:",
+  OPT_EXIT | OPT_EXPERT, 0, 0);
 
 show_help_options(options, "Global options (affect whole program "
   "instead of just one file):",
@@ -1806,7 +1809,7 @@ const OptionDef options[] = {
 { "hwaccel_output_format",  OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | 
OPT_SPEC | OPT_INPUT,
 { .off = OFFSET(hwaccel_output_formats) },
 "select output format used with HW accelerated decoding", "format" },
-{ "hwaccels",   OPT_TYPE_FUNC,   OPT_EXIT,
+{ "hwaccels",   OPT_TYPE_FUNC,   OPT_EXIT | OPT_EXPERT,
 { .func_arg = show_hwaccels },
 "show available HW acceleration methods" },
 { "autorotate", OPT_TYPE_BOOL,   OPT_SPEC | OPT_EXPERT | 
OPT_INPUT,
diff --git a/fftools/opt_common.h b/fftools/opt_common.h
index 36c591cc94..9bb5268472 100644
--- a/fftools/opt_common.h
+++ b/fftools/opt_common.h
@@ -41,9 +41,9 @@ int show_sources(void *optctx, const char *opt, const char 
*arg);
 
 #if CONFIG_AVDEVICE
 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE   
 \
-{ "sources", OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = 
show_sources },  \
+{ "sources", OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { 
.func_arg = show_sources }, \
   "list sources of the input device", "device" },  
 \
-{ "sinks"  , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG, { .func_arg = 
show_sinks },\
+{ "sinks"  , OPT_TYPE_FUNC, OPT_EXIT | OPT_FUNC_ARG | OPT_EXPERT, { 
.func_arg = show_sinks },   \
   "list sinks of the output device", "device" },   
 \
 
 #else
@@ -199,26 +199,26 @@ int opt_cpucount(void *optctx, const char *opt, const 
char *arg);
 #define CMDUTILS_COMMON_OPTIONS
 \
 { "L",OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_license }, "show license" },  \
 { "h",OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_help },"show help", "topic" },\
-{ "?",OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_help },"show help", "topic" },\
-{ "help", OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_help },"show help", "topic" },\
-{ "-help",OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_help },"show help", "topic" },\
+{ "?",OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = 
show_help },"show help", "topic" },\
+{ "help", OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = 
show_help },"show help", "topic" },\
+{ "-help",OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = 
show_help },"show help", "topic" },\
 { "version",  OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_version }, "show version" },  \
-{ "buildconf",OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_buildconf },   "show build configuration" },  \
-{ "formats",  OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_formats }, "show available formats" },\
+{ "buildconf",OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = 
show_buildconf },   "show build configuration" },  \
+{ "formats",  OPT_TYPE_FUNC, OPT_EXIT | OPT_EXPERT, { .func_arg = 
show_formats }, "show available formats" },\
 { "muxers",   OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_muxers },  "show available muxers" }, \
 { "demuxers", OPT_TYPE_FUNC, OPT_EXIT,  { .func_arg = 
show_demuxers },"show available demuxers" },   \
 

[FFmpeg-devel] [PATCH 3/8] fftools/cmdutils: drop alt_flags parameter from show_help_options()

2024-01-17 Thread Anton Khirnov
No user sets it to more than one flag, so it is redundant with
req_flags.
---
 fftools/cmdutils.c   |  3 +--
 fftools/cmdutils.h   |  3 +--
 fftools/ffmpeg_opt.c | 28 ++--
 fftools/ffplay.c |  4 ++--
 fftools/ffprobe.c|  2 +-
 5 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index d7d5ddee45..be01372743 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -108,7 +108,7 @@ int parse_number(const char *context, const char *numstr, 
enum OptionType type,
 }
 
 void show_help_options(const OptionDef *options, const char *msg, int 
req_flags,
-   int rej_flags, int alt_flags)
+   int rej_flags)
 {
 const OptionDef *po;
 int first;
@@ -118,7 +118,6 @@ void show_help_options(const OptionDef *options, const char 
*msg, int req_flags,
 char buf[128];
 
 if (((po->flags & req_flags) != req_flags) ||
-(alt_flags && !(po->flags & alt_flags)) ||
 (po->flags & rej_flags))
 continue;
 
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 0c3b475876..69e253c6ef 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -200,10 +200,9 @@ typedef struct OptionDef {
  * @param msg title of this group. Only printed if at least one option matches.
  * @param req_flags print only options which have all those flags set.
  * @param rej_flags don't print options which have any of those flags set.
- * @param alt_flags print only options that have at least one of those flags 
set
  */
 void show_help_options(const OptionDef *options, const char *msg, int 
req_flags,
-   int rej_flags, int alt_flags);
+   int rej_flags);
 
 /**
  * Show help for all options with given flags in class and all its
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 4a0d126aca..919e1eae46 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1197,46 +1197,46 @@ void show_help_default(const char *opt, const char *arg)
"\n", program_name);
 
 show_help_options(options, "Print help / information / capabilities:",
-  OPT_EXIT, OPT_EXPERT, 0);
+  OPT_EXIT, OPT_EXPERT);
 if (show_advanced)
 show_help_options(options, "Advanced information / capabilities:",
-  OPT_EXIT | OPT_EXPERT, 0, 0);
+  OPT_EXIT | OPT_EXPERT, 0);
 
 show_help_options(options, "Global options (affect whole program "
   "instead of just one file):",
-  0, OPT_PERFILE | OPT_EXIT | OPT_EXPERT, 0);
+  0, OPT_PERFILE | OPT_EXIT | OPT_EXPERT);
 if (show_advanced)
 show_help_options(options, "Advanced global options:", OPT_EXPERT,
-  OPT_PERFILE | OPT_EXIT, 0);
+  OPT_PERFILE | OPT_EXIT);
 
-show_help_options(options, "Per-file main options:", 0,
+show_help_options(options, "Per-file main options:", OPT_PERFILE,
   OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA |
-  OPT_EXIT, OPT_PERFILE);
+  OPT_EXIT);
 if (show_advanced)
 show_help_options(options, "Advanced per-file options:",
-  OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, 
OPT_PERFILE);
+  OPT_EXPERT | OPT_PERFILE, OPT_AUDIO | OPT_VIDEO | 
OPT_SUBTITLE);
 
 show_help_options(options, "Video options:",
-  OPT_VIDEO, OPT_EXPERT | OPT_AUDIO | OPT_SUBTITLE | 
OPT_DATA, 0);
+  OPT_VIDEO, OPT_EXPERT | OPT_AUDIO | OPT_SUBTITLE | 
OPT_DATA);
 if (show_advanced)
 show_help_options(options, "Advanced Video options:",
-  OPT_EXPERT | OPT_VIDEO, OPT_AUDIO | OPT_SUBTITLE | 
OPT_DATA, 0);
+  OPT_EXPERT | OPT_VIDEO, OPT_AUDIO | OPT_SUBTITLE | 
OPT_DATA);
 
 show_help_options(options, "Audio options:",
-  OPT_AUDIO, OPT_EXPERT | OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA, 0);
+  OPT_AUDIO, OPT_EXPERT | OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA);
 if (show_advanced)
 show_help_options(options, "Advanced Audio options:",
-  OPT_EXPERT | OPT_AUDIO, OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA, 0);
+  OPT_EXPERT | OPT_AUDIO, OPT_VIDEO | OPT_SUBTITLE | 
OPT_DATA);
 
 show_help_options(options, "Subtitle options:",
-  OPT_SUBTITLE, OPT_EXPERT | OPT_VIDEO | OPT_AUDIO | 
OPT_DATA, 0);
+  OPT_SUBTITLE, OPT_EXPERT | OPT_VIDEO | OPT_AUDIO | 
OPT_DATA);
 if (show_advanced)
 show_help_options(options, "Advanced Subtitle options:",
-  OPT_EXPERT | OPT_SUBTITLE, OPT_VIDEO | OPT_AUDIO | 
OPT_DATA, 0);
+  OPT_EXPERT | OPT_SUBTITLE, OPT_VIDEO | 

Re: [FFmpeg-devel] [PATCH 1/6] fftools/ffprobe: make option strings dynamically allocated

2024-01-17 Thread Anton Khirnov
Quoting Zhao Zhili (2024-01-17 12:22:10)
> 
> 
> > On Jan 17, 2024, at 17:22, Anton Khirnov  wrote:
> > 
> > Do not store the supplied arg pointer directly. While that is valid for
> > now, arg will become ephemeral in the future commits.
> > ---
> > fftools/ffprobe.c | 18 +-
> > 1 file changed, 13 insertions(+), 5 deletions(-)
> > 
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index f00ba48620..3a7aae3572 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -3827,8 +3827,10 @@ static int opt_input_file(void *optctx, const char 
> > *arg)
> > return AVERROR(EINVAL);
> > }
> > if (!strcmp(arg, "-"))
> > -arg = "fd:";
> > -input_filename = arg;
> > +arg = "pipe:";
> 
> Does the change of protocol on purpose, and why?

Good catch, it was a rebase fail.

Fixed locally.

Thanks,
-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/6] fftools/ffprobe: make option strings dynamically allocated

2024-01-17 Thread Zhao Zhili



> On Jan 17, 2024, at 17:22, Anton Khirnov  wrote:
> 
> Do not store the supplied arg pointer directly. While that is valid for
> now, arg will become ephemeral in the future commits.
> ---
> fftools/ffprobe.c | 18 +-
> 1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index f00ba48620..3a7aae3572 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -3827,8 +3827,10 @@ static int opt_input_file(void *optctx, const char 
> *arg)
> return AVERROR(EINVAL);
> }
> if (!strcmp(arg, "-"))
> -arg = "fd:";
> -input_filename = arg;
> +arg = "pipe:";

Does the change of protocol on purpose, and why?

> +input_filename = av_strdup(arg);
> +if (!input_filename)
> +return AVERROR(ENOMEM);
> 
> return 0;
> }
> @@ -3849,15 +3851,18 @@ static int opt_output_file_o(void *optctx, const char 
> *opt, const char *arg)
> }
> if (!strcmp(arg, "-"))
> arg = "fd:";
> -output_filename = arg;
> +output_filename = av_strdup(arg);
> +if (!output_filename)
> +return AVERROR(ENOMEM);
> 
> return 0;
> }
> 
> static int opt_print_filename(void *optctx, const char *opt, const char *arg)
> {
> -print_input_filename = arg;
> -return 0;
> +av_freep(_input_filename);
> +print_input_filename = av_strdup(arg);
> +return print_input_filename ? 0 : AVERROR(ENOMEM);
> }
> 
> void show_help_default(const char *opt, const char *arg)
> @@ -4287,6 +4292,9 @@ int main(int argc, char **argv)
> 
> end:
> av_freep(_format);
> +av_freep(_filename);
> +av_freep(_filename);
> +av_freep(_input_filename);
> av_freep(_intervals);
> av_hash_freep();
> 
> -- 
> 2.42.0
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 5/6] fftools/ffmpeg: deprecate -filter_complex_script

2024-01-17 Thread Anton Khirnov
It is equivalent to -/filter_complex.
---
 doc/ffmpeg.texi |  9 +
 doc/filters.texi|  3 +--
 fftools/ffmpeg.h|  1 +
 fftools/ffmpeg_opt.c|  9 -
 tests/fate/ffmpeg.mak   |  2 +-
 tests/fate/filter-audio.mak |  8 
 tests/fate/filter-video.mak | 26 +-
 tests/fate/mov.mak  |  4 ++--
 8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index e7d026ebf5..31a2b90b34 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1675,8 +1675,7 @@ Set the size of the canvas used to render subtitles.
 Create one or more streams in the output file. This option has two forms for
 specifying the data source(s): the first selects one or more streams from some
 input file (specified with @code{-i}), the second takes an output from some
-complex filtergraph (specified with @code{-filter_complex} or
-@code{-filter_complex_script}).
+complex filtergraph (specified with @code{-filter_complex}).
 
 In the first form, an output stream is created for every stream from the input
 file with the index @var{input_file_id}. If @var{stream_specifier} is given,
@@ -2207,12 +2206,6 @@ The default is the number of available CPUs.
 Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
 outputs. Equivalent to @option{-filter_complex}.
 
-@anchor{filter_complex_script option}
-@item -filter_complex_script @var{filename} (@emph{global})
-This option is similar to @option{-filter_complex}, the only difference is that
-its argument is the name of the file from which a complex filtergraph
-description is to be read.
-
 @item -accurate_seek (@emph{input})
 This option enables or disables accurate seeking in input files with the
 @option{-ss} option. It is enabled by default, so seeking is accurate when
diff --git a/doc/filters.texi b/doc/filters.texi
index 20c91bab3a..6ec7d54b5f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -308,8 +308,7 @@ use the @option{textfile} option in place of @option{text} 
to specify the text
 to render.
 
 When using the @command{ffmpeg} tool, you might consider to use the
-@ref{filter_script option,,-filter_script option,ffmpeg} or
-@ref{filter_complex_script option,,-filter_complex_script option,ffmpeg}.
+@ref{filter_script option,,-filter_script option,ffmpeg}.
 
 @chapter Timeline editing
 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index cdde3c2c03..c73fb91c14 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -62,6 +62,7 @@
 #define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
 #define FFMPEG_OPT_VSYNC_DROP 1
 #define FFMPEG_OPT_VSYNC 1
+#define FFMPEG_OPT_FILTER_SCRIPT 1
 
 #define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index ffb2c42421..d5bc7e9c8b 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1158,6 +1158,7 @@ static int opt_filter_complex(void *optctx, const char 
*opt, const char *arg)
 return fg_create(NULL, graph_desc, sch);
 }
 
+#if FFMPEG_OPT_FILTER_SCRIPT
 static int opt_filter_complex_script(void *optctx, const char *opt, const char 
*arg)
 {
 Scheduler *sch = optctx;
@@ -1165,8 +1166,12 @@ static int opt_filter_complex_script(void *optctx, const 
char *opt, const char *
 if (!graph_desc)
 return AVERROR(EINVAL);
 
+av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -/filter_complex %s 
instead\n",
+   opt, arg);
+
 return fg_create(NULL, graph_desc, sch);
 }
+#endif
 
 void show_help_default(const char *opt, const char *arg)
 {
@@ -1635,9 +1640,11 @@ const OptionDef options[] = {
 { "lavfi",   OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
 { .func_arg = opt_filter_complex },
 "create a complex filtergraph", "graph_description" },
+#if FFMPEG_OPT_FILTER_SCRIPT
 { "filter_complex_script", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
 { .func_arg = opt_filter_complex_script },
-"read complex filtergraph description from a file", "filename" },
+"deprecated, use -/filter_complex instead", "filename" },
+#endif
 { "auto_conversion_filters", OPT_TYPE_BOOL, OPT_EXPERT,
 { _conversion_filters },
 "enable automatic conversion filters globally" },
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index df955df4d0..84489e9fea 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -36,7 +36,7 @@ fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i 
$(TARGET_SAMPLES)/lossles
 
 FATE_SAMPLES_FFMPEG-$(call FILTERDEMDEC, COLORKEY OVERLAY SCALE, MPEGPS 
IMAGE_PPM_PIPE, CAVS PPM, CAVSVIDEO_PARSER) += fate-ffmpeg-filter_colorkey
 fate-ffmpeg-filter_colorkey: tests/data/filtergraphs/colorkey
-fate-ffmpeg-filter_colorkey: CMD = framecrc -auto_conversion_filters -idct 
simple -fflags +bitexact -flags +bitexact  -sws_flags +accurate_rnd+bitexact -i 
$(TARGET_SAMPLES)/cavs/cavs.mpg -fflags +bitexact -flags +bitexact 

[FFmpeg-devel] [PATCH 6/6] fftools/ffmpeg: deprecate -filter_script

2024-01-17 Thread Anton Khirnov
It is equivalent to -/filter.
---
 doc/ffmpeg.texi |  6 --
 doc/filters.texi|  3 ---
 fftools/ffmpeg.h|  2 ++
 fftools/ffmpeg_mux_init.c   | 36 ++--
 fftools/ffmpeg_opt.c|  4 +++-
 tests/fate/filter-audio.mak |  2 +-
 tests/fate/filter-video.mak |  6 +++---
 7 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 31a2b90b34..f58103810a 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -977,12 +977,6 @@ syntax.
 See the @ref{filter_complex_option,,-filter_complex option} if you
 want to create filtergraphs with multiple inputs and/or outputs.
 
-@anchor{filter_script option}
-@item -filter_script[:@var{stream_specifier}] @var{filename} 
(@emph{output,per-stream})
-This option is similar to @option{-filter}, the only difference is that its
-argument is the name of the file from which a filtergraph description is to be
-read.
-
 @item -reinit_filter[:@var{stream_specifier}] @var{integer} 
(@emph{input,per-stream})
 This boolean option determines if the filtergraph(s) to which this stream is 
fed gets
 reinitialized when input frame parameters change mid-stream. This option is 
enabled by
diff --git a/doc/filters.texi b/doc/filters.texi
index 6ec7d54b5f..1d70f4d934 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -307,9 +307,6 @@ For example, in case of the @ref{drawtext,,drawtext 
filter}, you might prefer to
 use the @option{textfile} option in place of @option{text} to specify the text
 to render.
 
-When using the @command{ffmpeg} tool, you might consider to use the
-@ref{filter_script option,,-filter_script option,ffmpeg}.
-
 @chapter Timeline editing
 
 Some filters support a generic @option{enable} option. For the filters
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index c73fb91c14..3014a626b4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -221,7 +221,9 @@ typedef struct OptionsContext {
 SpecifierOptList copy_initial_nonkeyframes;
 SpecifierOptList copy_prior_start;
 SpecifierOptList filters;
+#if FFMPEG_OPT_FILTER_SCRIPT
 SpecifierOptList filter_scripts;
+#endif
 SpecifierOptList reinit_filters;
 SpecifierOptList fix_sub_duration;
 SpecifierOptList fix_sub_duration_heartbeat;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 80109df0ae..5422a64cbc 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -415,36 +415,58 @@ static MuxStream *mux_stream_alloc(Muxer *mux, enum 
AVMediaType type)
 static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc,
OutputStream *ost, char **dst)
 {
-const char *filters = NULL, *filters_script = NULL;
+const char *filters = NULL;
+#if FFMPEG_OPT_FILTER_SCRIPT
+const char *filters_script = NULL;
 
 MATCH_PER_STREAM_OPT(filter_scripts, str, filters_script, oc, ost->st);
+#endif
 MATCH_PER_STREAM_OPT(filters,str, filters,oc, ost->st);
 
 if (!ost->enc) {
-if (filters_script || filters) {
+if (
+#if FFMPEG_OPT_FILTER_SCRIPT
+filters_script ||
+#endif
+filters) {
 av_log(ost, AV_LOG_ERROR,
"%s '%s' was specified, but codec copy was selected. "
"Filtering and streamcopy cannot be used together.\n",
+#if FFMPEG_OPT_FILTER_SCRIPT
filters ? "Filtergraph" : "Filtergraph script",
-   filters ? filters : filters_script);
+   filters ? filters : filters_script
+#else
+   "Filtergraph", filters
+#endif
+   );
 return AVERROR(ENOSYS);
 }
 return 0;
 }
 
 if (!ost->ist) {
-if (filters_script || filters) {
+if (
+#if FFMPEG_OPT_FILTER_SCRIPT
+filters_script ||
+#endif
+filters) {
 av_log(ost, AV_LOG_ERROR,
"%s '%s' was specified for a stream fed from a complex "
"filtergraph. Simple and complex filtering cannot be used "
"together for the same stream.\n",
+#if FFMPEG_OPT_FILTER_SCRIPT
filters ? "Filtergraph" : "Filtergraph script",
-   filters ? filters : filters_script);
+   filters ? filters : filters_script
+#else
+   "Filtergraph", filters
+#endif
+   );
 return AVERROR(EINVAL);
 }
 return 0;
 }
 
+#if FFMPEG_OPT_FILTER_SCRIPT
 if (filters_script && filters) {
 av_log(ost, AV_LOG_ERROR, "Both -filter and -filter_script set\n");
 return AVERROR(EINVAL);
@@ -452,7 +474,9 @@ static int ost_get_filters(const OptionsContext *o, 
AVFormatContext *oc,
 
 if (filters_script)
 *dst = file_read(filters_script);
-else if (filters)
+else
+#endif
+if (filters)
 *dst = av_strdup(filters);
 else
 *dst 

[FFmpeg-devel] [PATCH 3/6] fftools/ffmpeg: make attachment filenames dynamically allocated

2024-01-17 Thread Anton Khirnov
Do not store the supplied arg pointer directly. While that is valid for
now, it will become ephemeral in the future commits.
---
 fftools/ffmpeg_opt.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index ea995f2b5f..563f443bd8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -124,6 +124,9 @@ static void uninit_options(OptionsContext *o)
 #if FFMPEG_OPT_MAP_CHANNEL
 av_freep(>audio_channel_maps);
 #endif
+
+for (i = 0; i < o->nb_attachments; i++)
+av_freep(>attachments[i]);
 av_freep(>attachments);
 
 av_dict_free(>streamid);
@@ -494,7 +497,10 @@ static int opt_attach(void *optctx, const char *opt, const 
char *arg)
 if (ret < 0)
 return ret;
 
-o->attachments[o->nb_attachments - 1] = arg;
+o->attachments[o->nb_attachments - 1] = av_strdup(arg);
+if (!o->attachments[o->nb_attachments - 1])
+return AVERROR(ENOMEM);
+
 return 0;
 }
 
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/6] fftools/ffprobe: make option strings dynamically allocated

2024-01-17 Thread Anton Khirnov
Do not store the supplied arg pointer directly. While that is valid for
now, arg will become ephemeral in the future commits.
---
 fftools/ffprobe.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f00ba48620..3a7aae3572 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3827,8 +3827,10 @@ static int opt_input_file(void *optctx, const char *arg)
 return AVERROR(EINVAL);
 }
 if (!strcmp(arg, "-"))
-arg = "fd:";
-input_filename = arg;
+arg = "pipe:";
+input_filename = av_strdup(arg);
+if (!input_filename)
+return AVERROR(ENOMEM);
 
 return 0;
 }
@@ -3849,15 +3851,18 @@ static int opt_output_file_o(void *optctx, const char 
*opt, const char *arg)
 }
 if (!strcmp(arg, "-"))
 arg = "fd:";
-output_filename = arg;
+output_filename = av_strdup(arg);
+if (!output_filename)
+return AVERROR(ENOMEM);
 
 return 0;
 }
 
 static int opt_print_filename(void *optctx, const char *opt, const char *arg)
 {
-print_input_filename = arg;
-return 0;
+av_freep(_input_filename);
+print_input_filename = av_strdup(arg);
+return print_input_filename ? 0 : AVERROR(ENOMEM);
 }
 
 void show_help_default(const char *opt, const char *arg)
@@ -4287,6 +4292,9 @@ int main(int argc, char **argv)
 
 end:
 av_freep(_format);
+av_freep(_filename);
+av_freep(_filename);
+av_freep(_input_filename);
 av_freep(_intervals);
 av_hash_freep();
 
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/6] fftools/cmdutils: add option syntax for loading arbitrary arguments from a file

2024-01-17 Thread Anton Khirnov
Aligned with analogous feature for filter options in ffmpeg CLI.
---
 Changelog|  2 +
 doc/fftools-common-opts.texi |  9 
 fftools/cmdutils.c   | 99 ++--
 fftools/cmdutils.h   |  3 ++
 fftools/ffmpeg.h |  1 -
 fftools/ffmpeg_opt.c | 26 --
 6 files changed, 97 insertions(+), 43 deletions(-)

diff --git a/Changelog b/Changelog
index 6b7c1439cd..c40b6d08fd 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,8 @@ version :
 - fsync filter
 - Raw Captions with Time (RCWT) closed caption muxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
+- ffmpeg CLI options may now be used as -/opt , which is equivalent
+  to -opt >
 
 version 6.1:
 - libaribcaption decoder
diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index f459bfdc1d..1974d79a4c 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -13,6 +13,15 @@ corresponding value to true. They can be set to false by 
prefixing
 the option name with "no". For example using "-nofoo"
 will set the boolean option with name "foo" to false.
 
+Options that take arguments support a special syntax where the argument given 
on
+the command line is interpreted as a path to the file from which the actual
+argument value is loaded. To use this feature, add a forward slash '/'
+immediately before the option name (after the leading dash). E.g.
+@example
+ffmpeg -i INPUT -/filter:v filter.script OUTPUT
+@end example
+will load a filtergraph description from the file named @file{filter.script}.
+
 @anchor{Stream specifiers}
 @section Stream specifiers
 Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 44228ea637..d7d5ddee45 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -37,6 +37,7 @@
 #include "libswresample/swresample.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/display.h"
 #include "libavutil/getenv_utf8.h"
@@ -150,6 +151,9 @@ void show_help_children(const AVClass *class, int flags)
 
 static const OptionDef *find_option(const OptionDef *po, const char *name)
 {
+if (*name == '/')
+name++;
+
 while (po->name) {
 const char *end;
 if (av_strstart(name, po->name, ) && (!*end || *end == ':'))
@@ -239,9 +243,32 @@ static int write_option(void *optctx, const OptionDef *po, 
const char *opt,
  * a global var*/
 void *dst = po->flags & OPT_FLAG_OFFSET ?
 (uint8_t *)optctx + po->u.off : po->u.dst_ptr;
+char *arg_allocated = NULL;
+
 SpecifierOptList *sol = NULL;
 double num;
-int ret;
+int ret = 0;
+
+if (*opt == '/') {
+opt++;
+
+if (po->type == OPT_TYPE_BOOL) {
+av_log(NULL, AV_LOG_FATAL,
+   "Requested to load an argument from file for a bool option 
'%s'\n",
+   po->name);
+return AVERROR(EINVAL);
+}
+
+arg_allocated = file_read(arg);
+if (!arg_allocated) {
+av_log(NULL, AV_LOG_FATAL,
+   "Error reading the value for option '%s' from file: %s\n",
+   opt, arg);
+return AVERROR(EINVAL);
+}
+
+arg = arg_allocated;
+}
 
 if (po->flags & OPT_FLAG_SPEC) {
 char *p = strchr(opt, ':');
@@ -250,32 +277,42 @@ static int write_option(void *optctx, const OptionDef 
*po, const char *opt,
 sol = dst;
 ret = GROW_ARRAY(sol->opt, sol->nb_opt);
 if (ret < 0)
-return ret;
+goto finish;
 
 str = av_strdup(p ? p + 1 : "");
-if (!str)
-return AVERROR(ENOMEM);
+if (!str) {
+ret = AVERROR(ENOMEM);
+goto finish;
+}
 sol->opt[sol->nb_opt - 1].specifier = str;
 dst = >opt[sol->nb_opt - 1].u;
 }
 
 if (po->type == OPT_TYPE_STRING) {
 char *str;
-str = av_strdup(arg);
+if (arg_allocated) {
+str   = arg_allocated;
+arg_allocated = NULL;
+} else
+str = av_strdup(arg);
 av_freep(dst);
-if (!str)
-return AVERROR(ENOMEM);
+
+if (!str) {
+ret = AVERROR(ENOMEM);
+goto finish;
+}
+
 *(char **)dst = str;
 } else if (po->type == OPT_TYPE_BOOL || po->type == OPT_TYPE_INT) {
 ret = parse_number(opt, arg, OPT_TYPE_INT64, INT_MIN, INT_MAX, );
 if (ret < 0)
-return ret;
+goto finish;
 
 *(int *)dst = num;
 } else if (po->type == OPT_TYPE_INT64) {
 ret = parse_number(opt, arg, OPT_TYPE_INT64, INT64_MIN, INT64_MAX, 
);
 if (ret < 0)
-return ret;
+goto finish;
 
 *(int64_t *)dst = num;
 } else 

[FFmpeg-devel] [PATCH 2/6] fftools/ffplay: make option strings dynamically allocated

2024-01-17 Thread Anton Khirnov
Do not store the supplied arg pointer directly. While that is valid for
now, it will become ephemeral in the future commits.
---
 fftools/ffplay.c | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 3c378bca2c..356d061dee 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -400,7 +400,10 @@ static int opt_add_vfilter(void *optctx, const char *opt, 
const char *arg)
 if (ret < 0)
 return ret;
 
-vfilters_list[nb_vfilters - 1] = arg;
+vfilters_list[nb_vfilters - 1] = av_strdup(arg);
+if (!vfilters_list[nb_vfilters - 1])
+return AVERROR(ENOMEM);
+
 return 0;
 }
 
@@ -1305,7 +1308,13 @@ static void do_exit(VideoState *is)
 if (window)
 SDL_DestroyWindow(window);
 uninit_opts();
+for (int i = 0; i < nb_vfilters; i++)
+av_freep(_list[i]);
 av_freep(_list);
+av_freep(_codec_name);
+av_freep(_codec_name);
+av_freep(_codec_name);
+av_freep(_filename);
 avformat_network_deinit();
 if (show_status)
 printf("\n");
@@ -3594,8 +3603,10 @@ static int opt_input_file(void *optctx, const char 
*filename)
 return AVERROR(EINVAL);
 }
 if (!strcmp(filename, "-"))
-filename = "fd:";
-input_filename = filename;
+filename = "pipe:";
+input_filename = av_strdup(filename);
+if (!input_filename)
+return AVERROR(ENOMEM);
 
 return 0;
 }
@@ -3603,6 +3614,7 @@ static int opt_input_file(void *optctx, const char 
*filename)
 static int opt_codec(void *optctx, const char *opt, const char *arg)
 {
const char *spec = strchr(opt, ':');
+   const char **name;
if (!spec) {
av_log(NULL, AV_LOG_ERROR,
   "No media specifier was specified in '%s' in option '%s'\n",
@@ -3610,16 +3622,20 @@ static int opt_codec(void *optctx, const char *opt, 
const char *arg)
return AVERROR(EINVAL);
}
spec++;
+
switch (spec[0]) {
-   case 'a' :audio_codec_name = arg; break;
-   case 's' : subtitle_codec_name = arg; break;
-   case 'v' :video_codec_name = arg; break;
+   case 'a' : name = _codec_name;break;
+   case 's' : name = _codec_name; break;
+   case 'v' : name = _codec_name;break;
default:
av_log(NULL, AV_LOG_ERROR,
   "Invalid media specifier '%s' in option '%s'\n", spec, opt);
return AVERROR(EINVAL);
}
-   return 0;
+
+   av_freep(name);
+   *name = av_strdup(arg);
+   return *name ? 0 : AVERROR(ENOMEM);
 }
 
 static int dummy;
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 7/8] fftools/ffmpeg_demux: implement -bsf for input

2024-01-17 Thread Anton Khirnov
Quoting Stefano Sabatini (2024-01-06 13:12:19)
> 
> This looks spurious, since this suggests the example is about the
> listing, and it's applying a weird order of example/explanation
> (rather than the opposite).

I see nothing weird about this order, it's the standard way it is done
in most literature I encounter. I find the reverse order you're
suggesting far more weird and unnatural.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format

2024-01-17 Thread Connor Worley

Signed-off-by: Connor Worley 
---
 Changelog |   1 +
 configure |   1 +
 doc/general_contents.texi |   3 +-
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/dxvenc.c   | 362 ++
 libavcodec/version.h  |   2 +-
 7 files changed, 369 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/dxvenc.c

diff --git a/Changelog b/Changelog
index 5b2899d05b..224d84664a 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to 
youngest within each release,

 releases are sorted from youngest to oldest.
  version :
+- DXV DXT1 encoder
 - LEAD MCMP decoder
 - EVC decoding using external library libxevd
 - EVC encoding using external library libxeve
diff --git a/configure b/configure
index c8ae0a061d..21663000f8 100755
--- a/configure
+++ b/configure
@@ -2851,6 +2851,7 @@ dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
 dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
+dxv_encoder_select="texturedspenc"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
 eamad_decoder_select="aandcttables blockdsp bswapdsp"
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 8b48fed060..f269cbd1a9 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -670,7 +670,8 @@ library:
 @item Redirector@tab   @tab X
 @item RedSpark  @tab   @tab X
 @item Renderware TeXture Dictionary @tab   @tab X
-@item Resolume DXV  @tab   @tab X
+@item Resolume DXV  @tab X @tab X
+@tab Encoding is only supported for the DXT1 (Normal Quality, No 
Alpha) texture format.

 @item RF64  @tab   @tab X
 @item RL2   @tab   @tab X
 @tab Audio and video format used in some games by Entertainment 
Software Partners.

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index bb42095165..96361ac794 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -341,6 +341,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o 
dv.o dvdata.o

 OBJS-$(CONFIG_DXA_DECODER) += dxa.o
 OBJS-$(CONFIG_DXTORY_DECODER)  += dxtory.o
 OBJS-$(CONFIG_DXV_DECODER) += dxv.o
+OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o
 OBJS-$(CONFIG_EAC3_DECODER)+= eac3_data.o
 OBJS-$(CONFIG_EAC3_ENCODER)+= eac3enc.o eac3_data.o
 OBJS-$(CONFIG_EACMV_DECODER)   += eacmv.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 93ce8e3224..ef8c3a6d7d 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder;
 extern const FFCodec ff_dvvideo_decoder;
 extern const FFCodec ff_dxa_decoder;
 extern const FFCodec ff_dxtory_decoder;
+extern const FFCodec ff_dxv_encoder;
 extern const FFCodec ff_dxv_decoder;
 extern const FFCodec ff_eacmv_decoder;
 extern const FFCodec ff_eamad_decoder;
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
new file mode 100644
index 00..36ee06699d
--- /dev/null
+++ b/libavcodec/dxvenc.c
@@ -0,0 +1,362 @@
+/*
+ * Resolume DXV encoder
+ * Copyright (C) 2015 Vittorio Giovara 
+ * Copyright (C) 2015 Tom Butterworth 
+ * Copyright (C) 2018 Paul B Mahol
+ * Copyright (C) 2024 Connor Worley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
02110-1301 USA

+ */
+
+#include 
+
+#include "libavutil/crc.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+
+#include "mathops.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "codec_internal.h"
+#include "encode.h"
+#include "lzf.h"
+#include "texturedsp.h"
+#include "thread.h"
+
+#define LOOKBACK_HT_ELEMS 0x4
+#define LOOKBACK_WORDS0x20202
+
+enum DXVTextureFormat {
+DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'),
+};
+
+typedef struct HTEntry {
+uint32_t key;
+uint32_t pos;
+} HTEntry;
+
+static void ht_init(HTEntry *ht)
+{
+for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) {
+ht[i].pos = -1;
+}
+}
+
+static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
+uint32_t key, uint32_t pos)
+{
+uint32_t