[FFmpeg-devel] [PATCH 2/2] libswscale: Adds ff_hscale8to15_4_avx2 and ff_hscale8to15_X4_avx2 for all filter sizes.

2021-06-14 Thread Alan Kelly
These functions replace all ff_hscale8to15_*_ssse3 when avx2 is available.
---
 libswscale/swscale_internal.h |   2 +
 libswscale/utils.c|  37 +++
 libswscale/x86/Makefile   |   1 +
 libswscale/x86/scale_avx2.asm | 112 ++
 libswscale/x86/swscale.c  |  19 ++
 tests/checkasm/sw_scale.c |  21 +--
 6 files changed, 187 insertions(+), 5 deletions(-)
 create mode 100644 libswscale/x86/scale_avx2.asm

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index a1de95cee0..45ef657cd4 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -1056,4 +1056,6 @@ void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn 
yuv2plane1, yuv2planarX_fn
 //number of extra lines to process
 #define MAX_LINES_AHEAD 4
 
+//shuffle filter and filterPos for hyScale and hcScale filters in avx2
+void ff_shuffle_filter_coefficients(SwsContext *c, int* filterPos, int 
filterSize, int16_t *filter, int dstW);
 #endif /* SWSCALE_SWSCALE_INTERNAL_H */
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 6bac7b658d..0dc1f7df7f 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -267,6 +267,41 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_X2RGB10LE]   = { 1, 1 },
 };
 
+void ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int 
filterSize, int16_t *filter, int dstW){
+#if ARCH_X86_64
+int i, j, k, l;
+int cpu_flags = av_get_cpu_flags();
+if (EXTERNAL_AVX2_FAST(cpu_flags) && av_cpu_has_fast_gather()){
+if ((c->srcBpc == 8) && (c->dstBpc <= 14)){
+if (dstW % 16 == 0){
+if (filter != NULL){
+for (i = 0; i < dstW; i += 8){
+FFSWAP(int, filterPos[i + 2], filterPos[i+4]);
+FFSWAP(int, filterPos[i + 3], filterPos[i+5]);
+}
+if (filterSize > 4){
+int16_t *tmp2 = av_malloc(dstW * filterSize * 2);
+memcpy(tmp2, filter, dstW * filterSize * 2);
+for (i = 0; i < dstW; i += 16){//pixel
+for (k = 0; k < filterSize / 4; ++k){//fcoeff
+for (j = 0; j < 16; ++j){//inner pixel
+for (l = 0; l < 4; ++l){//coeff
+int from = i * filterSize + j * 
filterSize + k * 4 + l;
+int to = (i) * filterSize + j * 4 + l 
+ k * 64;
+filter[to] = tmp2[from];
+}
+}
+}
+}
+av_free(tmp2);
+}
+}
+}
+}
+}
+#endif
+}
+
 int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
 {
 return (unsigned)pix_fmt < FF_ARRAY_ELEMS(format_entries) ?
@@ -1697,6 +1732,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter 
*srcFilter,
get_local_pos(c, 0, 0, 0),
get_local_pos(c, 0, 0, 0))) < 0)
 goto fail;
+ff_shuffle_filter_coefficients(c, c->hLumFilterPos, 
c->hLumFilterSize, c->hLumFilter, dstW);
 if ((ret = initFilter(>hChrFilter, >hChrFilterPos,
>hChrFilterSize, c->chrXInc,
c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
@@ -1706,6 +1742,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter 
*srcFilter,
get_local_pos(c, c->chrSrcHSubSample, 
c->src_h_chr_pos, 0),
get_local_pos(c, c->chrDstHSubSample, 
c->dst_h_chr_pos, 0))) < 0)
 goto fail;
+ff_shuffle_filter_coefficients(c, c->hChrFilterPos, 
c->hChrFilterSize, c->hChrFilter, c->chrDstW);
 }
 } // initialize horizontal stuff
 
diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
index bfe383364e..68391494be 100644
--- a/libswscale/x86/Makefile
+++ b/libswscale/x86/Makefile
@@ -11,6 +11,7 @@ OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
 X86ASM-OBJS += x86/input.o  \
x86/output.o \
x86/scale.o  \
+   x86/scale_avx2.o  \
x86/rgb_2_rgb.o  \
x86/yuv_2_rgb.o  \
x86/yuv2yuvX.o   \
diff --git a/libswscale/x86/scale_avx2.asm b/libswscale/x86/scale_avx2.asm
new file mode 100644
index 00..d90fd2d791
--- /dev/null
+++ b/libswscale/x86/scale_avx2.asm
@@ -0,0 +1,112 @@

[FFmpeg-devel] [PATCH 1/2] libavutil/cpu: Adds av_cpu_has_fast_gather to detect cpus with avx fast gather instruction

2021-06-14 Thread Alan Kelly
Broadwell and later have fast gather instructions.
---
 This is so that the avx2 version of ff_hscale8to15X which uses gather
 instructions is only selected on machines where it will actually be
 faster.
 libavutil/cpu.c  |  6 ++
 libavutil/cpu.h  |  6 ++
 libavutil/cpu_internal.h |  1 +
 libavutil/x86/cpu.c  | 18 ++
 4 files changed, 31 insertions(+)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 8960415d00..0a723eeb7a 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -49,6 +49,12 @@
 
 static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
 
+int av_cpu_has_fast_gather(void){
+if (ARCH_X86)
+return ff_cpu_has_fast_gather();
+return 0;
+}
+
 static int get_cpu_flags(void)
 {
 if (ARCH_MIPS)
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index b555422dae..faf3a221f4 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -72,6 +72,7 @@
 #define AV_CPU_FLAG_MMI  (1 << 0)
 #define AV_CPU_FLAG_MSA  (1 << 1)
 
+int av_cpu_has_fast_gather(void);
 /**
  * Return the flags which specify extensions supported by the CPU.
  * The returned value is affected by av_force_cpu_flags() if that was used
@@ -107,6 +108,11 @@ int av_cpu_count(void);
  *  av_set_cpu_flags_mask(), then this function will behave as if AVX is not
  *  present.
  */
+
+/**
+ * Returns true if the cpu has fast gather instructions.
+ * Broadwell and later cpus have fast gather
+ */
 size_t av_cpu_max_align(void);
 
 #endif /* AVUTIL_CPU_H */
diff --git a/libavutil/cpu_internal.h b/libavutil/cpu_internal.h
index 889764320b..92525df0c1 100644
--- a/libavutil/cpu_internal.h
+++ b/libavutil/cpu_internal.h
@@ -46,6 +46,7 @@ int ff_get_cpu_flags_aarch64(void);
 int ff_get_cpu_flags_arm(void);
 int ff_get_cpu_flags_ppc(void);
 int ff_get_cpu_flags_x86(void);
+int ff_cpu_has_fast_gather(void);
 
 size_t ff_get_cpu_max_align_mips(void);
 size_t ff_get_cpu_max_align_aarch64(void);
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index bcd41a50a2..9724e0017b 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -270,3 +270,21 @@ size_t ff_get_cpu_max_align_x86(void)
 
 return 8;
 }
+
+int ff_cpu_has_fast_gather(void){
+int eax, ebx, ecx;
+int max_std_level, std_caps = 0;
+int family = 0, model = 0;
+cpuid(0, max_std_level, ebx, ecx, std_caps);
+
+if (max_std_level >= 1) {
+cpuid(1, eax, ebx, ecx, std_caps);
+family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
+model  = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0);
+// Broadwell and later
+if(family == 6 && model >= 70){
+  return 1;
+}
+}
+return 0;
+}
-- 
2.32.0.272.g935e593368-goog

___
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/2] libavutil/cpu: Adds av_cpu_has_fast_gather to detect cpus with avx fast gather instruction

2021-06-14 Thread Ronald S. Bultje
Hi Alan,

On Mon, Jun 14, 2021 at 7:20 AM Alan Kelly <
alankelly-at-google@ffmpeg.org> wrote:

> Broadwell and later have fast gather instructions.
> ---
>  This is so that the avx2 version of ff_hscale8to15X which uses gather
>  instructions is only selected on machines where it will actually be
>  faster.
>

We've in the past typically done this with a bit in the cpuflags return
value. Can this be added there instead of being its own function?

Also, what is the cycle count of ssse3/avx2 implementation for this
specific function on Haswell? It would be good to note that in the
respective patch so that we understand why the check was added.

Ronald
___
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] ffbuild/common.mak: explicitly pass windres preprocessor args

2021-06-14 Thread Martin Storsjö

On Tue, 8 Jun 2021, Kyle Schwarz wrote:


Binutils 2.36 no longer supports bundling args with the preprocessor
option.
---
ffbuild/common.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 32f5b997b5..9fbbf89130 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -90,7 +90,7 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
-$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)

%.o: %.rc
-   $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header -DRC_INVOKED 
$(CC_DEPFLAGS)" -o $@ $<
+   $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES)" $(foreach ARG,-E -xc-header 
-DRC_INVOKED $(CC_DEPFLAGS),--preprocessor-arg "$(ARG)") -o $@ $<

%.i: %.c
$(CC) $(CCFLAGS) $(CC_E) $<
--
2.31.1


If doing this, we no longer need to pass --preprocessor "$(DEPWINDRES)" at 
all (and one can remove DEPWINDRES from configure), and by not setting 
that option, we don't need to pass "-E -xcheader -DRC_INVOKED" either.


We could also just hardcode the options to pass (as it's probably safe to 
assume that windres calls a gcc compatible preprocessor), e.g. like this:


--preprocessor-arg -MMD --preprocessor-arg -MF --preprocessor-arg 
$(@:.o=.d) --preprocessor-arg -MT --preprocessor-arg $@


But your approach of $(foreach) also seems neat. In that case, it'd be 
something like this:


$(foreach ARG,$(CC_DEPFLAGS),--preprocessor-arg "$(ARG)")

I've been considering sending a patch like this, but have held off so far, 
as it's still under discussion in 
https://sourceware.org/bugzilla/show_bug.cgi?id=27594 whether this 
behaviour change is supposed to be reverted or not. (It's under discussion 
whether it was correct of users to use the --preprocessor option like 
this, even if the documentation used to explicitly say that it was 
allowed.)


// 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".


Re: [FFmpeg-devel] [PATCH 1/2] libavutil/cpu: Adds av_cpu_has_fast_gather to detect cpus with avx fast gather instruction

2021-06-14 Thread Andreas Rheinhardt
Alan Kelly:
> Broadwell and later have fast gather instructions.
> ---
>  This is so that the avx2 version of ff_hscale8to15X which uses gather
>  instructions is only selected on machines where it will actually be
>  faster.
>  libavutil/cpu.c  |  6 ++
>  libavutil/cpu.h  |  6 ++
>  libavutil/cpu_internal.h |  1 +
>  libavutil/x86/cpu.c  | 18 ++
>  4 files changed, 31 insertions(+)
> 
> diff --git a/libavutil/cpu.c b/libavutil/cpu.c
> index 8960415d00..0a723eeb7a 100644
> --- a/libavutil/cpu.c
> +++ b/libavutil/cpu.c
> @@ -49,6 +49,12 @@
>  
>  static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
>  
> +int av_cpu_has_fast_gather(void){
> +if (ARCH_X86)
> +return ff_cpu_has_fast_gather();
> +return 0;
> +}
> +
>  static int get_cpu_flags(void)
>  {
>  if (ARCH_MIPS)
> diff --git a/libavutil/cpu.h b/libavutil/cpu.h
> index b555422dae..faf3a221f4 100644
> --- a/libavutil/cpu.h
> +++ b/libavutil/cpu.h
> @@ -72,6 +72,7 @@
>  #define AV_CPU_FLAG_MMI  (1 << 0)
>  #define AV_CPU_FLAG_MSA  (1 << 1)
>  
> +int av_cpu_has_fast_gather(void);
>  /**
>   * Return the flags which specify extensions supported by the CPU.
>   * The returned value is affected by av_force_cpu_flags() if that was used
> @@ -107,6 +108,11 @@ int av_cpu_count(void);
>   *  av_set_cpu_flags_mask(), then this function will behave as if AVX is not
>   *  present.
>   */
> +
> +/**
> + * Returns true if the cpu has fast gather instructions.
> + * Broadwell and later cpus have fast gather
> + */

You added the documentation to av_cpu_max_align(), not
av_cpu_has_fast_gather().

>  size_t av_cpu_max_align(void);
>  
>  #endif /* AVUTIL_CPU_H */
> diff --git a/libavutil/cpu_internal.h b/libavutil/cpu_internal.h
> index 889764320b..92525df0c1 100644
> --- a/libavutil/cpu_internal.h
> +++ b/libavutil/cpu_internal.h
> @@ -46,6 +46,7 @@ int ff_get_cpu_flags_aarch64(void);
>  int ff_get_cpu_flags_arm(void);
>  int ff_get_cpu_flags_ppc(void);
>  int ff_get_cpu_flags_x86(void);
> +int ff_cpu_has_fast_gather(void);
>  
>  size_t ff_get_cpu_max_align_mips(void);
>  size_t ff_get_cpu_max_align_aarch64(void);
> diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
> index bcd41a50a2..9724e0017b 100644
> --- a/libavutil/x86/cpu.c
> +++ b/libavutil/x86/cpu.c
> @@ -270,3 +270,21 @@ size_t ff_get_cpu_max_align_x86(void)
>  
>  return 8;
>  }
> +
> +int ff_cpu_has_fast_gather(void){
> +int eax, ebx, ecx;
> +int max_std_level, std_caps = 0;
> +int family = 0, model = 0;
> +cpuid(0, max_std_level, ebx, ecx, std_caps);
> +
> +if (max_std_level >= 1) {
> +cpuid(1, eax, ebx, ecx, std_caps);
> +family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
> +model  = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0);
> +// Broadwell and later
> +if(family == 6 && model >= 70){
> +  return 1;
> +}
> +}
> +return 0;
> +}
> 

The usual way to signal things that a processor supports even if slow is
by a CPU flag; see AV_CPU_FLAG_(AVX|SSE2|SSE3)SLOW. That way one also
avoids adding a new public function that is completely useless when not
on X86.

- Andreas
___
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] lavc/videotoolboxenc.c: Fix preprocessor macro for OSX, 10.10.5 and probably older versions

2021-06-14 Thread Thilo Borgmann

Hi,

TARGET_OS_OSX exists since OSX 10.10.6. TARGET_OS_MAC is there on both sides of 
10.10.6. Fixes compilation on Yosemite.


-Thilo
From a6c690c8f1d311995c6511fcd22982ff1f4c5949 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Mon, 14 Jun 2021 14:51:13 +0200
Subject: [PATCH] lavc/videotoolboxenc.c: Fix preprocessor macro for OSX
 10.10.5 and probably older versions

---
 libavcodec/videotoolboxenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index f063a86..888b6d6c 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1038,7 +1038,7 @@ static int get_cv_ycbcr_matrix(AVCodecContext *avctx, 
CFStringRef *matrix) {
 // constant quality only on Macs with Apple Silicon
 static bool vtenc_qscale_enabled(void)
 {
-return TARGET_OS_OSX && TARGET_CPU_ARM64;
+return TARGET_OS_MAC && TARGET_CPU_ARM64;
 }
 
 static int vtenc_create_encoder(AVCodecContext   *avctx,
-- 
1.8.3.2

___
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] ffmpeg: add -fpsmin to clamp output framerate

2021-06-14 Thread Henrik Gramner
On Mon, Jun 14, 2021 at 9:22 AM Matthias Neugebauer  wrote:
> Anything I can do to not land in spam? On another Google groups
> mailing list I (and many others including the admin accounts) had
> the same issue a couple of times.

This is caused by sending emails from a domain with a DMARC reject or
quarantine policy: dmarc=fail (p=REJECT sp=REJECT dis=QUARANTINE)
header.from=mailbox.org

I think there are two options in mailman (the mailing list software)
to handle this that the list admin(s) could play around with:
https://wiki.list.org/DEV/DMARC

The first is to perform MIME wrapping of the original email, which can
be neat, but some receiving mail clients doesn't like it.

The second is to spoof the From address so the mail appears to have
originated from some other domain.

Another workaround is to change the DMARC policy of the sending domain.
___
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] lavc/videotoolboxenc.c: Fix preprocessor macro for OSX, 10.10.5 and probably older versions

2021-06-14 Thread Thilo Borgmann

Am 14.06.21 um 15:14 schrieb Marvin Scholz (ePirat):



Am 14.06.2021 um 15:03 schrieb Thilo Borgmann :

Hi,

TARGET_OS_OSX exists since OSX 10.10.6. TARGET_OS_MAC is there on both sides of 
10.10.6. Fixes compilation on Yosemite.



Hi Thilo, TARGET_OS_MAC is 1 when building for iOS as well, you need 
!TARGET_OS_IPHONE instead.


I thought so as well and other projects doing it that way.
The original author suggested _OS_MAC though.

I'll apply with !TARGET_OS_IPHONE.

Thanks!
Thilo


-Thilo
<0001-lavc-videotoolboxenc.c-Fix-preprocessor-macro-for-OS.patch>
___
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 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] ffmpeg: add -fpsmin to clamp output framerate

2021-06-14 Thread Matthias Neugebauer
Anything I can do to not land in spam? On another Google groups
mailing list I (and many others including the admin accounts) had
the same issue a couple of times.

___
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/2] libavutil/cpu: Adds av_cpu_has_fast_gather to detect cpus with avx fast gather instruction

2021-06-14 Thread James Almer

On 6/14/2021 8:53 AM, Ronald S. Bultje wrote:

Hi Alan,

