Re: [FFmpeg-devel] [PATCH v5 1/3] avutil/hwcontext_qsv: derive QSV frames to D3D11VA frames

2022-05-19 Thread Xiang, Haihao
On Sat, 2022-05-07 at 06:24 +, Tong Wu wrote:
> Fixes:
> $ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \
> -init_hw_device qsv=qsv@d3d11 -c:v h264_qsv -i input.h264 \
> -vf "hwmap=derive_device=d3d11va,format=d3d11" -f null -
> 
> Signed-off-by: Tong Wu 
> ---
>  libavutil/hwcontext_qsv.c | 16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index b28dcffe2a..ca21543075 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -1281,12 +1281,22 @@ static int qsv_frames_derive_from(AVHWFramesContext
> *dst_ctx,
>  #if CONFIG_D3D11VA
>  case AV_HWDEVICE_TYPE_D3D11VA:
>  {
> +D3D11_TEXTURE2D_DESC texDesc;
> +dst_ctx->initial_pool_size = src_ctx->initial_pool_size;
>  AVD3D11VAFramesContext *dst_hwctx = dst_ctx->hwctx;
> -mfxHDLPair *pair = (mfxHDLPair*)src_hwctx-
> >surfaces[i].Data.MemId;
> -dst_hwctx->texture = (ID3D11Texture2D*)pair->first;
> +dst_hwctx->texture_infos = av_calloc(src_hwctx->nb_surfaces,
> + sizeof(*dst_hwctx-
> >texture_infos));
> +if (!dst_hwctx->texture_infos)
> +return AVERROR(ENOMEM);
>  if (src_hwctx->frame_type & MFX_MEMTYPE_SHARED_RESOURCE)
>  dst_hwctx->MiscFlags = D3D11_RESOURCE_MISC_SHARED;
> -dst_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(src_hwctx-
> >frame_type);
> +for (i = 0; i < src_hwctx->nb_surfaces; i++) {
> +mfxHDLPair *pair = (mfxHDLPair*)src_hwctx-
> >surfaces[i].Data.MemId;
> +dst_hwctx->texture_infos[i].texture = (ID3D11Texture2D*)pair-
> >first;
> +dst_hwctx->texture_infos[i].index = pair->second ==
> (mfxMemId)MFX_INFINITE ? (intptr_t)0 : (intptr_t)pair->second;
> +}
> +ID3D11Texture2D_GetDesc(dst_hwctx->texture_infos[0].texture,
> );
> +dst_hwctx->BindFlags = texDesc.BindFlags;
>  }
>  break;
>  #endif

The new patchset LGTM, is there any more comment ?

-Haihao

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

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


[FFmpeg-devel] [PATCH 2/2] avformat/rtsp: break on unknown protocols

2022-05-19 Thread Michael Niedermayer
This function needs more cleanup and it lacks error handling

Fixes: use of uninitialized memory
Fixes: CID700776

Signed-off-by: Michael Niedermayer 
---
 libavformat/rtsp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 88e9ef5226..f948f1d395 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -949,6 +949,8 @@ static void rtsp_parse_transport(AVFormatContext *s,
  ";,", );
 }
 th->transport = RTSP_TRANSPORT_RAW;
+} else {
+break;
 }
 if (!av_strcasecmp(lower_transport, "TCP"))
 th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: assert non NULL buf

2022-05-19 Thread Michael Niedermayer
The code is only called if size is > 0 so buf should not be NULL

Helps: CID610554

Signed-off-by: Michael Niedermayer 
---
 libavformat/matroskadec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4715f1b7d4..de73f97aca 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3701,6 +3701,8 @@ static int matroska_parse_block(MatroskaDemuxContext 
*matroska, AVBufferRef *buf
 uint64_t num;
 int trust_default_duration;
 
+av_assert1(buf);
+
 ffio_init_context(, data, size, 0, NULL, NULL, NULL, NULL);
 
 if ((n = ebml_read_num(matroska, , 8, , 1)) < 0)
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH v6 3/3] avfilter: Make avpriv_open a library-internal function on msvcrt

2022-05-19 Thread softworkz
From: softworkz 

This applies the same change for libavfilter as commit
e743e7ae6ee7e535c4394bec6fe6650d2b0dbf65 did for the other libraries.

Original commit message:

Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Based-on-patch-by: Martin Storsjö 
Signed-off-by: softworkz 
---
 libavfilter/Makefile| 1 +
 libavfilter/file_open.c | 1 +
 tests/ref/fate/source   | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 libavfilter/file_open.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ee2ea51e69..78ccfa37d3 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -23,6 +23,7 @@ OBJS = allfilters.o   
  \
version.o\
video.o  \
 
+OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
 OBJS-$(HAVE_THREADS) += pthread.o
 
 # subsystems
diff --git a/libavfilter/file_open.c b/libavfilter/file_open.c
new file mode 100644
index 00..494a5d37a4
--- /dev/null
+++ b/libavfilter/file_open.c
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
diff --git a/tests/ref/fate/source b/tests/ref/fate/source
index 69dcdc4f27..16ea7ef9c1 100644
--- a/tests/ref/fate/source
+++ b/tests/ref/fate/source
@@ -8,6 +8,7 @@ libavcodec/reverse.c
 libavdevice/file_open.c
 libavdevice/reverse.c
 libavfilter/af_arnndn.c
+libavfilter/file_open.c
 libavfilter/log2_tab.c
 libavformat/file_open.c
 libavformat/golomb_tab.c
-- 
ffmpeg-codebot
___
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 v6 2/3] avcodec/dvdsubdec: use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread softworkz
From: softworkz 

Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz 
---
 libavcodec/dvdsubdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 30fe4d41de..19b78b3eb1 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -617,7 +617,7 @@ static int parse_ifo_palette(DVDSubContext *ctx, char *p)
 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
 
 ctx->has_palette = 0;
