[FFmpeg-devel] [PATCH] fate: Mark the tiff-zip-* tests as requiring zlib

2022-11-17 Thread Martin Storsjö
Signed-off-by: Martin Storsjö 
---
 tests/fate/image.mak | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 167c8ccf2c..42dd90feaa 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -513,12 +513,13 @@ fate-tiff-lzw-rgbf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/lzw_rgbf32le.ti
 FATE_TIFF += fate-tiff-lzw-rgbaf32le
 fate-tiff-lzw-rgbaf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/lzw_rgbaf32le.tif
 
-FATE_TIFF += fate-tiff-zip-rgbf32le
+FATE_TIFF_ZIP += fate-tiff-zip-rgbf32le
 fate-tiff-zip-rgbf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/zip_rgbf32le.tif
 
-FATE_TIFF += fate-tiff-zip-rgbaf32le
+FATE_TIFF_ZIP += fate-tiff-zip-rgbaf32le
 fate-tiff-zip-rgbaf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/zip_rgbaf32le.tif
 
+FATE_TIFF-$(call FRAMECRC, IMAGE2, TIFF, ZLIB) += $(FATE_TIFF_ZIP)
 FATE_TIFF-$(call FRAMECRC, IMAGE2, TIFF) += $(FATE_TIFF)
 
 FATE_IMAGE_FRAMECRC += $(FATE_TIFF-yes)
-- 
2.37.1 (Apple Git-137.1)

___
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/7] configure: drop support for complex functions

2022-11-17 Thread Anton Khirnov
They are not used since 520a5d33f0ea9f8838dbc7282470db700d248065.
---
 configure | 25 -
 1 file changed, 25 deletions(-)

diff --git a/configure b/configure
index e6470dc03b..868d11567b 100755
--- a/configure
+++ b/configure
@@ -1317,21 +1317,6 @@ int main(void){ $func(); }
 EOF
 }
 
-check_complexfunc(){
-log check_complexfunc "$@"
-func=$1
-narg=$2
-shift 2
-test $narg = 2 && args="f, g" || args="f * I"
-disable $func
-test_ld "cc" "$@" <
-#include 
-float foo(complex float f, complex float g) { return $func($args); }
-int main(void){ return (int) foo; }
-EOF
-}
-
 check_mathfunc(){
 log check_mathfunc "$@"
 func=$1
@@ -2224,11 +2209,6 @@ INTRINSICS_LIST="
 intrinsics_neon
 "
 
-COMPLEX_FUNCS="
-cabs
-cexp
-"
-
 MATH_FUNCS="
 atanf
 atan2f
@@ -2403,7 +2383,6 @@ HAVE_LIST="
 $(add_suffix _inline   $ARCH_EXT_LIST)
 $ARCH_FEATURES
 $BUILTIN_LIST
-$COMPLEX_FUNCS
 $HAVE_LIST_CMDLINE
 $HAVE_LIST_PUB
 $HEADERS_LIST
@@ -6541,10 +6520,6 @@ for func in $MATH_FUNCS; do
 eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
 done
 
-for func in $COMPLEX_FUNCS; do
-eval check_complexfunc $func \${${func}_args:-1}
-done
-
 # these are off by default, so fail if requested and not available
 enabled avisynth  && { require_headers "avisynth/avisynth_c.h 
avisynth/avs/version.h" &&
{ test_cpp_condition avisynth/avs/version.h 
"AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || 
AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" ||
-- 
2.35.1

___
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/7] doc/developer.texi: move editor configuration under formatting

2022-11-17 Thread Anton Khirnov
It logically belongs there.
---
 doc/developer.texi | 67 +++---
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 44da6e41af..d0e2e04a2d 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -119,6 +119,40 @@ The presentation is one inspired by 'indent -i4 -kr -nut'.
 The main priority in FFmpeg is simplicity and small code size in order to
 minimize the bug count.
 
+@subsection Vim configuration
+In order to configure Vim to follow FFmpeg formatting conventions, paste
+the following snippet into your @file{.vimrc}:
+@example
+" indentation rules for FFmpeg: 4 spaces, no tabs
+set expandtab
+set shiftwidth=4
+set softtabstop=4
+set cindent
+set cinoptions=(0
+" Allow tabs in Makefiles.
+autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
+" Trailing whitespace and tabs are forbidden, so highlight them.
+highlight ForbiddenWhitespace ctermbg=red guibg=red
+match ForbiddenWhitespace /\s\+$\|\t/
+" Do not highlight spaces at the end of line while typing on that line.
+autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@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/7] doc/developer.texi: document the use of other languages than C

2022-11-17 Thread Anton Khirnov
---
 doc/developer.texi | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 01735e07f5..44da6e41af 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -56,9 +56,9 @@ and should try to fix issues their commit causes.
 @anchor{Coding Rules}
 @chapter Coding Rules
 
-@section C language features
+@section Language
 
-FFmpeg is programmed in the ISO C99 language, extended with:
+FFmpeg is mainly programmed in the ISO C99 language, extended with:
 @itemize @bullet
 @item
 Atomic operations from C11 @file{stdatomic.h}. They are emulated on
@@ -83,6 +83,17 @@ complex numbers;
 mixed statements and declarations.
 @end itemize
 
+Other languages than C may be used in special cases:
+@itemize @bullet
+@item
+NASM is preferred for x86 SIMD or other x86 assembly. Inline assembly and
+intrinsics should be avoided, unless there is a strong reason to use them (e.g.
+code that needs to be inlined).
+
+@item
+Objective-C where required for interacting with macOS-specific interfaces.
+@end itemize
+
 @section Code formatting conventions
 
 There are the following guidelines regarding the indentation in files:
-- 
2.35.1

___
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 3/7] doc/developer.texi: update the language feature section

2022-11-17 Thread Anton Khirnov
It is currently very out of touch with reality.

* declare we are using C99 fully, rather than C90 plus extensions
* mention our use of stdatomic.h
* mention forbidden C99 features, like VLAs and complex numbers
---
 doc/developer.texi | 49 --
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 8e6d9d8730..01735e07f5 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -58,54 +58,29 @@ and should try to fix issues their commit causes.
 
 @section C language features
 
-FFmpeg is programmed in the ISO C90 language with a few additional
-features from ISO C99, namely:
-
+FFmpeg is programmed in the ISO C99 language, extended with:
 @itemize @bullet
 @item
-the @samp{inline} keyword;
-
-@item
-@samp{//} comments;
-
-@item
-designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
-
-@item
-compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
-
-@item
-for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
-
-@item
-Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ 
@}});
-
-@item
-Implementation defined behavior for signed integers is assumed to match the
-expected behavior for two's complement. Non representable values in integer
-casts are binary truncated. Shift right of signed values uses sign extension.
+Atomic operations from C11 @file{stdatomic.h}. They are emulated on
+architectures/compilers that do not support them, so all FFmpeg-internal code
+may use atomics without any extra checks. However, @file{stdatomic.h} must not
+be included in public headers, so they stay C99-compatible.
 @end itemize
 
-These features are supported by all compilers we care about, so we will not
-accept patches to remove their use unless they absolutely do not impair
-clarity and performance.
-
-All code must compile with recent versions of GCC and a number of other
-currently supported compilers. To ensure compatibility, please do not use
-additional C99 features or GCC extensions. Especially watch out for:
+Compiler-specific extensions may be used with good reason, but must not be
+depended on, i.e. the code must still compile and work with compilers lacking
+the extension.
 
+The following C99 features must not be used anywhere in the codebase:
 @itemize @bullet
 @item
-mixing statements and declarations;
-
-@item
-@samp{long long} (use @samp{int64_t} instead);
+variable-length arrays;
 
 @item
-@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
+complex numbers;
 
 @item
-GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
+mixed statements and declarations.
 @end itemize
 
 @section Code formatting conventions
-- 
2.35.1

___
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/7] doc/developer.texi: move the language feature section higher up

2022-11-17 Thread Anton Khirnov
It makes more sense to first describe the language we are using and only
then document how to format code in it, rather than the reverse.
---
 doc/developer.texi | 104 ++---
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index cf918ac6b1..8e6d9d8730 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -56,6 +56,58 @@ and should try to fix issues their commit causes.
 @anchor{Coding Rules}
 @chapter Coding Rules
 