On Mon, Jun 14, 2021 at 7:20 AM Alan Kelly <
alankelly-at-google@ffmpeg.org> wrote:


Broadwell and later have fast gather instructions.
---
  This is so that the avx2 version of ff_hscale8to15X which uses gather
  instructions is only selected on machines where it will actually be
  faster.



We've in the past typically done this with a bit in the cpuflags return
value. Can this be added there instead of being its own function?

Also, what is the cycle count of ssse3/avx2 implementation for this
specific function on Haswell? It would be good to note that in the
respective patch so that we understand why the check was added.


Between 9 and 12 on Haswell, 5 to 7 on Broadwell, and about 2 to 5 on 
Skylake and newer, acording to Agner's pdf if i'm reading it right. It's 
also slow on AMD before Zen 3.


And yes, this should if anything be a new cpu flag and not a new function.
___
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] lavc/videotoolboxenc.c: Fix preprocessor macro for OSX, 10.10.5 and probably older versions

2021-06-14 Thread Marvin Scholz (ePirat)

> Am 14.06.2021 um 15:03 schrieb Thilo Borgmann :
> 
> Hi,
> 
> TARGET_OS_OSX exists since OSX 10.10.6. TARGET_OS_MAC is there on both sides 
> of 10.10.6. Fixes compilation on Yosemite.
> 

Hi Thilo, TARGET_OS_MAC is 1 when building for iOS as well, you need 
!TARGET_OS_IPHONE instead.


> -Thilo
> <0001-lavc-videotoolboxenc.c-Fix-preprocessor-macro-for-OS.patch>
> ___
> 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] Avoid using the --preprocessor argument to windres

2021-06-14 Thread Martin Storsjö
Instead use --preprocessor-arg; in binutils 2.36, the --preprocessor
flag was changed so that it no longer accepts a string containing
multiple arguments, but the whole --preprocessor argument is
treated as the path to the preprocessor executable (where the path
can contain spaces).

It's currently unclear whether this behaviour will stay or if it
is going to be reverted in the future, see discussion at [1]. Just
to be safe, avoid using the --preprocessor argument. Don't redeclare
the full preprocessing command, but just add the $(CC_DEPFLAGS) options.

Based on a patch by Kyle Schwartz.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=27594
---
 configure  | 1 -
 ffbuild/common.mak | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 6bfd98b384..87c8e85fe6 100755
--- a/configure
+++ b/configure
@@ -7535,7 +7535,6 @@ LD_LIB=$LD_LIB
 LD_PATH=$LD_PATH
 DLLTOOL=$dlltool
 WINDRES=$windres
-DEPWINDRES=$dep_cc
 DOXYGEN=$doxygen
 LDFLAGS=$LDFLAGS
 LDEXEFLAGS=$LDEXEFLAGS
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 32f5b997b5..5d8f3dfc1f 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -90,7 +90,7 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS)
-$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)
 
 %.o: %.rc
-   $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header 
-DRC_INVOKED $(CC_DEPFLAGS)" -o $@ $<
+   $(WINDRES) $(IFLAGS) $(foreach ARG,$(CC_DEPFLAGS),--preprocessor-arg 
"$(ARG)") -o $@ $<
 
 %.i: %.c
$(CC) $(CCFLAGS) $(CC_E) $<
-- 
2.25.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] avfilter/vf_guided: support single input

2021-06-14 Thread Steven Liu


> 在 2021年6月14日,10:08,Xuewei Meng <928826...@qq.com> 写道:
> 
> From: Xuewei Meng 
> 
> Support single input for guided filter by adding guidance mode.
> If the guidance mode is off, single input is required. And
> edge-preserving smoothing is conducted. If the mode is on, two
> inputs are needed. The second input serves as the guidance. For
> this mode, more tasks are supported, such as detail enhancement,
> dehazing and so on.
> 
> Signed-off-by: Xuewei Meng 
> ---
> doc/filters.texi|  12 ++--
> libavfilter/vf_guided.c | 168 
> 2 files changed, 119 insertions(+), 61 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 78faf76..5c362c0 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -12975,8 +12975,6 @@ greyedge=difford=1:minknorm=0:sigma=2
> 
> @section guided
> Apply guided filter for edge-preserving smoothing, dehazing and so on.
> -This filter requires two inputs of same resolution and pixel format.
> -The second input serves as the reference.
> 
> The filter accepts the following options:
> @table @option
> @@ -12997,6 +12995,12 @@ Set subsampling ratio for @code{fast} mode.
> Range is 2 to 64. Default is 4.
> No subsampling occurs in @code{basic} mode.
> 
> +@item guidance
> +Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}. 
> +If @code{off}, single input is required. 
> +If @code{on}, two inputs of the same resolution and pixel format are 
> required.
> +The second input serves as the guidance.
> +
> @item planes
> Set planes to filter. Default is first only.
> @end table
> @@ -13009,7 +13013,7 @@ This filter supports the all above options as 
> @ref{commands}.
> @item
> Edge-preserving smoothing with guided filter:
> @example
> -ffmpeg -i in.png -i in.png -filter_complex guided out.png
> +ffmpeg -i in.png -vf guided out.png
> @end example
> 
> @item
> @@ -13017,7 +13021,7 @@ Dehazing, structure-transferring filtering, detail 
> enhancement with guided filte
> For the generation of guidance image, refer to paper "Guided Image Filtering".
> See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
> @example
> -ffmpeg -i in.png -i guidance.png -filter_complex guided out.png
> +ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
> @end example
> 
> @end itemize
> diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c
> index ea537e4..739d615 100644
> --- a/libavfilter/vf_guided.c
> +++ b/libavfilter/vf_guided.c
> @@ -22,6 +22,7 @@
> #include "libavutil/opt.h"
> #include "libavutil/pixdesc.h"
> #include "avfilter.h"
> +#include "filters.h"
> #include "formats.h"
> #include "framesync.h"
> #include "internal.h"
> @@ -33,6 +34,12 @@ enum FilterModes {
> NB_MODES,
> };
> 
> +enum GuidanceModes {
> +OFF,
> +ON,
> +NB_GUIDANCE_MODES,
> +};
> +
> typedef struct GuidedContext {
> const AVClass *class;
> FFFrameSync fs;
> @@ -41,7 +48,7 @@ typedef struct GuidedContext {
> float eps;
> int mode;
> int sub;
> -
> +int guidance;
> int planes;
> 
> int width;
> @@ -59,13 +66,16 @@ typedef struct GuidedContext {
> #define FLAGS 
> AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
> 
> static const AVOption guided_options[] = {
> -{ "radius", "set the box radius",   
> OFFSET(radius), AV_OPT_TYPE_INT,   {.i64 = 3}, 1,   20, FLAGS 
> },
> -{ "eps","set the regularization parameter (with square)",   
> OFFSET(eps),AV_OPT_TYPE_FLOAT, {.dbl = 0.01 },   0.0,1, FLAGS 
> },
> -{ "mode",   "set filtering mode (0: basic mode; 1: fast mode)", 
> OFFSET(mode),   AV_OPT_TYPE_INT,   {.i64 = BASIC}, BASIC, NB_MODES - 1, 
> FLAGS, "mode" },
> -{ "basic",  "basic guided filter",  0,   
>AV_OPT_TYPE_CONST, {.i64 = BASIC}, 0,0, FLAGS, "mode" 
> },
> -{ "fast",   "fast guided filter",   0,   
>AV_OPT_TYPE_CONST, {.i64 = FAST }, 0,0, FLAGS, "mode" 
> },
> -{ "sub","subsampling ratio for fast mode",  
> OFFSET(sub),AV_OPT_TYPE_INT,   {.i64 = 4}, 2,   64, FLAGS 
> },
> -{ "planes", "set planes to filter", 
> OFFSET(planes), AV_OPT_TYPE_INT,   {.i64=1  }, 0,  0xF, FLAGS 
> },
> +{ "radius",   "set the box radius",   
> OFFSET(radius),   AV_OPT_TYPE_INT,   {.i64 = 3}, 1,   
>  20, FLAGS },
> +{ "eps",  "set the regularization parameter (with square)",   
> OFFSET(eps),  AV_OPT_TYPE_FLOAT, {.dbl = 0.01 },   0.0,   
>   1, FLAGS },
> +{ "mode", "set filtering mode (0: basic mode; 1: fast mode)", 
> OFFSET(mode), AV_OPT_TYPE_INT,   {.i64 = BASIC}, BASIC,  NB_MODES 
> - 1, FLAGS, "mode" },
> +{ "basic","basic guided 

Re: [FFmpeg-devel] [PATCH 2/2] lavc/libvpxenc: Show encoder config as a warning in case

2021-06-14 Thread James Zern
On Sat, Jun 12, 2021 at 12:12 PM Thilo Borgmann  wrote:
>
> $subject
>

> ---
>  libavcodec/libvpxenc.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)

lgtm. Same comment for the else as for libaomenc.c
___
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/2] lavc/libaomenc: Show encoder config as a warning in case of failed initialization

2021-06-14 Thread Thilo Borgmann
Am 14.06.21 um 20:10 schrieb Thilo Borgmann:
> Am 14.06.21 um 19:39 schrieb James Zern:
>> On Sat, Jun 12, 2021 at 12:10 PM Thilo Borgmann  
>> wrote:
>>>
>>> Hi,
>>>
>>> if init fails, it's likely originating from the library's config. This and 
>>> 2/2 are for easier debugging in that case instead of having to run again 
>>> with loglevel DEBUG.
>>>
>>
>>> ---
>>>  libavcodec/libaomenc.c | 10 ++
>>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>>
>>
>> lgtm.
>>
>>> [...]
>>> -dump_enc_cfg(avctx, );
>>>  /* Construct Encoder Context */
>>>  res = aom_codec_enc_init(>encoder, iface, , flags);
>>>  if (res != AOM_CODEC_OK) {
>>> +dump_enc_cfg(avctx, , AV_LOG_WARNING);
>>>  log_encoder_error(avctx, "Failed to initialize encoder");
>>>  return AVERROR(EINVAL);
>>> +} else {
>>
>> This else could be removed since the other branch returns.
>>
>>> +dump_enc_cfg(avctx, , AV_LOG_DEBUG);
>>>  }
> 
> It would change existing behavior because currently, the cfg is always 
> printed.
> If we make that change, it would not be printed at all in that case. Not?

Ah I misunderstood. OK will apply with that change :)

Thanks,
Thilo
___
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] dashenc: Write out DASH manifest immediately in streaming mode

2021-06-14 Thread Jeyapal, Karthick


On 6/11/21, 9:31 PM, "Kevin LaFlamme"  wrote:

>Does my last explanation make sense or if not could you point me to
>where this reasoning is incorrect?
Your reasoning is perfectly fine. Since I haven't heard any objections to your 
reply, I have pushed this patch. Thanks.

>
>Kevin LaFlamme
>Director of Engineering (Front End)
>774.265.0382 (m)
>aiera.com
>On Jun 8, 2021, 8:52 PM -0400, Kevin LaFlamme , wrote:
>> I just realized there’s probably a more straightforward explanation:
>>
>> The scenario you brought up is already happening for all segments after
>> the first one, and this changes just makes the first one do the same
>> thing.
>>
>> The following scenario happens even without this change:
>>
>> Say you have a stream with "-streaming" and "-use_template" set and a
>> segment duration of 10 seconds. While the first segment is being
>> written there is no manifest, but then the first segment and manifest
>> are written and the segment segment starts to be written. At 15 seconds
>> in a client requests the manifest. It wants to be 2 seconds behind the
>> live edge (13 second seek position) so it calculates which segment name
>> it needs, which is the second one, and makes a request for it even
>> though it's only partially written. And this could currently happen for
>> any segment index > 1.
>>
>> With the proposed change this same thing just now happens on the first
>> segment as well.
>>
>> I'm definitely happy to try a different approach to fix the underlying
>> issue if I'm misunderstanding something or this reasoning is incorrect,
>> but this "seems" right to me from my understanding of the spec and the
>> behaviors I've witnessed so far.
>>
>> Kevin LaFlamme
>> Director of Engineering (Front End)
>> 774.265.0382 (m)
>> aiera.com
>> On Jun 8, 2021, 4:03 PM -0400, Kevin LaFlamme , wrote:
>> > To serve it in a truly streaming way does require some special purpose 
>> > server or configuration, but >the `@availabilityTimeComplete` field that 
>> > is written into the manifest is supposed to indicate to the >client making 
>> > the request whether or not the segment file is complete at the time it 
>> > becomes available. >In streaming mode, this is set to false so the client 
>> > should expect that it can get a partial segment >between the available 
>> > start time and the segment duration.
>> >
>> > So as each box is written to the file, it should be safe for the HTTP 
>> > server to send the partial >segment file that is currently on disk. And 
>> > the DASH spec specifically indicates whether or not to expect >a partial 
>> > file for the segment being requested. If the client can’t handle a partial 
>> > file and is still making >an attempt to request it before it’s fully 
>> > available (which is calculable from the information in the >manifest), the 
>> > client wouldn’t be respecting the DASH spec.
>> >
>> > Kevin LaFlamme
>> > Director of Engineering (Front End)
>> > 774.265.0382 (m)
>> > aiera.com
>> > On Jun 8, 2021, 3:34 PM -0400, Timo Rothenpieler , 
>> > wrote:
>> > > On 08.06.2021 21:24, Kevin LaFlamme wrote:
>> > > > For streaming mode with fragmented MP4 the intention is to have the 
>> > > > client read a partial file >since it’s broken up into sequential boxes 
>> > > > that are playable independently. This doesn’t change the >segment 
>> > > > files themselves or how they are written, it just writes a full index 
>> > > > file ahead of time.
>> > > >
>> > > > Even currently, the manifest gets written after the first segment is 
>> > > > written and the player can >immediately attempt to start reading the 
>> > > > second segment before it’s fully written.
>> > > >
>> > > > This is the same thing that the “-lhls” is doing in the block below, 
>> > > > writing out the HLS manifest >immediately so that it contains 
>> > > > X-EXT-PREFETCH fields for the partial segment files.
>> > > >
>> > > > Currently, if you have a low latency DASH stream with “-ldash” and 
>> > > > “-streaming” and the player >joins in the middle of the stream 
>> > > > everything works and it starts playing from the middle of the current 
>> > > > >segment. This means even with 10 second segments you can have latency 
>> > > > < 1sec of the live edge. >However, this doesn’t work for the very 
>> > > > first segment because the manifest isn’t available to the player >yet.
>> > > >
>> > > > I have a low-latency player where I’m seeing this issue right now and 
>> > > > this addresses the >problem, and seems consistent with the “-lhls” 
>> > > > handling below, but happy to make changes if there is >something else 
>> > > > I’m missing.
>> > >
>> > > Yes, I'm aware that that's how it's supposed to work in theory.
>> > > But does that work with any HTTP server?
>> > > Do they really manage to stream the file while it's being written to?
This feature works with most of the popular CDNs. And yes, they do manage a 
file as it is being written into.

>> > > Or does this need special software to serve the file? 

Re: [FFmpeg-devel] [PATCH v2 17/33] avdevice/dshow: discover source color range/space/etc

2021-06-14 Thread Michael Niedermayer
On Fri, Jun 11, 2021 at 10:30:48PM +0200, Diederick Niehorster wrote:
> Enabled discovering a DirectShow device's color range, space, primaries,
> transfer characteristics and chroma location, if the device exposes that
> information. Sets them in the stream's codecpars.
> 
> Signed-off-by: Diederick Niehorster 
> Co-authored-by: Valerii Zapodovnikov 
> Signed-off-by: Diederick Niehorster 
> ---
>  libavdevice/dshow.c | 250 +++-
>  1 file changed, 249 insertions(+), 1 deletion(-)

breaks build on mingw64

make
CC  libavdevice/dshow.o
src/libavdevice/dshow.c: In function ‘dshow_get_device_media_types’:
src/libavdevice/dshow.c:415:23: warning: unused variable ‘ctx’ 
[-Wunused-variable]
 struct dshow_ctx *ctx = avctx->priv_data;
   ^~~
src/libavdevice/dshow.c: In function ‘dshow_get_device_list’:
src/libavdevice/dshow.c:662:23: warning: unused variable ‘ctx’ 
[-Wunused-variable]
 struct dshow_ctx *ctx = avctx->priv_data;
   ^~~
src/libavdevice/dshow.c: In function ‘dshow_cycle_formats’:
src/libavdevice/dshow.c:731:13: error: unknown type name ‘DXVA_ExtendedFormat’; 
did you mean ‘DXVA2_ExtendedFormat’?
 DXVA_ExtendedFormat *extended_format_info = NULL;
 ^~~
 DXVA2_ExtendedFormat
src/libavdevice/dshow.c:744:41: error: ‘AMCONTROL_COLORINFO_PRESENT’ undeclared 
(first use in this function)
 if (v->dwControlFlags & AMCONTROL_COLORINFO_PRESENT)
 ^~~
src/libavdevice/dshow.c:744:41: note: each undeclared identifier is reported 
only once for each function it appears in
src/libavdevice/dshow.c:745:45: error: ‘DXVA_ExtendedFormat’ undeclared (first 
use in this function); did you mean ‘DXVA2_ExtendedFormat’?
 extended_format_info = 
(DXVA_ExtendedFormat*)>dwControlFlags;
 ^~~
 DXVA2_ExtendedFormat
src/libavdevice/dshow.c:745:65: error: expected expression before ‘)’ token
 extended_format_info = 
(DXVA_ExtendedFormat*)>dwControlFlags;
 ^
src/libavdevice/dshow.c:768:69: warning: passing argument 1 of 
‘dshow_color_range’ from incompatible pointer type 
[-Wincompatible-pointer-types]
 enum AVColorRange col_range = 