-if ((ifo = fopen(p, "r")) == NULL) {
+if ((ifo = av_fopen_utf8(p, "r")) == NULL) {
 av_log(ctx, AV_LOG_WARNING, "Unable to open IFO file \"%s\": %s\n", p, 
av_err2str(AVERROR(errno)));
 return AVERROR_EOF;
 }
-- 
ffmpeg-codebot

___
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 v6 1/3] avfilter: use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread softworkz
From: softworkz 

Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz 
---
 libavfilter/af_firequalizer.c | 2 +-
 libavfilter/vf_deshake.c  | 2 +-
 libavfilter/vf_psnr.c | 2 +-
 libavfilter/vf_signature.c| 4 ++--
 libavfilter/vf_ssim.c | 2 +-
 libavfilter/vf_vidstabdetect.c| 2 +-
 libavfilter/vf_vidstabtransform.c | 2 +-
 libavfilter/vf_vmafmotion.c   | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index c19a2fe122..e1497dcef0 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -604,7 +604,7 @@ static int generate_kernel(AVFilterContext *ctx, const char 
*gain, const char *g
 if (ret < 0)
 return ret;
 
-if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = 
fopen(s->dumpfile, "w"
+if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = 
av_fopen_utf8(s->dumpfile, "w"
 av_log(ctx, AV_LOG_WARNING, "dumping failed.\n");
 
 vars[VAR_CHS] = inlink->ch_layout.nb_channels;
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 4f28467bb2..dea69e11cd 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -353,7 +353,7 @@ static av_cold int init(AVFilterContext *ctx)
 }
 
 if (deshake->filename)
-deshake->fp = fopen(deshake->filename, "w");
+deshake->fp = av_fopen_utf8(deshake->filename, "w");
 if (deshake->fp)
 fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg 
angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", 1, 104, deshake->fp);
 
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 19852eaa69..09c2a5164a 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -280,7 +280,7 @@ static av_cold int init(AVFilterContext *ctx)
 if (!strcmp(s->stats_file_str, "-")) {
 s->stats_file = stdout;
 } else {
-s->stats_file = fopen(s->stats_file_str, "w");
+s->stats_file = av_fopen_utf8(s->stats_file_str, "w");
 if (!s->stats_file) {
 int err = AVERROR(errno);
 char buf[128];
diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 4ca57ebf1d..904123fd4e 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -386,7 +386,7 @@ static int xml_export(AVFilterContext *ctx, StreamContext 
*sc, const char* filen
 FILE* f;
 unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 };
 
-f = fopen(filename, "w");
+f = av_fopen_utf8(filename, "w");
 if (!f) {
 int err = AVERROR(EINVAL);
 char buf[128];
@@ -500,7 +500,7 @@ static int binary_export(AVFilterContext *ctx, 
StreamContext *sc, const char* fi
 if (!buffer)
 return AVERROR(ENOMEM);
 
-f = fopen(filename, "wb");
+f = av_fopen_utf8(filename, "wb");
 if (!f) {
 int err = AVERROR(EINVAL);
 char buf[128];
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 32f313817d..4a82cbec06 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -404,7 +404,7 @@ static av_cold int init(AVFilterContext *ctx)
 if (!strcmp(s->stats_file_str, "-")) {
 s->stats_file = stdout;
 } else {
-s->stats_file = fopen(s->stats_file_str, "w");
+s->stats_file = av_fopen_utf8(s->stats_file_str, "w");
 if (!s->stats_file) {
 int err = AVERROR(errno);
 char buf[128];
diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index 267a62ea9b..4acae5a3ea 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -126,7 +126,7 @@ static int config_input(AVFilterLink *inlink)
 av_log(ctx, AV_LOG_INFO, "  show = %d\n", s->conf.show);
 av_log(ctx, AV_LOG_INFO, "result = %s\n", s->result);
 
-s->f = fopen(s->result, "w");
+s->f = av_fopen_utf8(s->result, "w");
 if (s->f == NULL) {
 av_log(ctx, AV_LOG_ERROR, "cannot open transform file %s\n", 
s->result);
 return AVERROR(EINVAL);
diff --git a/libavfilter/vf_vidstabtransform.c 
b/libavfilter/vf_vidstabtransform.c
index 4619e9b256..17214f039f 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -191,7 +191,7 @@ static int config_input(AVFilterLink *inlink)
 av_log(ctx, AV_LOG_INFO, "zoomspeed = %g\n", tc->conf.zoomSpeed);
 av_log(ctx, AV_LOG_INFO, "interpol  = %s\n", 
getInterpolationTypeName(tc->conf.interpolType));
 
-f = fopen(tc->input, "r");
+f = av_fopen_utf8(tc->input, "r");
 if (!f) {
 int ret = AVERROR(errno);
 av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input);
diff --git a/libavfilter/vf_vmafmotion.c 

[FFmpeg-devel] [PATCH v6 0/3] use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread ffmpegagent
Unify file access operations by replacing usages of direct calls to posix
fopen()

v2: Remove changes to fftools for now
v3: Add some additional replacements
v4: Fix and improve commit messages
v5: Add patch to remap ff_open in libavfilter for MSVC on Windows
v6: Add avfilter/file_open.c to "Files without standard license headers"
list

softworkz (3):
  avfilter: use av_fopen_utf8() instead of plain fopen()
  avcodec/dvdsubdec: use av_fopen_utf8() instead of plain fopen()
  avfilter: Make avpriv_open a library-internal function on msvcrt

 libavcodec/dvdsubdec.c| 2 +-
 libavfilter/Makefile  | 1 +
 libavfilter/af_firequalizer.c | 2 +-
 libavfilter/file_open.c   | 1 +
 libavfilter/vf_deshake.c  | 2 +-
 libavfilter/vf_psnr.c | 2 +-
 libavfilter/vf_signature.c| 4 ++--
 libavfilter/vf_ssim.c | 2 +-
 libavfilter/vf_vidstabdetect.c| 2 +-
 libavfilter/vf_vidstabtransform.c | 2 +-
 libavfilter/vf_vmafmotion.c   | 2 +-
 tests/ref/fate/source | 1 +
 12 files changed, 13 insertions(+), 10 deletions(-)
 create mode 100644 libavfilter/file_open.c


base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100
Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-26%2Fsoftworkz%2Fsubmit_replace_fopen-v6
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-26/softworkz/submit_replace_fopen-v6
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/26

Range-diff vs v5:

 1:  bcafcfacea = 1:  bcafcfacea avfilter: use av_fopen_utf8() instead of plain 
fopen()
 2:  94d023ece3 = 2:  94d023ece3 avcodec/dvdsubdec: use av_fopen_utf8() instead 
of plain fopen()
 3:  5e50103af3 ! 3:  4035d5dd7b avfilter: Make avpriv_open a library-internal 
function on msvcrt
 @@ libavfilter/Makefile: OBJS = allfilters.o
   ## libavfilter/file_open.c (new) ##
  @@
  +#include "libavutil/file_open.c"
 +
 + ## tests/ref/fate/source ##
 +@@ tests/ref/fate/source: libavcodec/reverse.c
 + libavdevice/file_open.c
 + libavdevice/reverse.c
 + libavfilter/af_arnndn.c
 ++libavfilter/file_open.c
 + libavfilter/log2_tab.c
 + libavformat/file_open.c
 + libavformat/golomb_tab.c

-- 
ffmpeg-codebot
___
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] avcodec/libx264: don't define X264_API_IMPORTS when compiling static

2022-05-19 Thread softworkz
From: softworkz 

The definition of X264_API_IMPORTS is required for shared linking
(when MSVC is used) but it must not be defined in case of static
builds as is stated in x264.h:

https://code.videolan.org/videolan/x264/-/blob/
bfc87b7a330f75f5c9a21e56081e4b20344f139e/x264.h#L63-67

This commit adds a check for the definition of _LIB which indicates
static linking.

Signed-off-by: softworkz 
---
avcodec/libx264: don't define X264_API_IMPORTS when compiling static

The definition of X264_API_IMPORTS is required for shared linking (when
MSVC is used) but it must not be defined in case of static builds as is
stated in x264.h:


https://code.videolan.org/videolan/x264/-/blob/bfc87b7a330f75f5c9a21e56081e4b20344f139e/x264.h#L63-67

Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-29%2Fsoftworkz%2Fsubmit_x264_api_imports-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-29/softworkz/submit_x264_api_imports-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/29

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

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..2304bbb774 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -37,7 +37,7 @@
 #include "atsc_a53.h"
 #include "sei.h"
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(_LIB)
 #define X264_API_IMPORTS 1
 #endif
 

base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100
-- 
ffmpeg-codebot
___
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 v5 3/3] avfilter: Make avpriv_open a library-internal function on msvcrt

2022-05-19 Thread softworkz
From: softworkz 

This applies the same change for libavfilter as commit
e743e7ae6ee7e535c4394bec6fe6650d2b0dbf65 did for the other libraries.

Original commit message:

Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Based-on-patch-by: Martin Storsjö 
Signed-off-by: softworkz 
---
 libavfilter/Makefile| 1 +
 libavfilter/file_open.c | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 libavfilter/file_open.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ee2ea51e69..78ccfa37d3 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -23,6 +23,7 @@ OBJS = allfilters.o   
  \
version.o\
video.o  \
 
+OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
 OBJS-$(HAVE_THREADS) += pthread.o
 
 # subsystems
diff --git a/libavfilter/file_open.c b/libavfilter/file_open.c
new file mode 100644
index 00..494a5d37a4
--- /dev/null
+++ b/libavfilter/file_open.c
@@ -0,0 +1 @@
+#include "libavutil/file_open.c"
-- 
ffmpeg-codebot
___
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 v5 2/3] avcodec/dvdsubdec: use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread softworkz
From: softworkz 

Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz 
---
 libavcodec/dvdsubdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 30fe4d41de..19b78b3eb1 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -617,7 +617,7 @@ static int parse_ifo_palette(DVDSubContext *ctx, char *p)
 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
 
 ctx->has_palette = 0;
-if ((ifo = fopen(p, "r")) == NULL) {
+if ((ifo = av_fopen_utf8(p, "r")) == NULL) {
 av_log(ctx, AV_LOG_WARNING, "Unable to open IFO file \"%s\": %s\n", p, 
av_err2str(AVERROR(errno)));
 return AVERROR_EOF;
 }
-- 
ffmpeg-codebot

___
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 v5 1/3] avfilter: use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread softworkz
From: softworkz 

Unify file access operations by replacing usages of direct calls
to posix fopen() to prepare for long filename support on Windows.

Signed-off-by: softworkz 
---
 libavfilter/af_firequalizer.c | 2 +-
 libavfilter/vf_deshake.c  | 2 +-
 libavfilter/vf_psnr.c | 2 +-
 libavfilter/vf_signature.c| 4 ++--
 libavfilter/vf_ssim.c | 2 +-
 libavfilter/vf_vidstabdetect.c| 2 +-
 libavfilter/vf_vidstabtransform.c | 2 +-
 libavfilter/vf_vmafmotion.c   | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index c19a2fe122..e1497dcef0 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -604,7 +604,7 @@ static int generate_kernel(AVFilterContext *ctx, const char 
*gain, const char *g
 if (ret < 0)
 return ret;
 
-if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = 
fopen(s->dumpfile, "w"
+if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = 
av_fopen_utf8(s->dumpfile, "w"
 av_log(ctx, AV_LOG_WARNING, "dumping failed.\n");
 
 vars[VAR_CHS] = inlink->ch_layout.nb_channels;
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 4f28467bb2..dea69e11cd 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -353,7 +353,7 @@ static av_cold int init(AVFilterContext *ctx)
 }
 
 if (deshake->filename)
-deshake->fp = fopen(deshake->filename, "w");
+deshake->fp = av_fopen_utf8(deshake->filename, "w");
 if (deshake->fp)
 fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg 
angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", 1, 104, deshake->fp);
 
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 19852eaa69..09c2a5164a 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -280,7 +280,7 @@ static av_cold int init(AVFilterContext *ctx)
 if (!strcmp(s->stats_file_str, "-")) {
 s->stats_file = stdout;
 } else {
-s->stats_file = fopen(s->stats_file_str, "w");
+s->stats_file = av_fopen_utf8(s->stats_file_str, "w");
 if (!s->stats_file) {
 int err = AVERROR(errno);
 char buf[128];
diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 4ca57ebf1d..904123fd4e 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -386,7 +386,7 @@ static int xml_export(AVFilterContext *ctx, StreamContext 
*sc, const char* filen
 FILE* f;
 unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 };
 
-f = fopen(filename, "w");
+f = av_fopen_utf8(filename, "w");
 if (!f) {
 int err = AVERROR(EINVAL);
 char buf[128];
@@ -500,7 +500,7 @@ static int binary_export(AVFilterContext *ctx, 
StreamContext *sc, const char* fi
 if (!buffer)
 return AVERROR(ENOMEM);
 
-f = fopen(filename, "wb");
+f = av_fopen_utf8(filename, "wb");
 if (!f) {
 int err = AVERROR(EINVAL);
 char buf[128];
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 32f313817d..4a82cbec06 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -404,7 +404,7 @@ static av_cold int init(AVFilterContext *ctx)
 if (!strcmp(s->stats_file_str, "-")) {
 s->stats_file = stdout;
 } else {
-s->stats_file = fopen(s->stats_file_str, "w");
+s->stats_file = av_fopen_utf8(s->stats_file_str, "w");
 if (!s->stats_file) {
 int err = AVERROR(errno);
 char buf[128];
diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index 267a62ea9b..4acae5a3ea 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -126,7 +126,7 @@ static int config_input(AVFilterLink *inlink)
 av_log(ctx, AV_LOG_INFO, "  show = %d\n", s->conf.show);
 av_log(ctx, AV_LOG_INFO, "result = %s\n", s->result);
 
-s->f = fopen(s->result, "w");
+s->f = av_fopen_utf8(s->result, "w");
 if (s->f == NULL) {
 av_log(ctx, AV_LOG_ERROR, "cannot open transform file %s\n", 
s->result);
 return AVERROR(EINVAL);
diff --git a/libavfilter/vf_vidstabtransform.c 
b/libavfilter/vf_vidstabtransform.c
index 4619e9b256..17214f039f 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -191,7 +191,7 @@ static int config_input(AVFilterLink *inlink)
 av_log(ctx, AV_LOG_INFO, "zoomspeed = %g\n", tc->conf.zoomSpeed);
 av_log(ctx, AV_LOG_INFO, "interpol  = %s\n", 
getInterpolationTypeName(tc->conf.interpolType));
 
-f = fopen(tc->input, "r");
+f = av_fopen_utf8(tc->input, "r");
 if (!f) {
 int ret = AVERROR(errno);
 av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input);
diff --git a/libavfilter/vf_vmafmotion.c 

[FFmpeg-devel] [PATCH v5 0/3] use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread ffmpegagent
Unify file access operations by replacing usages of direct calls to posix
fopen()

v2: Remove changes to fftools for now
v3: Add some additional replacements
v4: Fix and improve commit messages
v5: Add patch to remap ff_open in libavfilter for MSVC on Windows

softworkz (3):
  avfilter: use av_fopen_utf8() instead of plain fopen()
  avcodec/dvdsubdec: use av_fopen_utf8() instead of plain fopen()
  avfilter: Make avpriv_open a library-internal function on msvcrt

 libavcodec/dvdsubdec.c| 2 +-
 libavfilter/Makefile  | 1 +
 libavfilter/af_firequalizer.c | 2 +-
 libavfilter/file_open.c   | 1 +
 libavfilter/vf_deshake.c  | 2 +-
 libavfilter/vf_psnr.c | 2 +-
 libavfilter/vf_signature.c| 4 ++--
 libavfilter/vf_ssim.c | 2 +-
 libavfilter/vf_vidstabdetect.c| 2 +-
 libavfilter/vf_vidstabtransform.c | 2 +-
 libavfilter/vf_vmafmotion.c   | 2 +-
 11 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 libavfilter/file_open.c


base-commit: 41a558fea06cc0a23b8d2d0dfb03ef6a25cf5100
Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-26%2Fsoftworkz%2Fsubmit_replace_fopen-v5
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-26/softworkz/submit_replace_fopen-v5
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/26

Range-diff vs v4:

 1:  7c455d7fa0 = 1:  bcafcfacea avfilter: use av_fopen_utf8() instead of plain 
fopen()
 2:  68192b1a1e = 2:  94d023ece3 avcodec/dvdsubdec: use av_fopen_utf8() instead 
of plain fopen()
 -:  -- > 3:  5e50103af3 avfilter: Make avpriv_open a library-internal 
function on msvcrt

-- 
ffmpeg-codebot
___
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 v4 0/2] use av_fopen_utf8() instead of plain fopen()

2022-05-19 Thread Soft Works


> -Original Message-
> From: Tobias Rapp 
> Sent: Wednesday, May 18, 2022 9:01 AM
> To: ffmpegagent ; ffmpeg-devel@ffmpeg.org
> Cc: Martin Storsjö ; Soft Works
> 
> Subject: Re: [PATCH v4 0/2] use av_fopen_utf8() instead of plain
> fopen()
> 
> On 17/05/2022 14:29, ffmpegagent wrote:
> > Unify file access operations by replacing usages of direct calls to
> posix
> > fopen()
> >
> > v2: Remove changes to fftools for now
> > v3: Add some additional replacements
> > v4: Fix and improve commit messages
> >
> > softworkz (2):
> >avfilter: use av_fopen_utf8() instead of plain fopen()
> >avcodec/dvdsubdec: use av_fopen_utf8() instead of plain fopen()
> >
> >   libavcodec/dvdsubdec.c| 2 +-
> >   libavfilter/af_firequalizer.c | 2 +-
> >   libavfilter/vf_deshake.c  | 2 +-
> >   libavfilter/vf_psnr.c | 2 +-
> >   libavfilter/vf_signature.c| 4 ++--
> >   libavfilter/vf_ssim.c | 2 +-
> >   libavfilter/vf_vidstabdetect.c| 2 +-
> >   libavfilter/vf_vidstabtransform.c | 2 +-
> >   libavfilter/vf_vmafmotion.c   | 2 +-
> >   9 files changed, 10 insertions(+), 10 deletions(-)
> >
> > [...]
> 
> Commit messages look fine to me now. I will leave the decision to
> others
> about the order of changes -- whether this patch-set comes first, or
> the
> fix for the CRT linking issue (possibly replacing this public function
> with a private copy).

To eliminate the question, I'm including that change in
the v5 of this patchset.

Thanks,
softworkz


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

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


[FFmpeg-devel] [PATCH] Add YCOCG colorspace to input arguments of vf_colorspace.

2022-05-19 Thread Mohammad Izadi
ffmpeg support YCOCG (YCOCG=YCGCO). However, vf_colorspace is only support 
YCGCO as input. Added YCOCG to the inputs.
---
 libavfilter/vf_colorspace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 3c8b3b20eb..bccd04528e 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -906,6 +906,7 @@ static const AVOption colorspace_options[] = {
 ENUM("smpte170m",   AVCOL_SPC_SMPTE170M,   "csp"),
 ENUM("smpte240m",   AVCOL_SPC_SMPTE240M,   "csp"),
 ENUM("ycgco",   AVCOL_SPC_YCGCO,   "csp"),
+ENUM("ycocg",   AVCOL_SPC_YCOCG,   "csp"),
 ENUM("gbr", AVCOL_SPC_RGB, "csp"),
 ENUM("bt2020nc",AVCOL_SPC_BT2020_NCL,  "csp"),
 ENUM("bt2020ncl",   AVCOL_SPC_BT2020_NCL,  "csp"),
-- 
2.36.1.124.g0e6072fb45-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".


[FFmpeg-devel] [PATCH] libavcodec/qsvenc: expose only supported options

2022-05-19 Thread Dmitry Rogozhkin
vp9, hevc, avc, mpeg2 QSV encoders inherit common list
of options (QSV_COMMON_OPTS) while bunch of options is not
actually supported by current qsv code. The only codec which
supportes everything is avc, followed by hevc, while vp9 and
mpeg2 significantly fall behind. This creates difficulties
for the users to use qsv encoders. This patch fixes options
list for encoders leaving only those which are actually
supported.

Signed-off-by: Dmitry Rogozhkin 
---
 libavcodec/qsvenc.h   | 52 ++-
 libavcodec/qsvenc_h264.c  | 12 +++
 libavcodec/qsvenc_hevc.c  |  9 
 libavcodec/qsvenc_mpeg2.c |  1 +
 4 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index cb84723..33bbc2a 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -89,22 +89,46 @@
 { "slow",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_3  },
INT_MIN, INT_MAX, VE, "preset" },   
 \
 { "slower",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_2  },
INT_MIN, INT_MAX, VE, "preset" },   
 \
 { "veryslow",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
MFX_TARGETUSAGE_BEST_QUALITY  }, INT_MIN, INT_MAX, VE, "preset" },  
  \
-{ "rdo","Enable rate distortion optimization",OFFSET(qsv.rdo), 
   AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE },
 \
+{ "forced_idr", "Forcing I frames as IDR frames", 
OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,  1, VE 
}, \
+{ "low_power", "enable low power mode(experimental: many limitations by mfx 
version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 
-1}, -1, 1, VE},
+
+#define QSV_OPTION_RDO \
+{ "rdo","Enable rate distortion optimization",OFFSET(qsv.rdo), 
   AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE },
+
+#define QSV_OPTION_MAX_FRAME_SIZE \
 { "max_frame_size", "Maximum encoded frame size in bytes",
OFFSET(qsv.max_frame_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,INT_MAX, VE 
}, \
 { "max_frame_size_i", "Maximum encoded I frame size in 
bytes",OFFSET(qsv.max_frame_size_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  
INT_MAX, VE }, \
-{ "max_frame_size_p", "Maximum encoded P frame size in 
bytes",OFFSET(qsv.max_frame_size_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  
INT_MAX, VE }, \
-{ "max_slice_size", "Maximum encoded slice size in bytes",
OFFSET(qsv.max_slice_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,INT_MAX, VE 
}, \
-{ "bitrate_limit",  "Toggle bitrate limitations", 
OFFSET(qsv.bitrate_limit),  AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "mbbrc",  "MB level bitrate control",   
OFFSET(qsv.mbbrc),  AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "extbrc", "Extended bitrate control",   
OFFSET(qsv.extbrc), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "adaptive_i", "Adaptive I-frame placement", 
OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "adaptive_b", "Adaptive B-frame placement", 
OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "p_strategy", "Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to 
be set to 0).",OFFSET(qsv.p_strategy), AV_OPT_TYPE_INT,{ .i64 = 0}, 0,  
  2, VE }, \
-{ "b_strategy", "Strategy to choose between I/P/B-frames", 
OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  1, VE 
}, \
-{ "forced_idr", "Forcing I frames as IDR frames", 
OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,  1, VE 
}, \
-{ "low_power", "enable low power mode(experimental: many limitations by mfx 
version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 
-1}, -1, 1, VE},\
-{ "dblk_idc", "This option disable deblocking. It has value in range 0~2.",   
OFFSET(qsv.dblk_idc),   AV_OPT_TYPE_INT,{ .i64 = 0 },   0,  2,  VE},\
-{ "low_delay_brc",   "Allow to strictly obey avg frame size", 
OFFSET(qsv.low_delay_brc),  AV_OPT_TYPE_BOOL,{ .i64 = -1 }, -1,  1, VE 
}, \
+{ "max_frame_size_p", "Maximum encoded P frame size in 
bytes",OFFSET(qsv.max_frame_size_p), AV_OPT_TYPE_INT, { .i64 = -1 }, -1,  
INT_MAX, VE },
+
+#define QSV_OPTION_MAX_SLICE_SIZE \
+{ "max_slice_size", "Maximum encoded slice size in bytes",

Re: [FFmpeg-devel] [PATCH 4/7] avcodec/mpegvideoenc: Remove ineffective [pb]bias options

2022-05-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> The user-provided value is overwritten in ff_mpv_encode_init()
> without having ever been read.
> (This has been broken when making these options mpegvideo-specific
> in commits 910247f1720c6aae422723c05dac6d0b19f20bec and
> cf7d2f2d2134c0854edf2db91e7436ac2bc9874f. No one has ever complained,
> so this commit removes these fields.)
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/mpegvideoenc.h | 4 
>  libavcodec/version.h  | 2 +-
>  2 files changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
> index a0e8913ea6..ecc389a6d3 100644
> --- a/libavcodec/mpegvideoenc.h
> +++ b/libavcodec/mpegvideoenc.h
> @@ -43,8 +43,6 @@
>  #define FF_MPV_FLAG_NAQ  0x0010
>  #define FF_MPV_FLAG_MV0  0x0020
>  
> -#define FF_DEFAULT_QUANT_BIAS 99
> -
>  #define FF_MPV_OPT_CMP_FUNC \
>  { "sad","Sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 
> = FF_CMP_SAD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "cmp_func" }, \
>  { "sse","Sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = 
> FF_CMP_SSE }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "cmp_func" }, \
> @@ -94,8 +92,6 @@ FF_MPV_OPT_CMP_FUNC, \
>  {"border_mask", "increase the quantizer for macroblocks close to borders", 
> FF_MPV_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, 
> FLT_MAX, FF_MPV_OPT_FLAGS},\
>  {"lmin", "minimum Lagrange factor (VBR)",   
> FF_MPV_OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 =  2*FF_QP2LAMBDA }, 0, INT_MAX, 
> FF_MPV_OPT_FLAGS },\
>  {"lmax", "maximum Lagrange factor (VBR)",   
> FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, 
> FF_MPV_OPT_FLAGS },\
> -{"ibias", "intra quant bias",   
> FF_MPV_OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = 
> FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
> -{"pbias", "inter quant bias",   
> FF_MPV_OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = 
> FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },   \
>  {"motion_est", "motion estimation algorithm",   
> FF_MPV_OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, 
> FF_ME_XONE, FF_MPV_OPT_FLAGS, "motion_est" },   \
>  { "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, 
> FF_MPV_OPT_FLAGS, "motion_est" }, \
>  { "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, 
> FF_MPV_OPT_FLAGS, "motion_est" }, \
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 87b7284a95..5183deb68b 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #include "version_major.h"
>  
> -#define LIBAVCODEC_VERSION_MINOR  28
> +#define LIBAVCODEC_VERSION_MINOR  29
>  #define LIBAVCODEC_VERSION_MICRO 100
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Ping for the last four patches of this patchset. I plan to push them on
Sunday unless there are objections.

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: Only read the primary item for AVIF

2022-05-19 Thread Vignesh Venkatasubramanian
On Mon, May 16, 2022 at 9:59 AM Vignesh Venkatasubramanian
 wrote:
>
> Update the still AVIF parser to only read the primary item. With this
> patch, AVIF still images with exif/icc/alpha channel will no longer
> fail to parse.
>
> For example, this patch enables parsing of files in:
> https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft
>
> Partially fixes trac ticket #7621
>
> Signed-off-by: Vignesh Venkatasubramanian 
> ---
>  libavformat/isom.h |  1 +
>  libavformat/mov.c  | 41 +
>  2 files changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index cf36f04d5b..f05c2d9c28 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -317,6 +317,7 @@ typedef struct MOVContext {
>  uint32_t mfra_size;
>  uint32_t max_stts_delta;
>  int is_still_picture_avif;
> +int primary_item_id;
>  } MOVContext;
>
>  int ff_mp4_read_descr_len(AVIOContext *pb);
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index d7be593a86..9310a393fe 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7445,6 +7445,13 @@ static int rb_size(AVIOContext *pb, uint64_t* value, 
> int size)
>  return size;
>  }
>
> +static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +avio_rb32(pb);  // version & flags.
> +c->primary_item_id = avio_rb16(pb);
> +return atom.size;
> +}
> +
>  static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  {
>  int version, offset_size, length_size, base_offset_size, index_size;
> @@ -7501,34 +7508,25 @@ static int mov_read_iloc(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  return AVERROR_PATCHWELCOME;
>  }
>  item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
> -if (item_count > 1) {
> -// For still AVIF images, we only support one item. Second item will
> -// generally be found for AVIF images with alpha channel. We don't
> -// support them as of now.
> -av_log(c->fc, AV_LOG_ERROR, "iloc: item_count > 1 not supported.\n");
> -return AVERROR_PATCHWELCOME;
> -}
>
>  // Populate the necessary fields used by mov_build_index.
> -sc->stsc_count = item_count;
> -sc->stsc_data = av_malloc_array(item_count, sizeof(*sc->stsc_data));
> +sc->stsc_count = 1;
> +sc->stsc_data = av_malloc_array(1, sizeof(*sc->stsc_data));
>  if (!sc->stsc_data)
>  return AVERROR(ENOMEM);
>  sc->stsc_data[0].first = 1;
>  sc->stsc_data[0].count = 1;
>  sc->stsc_data[0].id = 1;
> -sc->chunk_count = item_count;
> -sc->chunk_offsets =
> -av_malloc_array(item_count, sizeof(*sc->chunk_offsets));
> +sc->chunk_count = 1;
> +sc->chunk_offsets = av_malloc_array(1, sizeof(*sc->chunk_offsets));
>  if (!sc->chunk_offsets)
>  return AVERROR(ENOMEM);
> -sc->sample_count = item_count;
> -sc->sample_sizes =
> -av_malloc_array(item_count, sizeof(*sc->sample_sizes));
> +sc->sample_count = 1;
> +sc->sample_sizes = av_malloc_array(1, sizeof(*sc->sample_sizes));
>  if (!sc->sample_sizes)
>  return AVERROR(ENOMEM);
> -sc->stts_count = item_count;
> -sc->stts_data = av_malloc_array(item_count, sizeof(*sc->stts_data));
> +sc->stts_count = 1;
> +sc->stts_data = av_malloc_array(1, sizeof(*sc->stts_data));
>  if (!sc->stts_data)
>  return AVERROR(ENOMEM);
>  sc->stts_data[0].count = 1;
> @@ -7536,7 +7534,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  sc->stts_data[0].duration = 0;
>
>  for (int i = 0; i < item_count; i++) {
> -(version < 2) ? avio_rb16(pb) : avio_rb32(pb);  // item_id;
> +int item_id = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
>  if (version > 0)
>  avio_rb16(pb);  // construction_method.
>  avio_rb16(pb);  // data_reference_index.
> @@ -7552,8 +7550,10 @@ static int mov_read_iloc(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  if (rb_size(pb, _offset, offset_size) < 0 ||
>  rb_size(pb, _length, length_size) < 0)
>  return AVERROR_INVALIDDATA;
> -sc->sample_sizes[0] = extent_length;
> -sc->chunk_offsets[0] = base_offset + extent_offset;
> +if (item_id == c->primary_item_id) {
> +sc->sample_sizes[0] = extent_length;
> +sc->chunk_offsets[0] = base_offset + extent_offset;
> +}
>  }
>  }
>
> @@ -7670,6 +7670,7 @@ static const MOVParseTableEntry 
> mov_default_parse_table[] = {
>  { MKTAG('S','A','3','D'), mov_read_SA3D }, /* ambisonic audio box */
>  { MKTAG('S','A','N','D'), mov_read_SAND }, /* non diegetic audio box */
>  { MKTAG('i','l','o','c'), mov_read_iloc },
> +{ MKTAG('p','i','t','m'), mov_read_pitm },
>  { 0, NULL }
>  };
>
> --
> 2.36.0.550.gb090851708-goog
>

Any comments on this one? If 

Re: [FFmpeg-devel] [PATCH] avformat/img2: Add support for AVIF mux in image2

2022-05-19 Thread Vignesh Venkatasubramanian
On Thu, May 19, 2022 at 1:55 AM Gyan Doshi  wrote:
>
>
>
> On 2022-05-19 09:57 am, Gyan Doshi wrote:
> >
> >
> > On 2022-05-18 01:06 am, James Zern wrote:
> >> On Mon, May 16, 2022 at 10:40 AM Vignesh Venkatasubramanian
> >>  wrote:
> >>> Add support for AVIF muxing in the image2 muxer.
> >>>
> >>> Tested with this example:
> >>> ffmpeg -lavfi testsrc=duration=1:size=320x320 -g 1 -flags
> >>> global_header -c:v libaom-av1 -f image2 img-%2d.avif
> >>>
> >>> Signed-off-by: Vignesh Venkatasubramanian 
> >>> ---
> >>>   libavformat/img2enc.c | 4 +++-
> >>>   1 file changed, 3 insertions(+), 1 deletion(-)
> >>>
> >> lgtm.
> >
> > Will apply.
>
> Applied as dd99d34d67e2612a8f133f8a86db9f64b4dfa20d
>

Thank you!

> Regards,
> Gyan
> ___
> 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".



-- 
Vignesh
___
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/movenc: Support alpha channel for AVIF

2022-05-19 Thread Vignesh Venkatasubramanian
On Wed, May 18, 2022 at 7:36 PM Bang He  wrote:
>
> error happened:
>
> ./ffmpeg -i alpha.png -filter_complex [0:v]alphaextract[a] -map 0 -map [a]
> -still-picture 1 avif_with_alpha.avif
> ffmpeg version N-106936-gff5ea89da2 Copyright (c) 2000-2022 the FFmpeg
> developers
>   built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
>   configuration: --disable-ffplay --disable-ffprobe --enable-gpl
> --enable-nonfree --prefix=/home/bang/Desktop/out
>   libavutil  57. 24.101 / 57. 24.101
>   libavcodec 59. 28.100 / 59. 28.100
>   libavformat59. 24.100 / 59. 24.100
>   libavdevice59.  6.100 / 59.  6.100
>   libavfilter 8. 38.100 /  8. 38.100
>   libswscale  6.  6.100 /  6.  6.100
>   libswresample   4.  6.100 /  4.  6.100
>   libpostproc56.  5.100 / 56.  5.100
> Unrecognized option 'still-picture'.
> Error splitting the argument list: Option not found
>

You would have to build ffmpeg with libaom enabled for AVIF encoding
to work (since AVIF is backed by an AV1 encoder). From the logs you
posted, it seems like you don't have an AV1 encoder available in your
ffmpeg build.

The "-still-picture" flag was added in ab05e9a7f2. Please make sure
that you are sync'ed past that to pick up that option.

> On Thu, May 19, 2022 at 5:56 AM Vignesh Venkatasubramanian <
> vigneshv-at-google@ffmpeg.org> wrote:
>
> > AVIF specification allows for alpha channel as an auxillary item (in
> > case of still images) or as an auxillary track (in case of animated
> > images).  Add support for both of these. The AVIF muxer will take
> > exactly two streams (when alpha is present) as input (first one being
> > the YUV planes and the second one being the alpha plane).
> >
> > The input has to come from two different images (one of it color and
> > the other one being alpha), or it can come from a single file
> > source with the alpha channel extracted using the "alphaextract"
> > filter.
> >
> > Example using alphaextract:
> > ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map
> > "[a]" -still-picture 1 avif_with_alpha.avif
> >
> > Example using two sources (first source can be in any pixel format and
> > the second source has to be in monochrome grey pixel format):
> > ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy
> > avif_with_alpha.avif
> >
> > The generated files pass the compliance checks in Compliance Warden:
> > https://github.com/gpac/ComplianceWarden
> >
> > libavif (the reference avif library) is able to decode the files
> > generated using this patch.
> >
> > They also play back properly (with transparent background) in:
> > 1) Chrome
> > 2) Firefox (only still AVIF, no animation support)
> >
> > Signed-off-by: Vignesh Venkatasubramanian 
> > ---
> >  libavformat/movenc.c | 185 +--
> >  libavformat/movenc.h |   4 +-
> >  2 files changed, 128 insertions(+), 61 deletions(-)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index de971f94e8..00e42b7abb 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -2852,7 +2852,7 @@ static int mov_write_hdlr_tag(AVFormatContext *s,
> > AVIOContext *pb, MOVTrack *tra
> >  hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0";
> >  if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
> >  if (track->mode == MODE_AVIF) {
> > -hdlr_type = "pict";
> > +hdlr_type = (track == >tracks[0]) ? "pict" : "auxv";
> >  descr = "PictureHandler";
> >  } else {
> >  hdlr_type = "vide";
> > @@ -2940,57 +2940,83 @@ static int mov_write_iloc_tag(AVIOContext *pb,
> > MOVMuxContext *mov, AVFormatConte
> >  avio_wb32(pb, 0); /* Version & flags */
> >  avio_w8(pb, (4 << 4) + 4); /* offset_size(4) and length_size(4) */
> >  avio_w8(pb, 0); /* base_offset_size(4) and reserved(4) */
> > -avio_wb16(pb, 1); /* item_count */
> > +avio_wb16(pb, s->nb_streams); /* item_count */
> >
> > -avio_wb16(pb, 1); /* item_id */
> > -avio_wb16(pb, 0); /* data_reference_index */
> > -avio_wb16(pb, 1); /* extent_count */
> > -mov->avif_extent_pos = avio_tell(pb);
> > -avio_wb32(pb, 0); /* extent_offset (written later) */
> > -// For animated AVIF, we simply write the first packet's size.
> > -avio_wb32(pb, mov->avif_extent_length); /* extent_length */
> > +for (int i = 0; i < s->nb_streams; i++) {
> > +avio_wb16(pb, i + 1); /* item_id */
> > +avio_wb16(pb, 0); /* data_reference_index */
> > +avio_wb16(pb, 1); /* extent_count */
> > +mov->avif_extent_pos[i] = avio_tell(pb);
> > +avio_wb32(pb, 0); /* extent_offset (written later) */
> > +// For animated AVIF, we simply write the first packet's size.
> > +avio_wb32(pb, mov->avif_extent_length[i]); /* extent_length */
> > +}
> >
> >  return update_size(pb, pos);
> >  }
> >
> >  static int mov_write_iinf_tag(AVIOContext *pb, MOVMuxContext 

[FFmpeg-devel] [PATCH] avcodec/pthread_frame: Don't update the first thread ctx before freeing

2022-05-19 Thread Andreas Rheinhardt
Currently, ff_frame_thread_free() uses the last worker thread
to updates the first worker thread via update_context_from_thread()
immediately before freeing all these worker threads. This is
a remnant of the time in which the first worker was special.
(E.g. the first worker shared its AVCodecInternal with the public
AVCodecContext.)

But these times are over (none of the uses of is_copy matter
for ff_frame_thread_free()); nowadays the only thing that
update_context_from_thread() does is referencing a few
buffers/frames and replacing them with other references instead.
These new references will then be freed immediately thereafter
when the first worker thread is freed. Ensuring that the code is
free of double-frees is achieved by using reference-counted structures
(or in case of AVChannelLayouts: by giving each worker its own copy).

Some archaeology:
a) Updating the first worker thread from the last one used
has been done since frame-threading was added in
37b00b47cbeecd66bb34c5c7c534d016d6e8da24.
b) The precursor to ff_mpv_common_end() checked for is_copy
before freeing pictures (i.e. it only freed them for the first
worker thread).
c) Commits c2dfb1e37cc72bf144545c4410a4621cbff5c4b1 and
e33811bd2686411233cb0eb4a4ee45eb99d7e736 modified the
update_thread_context function of the H.264 decoder
so that it could fail before calling ff_mpeg_update_thread_context().
d) This led to a double free/an assert violation with an H.264
sample for which ff_mpeg_update_thread_context() is not reached
for the final update_context_from_thread(). Commit
a6e4796fbf0aa9b13451a8ef917ecc4e80d1d272 added code to fix this
sample.
e) This issue was fixed (even with the last mentioned commit reverted)
when the H.264 decoder was deMpegEncContextized in commit
b7fe35c9e50e1701274364adf7280bf4a02b092b (merging commit
2c541554076cc8a72e7145d4da30389ca763f32f).
f) mpegvideo.c stopped using is_copy when it was switched to refcounted
frames in 759001c534287a96dc96d1e274665feb7059145d.
g) 1f4cf92cfbd3accbae582ac63126ed5570ddfd37 removed the init_thread_copy
callbacks; now no FFCodec.close callback checks for is_copy at all
any more.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/pthread_frame.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index c667706206..8faea75a49 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -714,13 +714,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int 
thread_count)
 }
 }
 
-if (fctx->prev_thread && fctx->prev_thread != fctx->threads)
-if (update_context_from_thread(fctx->threads->avctx, 
fctx->prev_thread->avctx, 0) < 0) {
-av_log(avctx, AV_LOG_ERROR, "Final thread update failed\n");
-fctx->prev_thread->avctx->internal->is_copy = 
fctx->threads->avctx->internal->is_copy;
-fctx->threads->avctx->internal->is_copy = 1;
-}
-
 for (i = 0; i < thread_count; i++) {
 PerThreadContext *p = >threads[i];
 AVCodecContext *ctx = p->avctx;
-- 
2.32.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] Changelog: Add line for IPFS

2022-05-19 Thread Michael Niedermayer
Noticed-and-suggested-by: Mark Gaiser 
Signed-off-by: Michael Niedermayer 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 4d42a0f681..869f05de34 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version 5.1:
+- add ipfs/ipns protocol support
 - dialogue enhance audio filter
 - dropped obsolete XvMC hwaccel
 - pcm-bluray encoder
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH] opt_common: note D and T type streams for completeness.

2022-05-19 Thread Gyan Doshi
Addresses #9784
---
 fftools/opt_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 55d86eeb19..ae5e28a5af 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -675,6 +675,8 @@ int show_codecs(void *optctx, const char *opt, const char 
*arg)
" ..V... = Video codec\n"
" ..A... = Audio codec\n"
" ..S... = Subtitle codec\n"
+   " ..D... = Data codec\n"
+   " ..T... = Attachment codec\n"
" ...I.. = Intra frame-only codec\n"
" L. = Lossy compression\n"
" .S = Lossless compression\n"
-- 
2.36.1

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

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


[FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit

2022-05-19 Thread Anton Khirnov
---
 libavfilter/vf_v360.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 8f36d207c9..620a995733 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3765,6 +3765,7 @@ static int barrelsplit_to_xyz(const V360Context *s,
 const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 
4.f) : 1.f - s->out_pad;
 
 const int face = floorf(y * 4.f);
+const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f;
 float uf, vf;
 
 uf = x * 3.f - 2.f;
@@ -3774,36 +3775,23 @@ static int barrelsplit_to_xyz(const V360Context *s,
 vf = y * 2.f;
 uf = 1.f - uf;
 vf = 0.5f - vf;
-
-l_x = (0.5f - uf) / scalew;
-l_y = -0.5f;
-l_z = (0.5f - vf) / scaleh;
 break;
 case 1:
 vf = y * 2.f;
 uf = 1.f - uf;
 vf = 1.f - (vf - 0.5f);
-
-l_x = (0.5f - uf) / scalew;
-l_y =  0.5f;
-l_z = (-0.5f + vf) / scaleh;
 break;
 case 2:
 vf = y * 2.f - 0.5f;
 vf = 1.f - (1.f - vf);
-
-l_x = (0.5f - uf) / scalew;
-l_y = -0.5f;
-l_z = (0.5f - vf) / scaleh;
 break;
 case 3:
 vf = y * 2.f - 1.5f;
-
-l_x = (0.5f - uf) / scalew;
-l_y =  0.5f;
-l_z = (-0.5f + vf) / scaleh;
 break;
 }
+l_x = (0.5f - uf) / scalew;
+l_y =  0.5f * dir_vert;
+l_z = (vf - 0.5f) * dir_vert / scaleh;
 }
 
 vec[0] = l_x;
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding

2022-05-19 Thread Anton Khirnov
Make it match Facebook's transform360
(https://github.com/facebook/transform360)

Fixes one part of #9725.
---
 libavfilter/vf_v360.c | 46 ---
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 620a995733..940e6fc5f6 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3683,30 +3683,33 @@ static int xyz_to_barrelsplit(const V360Context *s,
 
 u_shift = 2 * ew;
 
+uf = vec[0] / vec[1] * scalew;
+vf = vec[2] / vec[1] * scaleh;
+
 if (theta <= 0.f && theta >= -M_PI_2 &&
 phi <= M_PI_2 && phi >= -M_PI_2) {
-uf = -vec[0] / vec[1];
-vf = -vec[2] / vec[1];
+uf *= -1.0f;
+vf  = -(vf + 1.f) * scaleh + 1.f;
 v_shift = 0;
 v_offset = -eh;
 } else if (theta >= 0.f && theta <= M_PI_2 &&
phi <= M_PI_2 && phi >= -M_PI_2) {
-uf =  vec[0] / vec[1];
-vf = -vec[2] / vec[1];
+vf = -(vf - 1.f) * scaleh;
 v_shift = height * 0.25f;
 } else if (theta <= 0.f && theta >= -M_PI_2) {
-uf =  vec[0] / vec[1];
-vf =  vec[2] / vec[1];
+// back top
+vf = (vf - 1.f) * scaleh + 1.f;
 v_shift = height * 0.5f;
 v_offset = -eh;
 } else {
-uf = -vec[0] / vec[1];
-vf =  vec[2] / vec[1];
+// back bottom
+uf *= -1.0f;
+vf = (vf + 1.f) * scaleh;
 v_shift = height * 0.75f;
 }
 
-uf = 0.5f * width / 3.f * (uf * scalew + 1.f);
-vf = height * 0.25f * (vf * scaleh + 1.f) + v_offset;
+uf = 0.5f * width / 3.f * (uf + 1.f);
+vf *= height * 0.25f;
 }
 
 ui = floorf(uf);
@@ -3764,29 +3767,22 @@ static int barrelsplit_to_xyz(const V360Context *s,
 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width  / 
3.f) : 1.f - s->out_pad;
 const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 
4.f) : 1.f - s->out_pad;
 
-const int face = floorf(y * 4.f);
+const float facef = floorf(y * 4.f);
+const intface = facef;
 const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f;
 float uf, vf;
 
 uf = x * 3.f - 2.f;
 
 switch (face) {
-case 0:
-vf = y * 2.f;
+case 0: // front top
+case 1: // front bottom
 uf = 1.f - uf;
-vf = 0.5f - vf;
-break;
-case 1:
-vf = y * 2.f;
-uf = 1.f - uf;
-vf = 1.f - (vf - 0.5f);
-break;
-case 2:
-vf = y * 2.f - 0.5f;
-vf = 1.f - (1.f - vf);
+vf = (0.5f - 2.f * y) / scaleh + facef;
 break;
-case 3:
-vf = y * 2.f - 1.5f;
+case 2: // back top
+case 3: // back bottom
+vf = (y * 2.f - 1.5f) / scaleh + 3.f - facef;
 break;
 }
 l_x = (0.5f - uf) / scalew;
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit

2022-05-19 Thread Anton Khirnov
The top/bottom of the barrel are each coded as two semicircles inside a
square block in the frame. Mask out the parts of the square that lie
outside of these semicircles, so they are made transparent when
alpha_mask=1.

Fixes the other part of #9725.
---
 libavfilter/vf_v360.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 940e6fc5f6..42b1761333 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3745,6 +3745,7 @@ static int barrelsplit_to_xyz(const V360Context *s,
 const float x = (i + 0.5f) / width;
 const float y = (j + 0.5f) / height;
 float l_x, l_y, l_z;
+int ret;
 
 if (x < 2.f / 3.f) {
 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width * 
2.f / 3.f) : 1.f - s->out_pad;
@@ -3763,6 +3764,8 @@ static int barrelsplit_to_xyz(const V360Context *s,
 l_x = cos_theta * sin_phi;
 l_y = sin_theta;
 l_z = cos_theta * cos_phi;
+
+ret = 1;
 } else {
 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width  / 
3.f) : 1.f - s->out_pad;
 const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 
4.f) : 1.f - s->out_pad;
@@ -3788,13 +3791,14 @@ static int barrelsplit_to_xyz(const V360Context *s,
 l_x = (0.5f - uf) / scalew;
 l_y =  0.5f * dir_vert;
 l_z = (vf - 0.5f) * dir_vert / scaleh;
+ret = (l_x * l_x * scalew * scalew + l_z * l_z * scaleh * scaleh) < 
0.5f * 0.5f;
 }
 
 vec[0] = l_x;
 vec[1] = l_y;
 vec[2] = l_z;
 
-return 1;
+return ret;
 }
 
 /**
-- 
2.34.1

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

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


[FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier

2022-05-19 Thread Anton Khirnov
This function is always called indirectly, it cannot be inlined.
---
 libavfilter/vf_v360.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 7f377dd8f2..8f36d207c9 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -4239,7 +4239,7 @@ static void set_dimensions(int *outw, int *outh, int w, 
int h, const AVPixFmtDes
 }
 
 // Calculate remap data
-static av_always_inline int v360_slice(AVFilterContext *ctx, void *arg, int 
jobnr, int nb_jobs)
+static int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 {
 V360Context *s = ctx->priv;
 SliceXYRemap *r = >slice_remap[jobnr];
-- 
2.34.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 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand

2022-05-19 Thread lance . lmwang
On Thu, May 19, 2022 at 11:12:58AM +0200, Anton Khirnov wrote:
> Quoting lance.lmw...@gmail.com (2022-05-11 15:30:37)
> > On Wed, May 11, 2022 at 02:00:10PM +0200, Anton Khirnov wrote:
> > > Quoting lance.lmw...@gmail.com (2022-05-08 09:17:01)
> > > > From: Limin Wang 
> > > > 
> > > > some samples include both A53 and SCTE20 data. Before the commit, both
> > > > of the will be exported, so the CC data will be repeated or garbarge
> > > 
> > > Why would it be garbage? That sounds like a bug.
> > > Why can't we just export both?
> > for A53/SCTE20/DVDCC are exprted by A53_CC side data and they're sharing
> > the same a53_buf_ref to store the data, so if stream contains CC wrapped
> > as ATSC A53 packets + the same data wrapped as SCTE-20 packets, the CC
> > data will repeated. We can consider to add a new side data type if 
> > necessary,
> > but it's preferable to export A53_CC even it's SCTE20, so we can't export
> > both by A53_CC still.
> 
> Does this apply to anything other than mpeg2? If not, it should be a
> codec-private option rather than a new global flag.

Yes, it's for mpeg2 only. At first, I think export_side_data option is 
proper place to use. But if export_side_data are considered to use for
global, then I'll consider to add a mpeg2-private option for it.

> 
> -- 
> Anton Khirnov
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
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] avfilter/src_movie: add dec_opts for the opened file

2022-05-19 Thread lance . lmwang
On Wed, May 18, 2022 at 10:50:58PM +0800, "zhilizhao(赵志立)" wrote:
> 
> 
> > On May 8, 2022, at 3:17 PM, lance.lmw...@gmail.com wrote:
> > 
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > doc/filters.texi| 9 +
> > libavfilter/src_movie.c | 5 -
> > 2 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 367614d2f8..6775cf43ba 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and 
> > protocol_blacklist options:
> > ffplay -f lavfi
> > "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
> > @end example
> > +
> > +@item dec_opts
> > +Specify decode options for the opened file. Format options can be specified
> > +as a list of @var{key}=@var{value} pairs separated by ':'. The following 
> > example
> > +shows how to add export_side_data options:
> 
> Looks like ‘Format options’ is copy-paste error from format_opts.

Yes, will fix it, thanks.

> 
> > +@example
> > +./ffmpeg -y  -f lavfi
> > +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" 
> > out.srt
> > +@end example
> > @end table
> > 
> > It allows overlaying a second video on top of the main input of
> > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> > index 711854c23c..c7dbd90aa9 100644
> > --- a/libavfilter/src_movie.c
> > +++ b/libavfilter/src_movie.c
> > @@ -70,6 +70,7 @@ typedef struct MovieContext {
> > int64_t discontinuity_threshold;
> > int64_t ts_offset;
> > int dec_threads;
> > +AVDictionary *dec_opts;
> > 
> > AVFormatContext *format_ctx;
> > 
> > @@ -96,6 +97,7 @@ static const AVOption movie_options[]= {
> > { "discontinuity", "set discontinuity threshold", 
> > OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 
> > INT64_MAX, FLAGS },
> > { "dec_threads",  "set the number of threads for decoding", 
> > OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 =  0}, 0, INT_MAX, FLAGS },
> > { "format_opts",  "set format options for the opened file", 
> > OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> > +{ "dec_opts", "set decode options for the opened file", 
> > OFFSET(dec_opts),AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS},
> > { NULL },
> > };
> > 
> > @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext 
> > *avf, const char *spec)
> > 
> > static int open_stream(AVFilterContext *ctx, MovieStream *st, int 
> > dec_threads)
> > {
> > +MovieContext *movie = ctx->priv;
> > const AVCodec *codec;
> > int ret;
> > 
> > @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, 
> > MovieStream *st, int dec_threads)
> > dec_threads = ff_filter_get_nb_threads(ctx);
> > st->codec_ctx->thread_count = dec_threads;
> > 
> > -if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
> > +if ((ret = avcodec_open2(st->codec_ctx, codec, >dec_opts)) < 0) 
> > {
> > av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
> > return ret;
> > }
> > -- 
> > 2.35.1
> > 
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

-- 
Thanks,
Limin Wang
___
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] Issue - Error Due to higher number of threads

2022-05-19 Thread Wolfgang Haupt

Hi,

Thanks for the reply. I checked the memory usage while building ffmpeg with
64 threads. The machine I tested has 128 GB ram. While I tested it I found
that maximum memory utilized by the build of ffmpeg was 17GB.  Still the
build throws up error semaphore or child process wait (Error 87 : The
parameter is incorrect). Hence could you check on the same please. I have
attached screenshots of memory utilized from the task manager.


What CPU are you on?
There is some complexity regarding the amount of threads and
process groups on windows, see: 
https://www.windowscentral.com/windows-10-pro-cant-handle-amd-threadripper-3990xs-128-threads


Do you even have a processor that will utilize 64 cores?
I recommend trying with smaller values and see where "windows make" 
starts to fail.




Regards,
S Srihari

On Thu, 12 May 2022 at 16:45, Timo Rothenpieler 
wrote:


On 12.05.2022 04:22, Srihari Sridhar wrote:

Hi,

I was building ffmpeg through windows. While I was able to successfully
able to build for smaller number of threads, for larger number of

threads I

faced an issue

The commands I used were
bash ./configure --arch=x86 --target-os=mingw32 --disable-x86asm
make -j 

While building with 4 Threads the build was successful
Screenshot:
[image: image.png]

While building with 64 threads, I faced the following error,
Screenshot :
[image: image.png]
   semaphore or child process wait (Error 87 : The parameter is incorrect)

Please don't use images for plain text. It's hard to access and barely
legible.


Please could you check this issue. Thanks

You probably just ran out of RAM or something. Highly unlikely that this
is an issue with ffmpeg.
___
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] Issue - Error Due to higher number of threads

2022-05-19 Thread Srihari Sridhar
Hi,

Thanks for the reply. I checked the memory usage while building ffmpeg with
64 threads. The machine I tested has 128 GB ram. While I tested it I found
that maximum memory utilized by the build of ffmpeg was 17GB.  Still the
build throws up error semaphore or child process wait (Error 87 : The
parameter is incorrect). Hence could you check on the same please. I have
attached screenshots of memory utilized from the task manager.

Regards,
S Srihari

On Thu, 12 May 2022 at 16:45, Timo Rothenpieler 
wrote:

> On 12.05.2022 04:22, Srihari Sridhar wrote:
> > Hi,
> >
> > I was building ffmpeg through windows. While I was able to successfully
> > able to build for smaller number of threads, for larger number of
> threads I
> > faced an issue
> >
> > The commands I used were
> > bash ./configure --arch=x86 --target-os=mingw32 --disable-x86asm
> > make -j 
> >
> > While building with 4 Threads the build was successful
> > Screenshot:
> > [image: image.png]
> >
> > While building with 64 threads, I faced the following error,
> > Screenshot :
> > [image: image.png]
> >   semaphore or child process wait (Error 87 : The parameter is incorrect)
>
> Please don't use images for plain text. It's hard to access and barely
> legible.
>
> > Please could you check this issue. Thanks
>
> You probably just ran out of RAM or something. Highly unlikely that this
> is an issue with ffmpeg.
> ___
> 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 2/2] avcodec: add an AVCodecContext flag to export A53/SCTE20/DVD CC side data on demand

2022-05-19 Thread Anton Khirnov
Quoting lance.lmw...@gmail.com (2022-05-11 15:30:37)
> On Wed, May 11, 2022 at 02:00:10PM +0200, Anton Khirnov wrote:
> > Quoting lance.lmw...@gmail.com (2022-05-08 09:17:01)
> > > From: Limin Wang 
> > > 
> > > some samples include both A53 and SCTE20 data. Before the commit, both
> > > of the will be exported, so the CC data will be repeated or garbarge
> > 
> > Why would it be garbage? That sounds like a bug.
> > Why can't we just export both?
> for A53/SCTE20/DVDCC are exprted by A53_CC side data and they're sharing
> the same a53_buf_ref to store the data, so if stream contains CC wrapped
> as ATSC A53 packets + the same data wrapped as SCTE-20 packets, the CC
> data will repeated. We can consider to add a new side data type if necessary,
> but it's preferable to export A53_CC even it's SCTE20, so we can't export
> both by A53_CC still.

Does this apply to anything other than mpeg2? If not, it should be a
codec-private option rather than a new global flag.

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

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


Re: [FFmpeg-devel] [PATCH 1/6] tests/Makefile: Remove FILTERDEMDECMUX

2022-05-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> It is unused and given that one needs an encoder to produce
> packets from AVFrames (as output by filters) this is likely
> to remain so, because FILTERDEMDECENCMUX is better for these
> scenarios.
> The only case where one can use filters without encoders is
> with the lavfi input device: It outputs AVPackets which could
> be copied without another conversion to AVFrames. Yet the variable
> to check for this is CONFIG_LAVFI_INDEV, but FILTERDEMDECMUX
> is designed to work with demuxers (i.e. CONFIG_*_DEMUXER).
> So there is no usecase for FILTERDEMDECMUX.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/Makefile | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index 7ddfbcfd7e..5cb33b6c65 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -111,7 +111,6 @@ FRAMECRC = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER) 
> $(3)  \
>  DEMMUX  = $(call ALLYES, $(1)_DEMUXER $(2)_MUXER $(3) FILE_PROTOCOL)
>  
>  FILTERDEMDEC   = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER 
> $(3)_DECODER $(4) FILE_PROTOCOL)
> -FILTERDEMDECMUX= $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER 
> $(3)_DECODER $(4)_MUXER   $(5) FILE_PROTOCOL)
>  FILTERDEMDECENCMUX = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER 
> $(3)_DECODER $(4)_ENCODER $(5)_MUXER $(6) FILE_PROTOCOL)
>  
>  PARSERDEMDEC   = $(call ALLYES, $(1)_PARSER $(2)_DEMUXER $(3)_DECODER 
> $(4) FILE_PROTOCOL)

Will apply this patchset tomorrow unless there are objections.

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


Re: [FFmpeg-devel] [PATCH] avformat/img2: Add support for AVIF mux in image2

2022-05-19 Thread Gyan Doshi



On 2022-05-19 09:57 am, Gyan Doshi wrote:



On 2022-05-18 01:06 am, James Zern wrote:

On Mon, May 16, 2022 at 10:40 AM Vignesh Venkatasubramanian
 wrote:

Add support for AVIF muxing in the image2 muxer.

Tested with this example:
ffmpeg -lavfi testsrc=duration=1:size=320x320 -g 1 -flags 
global_header -c:v libaom-av1 -f image2 img-%2d.avif


Signed-off-by: Vignesh Venkatasubramanian 
---
  libavformat/img2enc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)


lgtm.


Will apply.


Applied as dd99d34d67e2612a8f133f8a86db9f64b4dfa20d

Regards,
Gyan
___
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] ffmpeg: add display_{rotation, hflip, vflip} options

2022-05-19 Thread Jan Ekström
On Thu, May 19, 2022, 07:21 Gyan Doshi  wrote:

>
>
> On 2022-05-18 11:34 pm, Jan Ekström wrote:
> > This enables overriding the rotation as well as horizontal/vertical
> > flip state of a specific video stream on either the input or output
> > side.
>
> Since rotation, flip and scale are stored in a single data structure,
> how about a single option i.e. -display "rotate=90,flip=hv,scale=2"
>

I did think about that, and I even implemented AVDict based options for
ffmpeg.c in a branch. But then pretty much got tired of lack of AVOption
automation (f.ex. for the flip flagging etc), and decided that since these
are relatively basic and simple, the non-generic option for this could be
just three options in the initial submission.

Jan
___
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".