+@section C language features
+
+FFmpeg is programmed in the ISO C90 language with a few additional
+features from ISO C99, namely:
+
+@itemize @bullet
+@item
+the @samp{inline} keyword;
+
+@item
+@samp{//} comments;
+
+@item
+designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
+
+@item
+compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
+
+@item
+for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
+
+@item
+Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ 
@}});
+
+@item
+Implementation defined behavior for signed integers is assumed to match the
+expected behavior for two's complement. Non representable values in integer
+casts are binary truncated. Shift right of signed values uses sign extension.
+@end itemize
+
+These features are supported by all compilers we care about, so we will not
+accept patches to remove their use unless they absolutely do not impair
+clarity and performance.
+
+All code must compile with recent versions of GCC and a number of other
+currently supported compilers. To ensure compatibility, please do not use
+additional C99 features or GCC extensions. Especially watch out for:
+
+@itemize @bullet
+@item
+mixing statements and declarations;
+
+@item
+@samp{long long} (use @samp{int64_t} instead);
+
+@item
+@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
+
+@item
+GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
+@end itemize
+
 @section Code formatting conventions
 
 There are the following guidelines regarding the indentation in files:
@@ -121,58 +173,6 @@ int myfunc(int my_parameter)
 ...
 @end example
 
-@section C language features
-
-FFmpeg is programmed in the ISO C90 language with a few additional
-features from ISO C99, namely:
-
-@itemize @bullet
-@item
-the @samp{inline} keyword;
-
-@item
-@samp{//} comments;
-
-@item
-designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
-
-@item
-compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
-
-@item
-for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
-
-@item
-Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ 
@}});
-
-@item
-Implementation defined behavior for signed integers is assumed to match the
-expected behavior for two's complement. Non representable values in integer
-casts are binary truncated. Shift right of signed values uses sign extension.
-@end itemize
-
-These features are supported by all compilers we care about, so we will not
-accept patches to remove their use unless they absolutely do not impair
-clarity and performance.
-
-All code must compile with recent versions of GCC and a number of other
-currently supported compilers. To ensure compatibility, please do not use
-additional C99 features or GCC extensions. Especially watch out for:
-
-@itemize @bullet
-@item
-mixing statements and declarations;
-
-@item
-@samp{long long} (use @samp{int64_t} instead);
-
-@item
-@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
-
-@item
-GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
-@end itemize
-
 @section Naming conventions
 All names should be composed with underscores (_), not CamelCase. For example,
 @samp{avfilter_get_video_buffer} is an acceptable function name and
-- 
2.35.1

___
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/7] doc/developer.texi: drop a misplaced sentence from code formatting section

2022-11-17 Thread Anton Khirnov
It describes a general development policy, not code formatting. It is
also not true, as these days we tend to prioritize correctness, safety,
and completeness over code size.
---
 doc/developer.texi | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index d0e2e04a2d..a2719e7518 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -116,9 +116,6 @@ K&R coding style is used.
 @end itemize
 The presentation is one inspired by 'indent -i4 -kr -nut'.
 
-The main priority in FFmpeg is simplicity and small code size in order to
-minimize the bug count.
-
 @subsection Vim configuration
 In order to configure Vim to follow FFmpeg formatting conventions, paste
 the following snippet into your @file{.vimrc}:
-- 
2.35.1

___
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 7/7] doc/developer.texi: extend and update naming conventions

2022-11-17 Thread Anton Khirnov
Bring it up to date with current practice, as the current text does not
cover everything. Drop the reference to unprefixed exported symbols,
which do not exist anymore.
---
 doc/developer.texi | 43 +++
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index a2719e7518..48c27f3005 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -191,39 +191,50 @@ int myfunc(int my_parameter)
 @end example
 
 @section Naming conventions
-All names should be composed with underscores (_), not CamelCase. For example,
-@samp{avfilter_get_video_buffer} is an acceptable function name and
-@samp{AVFilterGetVideo} is not. The exception from this are type names, like
-for example structs and enums; they should always be in CamelCase.
 
-There are the following conventions for naming variables and functions:
+Names of functions, variables, and struct members must be lowercase, using
+underscores (_) to separate words. For example, 
@samp{avfilter_get_video_buffer}
+is an acceptable function name and @samp{AVFilterGetVideo} is not.
 
-@itemize @bullet
-@item
-For local variables no prefix is required.
+Struct, union, enum, and typedeffed type names must use CamelCase. All structs
+and unions should be typedeffed to the same name as the struct/union tag, e.g.
+@code{typedef struct AVFoo @{ ... @} AVFoo;}. Enums are typically not
+typedeffed.
 
+Enumeration constants and macros must be UPPERCASE, except for macros
+masquerading as functions, which should use the function naming convention.
+
+All identifiers in the libraries should be namespaced as follows:
+@itemize @bullet
 @item
-For file-scope variables and functions declared as @code{static}, no prefix
-is required.
+No namespacing for identifiers with file and lower scope (e.g. local variables,
+static functions), and struct and union members,
 
 @item
-For variables and functions visible outside of file scope, but only used
-internally by a library, an @code{ff_} prefix should be used,
-e.g. @samp{ff_w64_demuxer}.
+The @code{ff_} prefix must be used for variables and functions visible outside
+of file scope, but only used internally within a single library, e.g.
+@samp{ff_w64_demuxer}. This prevents name collisions when FFmpeg is statically
+linked.
 
 @item
 For variables and functions visible outside of file scope, used internally
 across multiple libraries, use @code{avpriv_} as prefix, for example,
 @samp{avpriv_report_missing_feature}.
 
+@item
+All other internal identifiers, like private type or macro names, should be
+namespaced only to avoid possible internal conflicts. E.g. @code{H264_NAL_SPS}
+vs. @code{HEVC_NAL_SPS}.
+
 @item
 Each library has its own prefix for public symbols, in addition to the
 commonly used @code{av_} (@code{avformat_} for libavformat,
 @code{avcodec_} for libavcodec, @code{swr_} for libswresample, etc).
 Check the existing code and choose names accordingly.
-Note that some symbols without these prefixes are also exported for
-retro-compatibility reasons. These exceptions are declared in the
-@code{lib/lib.v} files.
+
+@item
+Other public identifiers (struct, union, enum, macro, type names) must use 
their
+library's public prefix (@code{AV}, @code{Sws}, or @code{Swr}).
 @end itemize
 
 Furthermore, name space reserved for the system should not be invaded.
-- 
2.35.1

___
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 02/10] fftools/ffmpeg: drop an arbitrary condition

2022-11-17 Thread Anton Khirnov
Encoding init code will currently fall back to a 25fps default when no
framerate is known or specified, but only if there is a known source
input stream. There is no good reason for this condition, so drop it.
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 25155e155e..2c4dc83f03 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2877,7 +2877,7 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
 if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
 if (!ost->frame_rate.num)
 ost->frame_rate = 