dshow_color_range(extended_format_info);
 
^~~~
src/libavdevice/dshow.c:77:26: note: expected ‘DXVA2_ExtendedFormat * {aka 
struct _DXVA2_ExtendedFormat *}’ but argument is of type ‘int *’
 static enum AVColorRange dshow_color_range(DXVA2_ExtendedFormat* fmt_info)
  ^
src/libavdevice/dshow.c:769:69: warning: passing argument 1 of 
‘dshow_color_space’ from incompatible pointer type 
[-Wincompatible-pointer-types]
 enum AVColorSpace col_space = 
dshow_color_space(extended_format_info);
 
^~~~
src/libavdevice/dshow.c:101:26: note: expected ‘DXVA2_ExtendedFormat * {aka 
struct _DXVA2_ExtendedFormat *}’ but argument is of type ‘int *’
 static enum AVColorSpace dshow_color_space(DXVA2_ExtendedFormat* fmt_info)
  ^
src/libavdevice/dshow.c:770:76: warning: passing argument 1 of 
‘dshow_color_primaries’ from incompatible pointer type 
[-Wincompatible-pointer-types]
 enum AVColorPrimaries col_prim = 
dshow_color_primaries(extended_format_info);

^~~~
src/libavdevice/dshow.c:156:30: note: expected ‘DXVA2_ExtendedFormat * {aka 
struct _DXVA2_ExtendedFormat *}’ but argument is of type ‘int *’
 static enum AVColorPrimaries dshow_color_primaries(DXVA2_ExtendedFormat* 
fmt_info)
  ^
src/libavdevice/dshow.c:771:82: warning: passing argument 1 of 
‘dshow_color_trc’ from incompatible pointer type [-Wincompatible-pointer-types]
 enum AVColorTransferCharacteristic col_trc = 
dshow_color_trc(extended_format_info);

  ^~~~
src/libavdevice/dshow.c:193:43: note: expected ‘DXVA2_ExtendedFormat * {aka 
struct _DXVA2_ExtendedFormat *}’ but argument is of type ‘int *’
 static enum AVColorTransferCharacteristic 
dshow_color_trc(DXVA2_ExtendedFormat* fmt_info)
   ^~~
src/libavdevice/dshow.c:772:73: warning: passing argument 1 of 
‘dshow_chroma_loc’ from incompatible pointer type [-Wincompatible-pointer-types]
 enum AVChromaLocation chroma_loc = 
dshow_chroma_loc(extended_format_info);
   

Re: [FFmpeg-devel] [PATCH 1/2] lavc/libaomenc: Show encoder config as a warning in case of failed initialization

2021-06-14 Thread James Zern
On Sat, Jun 12, 2021 at 12:10 PM Thilo Borgmann  wrote:
>
> Hi,
>
> if init fails, it's likely originating from the library's config. This and 
> 2/2 are for easier debugging in that case instead of having to run again with 
> loglevel DEBUG.
>

> ---
>  libavcodec/libaomenc.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>

lgtm.

> [...]
> -dump_enc_cfg(avctx, );
>  /* Construct Encoder Context */
>  res = aom_codec_enc_init(>encoder, iface, , flags);
>  if (res != AOM_CODEC_OK) {
> +dump_enc_cfg(avctx, , AV_LOG_WARNING);
>  log_encoder_error(avctx, "Failed to initialize encoder");
>  return AVERROR(EINVAL);
> +} else {

This else could be removed since the other branch returns.

> +dump_enc_cfg(avctx, , AV_LOG_DEBUG);
>  }
>
___
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] lavfi/dnn_backend_openvino.c: Fix Memory Leak for RequestItem

2021-06-14 Thread Shubhanshu Saxena
Fix memory leak for RequestItem upon error while pushing to the
request_queue in the completion callback.

Signed-off-by: Shubhanshu Saxena 
---
 libavfilter/dnn/dnn_backend_openvino.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c 
b/libavfilter/dnn/dnn_backend_openvino.c
index 709a772a4d..702c4fb9ee 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -293,6 +293,8 @@ static void infer_completion_callback(void *args)
 
 request->inference_count = 0;
 if (ff_safe_queue_push_back(requestq, request) < 0) {
+ie_infer_request_free(>infer_request);
+av_freep();
 av_log(ctx, AV_LOG_ERROR, "Failed to push back request_queue.\n");
 return;
 }
-- 
2.25.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] avformat/matroskaenc: Allow changing the time stamp precision via option

2021-06-14 Thread Andreas Rheinhardt
Thierry Foucu:
> On Fri, Jun 4, 2021 at 10:18 PM Andreas Rheinhardt <
> andreas.rheinha...@outlook.com> wrote:
> 
>> Michael Fabian 'Xaymar' Dirks:
>>> On 2021-05-24 22:15, Andreas Rheinhardt wrote:
 michael.di...@xaymar.com:
> From: Michael Fabian 'Xaymar' Dirks 
>
> Adds "timestamp_precision" to the available options for Matroska
>> muxing.
> The option enables users and developers to change the precision of the
> time stamps in the Matroska container up to 1 nanosecond, which can aid
> with the proper detection of constant and variable rate content.
>
> Work-around fix for: 259, 6406, 7927, 8909 and 9124.
>
> Signed-off-by: Michael Fabian 'Xaymar' Dirks >>
> ---
>   doc/muxers.texi   |  8 
>   libavformat/matroskaenc.c | 33 ++---
>   2 files changed, 34 insertions(+), 7 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index e1c6ad0829..8655be94ff 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1583,6 +1583,14 @@ bitmap is stored bottom-up. Note that this
> option does not flip the bitmap
>   which has to be done manually beforehand, e.g. by using the vflip
> filter.
>   Default is @var{false} and indicates bitmap is stored top down.
>   +@item timestamp_precision
> +Sets the timestamp precision up to 1 nanosecond for Matroska/WebM,
> which can
> +improve detection of constant rate content in demuxers. Note that
> some poorly
> +implemented demuxers may require a timestamp precision of 1
> millisecond, so
> +increasing it past that point may result in playback issues. Higher
> precision
> +also reduces the maximum possible timestamp significantly.
 This should mention that a too high precision will increase container
 overhead.
>>> Good point.

> +Default is @var{1/1000} (1 millisecond).
> +
>   @end table
> @anchor{md5}
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 186a25d920..1b911a648c 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -158,6 +158,8 @@ typedef struct MatroskaMuxContext {
>   int default_mode;
> uint32_tsegment_uid[4];
> +
> +AVRational  time_base;
>   } MatroskaMuxContext;
> /** 2 bytes * 7 for EBML IDs, 7 1-byte EBML lengths, 6 1-byte uint,
> @@ -1814,6 +1816,7 @@ static int mkv_write_header(AVFormatContext *s)
>   const AVDictionaryEntry *tag;
>   int ret, i, version = 2;
>   int64_t creation_time;
> +int64_t time_base = 1;
> if (mkv->mode != MODE_WEBM ||
>   av_dict_get(s->metadata, "stereo_mode", NULL, 0) ||
> @@ -1850,7 +1853,10 @@ static int mkv_write_header(AVFormatContext *s)
>   return ret;
>   pb = mkv->info.bc;
>   -put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 100);
> +time_base = av_rescale_q(time_base, mkv->time_base,
> (AVRational){1, 10});
> +av_log(s, AV_LOG_DEBUG, "TimestampScale is: %" PRId64 " ns\n",
> time_base);
> +put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, time_base);
 There is a serious problem here: mkv->time_base is the time base that
 the muxer uses; yet if mkv->time_base is not a multiple of 1/10,
 then av_rescale_q will have to round a bit and then the demuxer will
 read a different time base, leading to a drift of all timestamps. This
 is not acceptable.
>>> This issue is already present in the current version of FFmpeg.
>>
>> Matroska's timestamp imprecision currently lead to jitter, but not to
>> drift (this of course presumes that one actually uses the timestamps
>> as-is (instead of summing the durations)). But your patch as-is can lead
>> to drift (when using a wrong timebase), because it adds a whole new type
>> of error: One in which the demuxer and the muxer disagree about the
>> timebase that is in use. Consider a user using 1/75000 as timebase.
>> 48kHz audio (with a timebase of 1/48000) can be converted accurately to
>> it, so that the muxer receives precise timestamps. Yet the muxer
>> actually writes that the timebase is 1/10 and that is what a
>> demuxer sees. This means that all timestamps (except those for which
>> Matroska uses "absolute timestamps" (Matroska-speak for a time/duration
>> that is always in 1/10 like default duration)) are skewed as-if
>> multiplied by 3/4.
>>
>>> Unfortunately even if you tell me this, this is not something I can
>>> change: Matroska uses nanosecond precision, and nobody has agreed on
>>> what the way forward for timestamps is. You will have to bring up such
>>> nanosecond-precision problems with the Matroska specification
>>> maintainers itself, which are currently seeking IETF standardization:
>>> 

Re: [FFmpeg-devel] [PATCH] avformat/dashenc: use av_match_ext()

2021-06-14 Thread Jeyapal, Karthick
From: Limin Wang 
>
>Signed-off-by: Limin Wang 
>---
>libavformat/dashenc.c | 16 +++-
>1 file changed, 3 insertions(+), 13 deletions(-)
Pushed.

Thanks,
Karthick
>
>diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>index 8a626c1..b7622bc 100644
>--- a/libavformat/dashenc.c
>+++ b/libavformat/dashenc.c
>@@ -330,16 +330,6 @@ static int init_segment_types(AVFormatContext *s)
> return 0;
>}
>
>-static int check_file_extension(const char *filename, const char *extension) {
>-char *dot;
>-if (!filename || !extension)
>-return -1;
>-dot = strrchr(filename, '.');
>-if (dot && !strcmp(dot + 1, extension))
>-return 0;
>-return -1;
>-}
>-
>static void set_vp9_codec_str(AVFormatContext *s, AVCodecParameters *par,
>   AVRational *frame_rate, char *str, int size) {
> VPCC vpcc;
>@@ -1530,9 +1520,9 @@ static int dash_init(AVFormatContext *s)
> }
>
> if (os->segment_type == SEGMENT_TYPE_WEBM) {
>-if ((!c->single_file && check_file_extension(os->init_seg_name, 
>os->format_name) != >0) ||
>-(!c->single_file && check_file_extension(os->media_seg_name, 
>os->format_name) >!= 0) ||
>-(c->single_file && check_file_extension(os->single_file_name, 
>os->format_name) >!= 0)) {
>+if ((!c->single_file && !av_match_ext(os->init_seg_name, 
>os->format_name))  ||
>+(!c->single_file && !av_match_ext(os->media_seg_name, 
>os->format_name)) ||
>+( c->single_file && !av_match_ext(os->single_file_name, 
>os->format_name))) {
> av_log(s, AV_LOG_WARNING,
>"One or many segment file names doesn't end with 
> .webm. "
>"Override -init_seg_name and/or -media_seg_name and/or 
> "
>-- 
>1.8.3.1
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>
>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 v2] avcodec/ccaption_dec: Make real-time latency configurable

2021-06-14 Thread Paul B Mahol
On Sun, Jun 13, 2021 at 11:50 PM Pavel Koshevoy  wrote:

> On Sat, Jun 5, 2021 at 11:40 AM Pavel Koshevoy 
> wrote:
>
> > Un-hardcode the 200ms minimum latency between emitting subtitle events
> > so that those that wish to receive a subtitle event for every screen
> > change could do so.
> >
> > The problem with delaying realtime output by any amount is that it is
> > unknown when the next byte pair that would trigger output will happen.
> > It may be within 200ms, or it may be several seconds later -- that's
> > not realtime at all.
> > ---
> >  libavcodec/ccaption_dec.c | 4 +++-
> >  libavcodec/version.h  | 2 +-
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> > index de05d037a8..27c61527f6 100644
> > --- a/libavcodec/ccaption_dec.c
> > +++ b/libavcodec/ccaption_dec.c
> > @@ -238,6 +238,7 @@ struct Screen {
> >  typedef struct CCaptionSubContext {
> >  AVClass *class;
> >  int real_time;
> > +int real_time_latency_msec;
> >  int data_field;
> >  struct Screen screen[2];
> >  int active_screen;
> > @@ -906,7 +907,7 @@ static int decode(AVCodecContext *avctx, void *data,
> > int *got_sub, AVPacket *avp
> >  }
> >
> >  if (ctx->real_time && ctx->screen_touched &&
> > -sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb,
> > AV_TIME_BASE_Q)) {
> > +sub->pts >= ctx->last_real_time +
> > av_rescale_q(ctx->real_time_latency_msec, ms_tb, AV_TIME_BASE_Q)) {
> >  ctx->last_real_time = sub->pts;
> >  ctx->screen_touched = 0;
> >
> > @@ -927,6 +928,7 @@ static int decode(AVCodecContext *avctx, void *data,
> > int *got_sub, AVPacket *avp
> >  #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
> >  static const AVOption options[] = {
> >  { "real_time", "emit subtitle events as they are decoded for
> > real-time display", OFFSET(real_time), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0,
> > 1, SD },
> > +{ "real_time_latency_msec", "minimum elapsed time between emitting
> > real-time subtitle events", OFFSET(real_time_latency_msec),
> > AV_OPT_TYPE_INT, { .i64 = 200 }, 0, 500, SD },
> >  { "data_field", "select data field", OFFSET(data_field),
> > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, SD, "data_field" },
> >  { "auto",   "pick first one that appears", 0, AV_OPT_TYPE_CONST, {
> > .i64 =-1 }, 0, 0, SD, "data_field" },
> >  { "first",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, SD,
> > "data_field" },
> > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > index 48165b9ac4..5b1e9e77f3 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -29,7 +29,7 @@
> >
> >  #define LIBAVCODEC_VERSION_MAJOR  59
> >  #define LIBAVCODEC_VERSION_MINOR   1
> > -#define LIBAVCODEC_VERSION_MICRO 100
> > +#define LIBAVCODEC_VERSION_MICRO 101
> >
> >  #define LIBAVCODEC_VERSION_INT
> AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> >
>  LIBAVCODEC_VERSION_MINOR, \
> > --
> > 2.26.2
> >
> >
>
> Ping.  If there are no objections may this be applied?
>
>
Do you have power to apply it?



> Thank you,
> Pavel.
> ___
> 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] avformat/matroskaenc: Allow changing the time stamp precision via option

2021-06-14 Thread Thierry Foucu
On Fri, Jun 4, 2021 at 10:18 PM Andreas Rheinhardt <
andreas.rheinha...@outlook.com> wrote:

> Michael Fabian 'Xaymar' Dirks:
> > On 2021-05-24 22:15, Andreas Rheinhardt wrote:
> >> michael.di...@xaymar.com:
> >>> From: Michael Fabian 'Xaymar' Dirks 
> >>>
> >>> Adds "timestamp_precision" to the available options for Matroska
> muxing.
> >>> The option enables users and developers to change the precision of the
> >>> time stamps in the Matroska container up to 1 nanosecond, which can aid
> >>> with the proper detection of constant and variable rate content.
> >>>
> >>> Work-around fix for: 259, 6406, 7927, 8909 and 9124.
> >>>
> >>> Signed-off-by: Michael Fabian 'Xaymar' Dirks  >
> >>> ---
> >>>   doc/muxers.texi   |  8 
> >>>   libavformat/matroskaenc.c | 33 ++---
> >>>   2 files changed, 34 insertions(+), 7 deletions(-)
> >>>
> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi
> >>> index e1c6ad0829..8655be94ff 100644
> >>> --- a/doc/muxers.texi
> >>> +++ b/doc/muxers.texi
> >>> @@ -1583,6 +1583,14 @@ bitmap is stored bottom-up. Note that this
> >>> option does not flip the bitmap
> >>>   which has to be done manually beforehand, e.g. by using the vflip
> >>> filter.
> >>>   Default is @var{false} and indicates bitmap is stored top down.
> >>>   +@item timestamp_precision
> >>> +Sets the timestamp precision up to 1 nanosecond for Matroska/WebM,
> >>> which can
> >>> +improve detection of constant rate content in demuxers. Note that
> >>> some poorly
> >>> +implemented demuxers may require a timestamp precision of 1
> >>> millisecond, so
> >>> +increasing it past that point may result in playback issues. Higher
> >>> precision
> >>> +also reduces the maximum possible timestamp significantly.
> >> This should mention that a too high precision will increase container
> >> overhead.
> > Good point.
> >>
> >>> +Default is @var{1/1000} (1 millisecond).
> >>> +
> >>>   @end table
> >>> @anchor{md5}
> >>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> >>> index 186a25d920..1b911a648c 100644
> >>> --- a/libavformat/matroskaenc.c
> >>> +++ b/libavformat/matroskaenc.c
> >>> @@ -158,6 +158,8 @@ typedef struct MatroskaMuxContext {
> >>>   int default_mode;
> >>> uint32_tsegment_uid[4];
> >>> +
> >>> +AVRational  time_base;
> >>>   } MatroskaMuxContext;
> >>> /** 2 bytes * 7 for EBML IDs, 7 1-byte EBML lengths, 6 1-byte uint,
> >>> @@ -1814,6 +1816,7 @@ static int mkv_write_header(AVFormatContext *s)
> >>>   const AVDictionaryEntry *tag;
> >>>   int ret, i, version = 2;
> >>>   int64_t creation_time;
> >>> +int64_t time_base = 1;
> >>> if (mkv->mode != MODE_WEBM ||
> >>>   av_dict_get(s->metadata, "stereo_mode", NULL, 0) ||
> >>> @@ -1850,7 +1853,10 @@ static int mkv_write_header(AVFormatContext *s)
> >>>   return ret;
> >>>   pb = mkv->info.bc;
> >>>   -put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 100);
> >>> +time_base = av_rescale_q(time_base, mkv->time_base,
> >>> (AVRational){1, 10});
> >>> +av_log(s, AV_LOG_DEBUG, "TimestampScale is: %" PRId64 " ns\n",
> >>> time_base);
> >>> +put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, time_base);
> >> There is a serious problem here: mkv->time_base is the time base that
> >> the muxer uses; yet if mkv->time_base is not a multiple of 1/10,
> >> then av_rescale_q will have to round a bit and then the demuxer will
> >> read a different time base, leading to a drift of all timestamps. This
> >> is not acceptable.
> > This issue is already present in the current version of FFmpeg.
>
> Matroska's timestamp imprecision currently lead to jitter, but not to
> drift (this of course presumes that one actually uses the timestamps
> as-is (instead of summing the durations)). But your patch as-is can lead
> to drift (when using a wrong timebase), because it adds a whole new type
> of error: One in which the demuxer and the muxer disagree about the
> timebase that is in use. Consider a user using 1/75000 as timebase.
> 48kHz audio (with a timebase of 1/48000) can be converted accurately to
> it, so that the muxer receives precise timestamps. Yet the muxer
> actually writes that the timebase is 1/10 and that is what a
> demuxer sees. This means that all timestamps (except those for which
> Matroska uses "absolute timestamps" (Matroska-speak for a time/duration
> that is always in 1/10 like default duration)) are skewed as-if
> multiplied by 3/4.
>
> > Unfortunately even if you tell me this, this is not something I can
> > change: Matroska uses nanosecond precision, and nobody has agreed on
> > what the way forward for timestamps is. You will have to bring up such
> > nanosecond-precision problems with the Matroska specification
> > maintainers itself, which are currently seeking IETF standardization:
> > 

Re: [FFmpeg-devel] [PATCH v2] avcodec/ccaption_dec: Make real-time latency configurable

2021-06-14 Thread Pavel Koshevoy
On Mon, Jun 14, 2021 at 10:04 AM Paul B Mahol  wrote:

> On Sun, Jun 13, 2021 at 11:50 PM Pavel Koshevoy 
> wrote:
>
> > On Sat, Jun 5, 2021 at 11:40 AM Pavel Koshevoy 
> > wrote:
> >
> > > Un-hardcode the 200ms minimum latency between emitting subtitle events
> > > so that those that wish to receive a subtitle event for every screen
> > > change could do so.
> > >
> > > The problem with delaying realtime output by any amount is that it is
> > > unknown when the next byte pair that would trigger output will happen.
> > > It may be within 200ms, or it may be several seconds later -- that's
> > > not realtime at all.
> > > ---
> > >  libavcodec/ccaption_dec.c | 4 +++-
> > >  libavcodec/version.h  | 2 +-
> > >  2 files changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> > > index de05d037a8..27c61527f6 100644
> > > --- a/libavcodec/ccaption_dec.c
> > > +++ b/libavcodec/ccaption_dec.c
> > > @@ -238,6 +238,7 @@ struct Screen {
> > >  typedef struct CCaptionSubContext {
> > >  AVClass *class;
> > >  int real_time;
> > > +int real_time_latency_msec;
> > >  int data_field;
> > >  struct Screen screen[2];
> > >  int active_screen;
> > > @@ -906,7 +907,7 @@ static int decode(AVCodecContext *avctx, void
> *data,
> > > int *got_sub, AVPacket *avp
> > >  }
> > >
> > >  if (ctx->real_time && ctx->screen_touched &&
> > > -sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb,
> > > AV_TIME_BASE_Q)) {
> > > +sub->pts >= ctx->last_real_time +
> > > av_rescale_q(ctx->real_time_latency_msec, ms_tb, AV_TIME_BASE_Q)) {
> > >  ctx->last_real_time = sub->pts;
> > >  ctx->screen_touched = 0;
> > >
> > > @@ -927,6 +928,7 @@ static int decode(AVCodecContext *avctx, void
> *data,
> > > int *got_sub, AVPacket *avp
> > >  #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
> > >  static const AVOption options[] = {
> > >  { "real_time", "emit subtitle events as they are decoded for
> > > real-time display", OFFSET(real_time), AV_OPT_TYPE_BOOL, { .i64 = 0 },
> 0,
> > > 1, SD },
> > > +{ "real_time_latency_msec", "minimum elapsed time between emitting
> > > real-time subtitle events", OFFSET(real_time_latency_msec),
> > > AV_OPT_TYPE_INT, { .i64 = 200 }, 0, 500, SD },
> > >  { "data_field", "select data field", OFFSET(data_field),
> > > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, SD, "data_field" },
> > >  { "auto",   "pick first one that appears", 0, AV_OPT_TYPE_CONST, {
> > > .i64 =-1 }, 0, 0, SD, "data_field" },
> > >  { "first",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, SD,
> > > "data_field" },
> > > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > > index 48165b9ac4..5b1e9e77f3 100644
> > > --- a/libavcodec/version.h
> > > +++ b/libavcodec/version.h
> > > @@ -29,7 +29,7 @@
> > >
> > >  #define LIBAVCODEC_VERSION_MAJOR  59
> > >  #define LIBAVCODEC_VERSION_MINOR   1
> > > -#define LIBAVCODEC_VERSION_MICRO 100
> > > +#define LIBAVCODEC_VERSION_MICRO 101
> > >
> > >  #define LIBAVCODEC_VERSION_INT
> > AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> > >
> >  LIBAVCODEC_VERSION_MINOR, \
> > > --
> > > 2.26.2
> > >
> > >
> >
> > Ping.  If there are no objections may this be applied?
> >
> >
> Do you have power to apply it?
>
>
Yes, I have git access, but I'm not the maintainer of
libavcodec/ccaption_dec.c

Pavel.
___
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 17/33] avdevice/dshow: discover source color range/space/etc

2021-06-14 Thread James Almer

On 6/14/2021 1:56 PM, Michael Niedermayer wrote:

On Fri, Jun 11, 2021 at 10:30:48PM +0200, Diederick Niehorster wrote:

Enabled discovering a DirectShow device's color range, space, primaries,
transfer characteristics and chroma location, if the device exposes that
information. Sets them in the stream's codecpars.

Signed-off-by: Diederick Niehorster 
Co-authored-by: Valerii Zapodovnikov 
Signed-off-by: Diederick Niehorster 
---
  libavdevice/dshow.c | 250 +++-
  1 file changed, 249 insertions(+), 1 deletion(-)


breaks build on mingw64

make
CC  libavdevice/dshow.o
src/libavdevice/dshow.c: In function ‘dshow_get_device_media_types’:
src/libavdevice/dshow.c:415:23: warning: unused variable ‘ctx’ 
[-Wunused-variable]
  struct dshow_ctx *ctx = avctx->priv_data;
^~~
src/libavdevice/dshow.c: In function ‘dshow_get_device_list’:
src/libavdevice/dshow.c:662:23: warning: unused variable ‘ctx’ 
[-Wunused-variable]
  struct dshow_ctx *ctx = avctx->priv_data;
^~~
src/libavdevice/dshow.c: In function ‘dshow_cycle_formats’:
src/libavdevice/dshow.c:731:13: error: unknown type name ‘DXVA_ExtendedFormat’; 
did you mean ‘DXVA2_ExtendedFormat’?
  DXVA_ExtendedFormat *extended_format_info = NULL;
  ^~~
  DXVA2_ExtendedFormat
src/libavdevice/dshow.c:744:41: error: ‘AMCONTROL_COLORINFO_PRESENT’ undeclared 
(first use in this function)
  if (v->dwControlFlags & AMCONTROL_COLORINFO_PRESENT)
  ^~~


$ grep -r AMCONTROL_COLORINFO_PRESENT /mingw64/x86_64-w64-mingw32/include/*
/mingw64/x86_64-w64-mingw32/include/dvdmedia.h:#define 
AMCONTROL_COLORINFO_PRESENT 0x0080


Can you see if you can update your mingw-w64 toolchain, or at least the 
headers/crt? This is not the first time you get an error with new code.
Old mingw headers releases lacked a lot of API and are not 
representative of what a sane toolchain is meant to have.

___
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/2] lavc/libaomenc: Show encoder config as a warning in case of failed initialization

2021-06-14 Thread Thilo Borgmann
Am 14.06.21 um 19:39 schrieb James Zern:
> On Sat, Jun 12, 2021 at 12:10 PM Thilo Borgmann  
> wrote:
>>
>> Hi,
>>
>> if init fails, it's likely originating from the library's config. This and 
>> 2/2 are for easier debugging in that case instead of having to run again 
>> with loglevel DEBUG.
>>
> 
>> ---
>>  libavcodec/libaomenc.c | 10 ++
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
> 
> lgtm.
> 
>> [...]
>> -dump_enc_cfg(avctx, );
>>  /* Construct Encoder Context */
>>  res = aom_codec_enc_init(>encoder, iface, , flags);
>>  if (res != AOM_CODEC_OK) {
>> +dump_enc_cfg(avctx, , AV_LOG_WARNING);
>>  log_encoder_error(avctx, "Failed to initialize encoder");
>>  return AVERROR(EINVAL);
>> +} else {
> 
> This else could be removed since the other branch returns.
> 
>> +dump_enc_cfg(avctx, , AV_LOG_DEBUG);
>>  }

It would change existing behavior because currently, the cfg is always printed.
If we make that change, it would not be printed at all in that case. Not?

Thanks,
Thilo
___
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] lavfi/drawtext: Add localtime_ms for millisecond precision

2021-06-14 Thread Thilo Borgmann
Am 08.06.21 um 18:42 schrieb Thilo Borgmann:
> Hi,
> 
> add %{localtime_ms} function to the drawtext filter. Same as %{localtime} but 
> with additional millisecond part. 

Ping for a volunteer to actually have a look at the patch for review.

Thanks,
Thilo
___
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/17] avcodec/avcodec: Stop including channel_layout.h in avcodec.h

2021-06-14 Thread Andreas Rheinhardt
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt 
---
 doc/examples/filtering_audio.c   | 1 +
 doc/examples/transcode_aac.c | 1 +
 doc/examples/transcoding.c   | 1 +
 fftools/cmdutils.c   | 1 +
 fftools/ffplay.c | 1 +
 fftools/ffprobe.c| 1 +
 libavcodec/aacdec_template.c | 1 +
 libavcodec/aacenc.c  | 1 +
 libavcodec/aacenc.h  | 1 +
 libavcodec/aacenctab.h   | 1 +
 libavcodec/aptxdec.c | 1 +
 libavcodec/aptxenc.c | 1 +
 libavcodec/atrac9dec.c   | 1 +
 libavcodec/audiotoolboxdec.c | 1 +
 libavcodec/audiotoolboxenc.c | 1 +
 libavcodec/avcodec.c | 1 +
 libavcodec/avcodec.h | 1 -
 libavcodec/dca_core.c| 1 +
 libavcodec/dca_xll.c | 1 +
 libavcodec/decode.c  | 1 +
 libavcodec/dolby_e.c | 1 +
 libavcodec/dolby_e_parser.c  | 1 +
 libavcodec/dvaudiodec.c  | 1 +
 libavcodec/encode.c  | 1 +
 libavcodec/evrcdec.c | 1 +
 libavcodec/flacenc.c | 1 +
 libavcodec/g722enc.c | 1 +
 libavcodec/ilbcdec.c | 1 +
 libavcodec/libcodec2.c   | 1 +
 libavcodec/libgsmenc.c   | 1 +
 libavcodec/libopusenc.c  | 1 +
 libavcodec/libshine.c| 1 +
 libavcodec/libtwolame.c  | 1 +
 libavcodec/libvorbisenc.c| 1 +
 libavcodec/mlp.c | 1 +
 libavcodec/mlpenc.c  | 1 +
 libavcodec/mpegaudioenc_fixed.c  | 1 +
 libavcodec/mpegaudioenc_float.c  | 1 +
 libavcodec/opus.c| 1 +
 libavcodec/opusenc.c | 1 +
 libavcodec/pafaudio.c| 1 +
 libavcodec/pcm-dvdenc.c  | 1 +
 libavcodec/ra144enc.c| 1 +
 libavcodec/s302m.c   | 1 +
 libavcodec/s302menc.c| 1 +
 libavcodec/sbcdec.c  | 1 +
 libavcodec/sbcenc.c  | 1 +
 libavcodec/siren.c   | 1 +
 libavcodec/tak.c | 1 +
 libavcodec/tta.c | 1 +
 libavcodec/utils.c   | 1 +
 libavcodec/wavpackenc.c  | 1 +
 libavdevice/avfoundation.m   | 1 +
 libavdevice/pulse_audio_enc.c| 1 +
 libavfilter/af_afir.c| 1 +
 libavfilter/af_apulsator.c   | 1 +
 libavfilter/af_biquads.c | 1 +
 libavfilter/af_firequalizer.c| 1 +
 libavfilter/af_hdcd.c| 1 +
 libavfilter/af_speechnorm.c  | 1 +
 libavfilter/asrc_afirsrc.c   | 1 +
 libavfilter/asrc_anoisesrc.c | 1 +
 libavfilter/asrc_hilbert.c   | 1 +
 libavfilter/asrc_sinc.c  | 1 +
 libavfilter/avf_showcqt.c| 1 +
 libavfilter/src_movie.c  | 1 +
 libavfilter/tests/formats.c  | 1 +
 libavformat/alp.c| 2 ++
 libavformat/apm.c| 1 +
 libavformat/argo_asf.c   | 1 +
 libavformat/argo_cvg.c   | 2 ++
 libavformat/codec2.c | 1 +
 libavformat/derf.c   | 1 +
 libavformat/dsfdec.c | 1 +
 libavformat/eacdata.c| 1 +
 libavformat/framehash.c  | 1 +
 libavformat/fwse.c   | 1 +
 libavformat/genh.c   | 1 +
 libavformat/ifv.c| 1 +
 libavformat/imx.c| 1 +
 libavformat/isom.c   | 1 +
 libavformat/kvag.c   | 2 ++
 libavformat/libopenmpt.c | 1 +
 libavformat/movenc.c | 1 +
 libavformat/mpeg.c   | 1 +
 libavformat/pp_bnk.c | 1 +
 libavformat/riffenc.c| 1 +
 libavformat/sbgdec.c | 1 +
 libavformat/sga.c| 1 +
 libavformat/wsddec.c | 1 +
 libswresample/options.c  | 1 +
 libswresample/swresample_frame.c | 1 +
 tests/api/api-flac-test.c| 1 +
 93 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index 508c19c60b..2af73a7031 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 static const char *filter_descr = 
"aresample=8000,aformat=sample_fmts=s16:channel_layouts=mono";
diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 711076b5a5..1cf6317e27 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -38,6 +38,7 @@
 #include "libavutil/audio_fifo.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/frame.h"
 #include "libavutil/opt.h"
 
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index 3a97426e2c..51c120dfb7 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f72231790f..553ef0fe4f 100644
--- a/fftools/cmdutils.c

[FFmpeg-devel] [PATCH 03/17] avcodec/avcodec: Don't include errno.h

2021-06-14 Thread Andreas Rheinhardt
This inclusion has been added before libavutil/error.h was split off
from avcodec.h (in 60c144f700e2e362047b00704abcb694d49e549c).

Signed-off-by: Andreas Rheinhardt 
---
Still included implicitly (even via multiple paths).

 libavcodec/avcodec.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 292c373c68..6873e12279 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -27,7 +27,6 @@
  * Libavcodec external API header
  */
 
-#include 
 #include "libavutil/samplefmt.h"
 #include "libavutil/attributes.h"
 #include "libavutil/avutil.h"
-- 
2.27.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 04/17] avcodec/avcodec: Don't include hwcontext.h

2021-06-14 Thread Andreas Rheinhardt
It is no longer used directly; but it is still indirectly included via
codec.h.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/avcodec.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6873e12279..5457f47bd0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -34,7 +34,6 @@
 #include "libavutil/cpu.h"
 #include "libavutil/dict.h"
 #include "libavutil/frame.h"
-#include "libavutil/hwcontext.h"
 #include "libavutil/log.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
-- 
2.27.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 05/17] avcodec/avcodec: Don't include cpu.h

2021-06-14 Thread Andreas Rheinhardt
It is not used here at all; instead, add it where it is used without
including it or any of the arch-specific CPU headers.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/avcodec.h   | 1 -
 libavcodec/frame_thread_encoder.c  | 1 +
 libavcodec/libaomdec.c | 1 +
 libavcodec/libaomenc.c | 1 +
 libavcodec/libdav1d.c  | 1 +
 libavcodec/libdavs2.c  | 1 +
 libavcodec/libuavs3d.c | 1 +
 libavcodec/libvpxdec.c | 1 +
 libavcodec/libvpxenc.c | 1 +
 libavcodec/tests/aarch64/dct.c | 1 +
 libavcodec/tests/arm/dct.c | 1 +
 libavcodec/tests/motion.c  | 1 +
 libavcodec/tests/ppc/dct.c | 1 +
 libavcodec/tests/x86/dct.c | 1 +
 libavfilter/dnn/dnn_backend_openvino.c | 1 +
 libavutil/frame.c  | 1 +
 libavutil/slicethread.c| 1 +
 libpostproc/postprocess.c  | 1 +
 libswresample/resample.c   | 1 +
 tools/target_dec_fuzzer.c  | 1 +
 20 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5457f47bd0..2304f6d6bb 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -31,7 +31,6 @@
 #include "libavutil/attributes.h"
 #include "libavutil/avutil.h"
 #include "libavutil/buffer.h"