av_buffersink_get_frame_rate(ost->filter->filter);
-if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) {
+if (!ost->frame_rate.num && !ost->max_frame_rate.num) {
 ost->frame_rate = (AVRational){25, 1};
 av_log(NULL, AV_LOG_WARNING,
"No information "
-- 
2.35.1

___
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 03/10] fftools/ffmpeg: stop inventing fake source information

2022-11-17 Thread Anton Khirnov
This code was supposed to affect copying stream dispositions, but it
does not achieve that after bd2d69, since dispositions are set
earlier.
---
 fftools/ffmpeg.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2c4dc83f03..08fdd6e98f 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3170,21 +3170,6 @@ static int transcode_init(void)
 InputStream *ist;
 char error[1024] = {0};
 
-for (i = 0; i < nb_filtergraphs; i++) {
-FilterGraph *fg = filtergraphs[i];
-for (j = 0; j < fg->nb_outputs; j++) {
-OutputFilter *ofilter = fg->outputs[j];
-if (!ofilter->ost || ofilter->ost->source_index >= 0)
-continue;
-if (fg->nb_inputs != 1)
-continue;
-for (k = nb_input_streams-1; k >= 0 ; k--)
-if (fg->inputs[0]->ist == input_streams[k])
-break;
-ofilter->ost->source_index = k;
-}
-}
-
 /* init framerate emulation */
 for (i = 0; i < nb_input_files; i++) {
 InputFile *ifile = input_files[i];
-- 
2.35.1

___
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 01/10] fftools/ffmpeg: move freeing an input stream into a separate function

2022-11-17 Thread Anton Khirnov
---
 fftools/ffmpeg.c | 41 -
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index dfdfad3ce4..25155e155e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -502,6 +502,28 @@ static int decode_interrupt_cb(void *ctx)
 
 const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
 
+static void ist_free(InputStream **pist)
+{
+InputStream *ist = *pist;
+
+if (!ist)
+return;
+
+av_frame_free(&ist->decoded_frame);
+av_packet_free(&ist->pkt);
+av_dict_free(&ist->decoder_opts);
+avsubtitle_free(&ist->prev_sub.subtitle);
+av_frame_free(&ist->sub2video.frame);
+av_freep(&ist->filters);
+av_freep(&ist->hwaccel_device);
+av_freep(&ist->dts_buffer);
+
+avcodec_free_context(&ist->dec_ctx);
+avcodec_parameters_free(&ist->par);
+
+av_freep(pist);
+}
+
 static void ffmpeg_cleanup(int ret)
 {
 int i, j;
@@ -558,23 +580,8 @@ static void ffmpeg_cleanup(int ret)
 for (i = 0; i < nb_input_files; i++)
 ifile_close(&input_files[i]);
 
-for (i = 0; i < nb_input_streams; i++) {
-InputStream *ist = input_streams[i];
-
-av_frame_free(&ist->decoded_frame);
-av_packet_free(&ist->pkt);
-av_dict_free(&ist->decoder_opts);
-avsubtitle_free(&ist->prev_sub.subtitle);
-av_frame_free(&ist->sub2video.frame);
-av_freep(&ist->filters);
-av_freep(&ist->hwaccel_device);
-av_freep(&ist->dts_buffer);
-
-avcodec_free_context(&ist->dec_ctx);
-avcodec_parameters_free(&ist->par);
-
-av_freep(&input_streams[i]);
-}
+for (i = 0; i < nb_input_streams; i++)
+ist_free(&input_streams[i]);
 
 if (vstats_file) {
 if (fclose(vstats_file))
-- 
2.35.1

___
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 05/10] fftools/ffmpeg_mux_init: simplify inner loop in map_auto_{video, audio}

2022-11-17 Thread Anton Khirnov
Skip unusable streams early and do not compute any scores for them.
---
 fftools/ffmpeg_mux_init.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index e460e7603f..6db70cc852 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -869,15 +869,18 @@ static void map_auto_video(Muxer *mux, const 
OptionsContext *o)
 for (int i = 0; i < ifile->nb_streams; i++) {
 int score;
 ist = input_streams[ifile->ist_index + i];
+
+if (ist->user_set_discard == AVDISCARD_ALL ||
+ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
+continue;
+
 score = ist->st->codecpar->width * ist->st->codecpar->height
+ 1 * !!(ist->st->event_flags & 
AVSTREAM_EVENT_FLAG_NEW_PACKETS)
+ 500*!!(ist->st->disposition & 
AV_DISPOSITION_DEFAULT);
-if (ist->user_set_discard == AVDISCARD_ALL)
-continue;
 if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & 
AV_DISPOSITION_ATTACHED_PIC))
 score = 1;
-if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
-score > file_best_score) {
+
+if (score > file_best_score) {
 if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition 
& AV_DISPOSITION_ATTACHED_PIC))
 continue;
 file_best_score = score;
@@ -913,13 +916,15 @@ static void map_auto_audio(Muxer *mux, const 
OptionsContext *o)
 for (int i = 0; i < ifile->nb_streams; i++) {
 int score;
 ist = input_streams[ifile->ist_index + i];
+
+if (ist->user_set_discard == AVDISCARD_ALL ||
+ist->st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
+continue;
+
 score = ist->st->codecpar->ch_layout.nb_channels
 + 1 * !!(ist->st->event_flags & 
AVSTREAM_EVENT_FLAG_NEW_PACKETS)
 + 500*!!(ist->st->disposition & 
AV_DISPOSITION_DEFAULT);
-if (ist->user_set_discard == AVDISCARD_ALL)
-continue;
-if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
-score > file_best_score) {
+if (score > file_best_score) {
 file_best_score = score;
 file_best_idx = ifile->ist_index + i;
 }
-- 
2.35.1

___
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 06/10] fftools/ffmpeg: remove the input_streams global

2022-11-17 Thread Anton Khirnov
Replace it with an array of streams in each InputFile. This is a more
accurate reflection of the actual relationship between InputStream and
InputFile.

Analogous to what was previously done to output streams in
7ef7a22251b852faab9404c85399ba8ac5dfbdc3.
---
 fftools/ffmpeg.c  |  86 +++
 fftools/ffmpeg.h  |  16 +++--
 fftools/ffmpeg_demux.c|  71 ++
 fftools/ffmpeg_filter.c   |   7 +--
 fftools/ffmpeg_mux_init.c | 121 --
 fftools/ffmpeg_opt.c  |   4 +-
 6 files changed, 161 insertions(+), 144 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0be2715687..0944f56b80 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -141,8 +141,6 @@ unsigned nb_output_dumped = 0;
 static BenchmarkTimeStamps current_time;
 AVIOContext *progress_avio = NULL;
 
-InputStream **input_streams = NULL;
-intnb_input_streams = 0;
 InputFile   **input_files   = NULL;
 intnb_input_files   = 0;
 
@@ -279,7 +277,7 @@ static void sub2video_heartbeat(InputStream *ist, int64_t 
pts)
video frames could be accumulating in the filter graph while a filter
(possibly overlay) is desperately waiting for a subtitle frame. */
 for (i = 0; i < infile->nb_streams; i++) {
-InputStream *ist2 = input_streams[infile->ist_index + i];
+InputStream *ist2 = infile->streams[i];
 if (!ist2->sub2video.frame)
 continue;
 /* subtitles seem to be usually muxed ahead of other streams;
@@ -502,28 +500,6 @@ static int decode_interrupt_cb(void *ctx)
 
 const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
 
-static void ist_free(InputStream **pist)
-{
-InputStream *ist = *pist;
-
-if (!ist)
-return;
-
-av_frame_free(&ist->decoded_frame);
-av_packet_free(&ist->pkt);
-av_dict_free(&ist->decoder_opts);
-avsubtitle_free(&ist->prev_sub.subtitle);
-av_frame_free(&ist->sub2video.frame);
-av_freep(&ist->filters);
-av_freep(&ist->hwaccel_device);
-av_freep(&ist->dts_buffer);
-
-avcodec_free_context(&ist->dec_ctx);
-avcodec_parameters_free(&ist->par);
-
-av_freep(pist);
-}
-
 static void ffmpeg_cleanup(int ret)
 {
 int i, j;
@@ -580,9 +556,6 @@ static void ffmpeg_cleanup(int ret)
 for (i = 0; i < nb_input_files; i++)
 ifile_close(&input_files[i]);
 
-for (i = 0; i < nb_input_streams; i++)
-ist_free(&input_streams[i]);
-
 if (vstats_file) {
 if (fclose(vstats_file))
 av_log(NULL, AV_LOG_ERROR,
@@ -592,7 +565,6 @@ static void ffmpeg_cleanup(int ret)
 av_freep(&vstats_filename);
 av_freep(&filter_nbthreads);
 
-av_freep(&input_streams);
 av_freep(&input_files);
 av_freep(&output_files);
 
@@ -628,6 +600,22 @@ static OutputStream *ost_iter(OutputStream *prev)
 return NULL;
 }
 
+InputStream *ist_iter(InputStream *prev)
+{
+int if_idx  = prev ? prev->file_index : 0;
+int ist_idx = prev ? prev->st->index + 1  : 0;
+
+for (; if_idx < nb_input_files; if_idx++) {
+InputFile *f = input_files[if_idx];
+if (ist_idx < f->nb_streams)
+return f->streams[ist_idx];
+
+ist_idx = 0;
+}
+
+return NULL;
+}
+
 void remove_avoptions(AVDictionary **a, AVDictionary *b)
 {
 const AVDictionaryEntry *t = NULL;
@@ -1410,7 +1398,7 @@ static void print_final_stats(int64_t total_size)
i, f->ctx->url);
 
 for (j = 0; j < f->nb_streams; j++) {
-InputStream *ist = input_streams[f->ist_index + j];
+InputStream *ist = f->streams[j];
 enum AVMediaType type = ist->par->codec_type;
 
 total_size+= ist->data_size;
@@ -2541,10 +2529,9 @@ static enum AVPixelFormat get_format(AVCodecContext *s, 
const enum AVPixelFormat
 return *p;
 }
 
-static int init_input_stream(int ist_index, char *error, int error_len)
+static int init_input_stream(InputStream *ist, char *error, int error_len)
 {
 int ret;
-InputStream *ist = input_streams[ist_index];
 
 if (ist->decoding_needed) {
 const AVCodec *codec = ist->dec;
@@ -3163,12 +3150,12 @@ static int transcode_init(void)
 InputFile *ifile = input_files[i];
 if (ifile->readrate || ifile->rate_emu)
 for (j = 0; j < ifile->nb_streams; j++)
-input_streams[j + ifile->ist_index]->start = 
av_gettime_relative();
+ifile->streams[j]->start = av_gettime_relative();
 }
 
 /* init input streams */
-for (i = 0; i < nb_input_streams; i++)
-if ((ret = init_input_stream(i, error, sizeof(error))) < 0)
+for (ist = ist_iter(NULL); ist; ist = ist_iter(ist))
+if ((ret = init_input_stream(ist, error, sizeof(error))) < 0)
 goto dump_format;
 
 /*
@@ -3199,7 +3186,7 @@ static int transcode_init(void)
 int discard  = AVDISCARD_ALL;
 
 for (k = 0; k < p->nb_stream_indexes; k++)
- 

[FFmpeg-devel] [PATCH 09/10] fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT()

2022-11-17 Thread Anton Khirnov
Avoids conflicts, e.g. when 'i' is used in the outvar expression.
---
 fftools/ffmpeg.h | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 5fc3b2d3d4..5cae266600 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -783,26 +783,26 @@ InputStream *ist_iter(InputStream *prev);
 {\
 char namestr[128] = "";\
 const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
-for (i = 0; opt_name_##name[i]; i++)\
-av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[i], 
opt_name_##name[i+1] ? (opt_name_##name[i+2] ? ", " : " or ") : "");\
+for (int _i = 0; opt_name_##name[_i]; _i++)\
+av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], 
opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
 av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, 
only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, 
so->u.type);\
 }
 
 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
 {\
-int i, ret, matches = 0;\
+int _ret, _matches = 0;\
 SpecifierOpt *so;\
-for (i = 0; i < o->nb_ ## name; i++) {\
-char *spec = o->name[i].specifier;\
-if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
-outvar = o->name[i].u.type;\
-so = &o->name[i];\
-matches++;\
-} else if (ret < 0)\
+for (int _i = 0; _i < o->nb_ ## name; _i++) {\
+char *spec = o->name[_i].specifier;\
+if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
+outvar = o->name[_i].u.type;\
+so = &o->name[_i];\
+_matches++;\
+} else if (_ret < 0)\
 exit_program(1);\
 }\
-if (matches > 1)\
+if (_matches > 1)\
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
 }
 
-- 
2.35.1

___
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 04/10] fftools/ffmpeg: replace OutputStream.source_index with a pointer to InputStream

2022-11-17 Thread Anton Khirnov
This is simpler. The indirection via an index exists for historical
reasons that longer apply.
---
 fftools/ffmpeg.c  | 42 ++-
 fftools/ffmpeg.h  |  7 ++-
 fftools/ffmpeg_mux_init.c | 37 --
 3 files changed, 38 insertions(+), 48 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 08fdd6e98f..0be2715687 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1122,15 +1122,12 @@ static void do_video_out(OutputFile *of,
 double delta, delta0;
 double duration = 0;
 double sync_ipts = AV_NOPTS_VALUE;
-InputStream *ist = NULL;
+InputStream *ist = ost->ist;
 AVFilterContext *filter = ost->filter->filter;
 
 init_output_stream_wrapper(ost, next_picture, 1);
 sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture);
 
-if (ost->source_index >= 0)
-ist = input_streams[ost->source_index];
-
 frame_rate = av_buffersink_get_frame_rate(filter);
 if (frame_rate.num > 0 && frame_rate.den > 0)
 duration = 1/(av_q2d(frame_rate) * av_q2d(enc->time_base));
@@ -1764,9 +1761,8 @@ static void flush_encoders(void)
 static int check_output_constraints(InputStream *ist, OutputStream *ost)
 {
 OutputFile *of = output_files[ost->file_index];
-int ist_index  = input_files[ist->file_index]->ist_index + ist->st->index;
 
-if (ost->source_index != ist_index)
+if (ost->ist != ist)
 return 0;
 
 if (ost->finished & MUXER_FINISHED)
@@ -2610,13 +2606,6 @@ static int init_input_stream(int ist_index, char *error, 
int error_len)
 return 0;
 }
 
-static InputStream *get_input_stream(OutputStream *ost)
-{
-if (ost->source_index >= 0)
-return input_streams[ost->source_index];
-return NULL;
-}
-
 static int compare_int64(const void *a, const void *b)
 {
 return FFDIFFSIGN(*(const int64_t *)a, *(const int64_t *)b);
@@ -2625,7 +2614,7 @@ static int compare_int64(const void *a, const void *b)
 static int init_output_stream_streamcopy(OutputStream *ost)
 {
 OutputFile *of = output_files[ost->file_index];
-InputStream *ist = get_input_stream(ost);
+InputStream *ist = ost->ist;
 InputFile *ifile = input_files[ist->file_index];
 AVCodecParameters *par = ost->st->codecpar;
 AVCodecContext *codec_ctx;
@@ -2838,7 +2827,7 @@ static void parse_forced_key_frames(char *kf, 
OutputStream *ost,
 
 static void init_encoder_time_base(OutputStream *ost, AVRational 
default_time_base)
 {
-InputStream *ist = get_input_stream(ost);
+InputStream *ist = ost->ist;
 AVCodecContext *enc_ctx = ost->enc_ctx;
 
 if (ost->enc_timebase.num > 0) {
@@ -2862,7 +2851,7 @@ static void init_encoder_time_base(OutputStream *ost, 
AVRational default_time_ba
 
 static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
 {
-InputStream *ist = get_input_stream(ost);
+InputStream *ist = ost->ist;
 AVCodecContext *enc_ctx = ost->enc_ctx;
 AVCodecContext *dec_ctx = NULL;
 OutputFile  *of = output_files[ost->file_index];
@@ -3006,8 +2995,8 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
 case AVMEDIA_TYPE_SUBTITLE:
 enc_ctx->time_base = AV_TIME_BASE_Q;
 if (!enc_ctx->width) {
-enc_ctx->width = input_streams[ost->source_index]->par->width;
-enc_ctx->height= input_streams[ost->source_index]->par->height;
+enc_ctx->width = ost->ist->par->width;
+enc_ctx->height= ost->ist->par->height;
 }
 if (dec_ctx && dec_ctx->subtitle_header) {
 /* ASS code assumes this buffer is null terminated so add extra 
byte. */
@@ -3063,13 +3052,12 @@ static int init_output_stream(OutputStream *ost, 
AVFrame *frame,
 
 if (ost->enc_ctx) {
 const AVCodec *codec = ost->enc_ctx->codec;
-InputStream *ist;
+InputStream *ist = ost->ist;
 
 ret = init_output_stream_encode(ost, frame);
 if (ret < 0)
 return ret;
 
-ist = get_input_stream(ost);
 if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
 av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
 
@@ -3150,7 +3138,7 @@ static int init_output_stream(OutputStream *ost, AVFrame 
*frame,
 // copy estimated duration as a hint to the muxer
 if (ost->st->duration <= 0 && ist && ist->st->duration > 0)
 ost->st->duration = av_rescale_q(ist->st->duration, 
ist->st->time_base, ost->st->time_base);
-} else if (ost->source_index >= 0) {
+} else if (ost->ist) {
 ret = init_output_stream_streamcopy(ost);
 if (ret < 0)
 return ret;
@@ -3257,12 +3245,12 @@ static int transcode_init(void)
 }
 
 av_log(NULL, AV_LOG_INFO, "  Stream #%d:%d -> #%d:%d",
-   input_streams[ost->source_index]->file_index,
-   input_streams[ost->source_index]->st->index,
+   ost-

[FFmpeg-devel] [PATCH 08/10] fftools/ffmpeg: declare loop variables inside loops in transcode_init()

2022-11-17 Thread Anton Khirnov
---
 fftools/ffmpeg.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index c43c3ca3bc..3767ab444b 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3140,21 +3140,19 @@ static int init_output_stream(OutputStream *ost, 
AVFrame *frame,
 
 static int transcode_init(void)
 {
-int ret = 0, i, j, k;
-OutputStream *ost;
-InputStream *ist;
+int ret = 0;
 char error[1024] = {0};
 
 /* init framerate emulation */
-for (i = 0; i < nb_input_files; i++) {
+for (int i = 0; i < nb_input_files; i++) {
 InputFile *ifile = input_files[i];
 if (ifile->readrate || ifile->rate_emu)
-for (j = 0; j < ifile->nb_streams; j++)
+for (int j = 0; j < ifile->nb_streams; j++)
 ifile->streams[j]->start = av_gettime_relative();
 }
 
 /* init input streams */
-for (ist = ist_iter(NULL); ist; ist = ist_iter(ist))
+for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist))
 if ((ret = init_input_stream(ist, error, sizeof(error))) < 0)
 goto dump_format;
 
@@ -3167,7 +3165,7 @@ static int transcode_init(void)
  *   to be configured with the correct audio frame size, which is only
  *   known after the encoder is initialized.
  */
-for (ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
+for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
 if (ost->enc_ctx &&
 (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
  ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))
@@ -3179,13 +3177,13 @@ static int transcode_init(void)
 }
 
 /* discard unused programs */
-for (i = 0; i < nb_input_files; i++) {
+for (int i = 0; i < nb_input_files; i++) {
 InputFile *ifile = input_files[i];
-for (j = 0; j < ifile->ctx->nb_programs; j++) {
+for (int j = 0; j < ifile->ctx->nb_programs; j++) {
 AVProgram *p = ifile->ctx->programs[j];
 int discard  = AVDISCARD_ALL;
 
-for (k = 0; k < p->nb_stream_indexes; k++)
+for (int k = 0; k < p->nb_stream_indexes; k++)
 if (!ifile->streams[p->stream_index[k]]->discard) {
 discard = AVDISCARD_DEFAULT;
 break;
@@ -3197,8 +3195,8 @@ static int transcode_init(void)
  dump_format:
 /* dump the stream mapping */
 av_log(NULL, AV_LOG_INFO, "Stream mapping:\n");
-for (ist = ist_iter(NULL); ist; ist = ist_iter(ist)) {
-for (j = 0; j < ist->nb_filters; j++) {
+for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) {
+for (int j = 0; j < ist->nb_filters; j++) {
 if (!filtergraph_is_simple(ist->filters[j]->graph)) {
 av_log(NULL, AV_LOG_INFO, "  Stream #%d:%d (%s) -> %s",
ist->file_index, ist->st->index, ist->dec ? 
ist->dec->name : "?",
@@ -3210,7 +3208,7 @@ static int transcode_init(void)
 }
 }
 
-for (ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
+for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
 if (ost->attachment_filename) {
 /* an attached file */
 av_log(NULL, AV_LOG_INFO, "  File %s -> Stream #%d:%d\n",
-- 
2.35.1

___
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 07/10] fftools/ffmpeg: do not assume input streams exist

2022-11-17 Thread Anton Khirnov
There can be zero input streams, with input provided by lavfi complex
filtergraphs.
---
 fftools/ffmpeg.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0944f56b80..c43c3ca3bc 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3401,7 +3401,11 @@ static int check_keyboard_interaction(int64_t cur_time)
 if (key == 'd' || key == 'D'){
 int debug=0;
 if(key == 'D') {
-debug = ist_iter(NULL)->dec_ctx->debug << 1;
+InputStream *ist = ist_iter(NULL);
+
+if (ist)
+debug = ist->dec_ctx->debug << 1;
+
 if(!debug) debug = 1;
 while (debug & FF_DEBUG_DCT_COEFF) //unsupported, would just crash
 debug += debug;
-- 
2.35.1

___
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 10/10] fftools/ffmpeg_mux_init: postpone matching -disposition to streams

2022-11-17 Thread Anton Khirnov
Do it in set_dispositions() rather than during stream creation.

Since at this point all other stream information is known, this allows
setting disposition based on metadata, which implements #10015. This
also avoids an extra allocated string in OutputStream that was unused
after of_open().
---
 fftools/ffmpeg.h  |  1 -
 fftools/ffmpeg_mux.c  |  1 -
 fftools/ffmpeg_mux_init.c | 36 
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 5cae266600..4b76b1d0d7 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -585,7 +585,6 @@ typedef struct OutputStream {
 int streamcopy_started;
 int copy_initial_nonkeyframes;
 int copy_prior_start;
-char *disposition;
 
 int keep_pix_fmt;
 
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index ad04f5049d..2b885f7ab0 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -673,7 +673,6 @@ static void ost_free(OutputStream **post)
 av_freep(&ost->logfile_prefix);
 av_freep(&ost->forced_kf_pts);
 av_freep(&ost->apad);
-av_freep(&ost->disposition);
 
 #if FFMPEG_OPT_MAP_CHANNEL
 av_freep(&ost->audio_channels_map);
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index b6782b49aa..7aa2e030d8 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -333,9 +333,6 @@ static OutputStream *new_output_stream(Muxer *mux, const 
OptionsContext *o,
 ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
 }
 
-MATCH_PER_STREAM_OPT(disposition, str, ost->disposition, oc, st);
-ost->disposition = av_strdup(ost->disposition);
-
 ms->max_muxing_queue_size = 128;
 MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ms->max_muxing_queue_size, 
oc, st);
 
@@ -1667,11 +1664,21 @@ static void copy_meta(Muxer *mux, const OptionsContext 
*o)
 }
 }
 
-static int set_dispositions(OutputFile *of, AVFormatContext *ctx)
+static int set_dispositions(Muxer *mux, const OptionsContext *o)
 {
+OutputFile*of = &mux->of;
+AVFormatContext  *ctx = mux->fc;
+
 int nb_streams[AVMEDIA_TYPE_NB]   = { 0 };
 int have_default[AVMEDIA_TYPE_NB] = { 0 };
 int have_manual = 0;
+int ret = 0;
+
+const char **dispositions;
+
+dispositions = av_calloc(ctx->nb_streams, sizeof(*dispositions));
+if (!dispositions)
+return AVERROR(ENOMEM);
 
 // first, copy the input dispositions
 for (int i = 0; i < ctx->nb_streams; i++) {
@@ -1679,7 +1686,9 @@ static int set_dispositions(OutputFile *of, 
AVFormatContext *ctx)
 
 nb_streams[ost->st->codecpar->codec_type]++;
 
-have_manual |= !!ost->disposition;
+MATCH_PER_STREAM_OPT(disposition, str, dispositions[i], ctx, ost->st);
+
+have_manual |= !!dispositions[i];
 
 if (ost->ist) {
 ost->st->disposition = ost->ist->st->disposition;
@@ -1693,25 +1702,25 @@ static int set_dispositions(OutputFile *of, 
AVFormatContext *ctx)
 // process manually set dispositions - they override the above copy
 for (int i = 0; i < ctx->nb_streams; i++) {
 OutputStream *ost = of->streams[i];
-int ret;
+const char  *disp = dispositions[i];
 
-if (!ost->disposition)
+if (!disp)
 continue;
 
 #if LIBAVFORMAT_VERSION_MAJOR >= 60
-ret = av_opt_set(ost->st, "disposition", ost->disposition, 0);
+ret = av_opt_set(ost->st, "disposition", disp, 0);
 #else
 {
 const AVClass *class = av_stream_get_class();
 const AVOption*o = av_opt_find(&class, "disposition", 
NULL, 0, AV_OPT_SEARCH_FAKE_OBJ);
 
 av_assert0(o);
-ret = av_opt_eval_flags(&class, o, ost->disposition, 
&ost->st->disposition);
+ret = av_opt_eval_flags(&class, o, disp, 
&ost->st->disposition);
 }
 #endif
 
 if (ret < 0)
-return ret;
+goto finish;
 }
 } else {
 // For each media type with more than one stream, find a suitable 
stream to
@@ -1730,7 +1739,10 @@ static int set_dispositions(OutputFile *of, 
AVFormatContext *ctx)
 }
 }
 
-return 0;
+finish:
+av_freep(&dispositions);
+
+return ret;
 }
 
 static void validate_enc_avopt(const Muxer *mux, const AVDictionary 
*codec_avopt)
@@ -1943,7 +1955,7 @@ int of_open(const OptionsContext *o, const char *filename)
 of_add_programs(oc, o);
 of_add_metadata(of, oc, o);
 
-err = set_dispositions(of, oc);
+err = set_dispositions(mux, o);
 if (err < 0) {
 av_log(NULL, AV_LOG_FATAL, "Error setting output stream 
dispositions\n");
 exit_program(1);
-- 
2.35.1

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

To unsubscribe, visit 

Re: [FFmpeg-devel] [PATCH] fate: Mark the tiff-zip-* tests as requiring zlib

2022-11-17 Thread Martin Storsjö

On Thu, 17 Nov 2022, Martin Storsjö wrote:


Signed-off-by: Martin Storsjö 
---
tests/fate/image.mak | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 167c8ccf2c..42dd90feaa 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -513,12 +513,13 @@ fate-tiff-lzw-rgbf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/lzw_rgbf32le.ti
FATE_TIFF += fate-tiff-lzw-rgbaf32le
fate-tiff-lzw-rgbaf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/lzw_rgbaf32le.tif

-FATE_TIFF += fate-tiff-zip-rgbf32le
+FATE_TIFF_ZIP += fate-tiff-zip-rgbf32le
fate-tiff-zip-rgbf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/zip_rgbf32le.tif

-FATE_TIFF += fate-tiff-zip-rgbaf32le
+FATE_TIFF_ZIP += fate-tiff-zip-rgbaf32le
fate-tiff-zip-rgbaf32le: CMD = framecrc -i 
$(TARGET_SAMPLES)/tiff/zip_rgbaf32le.tif

+FATE_TIFF-$(call FRAMECRC, IMAGE2, TIFF, ZLIB) += $(FATE_TIFF_ZIP)
FATE_TIFF-$(call FRAMECRC, IMAGE2, TIFF) += $(FATE_TIFF)

FATE_IMAGE_FRAMECRC += $(FATE_TIFF-yes)
--
2.37.1 (Apple Git-137.1)


OK'd by Anton on irc, and pushed.

// Martin
___
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] fate/aacenc: increase tolerance for ln-128k test

2022-11-17 Thread Lynne
The encoder is sensitive to changes in precision, and its test target
was a compromise. It was already close to failing on x87 FPUs.
ff_mdct_init used double precision entirely from the scale to computing
the MDCT exp tables. av_tx_init uses single-precision for the scale,
with a small input change which was enough to tip the test into failing on
x87 FPUs.

Increase the fuzz factor in line with other AAC encoder tests to fix.

Patch attached.

>From 823e5b35893ea6822981dab516159eec50498357 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Thu, 17 Nov 2022 12:39:47 +0100
Subject: [PATCH] fate/aacenc: increase tolerance for ln-128k test

The encoder is sensitive to changes in precision, and its test target
was a compromise. It was already close to failing on x87 FPUs.
ff_mdct_init used double precision entirely from the scale to computing
the MDCT exp tables. av_tx_init uses single-precision for the scale,
with a small input change which was enough to tip the test into failing on
x87 FPUs.

Increase the fuzz factor in line with other AAC encoder tests to fix.
---
 tests/fate/aac.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 1743428f54..4f8d1cdcea 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -174,7 +174,7 @@ fate-aac-ln-encode-128k: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s
 fate-aac-ln-encode-128k: CMP_SHIFT = -4096
 fate-aac-ln-encode-128k: CMP_TARGET = 622
 fate-aac-ln-encode-128k: SIZE_TOLERANCE = 3560
-fate-aac-ln-encode-128k: FUZZ = 5
+fate-aac-ln-encode-128k: FUZZ = 10
 
 FATE_AAC_ENCODE += fate-aac-pns-encode
 fate-aac-pns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav -c:a aac -aac_coder fast -aac_pns 1 -aac_is 0 -aac_ms 0 -aac_tns 0 -b:a 128k -cutoff 22050  -fflags +bitexact -flags +bitexact
-- 
2.38.1

___
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] Ffmpeg/ffprobe not work well with a DASH stream

2022-11-17 Thread Chang, Xiangzhong
Hi,

Thank you so much for this amazing project. I’ve found this project has been 
extremely useful for me.
I’ve found out that ffmpeg/ffplay does not work well with one of our DASH 
streams. In comparison, I’ve tried the following players

  1.  ExoPlayer
  2.  DASH-JS 
player
  3.  Bitmovin JS 
player

I was using the following script trying to probe/transcoding one of our DASH 
stream.
```
ffprobe_g  -loglevel debug 
"https://director.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/manifest.mpd?abs_begin=2022-11-16T08:00:00Z&is_live&no_dolby";
```

The following log have drawn my attention. It seems like ffprobe has failed to 
download some file chunks.
```
[dash @ 0x55b477e86880] DASH request for url 
'https://director.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/video-stream-1-150182387590546.mp4',
 offset 0
[tcp @ 0x55b477f09080] Starting connection attempt to 84.208.9.142 port 443
[tcp @ 0x55b477f09080] Successfully connected to 84.208.9.142 port 443
[tcp @ 0x55b477ed0f00] Starting connection attempt to 84.208.9.21 port 443
[tcp @ 0x55b477ed0f00] Successfully connected to 84.208.9.21 port 443
[https @ 0x55b477eee1c0] HTTP error 404 Not Found
```

However, when I was using wget to download it, all works out
```
hhk9417@HC994R6KQD:~/Desktop$ wget 
https://director.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/video-stream-1-150182387590546.mp4
--2022-11-17 14:53:30--  
https://director.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/video-stream-1-150182387590546.mp4
Resolving director.livecdn.teliaplay.net (director.livecdn.teliaplay.net)... 
84.208.9.75, 84.208.9.76, 84.208.9.141, ...
Connecting to director.livecdn.teliaplay.net 
(director.livecdn.teliaplay.net)|84.208.9.75|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: 
https://m323-cdne01.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/video-stream-1-150182387590546.mp4
 [following]
--2022-11-17 14:53:30--  
https://m323-cdne01.livecdn.teliaplay.net/notvm/mso/TV_1HD/dash/video-stream-1-150182387590546.mp4
Resolving m323-cdne01.livecdn.teliaplay.net 
(m323-cdne01.livecdn.teliaplay.net)... 84.208.9.21
Connecting to m323-cdne01.livecdn.teliaplay.net 
(m323-cdne01.livecdn.teliaplay.net)|84.208.9.21|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1293307 (1,2M) [video/mp4]
Saving to: ‘video-stream-1-150182387590546.mp4’

video-stream-1-150182387590546.mp4  
100%[=>]
   1,23M  --.-KB/sin 0,02s

2022-11-17 14:53:30 (50,8 MB/s) - ‘video-stream-1-150182387590546.mp4’ saved 
[1293307/1293307]
```

Regarding the FFmpeg SDK, I’m using the latest master branch, I’ve compiled it 
from scratch. The following are my compilation configs
```
--enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 
--enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations 
--enable-libspeex --enable-shared --enable-pthreads --enable-vaapi 
--enable-ffplay --disable-stripping --enable-debug=3 --enable-libopus 
--enable-libv4l2 --enable-zlib --enable-vaapi --enable-pthreads --enable-vdpau 
--enable-xlib --enable-libv4l2 --enable-libfreetype --enable-demuxer=dash 
--enable-libxml2 --enable-libaom --enable-libx265 --enable-openssl"
#define FFMPEG_LICENSE "nonfree and unredistributable
```

Cheers.




This email may contain information which is privileged or protected against 
unauthorized disclosure or communication. If you are not the intended 
recipient, please notify the sender and delete this message and any attachments 
from your system without producing, distributing or retaining copies thereof or 
disclosing its contents to any other person.

Telia Company processes emails and other files that may contain personal data 
in accordance with Telia Company’s Privacy 
Policy.


___
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/7] doc/developer.texi: document the use of other languages than C

2022-11-17 Thread Lynne
Nov 17, 2022, 11:09 by an...@khirnov.net:

> ---
>  doc/developer.texi | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/doc/developer.texi b/doc/developer.texi
> index 01735e07f5..44da6e41af 100644
> --- a/doc/developer.texi
> +++ b/doc/developer.texi
> @@ -56,9 +56,9 @@ and should try to fix issues their commit causes.
>  @anchor{Coding Rules}
>  @chapter Coding Rules
>  
> -@section C language features
> +@section Language
>  
> -FFmpeg is programmed in the ISO C99 language, extended with:
> +FFmpeg is mainly programmed in the ISO C99 language, extended with:
>  @itemize @bullet
>  @item
>  Atomic operations from C11 @file{stdatomic.h}. They are emulated on
> @@ -83,6 +83,17 @@ complex numbers;
>  mixed statements and declarations.
>  @end itemize
>  
> +Other languages than C may be used in special cases:
> +@itemize @bullet
> +@item
> +NASM is preferred for x86 SIMD or other x86 assembly. Inline assembly and
> +intrinsics should be avoided, unless there is a strong reason to use them 
> (e.g.
> +code that needs to be inlined).
>

We don't accept x86 intrinsics, so should isn't really appropriate.
Also, a word for other architectures would do.
Something like this maybe:

@item
NASM is required for x86 assembly. Inline assembly should be avoided,
unless there's a strong reason to use it (e.g. code that has to be inlined).
Intrinsics or other assembly flavours are not accepted for x86.
@item
For other architectures, GAS syntax should be used for assembly.
Inline assembly should be avoided, unless there's a good reason to use it.
Intrinsics are acceptable, but not recommended.

Other architectures also have different assembly syntax versions,
but it's so niche, it's not really worth mentioning.

Other patches look good.
___
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/7] doc/developer.texi: document the use of other languages than C

2022-11-17 Thread James Almer

On 11/17/2022 11:17 AM, Lynne wrote:

Nov 17, 2022, 11:09 by an...@khirnov.net:


---
  doc/developer.texi | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/developer.texi b/doc/developer.texi
index 01735e07f5..44da6e41af 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -56,9 +56,9 @@ and should try to fix issues their commit causes.
  @anchor{Coding Rules}
  @chapter Coding Rules
  
-@section C language features

+@section Language
  
-FFmpeg is programmed in the ISO C99 language, extended with:

+FFmpeg is mainly programmed in the ISO C99 language, extended with:
  @itemize @bullet
  @item
  Atomic operations from C11 @file{stdatomic.h}. They are emulated on
@@ -83,6 +83,17 @@ complex numbers;
  mixed statements and declarations.
  @end itemize
  
+Other languages than C may be used in special cases:

+@itemize @bullet
+@item
+NASM is preferred for x86 SIMD or other x86 assembly. Inline assembly and
+intrinsics should be avoided, unless there is a strong reason to use them (e.g.
+code that needs to be inlined).



We don't accept x86 intrinsics, so should isn't really appropriate.
Also, a word for other architectures would do.
Something like this maybe:

@item
NASM is required for x86 assembly. Inline assembly should be avoided,
unless there's a strong reason to use it (e.g. code that has to be inlined).
Intrinsics or other assembly flavours are not accepted for x86.


This is already not the case. See the stuff in libavutil/x86/intmath.h
Intrinsics are ok as long as they are single instructions for inlined 
stuff, much like with inline asm.
Builtins are obviously preferred, but they tend to be GCC/Clang only and 
at times limited in scope.



@item
For other architectures, GAS syntax should be used for assembly.
Inline assembly should be avoided, unless there's a good reason to use it.
Intrinsics are acceptable, but not recommended.

Other architectures also have different assembly syntax versions,
but it's so niche, it's not really worth mentioning.

Other patches look good.
___
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".


Re: [FFmpeg-devel] [PATCH 4/7] doc/developer.texi: document the use of other languages than C

2022-11-17 Thread Lynne
Nov 17, 2022, 15:25 by jamr...@gmail.com:

> On 11/17/2022 11:17 AM, Lynne wrote:
>
>> Nov 17, 2022, 11:09 by an...@khirnov.net:
>>
>>> ---
>>>  doc/developer.texi | 15 +--
>>>  1 file changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/doc/developer.texi b/doc/developer.texi
>>> index 01735e07f5..44da6e41af 100644
>>> --- a/doc/developer.texi
>>> +++ b/doc/developer.texi
>>> @@ -56,9 +56,9 @@ and should try to fix issues their commit causes.
>>>  @anchor{Coding Rules}
>>>  @chapter Coding Rules
>>>  -@section C language features
>>> +@section Language
>>>  -FFmpeg is programmed in the ISO C99 language, extended with:
>>> +FFmpeg is mainly programmed in the ISO C99 language, extended with:
>>>  @itemize @bullet
>>>  @item
>>>  Atomic operations from C11 @file{stdatomic.h}. They are emulated on
>>> @@ -83,6 +83,17 @@ complex numbers;
>>>  mixed statements and declarations.
>>>  @end itemize
>>>  +Other languages than C may be used in special cases:
>>> +@itemize @bullet
>>> +@item
>>> +NASM is preferred for x86 SIMD or other x86 assembly. Inline assembly and
>>> +intrinsics should be avoided, unless there is a strong reason to use them 
>>> (e.g.
>>> +code that needs to be inlined).
>>>
>>
>> We don't accept x86 intrinsics, so should isn't really appropriate.
>> Also, a word for other architectures would do.
>> Something like this maybe:
>>
>> @item
>> NASM is required for x86 assembly. Inline assembly should be avoided,
>> unless there's a strong reason to use it (e.g. code that has to be inlined).
>> Intrinsics or other assembly flavours are not accepted for x86.
>>
>
> This is already not the case. See the stuff in libavutil/x86/intmath.h
> Intrinsics are ok as long as they are single instructions for inlined stuff, 
> much like with inline asm.
> Builtins are obviously preferred, but they tend to be GCC/Clang only and at 
> times limited in scope.
>

I think it's niche enough to avoid mentioning it and deal with it if we need to.

___
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/7] configure: drop support for complex functions

2022-11-17 Thread Paul B Mahol
On 11/17/22, Anton Khirnov  wrote:
> They are not used since 520a5d33f0ea9f8838dbc7282470db700d248065.
> ---
>  configure | 25 -
>  1 file changed, 25 deletions(-)
>
> diff --git a/configure b/configure
> index e6470dc03b..868d11567b 100755
> --- a/configure
> +++ b/configure
> @@ -1317,21 +1317,6 @@ int main(void){ $func(); }
>  EOF
>  }
>
> -check_complexfunc(){
> -log check_complexfunc "$@"
> -func=$1
> -narg=$2
> -shift 2
> -test $narg = 2 && args="f, g" || args="f * I"
> -disable $func
> -test_ld "cc" "$@" < -#include 
> -#include 
> -float foo(complex float f, complex float g) { return $func($args); }
> -int main(void){ return (int) foo; }
> -EOF
> -}
> -
>  check_mathfunc(){
>  log check_mathfunc "$@"
>  func=$1
> @@ -2224,11 +2209,6 @@ INTRINSICS_LIST="
>  intrinsics_neon
>  "
>
> -COMPLEX_FUNCS="
> -cabs
> -cexp
> -"
> -
>  MATH_FUNCS="
>  atanf
>  atan2f
> @@ -2403,7 +2383,6 @@ HAVE_LIST="
>  $(add_suffix _inline   $ARCH_EXT_LIST)
>  $ARCH_FEATURES
>  $BUILTIN_LIST
> -$COMPLEX_FUNCS
>  $HAVE_LIST_CMDLINE
>  $HAVE_LIST_PUB
>  $HEADERS_LIST
> @@ -6541,10 +6520,6 @@ for func in $MATH_FUNCS; do
>  eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
>  done
>
> -for func in $COMPLEX_FUNCS; do
> -eval check_complexfunc $func \${${func}_args:-1}
> -done
> -
>  # these are off by default, so fail if requested and not available
>  enabled avisynth  && { require_headers "avisynth/avisynth_c.h
> avisynth/avs/version.h" &&
> { test_cpp_condition avisynth/avs/version.h
> "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 ||
> AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" ||
> --
> 2.35.1
>

Fine

> ___
> 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] x86/intmath: use _bzhi_u32 instead of the GCC internal builtin

2022-11-17 Thread James Almer
GCC does not recommend using their __builtin_ia32* builtins, so use the Intel
defined one instead.

Signed-off-by: James Almer 
---
 libavutil/x86/intmath.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 8a6b5ae261..2c701646ff 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -82,7 +82,8 @@ static av_always_inline av_const int ff_ctzll_x86(long long v)
 #if defined(__BMI2__)
 
 #if AV_GCC_VERSION_AT_LEAST(5,1)
-#define av_mod_uintp2 __builtin_ia32_bzhi_si
+#include 
+#define av_mod_uintp2 _bzhi_u32
 #elif HAVE_INLINE_ASM
 /* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we
  * implement it using inline assembly
-- 
2.38.1

___
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 v3 0/5] Fix FFmpeg compilation without DCE

2022-11-17 Thread L. E. Segovia
Renewing ping. CC Andreas and Lynne since they were interested previously.

amyspark

On 07/11/2022 11:48, L. E. Segovia wrote:
> Ping for review.
> 
> amyspark
> 
> On 03/11/2022 13:36, L. E. Segovia wrote:
>> Hi all,
>>
>> This new version is intended to make Patchwork log the set correctly.
>> (My apologies there, I'm not used to send patches through the command line.)
>>
>> v3 changes (same as v2):
>>
>> - Split indentation fixes for hevcdsp_init into its own commit
>> - Fixed spurious indentation in vf_ssim_init
>> - Implemented the macro approach for expanding the CONFIG_FOO checks in 
>> fftools
>> - Added the missing HAVE_X86ASM check in vc1dsp_init
>> - Added a missing HAVE_INLINE_ASM check in hpeldsp_init (see below)
>> - Fixed the HAVE_X86ASM check wrongly covering the INLINE_FOO clause in 
>> hpeldsp_init
>> - Removed the duplicate HAVE_X86ASM check in me_cmp_init
>> - Inlined the HAVE_X86ASM and ARCH_X86_64 checks in mlpdsp_init and 
>> vf_convolution_init 
>>
>> L. E. Segovia (5):
>>   all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2
>>   avcodec/x86/hevcdsp_init: Fix indentation after the ARCH_FOO changes
>>   all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO
>>   all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM
>>   all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM
>>
>>  fftools/ffprobe.c  |  16 +-
>>  fftools/opt_common.c   |  12 +-
>>  libavcodec/x86/aacencdsp_init.c|   2 +
>>  libavcodec/x86/aacpsdsp_init.c |   2 +
>>  libavcodec/x86/ac3dsp_init.c   |   4 +
>>  libavcodec/x86/audiodsp_init.c |   2 +
>>  libavcodec/x86/bswapdsp_init.c |   2 +
>>  libavcodec/x86/cavsdsp.c   |   2 +
>>  libavcodec/x86/celt_pvq_init.c |   2 +
>>  libavcodec/x86/cfhddsp_init.c  |   2 +
>>  libavcodec/x86/cfhdencdsp_init.c   |   2 +
>>  libavcodec/x86/dcadsp_init.c   |   2 +
>>  libavcodec/x86/dct_init.c  |   2 +
>>  libavcodec/x86/dnxhdenc_init.c |   2 +
>>  libavcodec/x86/exrdsp_init.c   |   2 +
>>  libavcodec/x86/fdctdsp_init.c  |   2 +
>>  libavcodec/x86/fft_init.c  |   2 +
>>  libavcodec/x86/flacdsp_init.c  |   8 +-
>>  libavcodec/x86/g722dsp_init.c  |   2 +
>>  libavcodec/x86/h263dsp_init.c  |   2 +
>>  libavcodec/x86/h264_intrapred_init.c   |   2 +
>>  libavcodec/x86/h264chroma_init.c   |   2 +
>>  libavcodec/x86/hevcdsp_init.c  | 549 +++--
>>  libavcodec/x86/hpeldsp_init.c  |   4 +
>>  libavcodec/x86/hpeldsp_vp3_init.c  |   2 +
>>  libavcodec/x86/huffyuvdsp_init.c   |   2 +
>>  libavcodec/x86/huffyuvencdsp_init.c|   2 +
>>  libavcodec/x86/idctdsp_init.c  |  11 +-
>>  libavcodec/x86/jpeg2000dsp_init.c  |   2 +
>>  libavcodec/x86/lossless_videodsp_init.c|   2 +
>>  libavcodec/x86/lossless_videoencdsp_init.c |   2 +
>>  libavcodec/x86/mdct15_init.c   |   2 +
>>  libavcodec/x86/me_cmp_init.c   |   2 +
>>  libavcodec/x86/mlpdsp_init.c   |   6 +-
>>  libavcodec/x86/mpegvideoencdsp_init.c  |   2 +
>>  libavcodec/x86/opusdsp_init.c  |   2 +
>>  libavcodec/x86/pixblockdsp_init.c  |   2 +
>>  libavcodec/x86/pngdsp_init.c   |   2 +
>>  libavcodec/x86/proresdsp_init.c|   2 +
>>  libavcodec/x86/rv34dsp_init.c  |   2 +
>>  libavcodec/x86/sbcdsp_init.c   |   2 +
>>  libavcodec/x86/sbrdsp_init.c   |   2 +
>>  libavcodec/x86/svq1enc_init.c  |   2 +
>>  libavcodec/x86/utvideodsp_init.c   |   2 +
>>  libavcodec/x86/v210enc_init.c  |   2 +
>>  libavcodec/x86/vc1dsp_init.c   |   6 +-
>>  libavcodec/x86/vorbisdsp_init.c|   2 +
>>  libavcodec/x86/vp3dsp_init.c   |   2 +
>>  libavcodec/x86/vp6dsp_init.c   |   2 +
>>  libavfilter/x86/af_afir_init.c |   2 +
>>  libavfilter/x86/af_anlmdn_init.c   |   2 +
>>  libavfilter/x86/af_volume_init.c   |   2 +
>>  libavfilter/x86/avf_showcqt_init.c |   2 +
>>  libavfilter/x86/colorspacedsp_init.c   |   6 +-
>>  libavfilter/x86/vf_atadenoise_init.c   |   8 +-
>>  libavfilter/x86/vf_blend_init.c|   2 +
>>  libavfilter/x86/vf_bwdif_init.c|   2 +
>>  libavfilter/x86/vf_convolution_init.c  |   2 +-
>>  libavfilter/x86/vf_framerate_init.c|   2 +
>>  libavfilter/x86/vf_fspp_init.c |   2 +
>>  libavfilter/x86/vf_gblur_init.c|   2 +
>>  libavfilter/x86/vf_hflip_init.c|   2 +
>>  libavfilter/x86/vf_limiter_init.c  |   2 +
>>  libavfilter/x86/vf_maskedclamp_init.c  |   2 +
>>  libavfilter/x86/vf_maskedmerge_init.c  |   2 +
>>  libavfilter/x86/vf_overlay_init.c  |   2 +
>>  libavfi

Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer

2022-11-17 Thread Christopher Degawa
On Thu, Oct 27, 2022 at 11:23 AM Christopher Degawa 
wrote:

>
>
> On Thu, Oct 20, 2022 at 11:56 PM Christopher Degawa 
> wrote:
>
>> From: Christopher Degawa 
>>
>> compressed_ten_bit_format has been deprecated upstream and has no effect
>> and can be removed. Plus, technically it was never used in the first place
>> since it would require the app (ffmpeg) to set it and do additional
>> processing of the input frames.
>>
>> Also simplify alloc_buffer by removing calculations relating to the
>> non-existant processing.
>>
>> Signed-off-by: Christopher Degawa 
>> ---
>>
>
> Ping on this and the other patch?
>

ping again? I don't have push rights or anything and nobody is listed as
the maintainer for libsvtav1.c, so I don't really have anyone I can
specifically ping for these.

>
___
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 v2 1/2] avcodec/libsvtav1: remove compressed_ten_bit_format and simplify alloc_buffer

2022-11-17 Thread James Almer

On 11/17/2022 8:23 PM, Christopher Degawa wrote:

On Thu, Oct 27, 2022 at 11:23 AM Christopher Degawa 
wrote:




On Thu, Oct 20, 2022 at 11:56 PM Christopher Degawa 
wrote:


From: Christopher Degawa 

compressed_ten_bit_format has been deprecated upstream and has no effect
and can be removed. Plus, technically it was never used in the first place
since it would require the app (ffmpeg) to set it and do additional
processing of the input frames.

Also simplify alloc_buffer by removing calculations relating to the
non-existant processing.

Signed-off-by: Christopher Degawa 
---



Ping on this and the other patch?



ping again? I don't have push rights or anything and nobody is listed as
the maintainer for libsvtav1.c, so I don't really have anyone I can
specifically ping for these.


Done. Sorry for the delay.
___
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] avcodec/libx265: fix build error

2022-11-17 Thread zhilizhao(赵志立)



> On Nov 3, 2022, at 22:20, Zhao Zhili  wrote:
> 
> From: Zhao Zhili 
> 
> x265_sei is available since X265_BUILD 88. Bump required version
> to 89 to fix the regression from commit 1f585030137, and remove a
> conditional compilation.
> 
> Signed-off-by: Zhao Zhili 
> ---
> configure| 2 +-
> libavcodec/libx265.c | 2 --
> 2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 2bcdf18a57..09d51002e3 100755
> --- a/configure
> +++ b/configure
> @@ -6736,7 +6736,7 @@ enabled libx264   && require_pkg_config libx264 
> x264 "stdint.h x264.h" x
>  require_cpp_condition libx264 x264.h "X264_BUILD 
> >= 158"; } &&
>  check_cpp_condition libx262 x264.h "X264_MPEG2"
> enabled libx265   && require_pkg_config libx265 x265 x265.h 
> x265_api_get &&
> - require_cpp_condition libx265 x265.h 
> "X265_BUILD >= 70"
> + require_cpp_condition libx265 x265.h 
> "X265_BUILD >= 89"
> enabled libxavs   && require libxavs "stdint.h xavs.h" 
> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
> enabled libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.3.0" 
> "stdint.h xavs2.h" xavs2_api_get
> enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 4aa96e1f2d..555b5e26d8 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -293,7 +293,6 @@ static av_cold int libx265_encode_init(AVCodecContext 
> *avctx)
> return ret;
> }
> 
> -#if X265_BUILD >= 89
> if (avctx->qmin >= 0) {
> ret = libx265_param_parse_int(avctx, "qpmin", avctx->qmin);
> if (ret < 0)
> @@ -304,7 +303,6 @@ static av_cold int libx265_encode_init(AVCodecContext 
> *avctx)
> if (ret < 0)
> return ret;
> }
> -#endif
> if (avctx->max_qdiff >= 0) {
> ret = libx265_param_parse_int(avctx, "qpstep", avctx->max_qdiff);
> if (ret < 0)
> -- 
> 2.34.1
> 

Applied as 36a8d1e729dcad6877791e1aa35c6deeab538555.
___
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".