-#include "libavutil/cpu.h"
 #include "libavutil/dict.h"
 #include "libavutil/frame.h"
 #include "libavutil/log.h"
diff --git a/libavcodec/frame_thread_encoder.c 
b/libavcodec/frame_thread_encoder.c
index b3e571f4b0..9cabfc495f 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -23,6 +23,7 @@
 #include "frame_thread_encoder.h"
 
 #include "libavutil/avassert.h"
+#include "libavutil/cpu.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/thread.h"
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 6e7324a832..75ecc08970 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -27,6 +27,7 @@
 #include 
 
 #include "libavutil/common.h"
+#include "libavutil/cpu.h"
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index f977fb4889..485a3be48f 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -30,6 +30,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/base64.h"
 #include "libavutil/common.h"
+#include "libavutil/cpu.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 50e6200f5d..cd67a906e2 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -22,6 +22,7 @@
 #include 
 
 #include "libavutil/avassert.h"
+#include "libavutil/cpu.h"
 #include "libavutil/film_grain_params.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/imgutils.h"
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 28cad9c5f7..a1672d1c95 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/cpu.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "davs2.h"
diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index f7e458b356..1d523c8722 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -24,6 +24,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/avutil.h"
 #include "libavutil/common.h"
+#include "libavutil/cpu.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index f9b4c9f427..42d1b8ab1c 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -29,6 +29,7 @@
 #include 
 
 #include "libavutil/common.h"
+#include "libavutil/cpu.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 94932a48da..70c8465358 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -38,6 +38,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
 #include "libavutil/common.h"
+#include "libavutil/cpu.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
diff --git a/libavcodec/tests/aarch64/dct.c b/libavcodec/tests/aarch64/dct.c
index 032a9638f6..9e477328d5 100644
--- a/libavcodec/tests/aarch64/dct.c
+++ b/libavcodec/tests/aarch64/dct.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 
+#include "libavutil/cpu.h"
 #include "libavcodec/aarch64/idct.h"
 
 static const struct algo fdct_tab_arch[] = {
diff --git a/libavcodec/tests/arm/dct.c b/libavcodec/tests/arm/dct.c
index 596d369a99..5f826e84df 100644
--- a/libavcodec/tests/arm/dct.c
+++ b/libavcodec/tests/arm/dct.c
@@ -18,6 +18,7 @@

Re: [FFmpeg-devel] [PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder

2021-06-14 Thread Andreas Rheinhardt
Mohammad Izadi:
> HDR10+ metadata is stored in the bit stream for HEVC. The story is different 
> for VP9 and cannot store the metadata in the bit stream. HDR10+ should be 
> passed to packet side data an stored in the container (mkv) for VP9.
> 
> This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing 
> it to the AVPacket side data.
> ---
>  doc/APIchanges |  2 +
>  libavcodec/avpacket.c  |  1 +
>  libavcodec/decode.c|  1 +
>  libavcodec/libvpxenc.c | 87 ++
>  libavcodec/packet.h|  8 
>  libavcodec/version.h   |  4 +-
>  6 files changed, 101 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 06493763b3..ee7881e1e9 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,8 @@ libavutil: 2021-04-27
>  
>  
>  API changes, most recent first:
> +2021-05-25 - 8c88a66d3c - lavc 59.2.100 - packet.h
> +  Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
>  
>  2021-06-09 - xx - lavf 59.3.100 - avformat.h
>Add pts_wrap_bits to AVStream
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index 7383d12d3e..800bee3489 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -289,6 +289,7 @@ const char *av_packet_side_data_name(enum 
> AVPacketSideDataType type)
>  case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
>  case AV_PKT_DATA_DOVI_CONF:  return "DOVI configuration 
> record";
>  case AV_PKT_DATA_S12M_TIMECODE:  return "SMPTE ST 12-1:2014 
> timecode";
> +case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic 
> Metadata (SMPTE 2094-40)";
>  }
>  return NULL;
>  }
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 75bc7ad98e..40f688e40c 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1488,6 +1488,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, 
> AVFrame *frame)
>  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
>  { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE 
> },
>  { AV_PKT_DATA_S12M_TIMECODE,  
> AV_FRAME_DATA_S12M_TIMECODE },
> +{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
> AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
>  };
>  
>  if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >= 
> sizeof(*pkt))
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 94932a48da..308ebe1691 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -64,6 +64,11 @@ struct FrameListData {
>  struct FrameListData *next;
>  };
>  
> +typedef struct FrameHDR10Plus {
> +int64_t pts;
> +AVBufferRef *hdr10_plus;
> +} FrameHDR10Plus;
> +
>  typedef struct VPxEncoderContext {
>  AVClass *class;
>  struct vpx_codec_ctx encoder;
> @@ -121,6 +126,8 @@ typedef struct VPxEncoderContext {
>  int tune_content;
>  int corpus_complexity;
>  int tpl_model;
> +int discard_hdr10_plus;
> +AVFifoBuffer *hdr10_plus_fifo;
>  /**
>   * If the driver does not support ROI then warn the first time we
>   * encounter a frame with ROI side data.
> @@ -316,6 +323,47 @@ static av_cold void free_frame_list(struct FrameListData 
> *list)
>  }
>  }
>  
> +static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct FrameHDR10Plus 
> *data)
> +{
> +int err = av_fifo_grow(fifo, sizeof(*data));
> +if (err < 0)
> +return err;
> +av_fifo_generic_write(fifo, data, sizeof(*data), NULL);
> +return 0;
> +}
> +
> +static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
> +{
> +FrameHDR10Plus frame_hdr10_plus;
> +while (av_fifo_size(*fifo) >= sizeof(FrameHDR10Plus)) {
> +av_fifo_generic_read(*fifo, _hdr10_plus, 
> sizeof(FrameHDR10Plus), NULL);
> +av_buffer_unref(_hdr10_plus.hdr10_plus);
> +}
> +av_fifo_freep(fifo);
> +}
> +
> +static int copy_hdr10_plus_to_pkt(AVFifoBuffer *fifo, AVPacket *pkt)
> +{
> +FrameHDR10Plus frame_hdr10_plus;
> +uint8_t *data;
> +if (!pkt)
> +return 0;
> +if (av_fifo_size(fifo) < sizeof(frame_hdr10_plus))
> +return 0;
> +
> +av_fifo_generic_read(fifo, _hdr10_plus, sizeof(frame_hdr10_plus), 
> NULL);
> +if (!frame_hdr10_plus.hdr10_plus || frame_hdr10_plus.pts != pkt->pts)
> +return 0;

Leak.

> +
> +data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
> frame_hdr10_plus.hdr10_plus->size);
> +if (!data)
> +return AVERROR(ENOMEM);

Leak.

> +
> +memcpy(data, frame_hdr10_plus.hdr10_plus->data, 
> frame_hdr10_plus.hdr10_plus->size);
> +
> +return 0;

Leak. You should really check for leaks yourself; given that this is not
a leak that only happens on error it is easily detectable.

> +}
> +
>  static av_cold int codecctl_int(AVCodecContext *avctx,
>  enum vp8e_enc_control_id id, int val)
>  {
> @@ -384,6 +432,8 @@ 

Re: [FFmpeg-devel] [PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder

2021-06-14 Thread Mohammad Izadi
On Thu, Jun 10, 2021 at 4:05 PM Andreas Rheinhardt <
andreas.rheinha...@outlook.com> wrote:

> Mohammad Izadi:
> > HDR10+ metadata is stored in the bit stream for HEVC. The story is
> different for VP9 and cannot store the metadata in the bit stream. HDR10+
> should be passed to packet side data an stored in the container (mkv) for
> VP9.
> >
> > This CL is taking HDR10+ from AVFrame side data in libvpxenc and is
> passing it to the AVPacket side data.
> > ---
> >  doc/APIchanges |  2 +
> >  libavcodec/avpacket.c  |  1 +
> >  libavcodec/decode.c|  1 +
> >  libavcodec/libvpxenc.c | 99 ++
> >  libavcodec/packet.h|  8 
> >  libavcodec/version.h   |  4 +-
> >  6 files changed, 113 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 55171311ed..bba5b06c6a 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -13,6 +13,8 @@ libavutil: 2021-04-27
> >
> >
> >  API changes, most recent first:
> > +2021-05-25 - 8c88a66d3c - lavc 59.2.100 - packet.h
> > +  Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
> >
> >  2021-xx-xx - xx - lavc 59.1.100 - avcodec.h codec.h
> >Move av_get_profile_name() from avcodec.h to codec.h.
> > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > index 7383d12d3e..800bee3489 100644
> > --- a/libavcodec/avpacket.c
> > +++ b/libavcodec/avpacket.c
> > @@ -289,6 +289,7 @@ const char *av_packet_side_data_name(enum
> AVPacketSideDataType type)
> >  case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
> >  case AV_PKT_DATA_DOVI_CONF:  return "DOVI
> configuration record";
> >  case AV_PKT_DATA_S12M_TIMECODE:  return "SMPTE ST
> 12-1:2014 timecode";
> > +case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic
> Metadata (SMPTE 2094-40)";
> >  }
> >  return NULL;
> >  }
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index 75bc7ad98e..40f688e40c 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -1488,6 +1488,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
> AVFrame *frame)
> >  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
> },
> >  { AV_PKT_DATA_ICC_PROFILE,
> AV_FRAME_DATA_ICC_PROFILE },
> >  { AV_PKT_DATA_S12M_TIMECODE,
> AV_FRAME_DATA_S12M_TIMECODE },
> > +{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
>  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> >  };
> >
> >  if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >=
> sizeof(*pkt))
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index 66bad444d0..e2e6c60b68 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -64,6 +64,11 @@ struct FrameListData {
> >  struct FrameListData *next;
> >  };
> >
> > +typedef struct FrameHDR10Plus {
> > +int64_t pts;
> > +AVBufferRef *hdr10_plus;
> > +} FrameHDR10Plus;
> > +
> >  typedef struct VPxEncoderContext {
> >  AVClass *class;
> >  struct vpx_codec_ctx encoder;
> > @@ -121,6 +126,8 @@ typedef struct VPxEncoderContext {
> >  int tune_content;
> >  int corpus_complexity;
> >  int tpl_model;
> > +int discard_hdr10_plus;
> > +AVFifoBuffer *hdr10_plus_fifo;
> >  /**
> >   * If the driver does not support ROI then warn the first time we
> >   * encounter a frame with ROI side data.
> > @@ -316,6 +323,55 @@ static av_cold void free_frame_list(struct
> FrameListData *list)
> >  }
> >  }
> >
> > +static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct
> FrameHDR10Plus *data)
> > +{
> > +int err = av_fifo_grow(fifo, sizeof(*data));
> > +if (err < 0)
> > +return err;
> > +av_fifo_generic_write(fifo, data, sizeof(*data), NULL);
> > +return 0;
> > +}
> > +
> > +static av_cold void free_hdr10_plus(struct FrameHDR10Plus *p)
> > +{
> > +if (!p)
> > +return;
> > +av_buffer_unref(>hdr10_plus);
> > +av_free(p);
> > +}
> > +
> > +static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
> > +{
> > +FrameHDR10Plus *frame_hdr10_plus = NULL;
> > +while (av_fifo_size(*fifo) >= sizeof(FrameHDR10Plus)) {
> > +av_fifo_generic_read(*fifo, frame_hdr10_plus,
> sizeof(FrameHDR10Plus), NULL);
> > +free_hdr10_plus(frame_hdr10_plus);
>
> You apparently overlooked/ignored my email here:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281220.html

using variable rather pointer now. What tools are you using to detect
leaks? Can you please direct me to a link or doc to know how to find the
leak?
I use ffmpeg_g, but does not show any leak.

>
>
> > +}
> > +av_fifo_freep(fifo);
> > +}
> > +
> > +static int copy_hdr10_plus_to_pkt(AVFifoBuffer *fifo, AVPacket *pkt)
> > +{
> > +FrameHDR10Plus frame_hdr10_plus;
> > +uint8_t *data;
> > +if (!pkt)
> > +return 0;
> > +if (av_fifo_size(fifo) < sizeof(frame_hdr10_plus))
> > +return 0;
> > +
> 

Re: [FFmpeg-devel] [PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder

2021-06-14 Thread Andreas Rheinhardt
Mohammad Izadi:
> On Thu, Jun 10, 2021 at 4:05 PM Andreas Rheinhardt <
> andreas.rheinha...@outlook.com> wrote:
> 
>> Mohammad Izadi:
>>> HDR10+ metadata is stored in the bit stream for HEVC. The story is
>> different for VP9 and cannot store the metadata in the bit stream. HDR10+
>> should be passed to packet side data an stored in the container (mkv) for
>> VP9.
>>>
>>> This CL is taking HDR10+ from AVFrame side data in libvpxenc and is
>> passing it to the AVPacket side data.
>>> ---
>>>  doc/APIchanges |  2 +
>>>  libavcodec/avpacket.c  |  1 +
>>>  libavcodec/decode.c|  1 +
>>>  libavcodec/libvpxenc.c | 99 ++
>>>  libavcodec/packet.h|  8 
>>>  libavcodec/version.h   |  4 +-
>>>  6 files changed, 113 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 55171311ed..bba5b06c6a 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -13,6 +13,8 @@ libavutil: 2021-04-27
>>>
>>>
>>>  API changes, most recent first:
>>> +2021-05-25 - 8c88a66d3c - lavc 59.2.100 - packet.h
>>> +  Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
>>>
>>>  2021-xx-xx - xx - lavc 59.1.100 - avcodec.h codec.h
>>>Move av_get_profile_name() from avcodec.h to codec.h.
>>> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
>>> index 7383d12d3e..800bee3489 100644
>>> --- a/libavcodec/avpacket.c
>>> +++ b/libavcodec/avpacket.c
>>> @@ -289,6 +289,7 @@ const char *av_packet_side_data_name(enum
>> AVPacketSideDataType type)
>>>  case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
>>>  case AV_PKT_DATA_DOVI_CONF:  return "DOVI
>> configuration record";
>>>  case AV_PKT_DATA_S12M_TIMECODE:  return "SMPTE ST
>> 12-1:2014 timecode";
>>> +case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic
>> Metadata (SMPTE 2094-40)";
>>>  }
>>>  return NULL;
>>>  }
>>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>>> index 75bc7ad98e..40f688e40c 100644
>>> --- a/libavcodec/decode.c
>>> +++ b/libavcodec/decode.c
>>> @@ -1488,6 +1488,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
>> AVFrame *frame)
>>>  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
>> },
>>>  { AV_PKT_DATA_ICC_PROFILE,
>> AV_FRAME_DATA_ICC_PROFILE },
>>>  { AV_PKT_DATA_S12M_TIMECODE,
>> AV_FRAME_DATA_S12M_TIMECODE },
>>> +{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
>>  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
>>>  };
>>>
>>>  if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >=
>> sizeof(*pkt))
>>> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
>>> index 66bad444d0..e2e6c60b68 100644
>>> --- a/libavcodec/libvpxenc.c
>>> +++ b/libavcodec/libvpxenc.c
>>> @@ -64,6 +64,11 @@ struct FrameListData {
>>>  struct FrameListData *next;
>>>  };
>>>
>>> +typedef struct FrameHDR10Plus {
>>> +int64_t pts;
>>> +AVBufferRef *hdr10_plus;
>>> +} FrameHDR10Plus;
>>> +
>>>  typedef struct VPxEncoderContext {
>>>  AVClass *class;
>>>  struct vpx_codec_ctx encoder;
>>> @@ -121,6 +126,8 @@ typedef struct VPxEncoderContext {
>>>  int tune_content;
>>>  int corpus_complexity;
>>>  int tpl_model;
>>> +int discard_hdr10_plus;
>>> +AVFifoBuffer *hdr10_plus_fifo;
>>>  /**
>>>   * If the driver does not support ROI then warn the first time we
>>>   * encounter a frame with ROI side data.
>>> @@ -316,6 +323,55 @@ static av_cold void free_frame_list(struct
>> FrameListData *list)
>>>  }
>>>  }
>>>
>>> +static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct
>> FrameHDR10Plus *data)
>>> +{
>>> +int err = av_fifo_grow(fifo, sizeof(*data));
>>> +if (err < 0)
>>> +return err;
>>> +av_fifo_generic_write(fifo, data, sizeof(*data), NULL);
>>> +return 0;
>>> +}
>>> +
>>> +static av_cold void free_hdr10_plus(struct FrameHDR10Plus *p)
>>> +{
>>> +if (!p)
>>> +return;
>>> +av_buffer_unref(>hdr10_plus);
>>> +av_free(p);
>>> +}
>>> +
>>> +static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
>>> +{
>>> +FrameHDR10Plus *frame_hdr10_plus = NULL;
>>> +while (av_fifo_size(*fifo) >= sizeof(FrameHDR10Plus)) {
>>> +av_fifo_generic_read(*fifo, frame_hdr10_plus,
>> sizeof(FrameHDR10Plus), NULL);
>>> +free_hdr10_plus(frame_hdr10_plus);
>>
>> You apparently overlooked/ignored my email here:
>> https://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281220.html
> 
> using variable rather pointer now. What tools are you using to detect
> leaks? Can you please direct me to a link or doc to know how to find the
> leak?

See below for the tools; but these leaks have actually been found by
reading the code (for every allocation in your code there should be a
matching free; but there isn't for the AVBufferRef that you allocate).

> I use ffmpeg_g, but does not show any leak.
> 

Of course not; why should debug symbols alone show a leak?

>>
>>
>>> 

[FFmpeg-devel] [PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder

2021-06-14 Thread Mohammad Izadi
HDR10+ metadata is stored in the bit stream for HEVC. The story is different 
for VP9 and cannot store the metadata in the bit stream. HDR10+ should be 
passed to packet side data an stored in the container (mkv) for VP9.

This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing it 
to the AVPacket side data.
---
 doc/APIchanges |  2 +
 libavcodec/avpacket.c  |  1 +
 libavcodec/decode.c|  1 +
 libavcodec/libvpxenc.c | 87 ++
 libavcodec/packet.h|  8 
 libavcodec/version.h   |  4 +-
 6 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 06493763b3..ee7881e1e9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,8 @@ libavutil: 2021-04-27
 
 
 API changes, most recent first:
+2021-05-25 - 8c88a66d3c - lavc 59.2.100 - packet.h
+  Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
 
 2021-06-09 - xx - lavf 59.3.100 - avformat.h
   Add pts_wrap_bits to AVStream
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 7383d12d3e..800bee3489 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -289,6 +289,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
 case AV_PKT_DATA_DOVI_CONF:  return "DOVI configuration 
record";
 case AV_PKT_DATA_S12M_TIMECODE:  return "SMPTE ST 12-1:2014 
timecode";
+case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic 
Metadata (SMPTE 2094-40)";
 }
 return NULL;
 }
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 75bc7ad98e..40f688e40c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1488,6 +1488,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
 { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
 { AV_PKT_DATA_S12M_TIMECODE,  AV_FRAME_DATA_S12M_TIMECODE 
},
+{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
 };
 
 if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >= 
sizeof(*pkt))
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 94932a48da..308ebe1691 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -64,6 +64,11 @@ struct FrameListData {
 struct FrameListData *next;
 };
 
+typedef struct FrameHDR10Plus {
+int64_t pts;
+AVBufferRef *hdr10_plus;
+} FrameHDR10Plus;
+
 typedef struct VPxEncoderContext {
 AVClass *class;
 struct vpx_codec_ctx encoder;
@@ -121,6 +126,8 @@ typedef struct VPxEncoderContext {
 int tune_content;
 int corpus_complexity;
 int tpl_model;
+int discard_hdr10_plus;
+AVFifoBuffer *hdr10_plus_fifo;
 /**
  * If the driver does not support ROI then warn the first time we
  * encounter a frame with ROI side data.
@@ -316,6 +323,47 @@ static av_cold void free_frame_list(struct FrameListData 
*list)
 }
 }
 
+static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct FrameHDR10Plus 
*data)
+{
+int err = av_fifo_grow(fifo, sizeof(*data));
+if (err < 0)
+return err;
+av_fifo_generic_write(fifo, data, sizeof(*data), NULL);
+return 0;
+}
+
+static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
+{
+FrameHDR10Plus frame_hdr10_plus;
+while (av_fifo_size(*fifo) >= sizeof(FrameHDR10Plus)) {
+av_fifo_generic_read(*fifo, _hdr10_plus, sizeof(FrameHDR10Plus), 
NULL);
+av_buffer_unref(_hdr10_plus.hdr10_plus);
+}
+av_fifo_freep(fifo);
+}
+
+static int copy_hdr10_plus_to_pkt(AVFifoBuffer *fifo, AVPacket *pkt)
+{
+FrameHDR10Plus frame_hdr10_plus;
+uint8_t *data;
+if (!pkt)
+return 0;
+if (av_fifo_size(fifo) < sizeof(frame_hdr10_plus))
+return 0;
+
+av_fifo_generic_read(fifo, _hdr10_plus, sizeof(frame_hdr10_plus), 
NULL);
+if (!frame_hdr10_plus.hdr10_plus || frame_hdr10_plus.pts != pkt->pts)
+return 0;
+
+data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, 
frame_hdr10_plus.hdr10_plus->size);
+if (!data)
+return AVERROR(ENOMEM);
+
+memcpy(data, frame_hdr10_plus.hdr10_plus->data, 
frame_hdr10_plus.hdr10_plus->size);
+
+return 0;
+}
+
 static av_cold int codecctl_int(AVCodecContext *avctx,
 enum vp8e_enc_control_id id, int val)
 {
@@ -384,6 +432,8 @@ static av_cold int vpx_free(AVCodecContext *avctx)
 av_freep(>twopass_stats.buf);
 av_freep(>stats_out);
 free_frame_list(ctx->coded_frame_list);
+if (ctx->hdr10_plus_fifo)
+free_hdr10_plus_fifo(>hdr10_plus_fifo);
 return 0;
 }
 
@@ -835,6 +885,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 #endif
 AVDictionaryEntry* en = NULL;
 
+ctx->discard_hdr10_plus = 1;
 av_log(avctx, AV_LOG_INFO, "%s\n", 

Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: Allow changing the time stamp precision via option

2021-06-14 Thread Andreas Rheinhardt
Thierry Foucu:
> On Mon, Jun 14, 2021 at 12:09 PM Andreas Rheinhardt <
> andreas.rheinha...@outlook.com> wrote:
> 
>> Thierry Foucu:
>>> On Fri, Jun 4, 2021 at 10:18 PM Andreas Rheinhardt <
>>> andreas.rheinha...@outlook.com> wrote:
>>>
 Michael Fabian 'Xaymar' Dirks:
> On 2021-05-24 22:15, Andreas Rheinhardt wrote:
>> michael.di...@xaymar.com:
>>> From: Michael Fabian 'Xaymar' Dirks 
>>>
>>> Adds "timestamp_precision" to the available options for Matroska
 muxing.
>>> The option enables users and developers to change the precision of
>> the
>>> time stamps in the Matroska container up to 1 nanosecond, which can
>> aid
>>> with the proper detection of constant and variable rate content.
>>>
>>> Work-around fix for: 259, 6406, 7927, 8909 and 9124.
>>>
>>> Signed-off-by: Michael Fabian 'Xaymar' Dirks <
>> michael.di...@xaymar.com
>
>>> ---
>>>   doc/muxers.texi   |  8 
>>>   libavformat/matroskaenc.c | 33 ++---
>>>   2 files changed, 34 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>>> index e1c6ad0829..8655be94ff 100644
>>> --- a/doc/muxers.texi
>>> +++ b/doc/muxers.texi
>>> @@ -1583,6 +1583,14 @@ bitmap is stored bottom-up. Note that this
>>> option does not flip the bitmap
>>>   which has to be done manually beforehand, e.g. by using the vflip
>>> filter.
>>>   Default is @var{false} and indicates bitmap is stored top down.
>>>   +@item timestamp_precision
>>> +Sets the timestamp precision up to 1 nanosecond for Matroska/WebM,
>>> which can
>>> +improve detection of constant rate content in demuxers. Note that
>>> some poorly
>>> +implemented demuxers may require a timestamp precision of 1
>>> millisecond, so
>>> +increasing it past that point may result in playback issues. Higher
>>> precision
>>> +also reduces the maximum possible timestamp significantly.
>> This should mention that a too high precision will increase container
>> overhead.
> Good point.
>>
>>> +Default is @var{1/1000} (1 millisecond).
>>> +
>>>   @end table
>>> @anchor{md5}
>>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>>> index 186a25d920..1b911a648c 100644
>>> --- a/libavformat/matroskaenc.c
>>> +++ b/libavformat/matroskaenc.c
>>> @@ -158,6 +158,8 @@ typedef struct MatroskaMuxContext {
>>>   int default_mode;
>>> uint32_tsegment_uid[4];
>>> +
>>> +AVRational  time_base;
>>>   } MatroskaMuxContext;
>>> /** 2 bytes * 7 for EBML IDs, 7 1-byte EBML lengths, 6 1-byte
>> uint,
>>> @@ -1814,6 +1816,7 @@ static int mkv_write_header(AVFormatContext *s)
>>>   const AVDictionaryEntry *tag;
>>>   int ret, i, version = 2;
>>>   int64_t creation_time;
>>> +int64_t time_base = 1;
>>> if (mkv->mode != MODE_WEBM ||
>>>   av_dict_get(s->metadata, "stereo_mode", NULL, 0) ||
>>> @@ -1850,7 +1853,10 @@ static int mkv_write_header(AVFormatContext
>> *s)
>>>   return ret;
>>>   pb = mkv->info.bc;
>>>   -put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 100);
>>> +time_base = av_rescale_q(time_base, mkv->time_base,
>>> (AVRational){1, 10});
>>> +av_log(s, AV_LOG_DEBUG, "TimestampScale is: %" PRId64 " ns\n",
>>> time_base);
>>> +put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, time_base);
>> There is a serious problem here: mkv->time_base is the time base that
>> the muxer uses; yet if mkv->time_base is not a multiple of
>> 1/10,
>> then av_rescale_q will have to round a bit and then the demuxer will
>> read a different time base, leading to a drift of all timestamps. This
>> is not acceptable.
> This issue is already present in the current version of FFmpeg.

 Matroska's timestamp imprecision currently lead to jitter, but not to
 drift (this of course presumes that one actually uses the timestamps
 as-is (instead of summing the durations)). But your patch as-is can lead
 to drift (when using a wrong timebase), because it adds a whole new type
 of error: One in which the demuxer and the muxer disagree about the
 timebase that is in use. Consider a user using 1/75000 as timebase.
 48kHz audio (with a timebase of 1/48000) can be converted accurately to
 it, so that the muxer receives precise timestamps. Yet the muxer
 actually writes that the timebase is 1/10 and that is what a
 demuxer sees. This means that all timestamps (except those for which
 Matroska uses "absolute timestamps" (Matroska-speak for a time/duration
 that is always in 1/10 like default duration)) are skewed as-if
 multiplied by 3/4.

> Unfortunately even if you 

[FFmpeg-devel] [PATCH 01/17] avcodec/avcodec: Stop including bsf.h in avcodec.h

2021-06-14 Thread Andreas Rheinhardt
Also include bsf.h directly wherever it is used.

Signed-off-by: Andreas Rheinhardt 
---
Following the example of e67e02d15672a87da1b0566e197a1e19dc7e1e33
I have neither added an APIchanges entry nor a version bump for
anything in this set.

 fftools/cmdutils.c | 1 +
 fftools/ffmpeg.h   | 1 +
 fftools/ffmpeg_opt.c   | 1 +
 libavcodec/avcodec.c   | 1 +
 libavcodec/avcodec.h   | 1 -
 libavcodec/bitstream_filters.c | 6 +++---
 libavcodec/cbs_bsf.c   | 1 +
 libavcodec/decode.c| 1 +
 libavcodec/internal.h  | 1 +
 libavcodec/opus_metadata_bsf.c | 1 +
 libavcodec/pcm_rechunk_bsf.c   | 1 +
 libavformat/av1dec.c   | 1 +
 libavformat/concatdec.c| 1 +
 libavformat/internal.h | 1 +
 libavformat/mux.c  | 1 +
 libavformat/tee.c  | 1 +
 libavformat/utils.c| 1 +
 17 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 4148285971..f72231790f 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -53,6 +53,7 @@
 #include "libavutil/cpu.h"
 #include "libavutil/ffversion.h"
 #include "libavutil/version.h"
+#include "libavcodec/bsf.h"
 #include "cmdutils.h"
 #if HAVE_SYS_RESOURCE_H
 #include 
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index e9d30fbd67..b424f914e9 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -31,6 +31,7 @@
 #include "libavformat/avio.h"
 
 #include "libavcodec/avcodec.h"
+#include "libavcodec/bsf.h"
 
 #include "libavfilter/avfilter.h"
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index a63bed54cf..6dbe638433 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -27,6 +27,7 @@
 #include "libavformat/avformat.h"
 
 #include "libavcodec/avcodec.h"
+#include "libavcodec/bsf.h"
 
 #include "libavfilter/avfilter.h"
 
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index d369b30bbc..3b3a3ef05a 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -32,6 +32,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/thread.h"
 #include "avcodec.h"
+#include "bsf.h"
 #include "decode.h"
 #include "encode.h"
 #include "frame_thread_encoder.h"
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dabd60386e..f6d2cde441 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -41,7 +41,6 @@
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
 
-#include "bsf.h"
 #include "codec.h"
 #include "codec_desc.h"
 #include "codec_par.h"
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index e03326515b..d565286397 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -16,12 +16,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "config.h"
+#include 
+#include 
 
-#include "libavutil/common.h"
 #include "libavutil/log.h"
 
-#include "avcodec.h"
+#include "bsf.h"
 #include "bsf_internal.h"
 
 extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c
index 0977d431f7..86ec3f2a4d 100644
--- a/libavcodec/cbs_bsf.c
+++ b/libavcodec/cbs_bsf.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "bsf.h"
 #include "bsf_internal.h"
 #include "cbs_bsf.h"
 
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 75bc7ad98e..6def4047e5 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -40,6 +40,7 @@
 
 #include "avcodec.h"
 #include "bytestream.h"
+#include "bsf.h"
 #include "decode.h"
 #include "hwconfig.h"
 #include "internal.h"
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 975ec0ba30..d8fb054832 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -32,6 +32,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/pixfmt.h"
 #include "avcodec.h"
+#include "bsf.h"
 #include "config.h"
 
 /**
diff --git a/libavcodec/opus_metadata_bsf.c b/libavcodec/opus_metadata_bsf.c
index 723e31c243..e73852d618 100644
--- a/libavcodec/opus_metadata_bsf.c
+++ b/libavcodec/opus_metadata_bsf.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "bsf.h"
 #include "bsf_internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
diff --git a/libavcodec/pcm_rechunk_bsf.c b/libavcodec/pcm_rechunk_bsf.c
index 47f44b6467..32a90cd2f7 100644
--- a/libavcodec/pcm_rechunk_bsf.c
+++ b/libavcodec/pcm_rechunk_bsf.c
@@ -19,6 +19,7 @@
  */
 
 #include "avcodec.h"
+#include "bsf.h"
 #include "bsf_internal.h"
 #include "libavutil/avassert.h"
 #include "libavutil/opt.h"
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 8ca804c2a3..be6808f5c4 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -25,6 +25,7 @@
 #include "libavutil/fifo.h"
 #include "libavutil/opt.h"
 #include "libavcodec/av1_parse.h"
+#include "libavcodec/bsf.h"
 

[FFmpeg-devel] [PATCH 10/17] Remove unnecessary avassert.h inclusions

2021-06-14 Thread Andreas Rheinhardt
From: Andreas Rheinhardt 

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffplay.c   | 3 ---
 libavcodec/ass.c   | 1 -
 libavcodec/cfhd.h  | 2 --
 libavcodec/cfhddsp.c   | 1 -
 libavcodec/cfhdenc.c   | 1 -
 libavcodec/cfhdencdsp.c| 1 -
 libavcodec/dirac_dwt.c | 1 -
 libavcodec/dstdec.c| 1 -
 libavcodec/ffv1.h  | 1 -
 libavcodec/g729_parser.c   | 1 -
 libavcodec/gif_parser.c| 1 -
 libavcodec/jpeg2000dwt.c   | 1 -
 libavcodec/libopenjpegenc.c| 1 -
 libavcodec/libuavs3d.c | 1 -
 libavcodec/movtextenc.c| 1 -
 libavcodec/photocd.c   | 1 -
 libavcodec/rasc.c  | 1 -
 libavcodec/sga.c   | 1 -
 libavcodec/sgidec.c| 1 -
 libavdevice/v4l2-common.h  | 1 -
 libavdevice/v4l2.c | 1 +
 libavfilter/aeval.c| 1 -
 libavfilter/af_agate.c | 1 -
 libavfilter/af_aiir.c  | 1 -
 libavfilter/af_alimiter.c  | 1 -
 libavfilter/af_amultiply.c | 1 -
 libavfilter/af_anlms.c | 1 -
 libavfilter/af_asetnsamples.c  | 1 -
 libavfilter/af_asr.c   | 1 -
 libavfilter/af_axcorrelate.c   | 1 -
 libavfilter/af_join.c  | 1 -
 libavfilter/af_lv2.c   | 1 -
 libavfilter/af_mcompand.c  | 1 -
 libavfilter/af_sidechaincompress.c | 1 -
 libavfilter/avf_abitscope.c| 1 -
 libavfilter/avf_aphasemeter.c  | 1 -
 libavfilter/avf_concat.c   | 1 -
 libavfilter/avf_showcqt.c  | 1 -
 libavfilter/buffersrc.c| 1 -
 libavfilter/dnn/dnn_backend_native_layer_depth2space.c | 1 -
 libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  | 1 -
 libavfilter/dnn/dnn_backend_native_layer_mathunary.c   | 1 -
 libavfilter/dnn/dnn_backend_native_layer_maximum.c | 1 -
 libavfilter/dnn/queue.c| 1 -
 libavfilter/drawutils.c| 1 -
 libavfilter/f_loop.c   | 1 -
 libavfilter/src_movie.c| 1 -
 libavfilter/trim.c | 1 -
 libavfilter/vf_bm3d.c  | 1 -
 libavfilter/vf_bwdif.c | 1 -
 libavfilter/vf_cover_rect.c| 1 -
 libavfilter/vf_datascope.c | 1 -
 libavfilter/vf_deinterlace_vaapi.c | 1 -
 libavfilter/vf_epx.c   | 1 -
 libavfilter/vf_fftdnoiz.c  | 1 -
 libavfilter/vf_freezedetect.c  | 1 -
 libavfilter/vf_freezeframes.c  | 1 -
 libavfilter/vf_fspp.c  | 1 -
 libavfilter/vf_histogram.c | 1 -
 libavfilter/vf_lensfun.c   | 1 -
 libavfilter/vf_median.c| 1 -
 libavfilter/vf_mestimate.c | 1 -
 libavfilter/vf_minterpolate.c  | 1 -
 libavfilter/vf_misc_vaapi.c| 1 -
 libavfilter/vf_nnedi.c | 1 -
 libavfilter/vf_overlay_qsv.c   | 1 -
 libavfilter/vf_pp7.c   | 1 -
 libavfilter/vf_procamp_vaapi.c | 1 -
 libavfilter/vf_scale.c | 1 -
 libavfilter/vf_scale_vaapi.c   | 1 -
 libavfilter/vf_scdet.c | 1 -
 libavfilter/vf_showpalette.c   | 1 -
 libavfilter/vf_shuffleframes.c | 1 -
 libavfilter/vf_spp.c   | 1 -
 libavfilter/vf_tonemap_vaapi.c | 1 -
 libavfilter/vf_tpad.c  | 1 -
 libavfilter/vf_transpose_opencl.c  | 1 -
 libavfilter/vf_transpose_vaapi.c   | 1 -
 libavfilter/vf_vignette.c  | 1 -
 libavfilter/vf_vpp_qsv.c   

[FFmpeg-devel] [PATCH 09/17] Remove unnecessary mem.h inclusions

2021-06-14 Thread Andreas Rheinhardt
From: Andreas Rheinhardt 

Signed-off-by: Andreas Rheinhardt 
---
 fftools/ffmpeg_qsv.c| 1 -
 libavcodec/aactab.c | 1 -
 libavcodec/arbc.c   | 1 -
 libavcodec/argo.c   | 1 -
 libavcodec/dcadsp.c | 1 -
 libavcodec/dss_sp.c | 1 -
 libavcodec/dvbsub_parser.c  | 1 -
 libavcodec/h264_redundant_pps_bsf.c | 1 -
 libavcodec/libvo-amrwbenc.c | 1 -
 libavcodec/mpegaudiodsp_template.c  | 1 -
 libavcodec/opustab.h| 2 --
 libavcodec/rl.c | 1 -
 libavcodec/snappy.c | 2 --
 libavcodec/truemotion2rt.c  | 1 -
 libavcodec/v210dec.c| 1 -
 libavcodec/v210x.c  | 1 -
 libavcodec/x86/ac3dsp_init.c| 1 -
 libavcodec/x86/lpc.c| 2 +-
 libavcodec/x86/rv40dsp_init.c   | 1 -
 libavcodec/x86/vc1dsp_mmx.c | 1 -
 libavcodec/x86/videodsp_init.c  | 1 -
 libavcodec/x86/vp8dsp_init.c| 1 -
 libavcodec/x86/vp9dsp_init.c| 1 -
 libavcodec/x86/vp9dsp_init_16bpp_template.c | 1 -
 libavdevice/fbdev_dec.c | 1 -
 libavdevice/fbdev_enc.c | 1 -
 libavdevice/libcdio.c   | 1 -
 libavfilter/boxblur.h   | 1 -
 libavfilter/drawutils.c | 1 -
 libavfilter/vf_deinterlace_vaapi.c  | 1 -
 libavfilter/vf_misc_vaapi.c | 1 -
 libavfilter/vf_neighbor_opencl.c| 1 -
 libavfilter/vf_overlay_cuda.c   | 1 -
 libavfilter/vf_overlay_opencl.c | 1 -
 libavfilter/vf_procamp_vaapi.c  | 1 -
 libavfilter/vf_scale_vaapi.c| 1 -
 libavfilter/vf_tonemap_opencl.c | 1 -
 libavfilter/vf_tonemap_vaapi.c  | 1 -
 libavfilter/vf_transpose_opencl.c   | 1 -
 libavfilter/vf_transpose_vaapi.c| 1 -
 libavfilter/vf_xfade_opencl.c   | 1 -
 libavfilter/video.c | 1 -
 libavfilter/x86/vf_atadenoise_init.c| 1 -
 libavfilter/x86/vf_bwdif_init.c | 1 -
 libavfilter/x86/vf_eq_init.c| 1 -
 libavfilter/x86/vf_gradfun_init.c   | 1 -
 libavfilter/x86/vf_idet_init.c  | 1 -
 libavfilter/x86/vf_maskedclamp_init.c   | 1 -
 libavfilter/x86/vf_transpose_init.c | 1 -
 libavfilter/x86/vf_w3fdif_init.c| 1 -
 libavfilter/x86/vf_yadif_init.c | 1 -
 libavformat/replaygain.c| 1 -
 libavutil/avsscanf.c| 1 -
 libavutil/tests/aes_ctr.c   | 1 -
 tests/checkasm/llviddspenc.c| 1 -
 tests/checkasm/sw_rgb.c | 1 -
 tests/checkasm/sw_scale.c   | 1 -
 tools/ffhash.c  | 2 +-
 58 files changed, 2 insertions(+), 60 deletions(-)

diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c
index 960c88b69d..7bd999d310 100644
--- a/fftools/ffmpeg_qsv.c
+++ b/fftools/ffmpeg_qsv.c
@@ -22,7 +22,6 @@
 #include "libavutil/dict.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_qsv.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavcodec/qsv.h"
 
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index fa5420fec6..0553f41a61 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -28,7 +28,6 @@
  */
 
 #include "config.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/thread.h"
 #include "aac.h"
diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index 0f83a68758..d03fdf214b 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -26,7 +26,6 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/argo.c b/libavcodec/argo.c
index 87c646f56c..94c65477c5 100644
--- a/libavcodec/argo.c
+++ b/libavcodec/argo.c
@@ -26,7 +26,6 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index 9d00ebd281..e424a7443c 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -18,7 +18,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 
 #include "dcadsp.h"
diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index b904585b5d..050b412496 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -21,7 +21,6 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
-#include 

[FFmpeg-devel] [PATCH 06/17] avcodec/lossless_videodsp: Improve included headers

2021-06-14 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/lossless_videodsp.c | 3 ++-
 libavcodec/lossless_videodsp.h | 3 ---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c
index cff94c234d..fa0869eef9 100644
--- a/libavcodec/lossless_videodsp.c
+++ b/libavcodec/lossless_videodsp.c
@@ -17,7 +17,8 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "avcodec.h"
+
+#include "config.h"
 #include "lossless_videodsp.h"
 #include "libavcodec/mathops.h"
 
diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h
index 8077898d1a..da4baa1414 100644
--- a/libavcodec/lossless_videodsp.h
+++ b/libavcodec/lossless_videodsp.h
@@ -25,9 +25,6 @@
 #include 
 #include 
 
-#include "avcodec.h"
-#include "libavutil/cpu.h"
-
 typedef struct LLVidDSPContext {
 void (*add_bytes)(uint8_t *dst /* align 32 */, uint8_t *src /* align 32 */,
   ptrdiff_t w);
-- 
2.27.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 08/17] Remove obsolete version.h inclusions

2021-06-14 Thread Andreas Rheinhardt
These have mostly been added because of FF_API_*; yet when these were
removed, removing the header has been forgotten.

Signed-off-by: Andreas Rheinhardt 
---
Some of these leftovers are from the last bump. Sorry.

 libavcodec/blockdsp.c | 1 -
 libavcodec/blockdsp.h | 1 -
 libavcodec/codec_desc.c   | 1 -
 libavcodec/error_resilience.c | 1 -
 libavcodec/mpegutils.h| 1 -
 libavcodec/utils.c| 1 -
 libavfilter/formats.h | 1 -
 libavformat/hlsproto.c| 1 -
 libavutil/aes.h   | 1 -
 libavutil/aes_ctr.h   | 1 -
 libavutil/buffer.h| 2 --
 libavutil/crc.h   | 1 -
 libavutil/dict.h  | 2 --
 libavutil/hash.h  | 2 --
 libavutil/hmac.c  | 1 -
 libavutil/hmac.h  | 1 -
 libavutil/lls.c   | 1 -
 libavutil/lls.h   | 1 -
 libavutil/log.h   | 1 -
 libavutil/mathematics.c   | 1 -
 libavutil/md5.h   | 1 -
 libavutil/murmur3.h   | 2 --
 libavutil/opt.h   | 1 -
 libavutil/pixdesc.c   | 1 -
 libavutil/pixdesc.h   | 1 -
 libavutil/ripemd.h| 1 -
 libavutil/sha.h   | 1 -
 libavutil/sha512.h| 1 -
 libavutil/tree.h  | 1 -
 29 files changed, 33 deletions(-)

diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index c7efe7e77b..5fb242ea65 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -23,7 +23,6 @@
 #include "libavutil/attributes.h"
 #include "avcodec.h"
 #include "blockdsp.h"
-#include "version.h"
 
 static void clear_block_c(int16_t *block)
 {
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index 26fc2ea13b..58eecffb07 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -23,7 +23,6 @@
 #include 
 
 #include "avcodec.h"
-#include "version.h"
 
 /* add and put pixel (decoding)
  * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 35527dcc37..674f4bf8c3 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -27,7 +27,6 @@
 #include "codec_id.h"
 #include "codec_desc.h"
 #include "profiles.h"
-#include "version.h"
 
 #define MT(...) (const char *const[]){ __VA_ARGS__, NULL }
 
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 68bc10ac31..f13be7b918 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -35,7 +35,6 @@
 #include "mpegvideo.h"
 #include "rectangle.h"
 #include "thread.h"
-#include "version.h"
 
 /**
  * @param stride the number of MVs to get to the next row
diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index 81f0b73bb1..5aeff47bbd 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -26,7 +26,6 @@
 #include "libavutil/frame.h"
 
 #include "avcodec.h"
-#include "version.h"
 
 /**
  * Return value for header parsers if frame is not coded.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0b12ae2930..de2d38c58b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -41,7 +41,6 @@
 #include "internal.h"
 #include "put_bits.h"
 #include "raw.h"
-#include "version.h"
 #include 
 #include 
 #include 
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index 3a6044971b..65acc939e3 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -20,7 +20,6 @@
 #define AVFILTER_FORMATS_H
 
 #include "avfilter.h"
-#include "version.h"
 
 /**
  * A list of supported formats for one end of a filter link. This is used
diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 9e78f931e8..6a2765bbe9 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -31,7 +31,6 @@
 #include "avio_internal.h"
 #include "internal.h"
 #include "url.h"
-#include "version.h"
 
 /*
  * An apple http stream consists of a playlist with media segment files,
diff --git a/libavutil/aes.h b/libavutil/aes.h
index 09efbda107..d243286c86 100644
--- a/libavutil/aes.h
+++ b/libavutil/aes.h
@@ -24,7 +24,6 @@
 #include 
 
 #include "attributes.h"
-#include "version.h"
 
 /**
  * @defgroup lavu_aes AES
diff --git a/libavutil/aes_ctr.h b/libavutil/aes_ctr.h
index e4aae126a7..4e9fda7aca 100644
--- a/libavutil/aes_ctr.h
+++ b/libavutil/aes_ctr.h
@@ -25,7 +25,6 @@
 #include 
 
 #include "attributes.h"
-#include "version.h"
 
 #define AES_CTR_KEY_SIZE (16)
 #define AES_CTR_IV_SIZE (8)
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index 63ab87eb72..2c0ce1a108 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -28,8 +28,6 @@
 #include 
 #include 
 
-#include "version.h"
-
 /**
  * @defgroup lavu_buffer AVBuffer
  * @ingroup lavu_data
diff --git a/libavutil/crc.h b/libavutil/crc.h
index 47e22b4c78..24a2e3caed 100644
--- a/libavutil/crc.h
+++ b/libavutil/crc.h
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include "attributes.h"
-#include "version.h"
 
 /**
  * @defgroup lavu_crc32 CRC
diff --git a/libavutil/dict.h 

[FFmpeg-devel] [PATCH 07/17] avutil/internal, swresample/audioconvert: Remove cpu.h inclusions

2021-06-14 Thread Andreas Rheinhardt
These inclusions are not necessary, as cpu.h is already included
wherever it is needed (via direct inclusion or via the arch-specific
headers).

Signed-off-by: Andreas Rheinhardt 
---
I did my best to make sure this is correct on all arches; but testing
is always welcome.

 libavutil/internal.h | 1 -
 libswresample/audioconvert.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 7cd36ff742..a33e8700c3 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -40,7 +40,6 @@
 #include "config.h"
 #include "attributes.h"
 #include "timer.h"
-#include "cpu.h"
 #include "dict.h"
 #include "macros.h"
 #include "pixfmt.h"
diff --git a/libswresample/audioconvert.h b/libswresample/audioconvert.h
index 1ca30c2a65..bb143a876d 100644
--- a/libswresample/audioconvert.h
+++ b/libswresample/audioconvert.h
@@ -30,7 +30,6 @@
 
 
 #include "swresample_internal.h"
-#include "libavutil/cpu.h"
 
 
 typedef void (conv_func_type)(uint8_t *po, const uint8_t *pi, int is, int os, 
uint8_t *end);
-- 
2.27.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 12/17] Avoid calling functions repeatedly via FFMIN

2021-06-14 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/pngdec.c  | 4 +++-
 libavformat/afc.c| 4 ++--
 libavformat/avidec.c | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 16c4c3a283..3c7907 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1044,7 +1044,9 @@ static void handle_p_frame_png(PNGDecContext *s, AVFrame 
*p)
 int i, j;
 uint8_t *pd  = p->data[0];
 uint8_t *pd_last = s->last_picture.f->data[0];
-int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * 
s->bpp);
+int ls = av_image_get_linesize(p->format, s->width, 0);
+
+ls = FFMIN(ls, s->width * s->bpp);
 
 ff_thread_await_progress(>last_picture, INT_MAX, 0);
 for (j = 0; j < s->height; j++) {
diff --git a/libavformat/afc.c b/libavformat/afc.c
index a99f65472d..102b74baeb 100644
--- a/libavformat/afc.c
+++ b/libavformat/afc.c
@@ -57,10 +57,10 @@ static int afc_read_header(AVFormatContext *s)
 static int afc_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 AFCDemuxContext *c = s->priv_data;
-int64_t size;
+int64_t size = c->data_end - avio_tell(s->pb);
 int ret;
 
-size = FFMIN(c->data_end - avio_tell(s->pb), 18 * 128);
+size = FFMIN(size, 18 * 128);
 if (size <= 0)
 return AVERROR_EOF;
 
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 14a2dd6cd7..2e175b3179 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -363,7 +363,8 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
 uint16_t size= avio_rl16(s->pb);
 const char *name = NULL;
 char buffer[64]  = { 0 };
-size = FFMIN(size, tag_end - avio_tell(s->pb));
+uint64_t remaining = tag_end - avio_tell(s->pb);
+size = FFMIN(size, remaining);
 size -= avio_read(s->pb, buffer,
   FFMIN(size, sizeof(buffer) - 1));
 switch (tag) {
-- 
2.27.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 16/17] Remove/replace some unnecessary avcodec.h inclusions

2021-06-14 Thread Andreas Rheinhardt
Also remove other unnecessary headers and include headers directly while
at it.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ac3.c |  1 -
 libavcodec/ac3.h |  5 +++--
 libavcodec/ac3dsp.c  |  9 -
 libavcodec/ac3enc.h  |  1 +
 libavcodec/ac3tab.c  |  3 +--
 libavcodec/acelp_filters.c   |  4 +++-
 libavcodec/allcodecs.c   |  6 +-
 libavcodec/ass_split.c   |  4 +++-
 libavcodec/atrac.c   |  4 +---
 libavcodec/av1_parse.h   |  6 +-
 libavcodec/bitstream.c   | 15 +--
 libavcodec/bmp.h |  2 --
 libavcodec/celp_filters.c|  5 +++--
 libavcodec/dcahuff.c |  6 --
 libavcodec/dcahuff.h |  7 ---
 libavcodec/dirac.c   |  4 +---
 libavcodec/dsd.c |  6 +++---
 libavcodec/dsd.h |  5 ++---
 libavcodec/elbg.c|  1 -
 libavcodec/elsdec.c  |  1 -
 libavcodec/exif.h|  4 ++--
 libavcodec/fits.c|  7 ++-
 libavcodec/g722.h|  2 +-
 libavcodec/g723_1.c  |  3 ++-
 libavcodec/g729postfilter.c  | 10 +++---
 libavcodec/gsmdec_data.h |  1 -
 libavcodec/h261.c|  2 +-
 libavcodec/h263.c|  9 -
 libavcodec/h2645_parse.h |  4 +++-
 libavcodec/h264_cabac.c  |  1 -
 libavcodec/h264_cavlc.c  |  1 -
 libavcodec/h264_levels.c |  3 ++-
 libavcodec/h264_mp4toannexb_bsf.c|  2 +-
 libavcodec/h264_sei.c| 10 --
 libavcodec/h264data.c|  2 +-
 libavcodec/h264dsp.c |  1 -
 libavcodec/h264pred.c|  4 +++-
 libavcodec/hevc_mp4toannexb_bsf.c|  2 +-
 libavcodec/ivi_dsp.c |  3 ++-
 libavcodec/jpegls.c  |  4 +++-
 libavcodec/jpegls.h  |  3 +--
 libavcodec/lossless_audiodsp.c   |  3 ++-
 libavcodec/lossless_videoencdsp.h|  3 +--
 libavcodec/lsp.c |  2 +-
 libavcodec/lzw.c |  2 +-
 libavcodec/lzwenc.c  |  5 +++--
 libavcodec/mlp.h |  2 --
 libavcodec/mpc.c |  5 ++---
 libavcodec/mpc.h |  3 ++-
 libavcodec/mpegaudiodecheader.c  |  2 --
 libavcodec/mpegaudiodecheader.h  |  3 ++-
 libavcodec/nellymoser.c  |  4 +++-
 libavcodec/nellymoser.h  |  2 +-
 libavcodec/pcm_rechunk_bsf.c |  1 -
 libavcodec/png.c |  4 +++-
 libavcodec/rangecoder.c  |  2 +-
 libavcodec/raw.h |  3 +--
 libavcodec/rle.c |  3 ++-
 libavcodec/roqvideo.c|  3 ++-
 libavcodec/rv30dsp.c |  5 -
 libavcodec/rv40dsp.c |  1 -
 libavcodec/sbc.c |  1 -
 libavcodec/sbc.h |  3 ++-
 libavcodec/setts_bsf.c   |  1 -
 libavcodec/simple_idct.c |  1 -
 libavcodec/tiff_common.c |  1 +
 libavcodec/tiff_common.h |  5 ++---
 libavcodec/v4l2_buffers.h|  5 -
 libavcodec/v4l2_context.h|  7 ---
 libavcodec/v4l2_fmt.h|  3 ++-
 libavcodec/vc1data.c |  2 +-
 libavcodec/vp3dsp.c  |  5 -
 libavcodec/vp56dsp.c |  2 +-
 libavcodec/vp9block.c|  3 ---
 libavcodec/vp9recon.c|  2 --
 libavcodec/wmv2.h|  1 -
 libavcodec/wmv2dsp.c |  3 ++-
 libavcodec/x86/cfhddsp_init.c|  3 ++-
 libavcodec/x86/cfhdencdsp_init.c |  3 ++-
 libavcodec/x86/h264_intrapred_init.c |  5 -
 libavcodec/x86/mlpdsp_init.c |  3 +++
 libavcodec/x86/snowdsp.c |  3 ++-
 libavdevice/avdevice.c   |  1 -
 libavdevice/oss.c|  1 -
 libavdevice/oss.h|  5 +++--
 libavdevice/oss_dec.c|  2 --
 libavdevice/oss_enc.c|  2 --
 libavfilter/af_ashowinfo.c   |  2 --
 libavformat/mxf.c|  1 +
 libavformat/mxf.h|  5 +++--
 libavformat/riff.c   |  5 +++--
 libavformat/riff.h   |  1 -
 libavformat/riffdec.c|  5 ++---
 libavformat/rtp.h|  6 --
 libavformat/rtpdec.h |  3 ++-
 libavformat/rtpdec_qdm2.c|  1 -
 libavformat/vpcc.c   |  1 +
 libavformat/vpcc.h   |  4 ++--
 98 files changed, 196 insertions(+), 142 deletions(-)

diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index 6d09288eee..a0fd00138f 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -26,7 +26,6 @@
 
 #include 

[FFmpeg-devel] [PATCH 14/17] avcodec/dsd_tablegen: Merge header into dsd.c

2021-06-14 Thread Andreas Rheinhardt
Since b492fbcc6e87094804fdf71308dc500976c6b165, the DSD tables are
always initialized at runtime, so merge the dsd_tablegen.h header
into dsd.c.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/dsd.c  | 44 ++-
 libavcodec/dsd_tablegen.h | 75 ---
 2 files changed, 43 insertions(+), 76 deletions(-)
 delete mode 100644 libavcodec/dsd_tablegen.h

diff --git a/libavcodec/dsd.c b/libavcodec/dsd.c
index 95aab61ea4..c18e20436a 100644
--- a/libavcodec/dsd.c
+++ b/libavcodec/dsd.c
@@ -25,9 +25,51 @@
 #include "libavcodec/internal.h"
 #include "libavcodec/mathops.h"
 #include "avcodec.h"
-#include "dsd_tablegen.h"
 #include "dsd.h"
 
+#define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */
+
+/*
+ * Properties of this 96-tap lowpass filter when applied on a signal
+ * with sampling rate of 44100*64 Hz:
+ *
+ * () has a delay of 17 microseconds.
+ *
+ * () flat response up to 48 kHz
+ *
+ * () if you downsample afterwards by a factor of 8, the
+ *spectrum below 70 kHz is practically alias-free.
+ *
+ * () stopband rejection is about 160 dB
+ *
+ * The coefficient tables ("ctables") take only 6 Kibi Bytes and
+ * should fit into a modern processor's fast cache.
+ */
+
+/**
+ * The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter
+ */
+static const double htaps[HTAPS] = {
+ 0.09950731974056658,0.09562845727714668,0.08819647126516944,
+ 0.07782552527068175,0.06534876523171299,0.05172629311427257,
+ 0.0379429484910187, 0.02490921351762261,0.0133774746265897,
+ 0.003883043418804416,  -0.003284703416210726,  -0.008080250212687497,
+-0.01067241812471033,   -0.01139427235000863,   -0.0106813877974587,
+-0.009007905078766049,  -0.006828859761015335,  -0.004535184322001496,
+-0.002425035959059578,  -0.0006922187080790708,  0.0005700762133516592,
+ 0.001353838005269448,   0.001713709169690937,   0.001742046839472948,
+ 0.001545601648013235,   0.001226696225277855,   0.0008704322683580222,
+ 0.0005381636200535649,  0.000266446345425276,   7.002968738383528e-05,
+-5.279407053811266e-05, -0.0001140625650874684, -0.0001304796361231895,
+-0.0001189970287491285, -9.396247155265073e-05, -6.577634378272832e-05,
+-4.07492895872535e-05,  -2.17407957554587e-05,  -9.163058931391722e-06,
+-2.017460145032201e-06,  1.249721855219005e-06,  2.166655190537392e-06,
+ 1.930520892991082e-06,  1.319400334374195e-06,  7.410039764949091e-07,
+ 3.423230509967409e-07,  1.244182214744588e-07,  3.130441005359396e-08
+};
+
+static float ctables[CTABLES][256];
+
 static av_cold void dsd_ctables_tableinit(void)
 {
 int t, e, m, sign;
diff --git a/libavcodec/dsd_tablegen.h b/libavcodec/dsd_tablegen.h
deleted file mode 100644
index e5da86a1dc..00
--- a/libavcodec/dsd_tablegen.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Header file for hardcoded DSD tables
- * based on BSD licensed dsd2pcm by Sebastian Gesemann
- * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved.
- *
- * 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
- */
-
-#ifndef AVCODEC_DSD_TABLEGEN_H
-#define AVCODEC_DSD_TABLEGEN_H
-
-#include 
-#include "libavutil/attributes.h"
-#include "dsd.h"
-
-#define HTAPS   48/** number of FIR constants */
-#define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */
-
-#include "libavutil/common.h"
-
-/*
- * Properties of this 96-tap lowpass filter when applied on a signal
- * with sampling rate of 44100*64 Hz:
- *
- * () has a delay of 17 microseconds.
- *
- * () flat response up to 48 kHz
- *
- * () if you downsample afterwards by a factor of 8, the
- *spectrum below 70 kHz is practically alias-free.
- *
- * () stopband rejection is about 160 dB
- *
- * The coefficient tables ("ctables") take only 6 Kibi Bytes and
- * should fit into a modern processor's fast cache.
- */
-
-/**
- * The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter
- */
-static const double htaps[HTAPS] = {
- 0.09950731974056658,0.09562845727714668,0.08819647126516944,
- 0.07782552527068175,0.06534876523171299,0.05172629311427257,
- 0.0379429484910187, 0.02490921351762261,0.0133774746265897,
- 

[FFmpeg-devel] [PATCH 15/17] avcodec/g729postfilter.h: Include acelp_pitch_delay.h

2021-06-14 Thread Andreas Rheinhardt
Needed for PITCH_DELAY_MAX.

Signed-off-by: Andreas Rheinhardt 
---
fate-checkheaders doesn't catch this, because it doesn't use the
RES_PREV_DATA_SIZE macro at all.

 libavcodec/g729postfilter.c | 1 -
 libavcodec/g729postfilter.h | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index 617744ec8e..125a4095f8 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -23,7 +23,6 @@
 
 #include "avcodec.h"
 #include "g729.h"
-#include "acelp_pitch_delay.h"
 #include "g729postfilter.h"
 #include "celp_math.h"
 #include "acelp_filters.h"
diff --git a/libavcodec/g729postfilter.h b/libavcodec/g729postfilter.h
index 5c2aaf235b..69815341ed 100644
--- a/libavcodec/g729postfilter.h
+++ b/libavcodec/g729postfilter.h
@@ -22,6 +22,7 @@
 #define AVCODEC_G729POSTFILTER_H
 
 #include 
+#include "acelp_pitch_delay.h"
 #include "audiodsp.h"
 
 /**
-- 
2.27.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 13/17] avfilter/internal: Mark ff_filter_get_nb_threads() as av_pure

2021-06-14 Thread Andreas Rheinhardt
It does not modify anything; it only returns a value, so it fulfills
the requirements for av_pure.
The deeper rationale behind this change is that this function is called
quite often inside arguments to FFMIN which may lead to two calls to it;
declaring this function as av_pure allows the compiler to optimize the
second call away.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index f3b434dbe9..1bcfb830a1 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -363,7 +363,7 @@ static inline int ff_norm_qscale(int qscale, int type)
  * Get number of threads for current filter instance.
  * This number is always same or less than graph->nb_threads.
  */
-int ff_filter_get_nb_threads(AVFilterContext *ctx);
+int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure;
 
 /**
  * Generic processing of user supplied commands that are set
-- 
2.27.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 11/17] avcodec: Remove some unnecessary mpegvideo.h inclusions

2021-06-14 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h263data.c   | 2 +-
 libavcodec/h264_slice.c | 2 +-
 libavcodec/snowdec.c| 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h263data.c b/libavcodec/h263data.c
index 20d0436fda..c520df3574 100644
--- a/libavcodec/h263data.c
+++ b/libavcodec/h263data.c
@@ -26,7 +26,7 @@
 #include 
 
 #include "h263data.h"
-#include "mpegvideo.h"
+#include "rl.h"
 
 /* intra MCBPC, mb_type = (intra), then (intraq) */
 const uint8_t ff_h263_intra_MCBPC_code[9] = { 1, 1, 2, 3, 1, 1, 2, 3, 1 };
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 9c2301d7e0..20055e6f7a 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -29,6 +29,7 @@
 #include "libavutil/display.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/stereo3d.h"
+#include "libavutil/timecode.h"
 #include "internal.h"
 #include "cabac.h"
 #include "cabac_functions.h"
@@ -43,7 +44,6 @@
 #include "golomb.h"
 #include "mathops.h"
 #include "mpegutils.h"
-#include "mpegvideo.h"
 #include "rectangle.h"
 #include "thread.h"
 
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 7367176f07..1355ae6ed1 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -29,7 +29,6 @@
 #include "rangecoder.h"
 #include "mathops.h"
 
-#include "mpegvideo.h"
 #include "h263.h"
 
 static av_always_inline void predict_slice_buffered(SnowContext *s, 
slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){
-- 
2.27.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 17/17] avcodec/libavcodec.v: Tighten export whitelist

2021-06-14 Thread Andreas Rheinhardt
Currently every symbol (with external linkage) that starts with "av" is
exported. Yet libaom-av1 has lots of functions that are not meant to be
exported and start with "av1_" (I counted 1236); and libvpx has
average_split_mvs. These functions are exported if one links these
libraries statically into a shared libavcodec.so.

Solve this by tightening the whitelist to "av_", "avcodec_", "avpriv_"
and (as a special-case) "avsubtitle_free".

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/libavcodec.v | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libavcodec.v b/libavcodec/libavcodec.v
index f1d5e5bc77..d863e056a5 100644
--- a/libavcodec/libavcodec.v
+++ b/libavcodec/libavcodec.v
@@ -1,6 +1,9 @@
 LIBAVCODEC_MAJOR {
 global:
-av*;
+av_*;
+avcodec_*;
+avpriv_*;
+avsubtitle_free;
 local:
 *;
 };
-- 
2.27.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] avformat/matroskaenc: Allow changing the time stamp precision via option

2021-06-14 Thread Thierry Foucu
On Mon, Jun 14, 2021 at 12:09 PM Andreas Rheinhardt <
andreas.rheinha...@outlook.com> wrote:

> Thierry Foucu:
> > On Fri, Jun 4, 2021 at 10:18 PM Andreas Rheinhardt <
> > andreas.rheinha...@outlook.com> wrote:
> >
> >> Michael Fabian 'Xaymar' Dirks:
> >>> On 2021-05-24 22:15, Andreas Rheinhardt wrote:
>  michael.di...@xaymar.com:
> > From: Michael Fabian 'Xaymar' Dirks 
> >
> > Adds "timestamp_precision" to the available options for Matroska
> >> muxing.
> > The option enables users and developers to change the precision of
> the
> > time stamps in the Matroska container up to 1 nanosecond, which can
> aid
> > with the proper detection of constant and variable rate content.
> >
> > Work-around fix for: 259, 6406, 7927, 8909 and 9124.
> >
> > Signed-off-by: Michael Fabian 'Xaymar' Dirks <
> michael.di...@xaymar.com
> >>>
> > ---
> >   doc/muxers.texi   |  8 
> >   libavformat/matroskaenc.c | 33 ++---
> >   2 files changed, 34 insertions(+), 7 deletions(-)
> >
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index e1c6ad0829..8655be94ff 100644
> > --- a/doc/muxers.texi
> > +++ b/doc/muxers.texi
> > @@ -1583,6 +1583,14 @@ bitmap is stored bottom-up. Note that this
> > option does not flip the bitmap
> >   which has to be done manually beforehand, e.g. by using the vflip
> > filter.
> >   Default is @var{false} and indicates bitmap is stored top down.
> >   +@item timestamp_precision
> > +Sets the timestamp precision up to 1 nanosecond for Matroska/WebM,
> > which can
> > +improve detection of constant rate content in demuxers. Note that
> > some poorly
> > +implemented demuxers may require a timestamp precision of 1
> > millisecond, so
> > +increasing it past that point may result in playback issues. Higher
> > precision
> > +also reduces the maximum possible timestamp significantly.
>  This should mention that a too high precision will increase container
>  overhead.
> >>> Good point.
> 
> > +Default is @var{1/1000} (1 millisecond).
> > +
> >   @end table
> > @anchor{md5}
> > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> > index 186a25d920..1b911a648c 100644
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -158,6 +158,8 @@ typedef struct MatroskaMuxContext {
> >   int default_mode;
> > uint32_tsegment_uid[4];
> > +
> > +AVRational  time_base;
> >   } MatroskaMuxContext;
> > /** 2 bytes * 7 for EBML IDs, 7 1-byte EBML lengths, 6 1-byte
> uint,
> > @@ -1814,6 +1816,7 @@ static int mkv_write_header(AVFormatContext *s)
> >   const AVDictionaryEntry *tag;
> >   int ret, i, version = 2;
> >   int64_t creation_time;
> > +int64_t time_base = 1;
> > if (mkv->mode != MODE_WEBM ||
> >   av_dict_get(s->metadata, "stereo_mode", NULL, 0) ||
> > @@ -1850,7 +1853,10 @@ static int mkv_write_header(AVFormatContext
> *s)
> >   return ret;
> >   pb = mkv->info.bc;
> >   -put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 100);
> > +time_base = av_rescale_q(time_base, mkv->time_base,
> > (AVRational){1, 10});
> > +av_log(s, AV_LOG_DEBUG, "TimestampScale is: %" PRId64 " ns\n",
> > time_base);
> > +put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, time_base);
>  There is a serious problem here: mkv->time_base is the time base that
>  the muxer uses; yet if mkv->time_base is not a multiple of
> 1/10,
>  then av_rescale_q will have to round a bit and then the demuxer will
>  read a different time base, leading to a drift of all timestamps. This
>  is not acceptable.
> >>> This issue is already present in the current version of FFmpeg.
> >>
> >> Matroska's timestamp imprecision currently lead to jitter, but not to
> >> drift (this of course presumes that one actually uses the timestamps
> >> as-is (instead of summing the durations)). But your patch as-is can lead
> >> to drift (when using a wrong timebase), because it adds a whole new type
> >> of error: One in which the demuxer and the muxer disagree about the
> >> timebase that is in use. Consider a user using 1/75000 as timebase.
> >> 48kHz audio (with a timebase of 1/48000) can be converted accurately to
> >> it, so that the muxer receives precise timestamps. Yet the muxer
> >> actually writes that the timebase is 1/10 and that is what a
> >> demuxer sees. This means that all timestamps (except those for which
> >> Matroska uses "absolute timestamps" (Matroska-speak for a time/duration
> >> that is always in 1/10 like default duration)) are skewed as-if
> >> multiplied by 3/4.
> >>
> >>> Unfortunately even if you tell me this, this is not 

Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: Add localtime_ms for millisecond precision

2021-06-14 Thread Steven Liu
Thilo Borgmann  于2021年6月15日周二 上午3:14写道:
>
> Am 08.06.21 um 18:42 schrieb Thilo Borgmann:
> > Hi,
> >
> > add %{localtime_ms} function to the drawtext filter. Same as %{localtime} 
> > but with additional millisecond part.
>
> Ping for a volunteer to actually have a look at the patch for review.
lgtm

>
> Thanks,
> Thilo
> ___
> 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".

Thanks
Steven
___
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] ffmpeg: add -fpsmin to clamp output framerate

2021-06-14 Thread Gyan Doshi




On 2021-06-14 12:52, Matthias Neugebauer wrote:

Anything I can do to not land in spam? On another Google groups
mailing list I (and many others including the admin accounts) had
the same issue a couple of times.


Quickest workaround: send from a non-Gmail account.

Regards,
Gyan

P.S. Is Google Groups filtering out Gmail messages? :)
___
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".