[FFmpeg-devel] [PATCH v2] avformat/mov: fix buffering issue for special HTTP(s) mp4.

2022-12-20 Thread Chen, Jinkai
Problem:
Using ffplay play on these sources:
https://ali-sprite-video.yyouwang.com/video/works/202211/1667997073624_73.mp4
https://images.voghion.com/productImages/04_01_C_30011_2020220106GiuseppeFanara0012.mp4

Solution:
Add a private option, it will use separated IO context(HTTP connection)
for each AVStream. Preventing from reading audio and video in
long distance(offset), which cause seeking(HTTP request) frequently.

Storing the user options when open input,
and make sure that can be passed to demuxer context.

Signed-off-by: Gamhoi Chan mailto:chenjin...@agora.io>>
---
libavformat/avformat.c |  1 +
libavformat/demux.c|  5 -
libavformat/internal.h |  5 +
libavformat/isom.h |  1 +
libavformat/mov.c  | 14 +-
5 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 19c7219471..4453727f34 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -129,6 +129,7 @@ void avformat_free_context(AVFormatContext *s)
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_dict_free(&si->id3v2_meta);
+av_dict_free(&si->options);
av_packet_free(&si->pkt);
av_packet_free(&si->parse_pkt);
av_freep(&s->streams);
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2dfd82a63c..2377bfdab0 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -237,8 +237,11 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
if (fmt)
s->iformat = fmt;

-if (options)
+if (options) {
av_dict_copy(&tmp, *options, 0);
+si->options = NULL;
+av_dict_copy(&si->options, *options, 0);
+}

if (s->pb) // must be before any goto fail
s->flags |= AVFMT_FLAG_CUSTOM_IO;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ce837fefc7..7caae8b93e 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -186,6 +186,11 @@ typedef struct FFFormatContext {
 * Contexts and child contexts do not contain a metadata option
 */
int metafree;
+
+/**
+ * options from avformat_open_input
+ */
+AVDictionary *options;
} FFFormatContext;

static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 64fb7065d5..dad049a2df 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -326,6 +326,7 @@ typedef struct MOVContext {
int64_t extent_offset;
} *avif_info;
int avif_info_size;
+int use_stream_pb;
} MOVContext;

int ff_mp4_read_descr_len(AVIOContext *pb);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 29bd3103e3..0d5818b327 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4519,6 +4519,18 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
   st->index, dref->path, dref->dir, dref->filename,
   dref->volume, dref->nlvl_from, dref->nlvl_to);
}
+} else if (c->use_stream_pb) {
+FFFormatContext *const si = ffformatcontext(c->fc);
+AVDictionary *opts = NULL;
+av_dict_copy(&opts, si->options, 0);
+ret = c->fc->io_open(c->fc, &sc->pb, c->fc->url, AVIO_FLAG_READ, 
&opts);
+av_dict_free(&opts);
+if (ret < 0) {
+av_log(c->fc, AV_LOG_ERROR,
+"use_stream_pb, stream %d, error opening url %s.\n",
+st->index, c->fc->url);
+return ret;
+}
} else {
sc->pb = c->fc->pb;
sc->pb_is_copied = 1;
@@ -9119,7 +9131,7 @@ static const AVOption mov_options[] = {
{ "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), 
AV_OPT_TYPE_BOOL,
{.i64 = 0}, 0, 1, FLAGS },
{ "max_stts_delta", "treat offsets above this value as invalid", 
OFFSET(max_stts_delta), AV_OPT_TYPE_INT, {.i64 = UINT_MAX-48000*10 }, 0, 
UINT_MAX, .flags = AV_OPT_FLAG_DECODING_PARAM },
-
+{ "use_stream_pb", "Each steam has its own AVIOContext.", 
OFFSET(use_stream_pb), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ NULL },
};

--
___
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] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -mask_url to replace the protocol address in the command with the asterisk (*)

2022-12-20 Thread Wujian(Chin)
>> @@ -215,13 +249,13 @@ static void prepare_app_arguments(int *argc_ptr, char 
>> ***argv_ptr)
>>  if (win32_argv_utf8) {
>>  *argc_ptr = win32_argc;
>>  *argv_ptr = win32_argv_utf8;

>> -return;
>> +goto end;

> We only use goto for error processing.
   
  I think that it's more concise to use code this way.


>> +int i, j;
>> +for (i = 1; i < argc; i++) {

>> +char *match = strstr(argv[i], "://");
>> +if (match) {
>> +int total = strlen(argv[i]);
>> +for (j = 0; j < total; j++) {
>> +argv[i][j] = '*';
>> +}

>Masking the whole URL seems too much. Logins and passwords are introduced by 
>the @ character.

 I think that it would be better to replace the entire url, so that the code 
implementation is simple.


>> +char **argv2;

>> +argv2 = av_mallocz(argc * sizeof(char *));

>sizeof(*argv2)
>
>> +maskFlag = 0;
>> +if (argc > 1 && !strcmp(argv[1], "-mask_url")) {
>> +argv[1] = argv[0];
>> +maskFlag = 1;
>> +argc--;
>> +argv++;
>> +}

>This option is not special nor important enough to warrant a special treatment 
>like that.

 This option needs to replace the URL. It is more appropriate to judge mask_url 
and copy argv in this place. Otherwise, do you have any other suggestions?
 
 Thank you for your issue. Nicolas George


-邮件原件-
发件人: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] 代表 Nicolas George
发送时间: 2022年12月19日 21:30
收件人: FFmpeg development discussions and patches 
抄送: wangqinghua (I) 
主题: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add 
-mask_url to replace the protocol address in the command with the asterisk (*)

Wujian(Chin) (12022-12-19):
> I have modified the issues. Please review it again. Thank you.
> 
> If the protocol address contains the user name and password, The ps -ef 
> command exposes plaintext.

Spurious comma or capital.

> The -mask_url parameter option is added to replace the protocol address in 
> the command line with the asterisk (*).
> Because other users can run the ps -ef command to view sensitive 
> information such as the user name and password in the protocol address, which 
> is insecure.

Please wrap to 60-72 characters.

> 
> Signed-off-by: wujian_nanjing 
> ---
>  doc/ffmpeg.texi|  9 +
>  doc/ffplay.texi|  8 
>  doc/ffprobe.texi   |  9 +
>  fftools/cmdutils.c | 47 
> +++
>  fftools/cmdutils.h | 15 +++
>  fftools/ffmpeg.c   | 16 +---
>  fftools/ffplay.c   | 15 +--
>  fftools/ffprobe.c  | 18 ++
>  8 files changed, 124 insertions(+), 13 deletions(-)
> 
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 0367930..1f6cb33 
> 100644

> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi

> --- a/doc/ffplay.texi
> +++ b/doc/ffplay.texi

> --- a/doc/ffprobe.texi
> +++ b/doc/ffprobe.texi

The place for common options is doc/fftools-common-opts.texi.

> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 
> a1de621..c35d7e1 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts;
>  
>  int hide_banner = 0;
>  

> +void param_masking(int argc, char **argv) {

Functions name in ...ing do not seem idiomatic to me.

The style for the brace is off.

> +int i, j;
> +for (i = 1; i < argc; i++) {

> +char *match = strstr(argv[i], "://");
> +if (match) {
> +int total = strlen(argv[i]);
> +for (j = 0; j < total; j++) {
> +argv[i][j] = '*';
> +}

Masking the whole URL seems too much. Logins and passwords are introduced by 
the @ character.

> +}
> +}
> +}
> +

> +char **copy_argv(int argc, char **argv) {

The brace is off here too.

> +char **argv2;

> +argv2 = av_mallocz(argc * sizeof(char *));

sizeof(*argv2)

> +if (!argv2)
> +exit_program(1);

Error message.

> +
> +for (int i = 0; i < argc; i++) {
> +int length = strlen(argv[i]) + 1;
> +argv2[i] = av_mallocz(length * sizeof(char *));
> +if (!argv2[i])
> +exit_program(1);
> +memcpy(argv2[i], argv[i], length - 1);
> +}
> +return argv2;
> +}
> +

> +void free_pp(int argc, char **argv) {

The brace is off too. This function is called only from ffprobe, looks wrong.

> +for (int i = 0; i < argc; i++)
> +av_free(argv[i]);
> +av_free(argv);
> +}
>  void uninit_opts(void)
>  {
>  av_dict_free(&swr_opts);
> @@ -215,13 +249,13 @@ static void prepare_app_arguments(int *argc_ptr, char 
> ***argv_ptr)
>  if (win32_argv_utf8) {
>  *argc_ptr = win32_argc;
>  *argv_ptr = win32_argv_utf8;

> -return;
> +goto end;

We only use goto for error processing.

>  }
>  
>  win32_argc = 0;
>  argv_w = CommandLineToArgvW(GetCommandLineW()

Re: [FFmpeg-devel] [PATCH v6] lavc: convert frame threading to the receive_frame() pattern

2022-12-20 Thread Andreas Rheinhardt
Timo Rothenpieler:
> From: Anton Khirnov 
> 
> Reorganize the code such that the frame threading code does not call the
> decoders directly, but instead calls back into the generic decoding
> code. This avoids duplicating the logic that wraps the decoder
> invocation and will be useful in the following commits.
> ---
>  libavcodec/decode.c|  62 ++---
>  libavcodec/decode.h|   7 +
>  libavcodec/internal.h  |   7 +
>  libavcodec/pthread_frame.c | 279 -
>  libavcodec/thread.h|  18 +--
>  5 files changed, 247 insertions(+), 126 deletions(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 3e5be501b9..5d2b484b66 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -180,6 +180,11 @@ fail:
>  return ret;
>  }
>  
> +#if !HAVE_THREADS
> +#define ff_thread_get_packet(avctx, pkt) (AVERROR_BUG)
> +#define ff_thread_receive_frame(avctx, frame) (AVERROR_BUG)
> +#endif
> +
>  int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
>  {
>  AVCodecInternal *avci = avctx->internal;
> @@ -188,7 +193,14 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
> *pkt)
>  if (avci->draining)
>  return AVERROR_EOF;
>  
> -ret = av_bsf_receive_packet(avci->bsf, pkt);
> +/* If we are a worker thread, get the next packet from the threading
> + * context. Otherwise we are the main (user-facing) context, so we get 
> the
> + * next packet from the input filterchain.
> + */
> +if (avctx->internal->is_frame_mt)
> +ret = ff_thread_get_packet(avctx, pkt);
> +else
> +ret = av_bsf_receive_packet(avci->bsf, pkt);
>  if (ret == AVERROR_EOF)
>  avci->draining = 1;
>  if (ret < 0)
> @@ -273,30 +285,25 @@ static inline int decode_simple_internal(AVCodecContext 
> *avctx, AVFrame *frame,
>  return AVERROR_EOF;
>  
>  if (!pkt->data &&
> -!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
> -  avctx->active_thread_type & FF_THREAD_FRAME))
> +!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
>  return AVERROR_EOF;
>  
>  got_frame = 0;
>  
> -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) {
> -ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt);
> -} else {
> -ret = codec->cb.decode(avctx, frame, &got_frame, pkt);
> -
> -if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
> -frame->pkt_dts = pkt->dts;
> -if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
> -if(!avctx->has_b_frames)
> -frame->pkt_pos = pkt->pos;
> -//FIXME these should be under if(!avctx->has_b_frames)
> -/* get_buffer is supposed to set frame parameters */
> -if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
> -if (!frame->sample_aspect_ratio.num)  
> frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
> -if (!frame->width)frame->width   
> = avctx->width;
> -if (!frame->height)   frame->height  
> = avctx->height;
> -if (frame->format == AV_PIX_FMT_NONE) frame->format  
> = avctx->pix_fmt;
> -}
> +ret = codec->cb.decode(avctx, frame, &got_frame, pkt);
> +
> +if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
> +frame->pkt_dts = pkt->dts;
> +if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
> +if(!avctx->has_b_frames)
> +frame->pkt_pos = pkt->pos;
> +//FIXME these should be under if(!avctx->has_b_frames)
> +/* get_buffer is supposed to set frame parameters */
> +if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
> +if (!frame->sample_aspect_ratio.num)  frame->sample_aspect_ratio 
> = avctx->sample_aspect_ratio;
> +if (!frame->width)frame->width   
> = avctx->width;
> +if (!frame->height)   frame->height  
> = avctx->height;
> +if (frame->format == AV_PIX_FMT_NONE) frame->format  
> = avctx->pix_fmt;
>  }
>  }
>  emms_c();
> @@ -546,7 +553,7 @@ static int decode_simple_receive_frame(AVCodecContext 
> *avctx, AVFrame *frame)
>  return 0;
>  }
>  
> -static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame 
> *frame)
> +int ff_decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
>  {
>  AVCodecInternal *avci = avctx->internal;
>  const FFCodec *const codec = ffcodec(avctx->codec);
> @@ -569,6 +576,17 @@ static int decode_receive_frame_internal(AVCodecContext 
> *avctx, AVFrame *frame)
>  return ok;
>  }

You keep detect_colorspace() (the ICC stuff) in the worker threads; this
means that more cmsContexts need to be allocated. Given that the
cmdContexts are not synced between threads, thi

[FFmpeg-devel] 答复: [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -mask_url to replace the protocol address in the command with the asterisk (*)

2022-12-20 Thread Wujian(Chin)


>Marvin Scholz (12022-12-19):
> I agree, but then the docs should probably mention that to not give a 
>> false sense of absolute security here. And maybe note that it might

>Indeed, documentation is necessary.

Is it appropriate to describe this document? Please give some suggestions. 
Thank you , everyone.

fftools-common-opts.texi 
@item -mask_url -i @var{url} (@emph{output})
If the protocol address contains the user name and password, the ps -ef
command exposes plaintext. The -mask_url parameter option is added to
replace the protocol address in the command line with the asterisk (*).
Because other users can run the ps -ef command to view sensitive
information such as the user name and password in the protocol address,
which is insecure.
@example
ffmpeg -mask_url -i rtsp://username:password-ip:port/stream/test
@end example


>> be a better option to pass the password via stdin or hide the process 
>> from other users to completely avoid leaking the password.

>Unfortunately, as far as I know, we do not have any mechanism of the kind. 
>That would be useful.

>Regards,

--
>  Nicolas George
___
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 1/2] amfenc: Update the min version to 1.4.28.0 for AMF SDK.

2022-12-20 Thread Dmitrii Ovchinnikov
From: Dmitrii Ovchinnikov 

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2180ebb4f1..8a20d67612 100755
--- a/configure
+++ b/configure
@@ -7034,7 +7034,7 @@ fi
 
 enabled amf &&
 check_cpp_condition amf "AMF/core/Version.h" \
-"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x000100040009"
+"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x00010004001c"
 
 # Funny iconv installations are not unusual, so check it after all flags have 
been set
 if enabled libc_iconv; then
-- 
2.38.1.windows.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/2] libavcodec/amfenc: add AV1 encoding support

2022-12-20 Thread Dmitrii Ovchinnikov
From: Dmitrii Ovchinnikov 

---
 configure   |   1 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/amfenc.c |   9 +
 libavcodec/amfenc.h |   6 +
 libavcodec/amfenc_av1.c | 361 
 6 files changed, 379 insertions(+)
 create mode 100644 libavcodec/amfenc_av1.c

diff --git a/configure b/configure
index 8a20d67612..56c959012e 100755
--- a/configure
+++ b/configure
@@ -3255,6 +3255,7 @@ wmv3_crystalhd_decoder_select="crystalhd"
 av1_qsv_decoder_select="qsvdec"
 av1_qsv_encoder_select="qsvenc"
 av1_qsv_encoder_deps="libvpl"
+av1_amf_encoder_deps="amf"
 
 # parsers
 aac_parser_select="adts_header mpeg4audio"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 98841ed07c..25686c2991 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -163,6 +163,7 @@ OBJS-$(CONFIG_TEXTUREDSP)  += texturedsp.o
 OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
 OBJS-$(CONFIG_VAAPI_ENCODE)+= vaapi_encode.o
+OBJS-$(CONFIG_AV1_AMF_ENCODER) += amfenc_av1.o
 OBJS-$(CONFIG_VC1DSP)  += vc1dsp.o
 OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
 OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index d5a6c427e1..d7d83be293 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -831,6 +831,7 @@ extern const FFCodec ff_av1_cuvid_decoder;
 extern const FFCodec ff_av1_nvenc_encoder;
 extern const FFCodec ff_av1_qsv_decoder;
 extern const FFCodec ff_av1_qsv_encoder;
+extern const FFCodec ff_av1_amf_encoder;
 extern const FFCodec ff_libopenh264_encoder;
 extern const FFCodec ff_libopenh264_decoder;
 extern const FFCodec ff_h264_amf_encoder;
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index a033e1220e..c487fc48aa 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -349,6 +349,9 @@ static int amf_init_encoder(AVCodecContext *avctx)
 case AV_CODEC_ID_HEVC:
 codec_id = AMFVideoEncoder_HEVC;
 break;
+case AV_CODEC_ID_AV1 :
+codec_id = AMFVideoEncoder_AV1;
+break;
 default:
 break;
 }
@@ -460,6 +463,11 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket 
*pkt, AMFBuffer *buff
 pkt->flags = AV_PKT_FLAG_KEY;
 }
 break;
+case AV_CODEC_ID_AV1:
+buffer->pVtbl->GetProperty(buffer, 
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE, &var);
+if (var.int64Value == AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY) 
{
+pkt->flags = AV_PKT_FLAG_KEY;
+}
 default:
 break;
 }
@@ -681,6 +689,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 case AV_CODEC_ID_HEVC:
 AMF_ASSIGN_PROPERTY_INT64(res, surface, 
AMF_VIDEO_ENCODER_HEVC_INSERT_AUD, !!ctx->aud);
 break;
+//case AV_CODEC_ID_AV1 not supported
 default:
 break;
 }
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 1ab98d2f78..66e0680719 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 
 #include "libavutil/fifo.h"
 
@@ -116,6 +117,11 @@ typedef struct AmfContext {
 int min_qp_p;
 int max_qp_p;
 int tier;
+
+// AV1 - specific options
+
+enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM align;
+
 } AmfContext;
 
 extern const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[];
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
new file mode 100644
index 00..6065ce43d9
--- /dev/null
+++ b/libavcodec/amfenc_av1.c
@@ -0,0 +1,361 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/internal.h"
+#include "libavutil/opt.h"
+#include "amfenc.h"
+#include "codec_internal.h"
+#include "internal.h"
+
+#define OFFSET(x) offsetof(AmfContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+{ "usage",  "Set the encoding usage", 

[FFmpeg-devel] [crop support for matroska demuxer, V4 1/3] libavcodec: Add crop related fields to structure AVCodecContext and AVCodecParameters.

2022-12-20 Thread Dmitrii Ovchinnikov
From: Dmitrii Ovchinnikov 

---
 libavcodec/avcodec.h   | 35 +++
 libavcodec/codec_par.h |  8 
 libavcodec/options_table.h |  4 
 3 files changed, 47 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3edd8e2636..57b340c24d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -380,6 +380,19 @@ typedef struct RcOverride{
  */
 #define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0)
 
+/**
+* Video decoding only. Certain container support cropping, meaning that
+* only a sub-rectangle of the decoded frame is intended for display.
+* Certain codec supports cropping as well.This option controls how
+* cropping is handled by libavcodec when  container cropping and
+* codec cropping exist.
+*/
+enum CONTAINER_CROPPING_POLICY_TYPE {
+FF_CONTAINER_CROPPING_IGNORE = 0,
+FF_CONTAINER_CROPPING_ADDITION,
+FF_CONTAINER_CROPPING_OVERWRITE
+};
+
 struct AVCodecInternal;
 
 /**
@@ -2057,6 +2070,28 @@ typedef struct AVCodecContext {
  * The decoder can then override during decoding as needed.
  */
 AVChannelLayout ch_layout;
+
+/* When set to 1 (the default), libavcodec will apply container cropping
+ * to codec cropping additionally.
+ *
+ * When set to 2, libavcodec will use container cropping to overwrite
+ * codec cropping (the final cropping uses container cropping parameters)
+ *
+ * When set to 0, libavcodec will ignore container cropping parameters
+ * (the final cropping uses codec cropping parameters)
+ *
+ * This field works with "apply_cropping". Only if apply_cropping is 1, 
this
+ * field works
+ */
+enum CONTAINER_CROPPING_POLICY_TYPE container_apply_cropping;
+
+/**
+ * The cropping parameters from container.
+ */
+int container_crop_top;
+int container_crop_left;
+int container_crop_bottom;
+int container_crop_right;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h
index f51d27c590..cc0695689c 100644
--- a/libavcodec/codec_par.h
+++ b/libavcodec/codec_par.h
@@ -211,6 +211,14 @@ typedef struct AVCodecParameters {
  * Audio only. The channel layout and number of channels.
  */
 AVChannelLayout ch_layout;
+
+/**
+ * The cropping parameters from container.
+ */
+int container_crop_top;
+int container_crop_left;
+int container_crop_bottom;
+int container_crop_right;
 } AVCodecParameters;
 
 /**
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index cd02f5096f..fd1ef21f90 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -401,6 +401,10 @@ static const AVOption avcodec_options[] = {
 {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated 
decoder's supported profiles do not exactly match the stream", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
 {"extra_hw_frames", "Number of extra hardware frames to allocate for the 
user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
V|D },
 {"discard_damaged_percentage", "Percentage of damaged samples to discard a 
frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 
100, V|D },
+{ "container_apply_cropping", "ploicy using container cropping parameters", 
OFFSET(container_apply_cropping), AV_OPT_TYPE_INT64, {.i64 = 
FF_CONTAINER_CROPPING_ADDITION }, 0, 2, V | D, "container_apply_cropping" },
+{ "ignore","ignore container cropping",
   0, AV_OPT_TYPE_CONST, {.i64 = FF_CONTAINER_CROPPING_IGNORE },0, 0, V 
| D, "container_apply_cropping" },
+{ "addition",  "apply container cropping additionally to elementary stream 
cropping", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CONTAINER_CROPPING_ADDITION },  0, 
0, V | D, "container_apply_cropping" },
+{ "overwrite", "use container cropping to overwrite elementary stream 
cropping",  0, AV_OPT_TYPE_CONST, {.i64 = FF_CONTAINER_CROPPING_OVERWRITE 
}, 0, 0, V | D, "container_apply_cropping" },
 {NULL},
 };
 
-- 
2.30.0.windows.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".


[FFmpeg-devel] [crop support for matroska demuxer, V4 2/3] libavcodec: Public code to support container crop

2022-12-20 Thread Dmitrii Ovchinnikov
From: Dmitrii Ovchinnikov 

Support both simple and receive_frame api
The container crop information is applied additional to frame crop information
---
 libavcodec/codec_par.c | 30 ++-
 libavcodec/decode.c| 54 ++
 2 files changed, 73 insertions(+), 11 deletions(-)

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index abda649aa8..9738402434 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -115,17 +115,21 @@ int avcodec_parameters_from_context(AVCodecParameters 
*par,
 
 switch (par->codec_type) {
 case AVMEDIA_TYPE_VIDEO:
-par->format  = codec->pix_fmt;
-par->width   = codec->width;
-par->height  = codec->height;
-par->field_order = codec->field_order;
-par->color_range = codec->color_range;
-par->color_primaries = codec->color_primaries;
-par->color_trc   = codec->color_trc;
-par->color_space = codec->colorspace;
-par->chroma_location = codec->chroma_sample_location;
-par->sample_aspect_ratio = codec->sample_aspect_ratio;
-par->video_delay = codec->has_b_frames;
+par->format= codec->pix_fmt;
+par->width = codec->width;
+par->height= codec->height;
+par->container_crop_top= codec->container_crop_top;
+par->container_crop_left   = codec->container_crop_left;
+par->container_crop_bottom = codec->container_crop_bottom;
+par->container_crop_right  = codec->container_crop_right;
+par->field_order   = codec->field_order;
+par->color_range   = codec->color_range;
+par->color_primaries   = codec->color_primaries;
+par->color_trc = codec->color_trc;
+par->color_space   = codec->colorspace;
+par->chroma_location   = codec->chroma_sample_location;
+par->sample_aspect_ratio   = codec->sample_aspect_ratio;
+par->video_delay   = codec->has_b_frames;
 break;
 case AVMEDIA_TYPE_AUDIO:
 par->format   = codec->sample_fmt;
@@ -199,6 +203,10 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 codec->pix_fmt= par->format;
 codec->width  = par->width;
 codec->height = par->height;
+codec->container_crop_top = par->container_crop_top;
+codec->container_crop_left= par->container_crop_left;
+codec->container_crop_bottom  = par->container_crop_bottom;
+codec->container_crop_right   = par->container_crop_right;
 codec->field_order= par->field_order;
 codec->color_range= par->color_range;
 codec->color_primaries= par->color_primaries;
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6be2d3d6ed..9e44fcb293 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -693,6 +693,60 @@ static int apply_cropping(AVCodecContext *avctx, AVFrame 
*frame)
 if (!avctx->apply_cropping)
 return 0;
 
+if (avctx->container_apply_cropping == FF_CONTAINER_CROPPING_ADDITION)
+{
+/*check if container parameter and elementary streaming cropping 
parameters are saft for apploying  */
+if (avctx->container_crop_left + frame->crop_left >= INT_MAX - 
(avctx->container_crop_right + frame->crop_right) ||
+avctx->container_crop_top + frame->crop_top >= INT_MAX - 
(avctx->container_crop_bottom + frame->crop_bottom) ||
+(avctx->container_crop_left + frame->crop_left + 
avctx->container_crop_right + frame->crop_right) >= frame->width ||
+(avctx->container_crop_top + frame->crop_top + 
avctx->container_crop_bottom + frame->crop_bottom) >= frame->height) {
+av_log(avctx, AV_LOG_WARNING,
+"Apply container and elementary stream corpping parametes 
error: "
+"container cropping paramters "
+"%d/%d/%d/%d "
+"elementary stream croping paramters "
+
"%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" "
+"(frame size %dx%d). This is a bug, please report it\n",
+avctx->container_crop_left, avctx->container_crop_right, 
avctx->container_crop_top, avctx->container_crop_bottom,
+frame->crop_left, frame->crop_right, frame->crop_top, 
frame->crop_bottom,
+frame->width, frame->height);
+frame->crop_left   = 0;
+frame->crop_right  = 0;
+frame->crop_top= 0;
+frame->crop_bottom = 0;
+return 0;
+}
+
+frame->crop_top+= (size_t)avctx->container_crop_top;
+frame->crop_left   += (size_t)avctx->container_crop_left;
+frame->crop_bottom += 

[FFmpeg-devel] [crop support for matroska demuxer, V4 3/3] libavformat\matroskadec.c: crop support for matroska demuxer.

2022-12-20 Thread Dmitrii Ovchinnikov
From: Dmitrii Ovchinnikov 

In webm specification, it supports cropping information. 
(https://www.webmproject.org/docs/container/)
In ffmpeg, the implementation of webm is a subset of matroska. In 
matroskadec.c, those cropping related four fields are forced to 0.

for the sample file with crop (crop_bottom =8, crop_top=crop_left=crop_right=0.)
ffmpeg.exe -i  test_with_container_crop.webm -pix_fmt yuv420p -y output.yuv

original ffmpeg code - the output.yuv resolution is 1920x1088
changed code - the output.yuv resolution is 1920x1080

---
 libavformat/matroskadec.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d582f566a2..2023fd4977 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -210,6 +210,10 @@ typedef struct MatroskaTrackVideo {
 uint64_t pixel_width;
 uint64_t pixel_height;
 EbmlBin  color_space;
+uint64_t pixel_cropt;
+uint64_t pixel_cropl;
+uint64_t pixel_cropb;
+uint64_t pixel_cropr;
 uint64_t display_unit;
 uint64_t interlaced;
 uint64_t field_order;
@@ -517,10 +521,10 @@ static EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOALPHAMODE,  EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, alpha_mode), { .u = 0 } },
 { MATROSKA_ID_VIDEOCOLOR,  EBML_NEST,  0, 
sizeof(MatroskaTrackVideoColor), offsetof(MatroskaTrackVideo, color), { .n = 
matroska_track_video_color } },
 { MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
-{ MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
-{ MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
-{ MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE },
-{ MATROSKA_ID_VIDEOPIXELCROPR, EBML_NONE },
+{ MATROSKA_ID_VIDEOPIXELCROPT, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, pixel_cropt), {.u = 0 } },
+{ MATROSKA_ID_VIDEOPIXELCROPL, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, pixel_cropl), {.u = 0 } },
+{ MATROSKA_ID_VIDEOPIXELCROPB, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, pixel_cropb), {.u = 0 } },
+{ MATROSKA_ID_VIDEOPIXELCROPR, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, pixel_cropr), {.u = 0 } },
 { MATROSKA_ID_VIDEODISPLAYUNIT,EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, display_unit), { .u= 
MATROSKA_VIDEO_DISPLAYUNIT_PIXELS } },
 { MATROSKA_ID_VIDEOFLAGINTERLACED, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, interlaced),  { .u = 
MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED } },
 { MATROSKA_ID_VIDEOFIELDORDER, EBML_UINT,  0, 0, 
offsetof(MatroskaTrackVideo, field_order), { .u = 
MATROSKA_VIDEO_FIELDORDER_UNDETERMINED } },
@@ -2879,6 +2883,11 @@ static int matroska_parse_tracks(AVFormatContext *s)
 st->codecpar->width  = track->video.pixel_width;
 st->codecpar->height = track->video.pixel_height;
 
+st->codecpar->container_crop_top= track->video.pixel_cropt;
+st->codecpar->container_crop_left   = track->video.pixel_cropl;
+st->codecpar->container_crop_bottom = track->video.pixel_cropb;
+st->codecpar->container_crop_right  = track->video.pixel_cropr;
+
 if (track->video.interlaced == 
MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED)
 st->codecpar->field_order = mkv_field_order(matroska, 
track->video.field_order);
 else if (track->video.interlaced == 
MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE)
-- 
2.30.0.windows.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 v6] lavc: convert frame threading to the receive_frame() pattern

2022-12-20 Thread Timo Rothenpieler

On 20.12.2022 12:45, Andreas Rheinhardt wrote:

Timo Rothenpieler:

From: Anton Khirnov 

Reorganize the code such that the frame threading code does not call the
decoders directly, but instead calls back into the generic decoding
code. This avoids duplicating the logic that wraps the decoder
invocation and will be useful in the following commits.
---
  libavcodec/decode.c|  62 ++---
  libavcodec/decode.h|   7 +
  libavcodec/internal.h  |   7 +
  libavcodec/pthread_frame.c | 279 -
  libavcodec/thread.h|  18 +--
  5 files changed, 247 insertions(+), 126 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 3e5be501b9..5d2b484b66 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -180,6 +180,11 @@ fail:
  return ret;
  }
  
+#if !HAVE_THREADS

+#define ff_thread_get_packet(avctx, pkt) (AVERROR_BUG)
+#define ff_thread_receive_frame(avctx, frame) (AVERROR_BUG)
+#endif
+
  int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
  {
  AVCodecInternal *avci = avctx->internal;
@@ -188,7 +193,14 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket 
*pkt)
  if (avci->draining)
  return AVERROR_EOF;
  
-ret = av_bsf_receive_packet(avci->bsf, pkt);

+/* If we are a worker thread, get the next packet from the threading
+ * context. Otherwise we are the main (user-facing) context, so we get the
+ * next packet from the input filterchain.
+ */
+if (avctx->internal->is_frame_mt)
+ret = ff_thread_get_packet(avctx, pkt);
+else
+ret = av_bsf_receive_packet(avci->bsf, pkt);
  if (ret == AVERROR_EOF)
  avci->draining = 1;
  if (ret < 0)
@@ -273,30 +285,25 @@ static inline int decode_simple_internal(AVCodecContext 
*avctx, AVFrame *frame,
  return AVERROR_EOF;
  
  if (!pkt->data &&

-!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
-  avctx->active_thread_type & FF_THREAD_FRAME))
+!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
  return AVERROR_EOF;
  
  got_frame = 0;
  
-if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) {

-ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt);
-} else {
-ret = codec->cb.decode(avctx, frame, &got_frame, pkt);
-
-if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
-frame->pkt_dts = pkt->dts;
-if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
-if(!avctx->has_b_frames)
-frame->pkt_pos = pkt->pos;
-//FIXME these should be under if(!avctx->has_b_frames)
-/* get_buffer is supposed to set frame parameters */
-if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
-if (!frame->sample_aspect_ratio.num)  frame->sample_aspect_ratio 
= avctx->sample_aspect_ratio;
-if (!frame->width)frame->width   
= avctx->width;
-if (!frame->height)   frame->height  
= avctx->height;
-if (frame->format == AV_PIX_FMT_NONE) frame->format  
= avctx->pix_fmt;
-}
+ret = codec->cb.decode(avctx, frame, &got_frame, pkt);
+
+if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
+frame->pkt_dts = pkt->dts;
+if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
+if(!avctx->has_b_frames)
+frame->pkt_pos = pkt->pos;
+//FIXME these should be under if(!avctx->has_b_frames)
+/* get_buffer is supposed to set frame parameters */
+if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
+if (!frame->sample_aspect_ratio.num)  frame->sample_aspect_ratio = 
avctx->sample_aspect_ratio;
+if (!frame->width)frame->width   = 
avctx->width;
+if (!frame->height)   frame->height  = 
avctx->height;
+if (frame->format == AV_PIX_FMT_NONE) frame->format  = 
avctx->pix_fmt;
  }
  }
  emms_c();
@@ -546,7 +553,7 @@ static int decode_simple_receive_frame(AVCodecContext 
*avctx, AVFrame *frame)
  return 0;
  }
  
-static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)

+int ff_decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
  {
  AVCodecInternal *avci = avctx->internal;
  const FFCodec *const codec = ffcodec(avctx->codec);
@@ -569,6 +576,17 @@ static int decode_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame)
  return ok;
  }


You keep detect_colorspace() (the ICC stuff) in the worker threads; this
means that more cmsContexts need to be allocated. Given that the
cmdContexts are not synced between threads, this also might possibly
mean that the output depends upon the number of threads (depending upon
how state based fflcms2 is). Is there a downside to 

Re: [FFmpeg-devel] [PATCH v6] lavc: convert frame threading to the receive_frame() pattern

2022-12-20 Thread James Almer

On 12/20/2022 1:06 PM, Timo Rothenpieler wrote:


Generally, I don't see the advantage of this. The only decoder that
would benefit from it is SMVJPEG, yet for all other codecs it will just
involve more allocs+frees.


Being unable to support newer encoders because only the old (and I 
thought deprecated, but apprently not, given encoders are getting ported 
back to it??) is a pretty bad situation, and could hold back some progress.


Decoders. And what was deprecated and removed was the public API, not 
the internal callback.
For 1:1 decoders, or decoders with no delay or buffering, the decoupled 
input/output callback is overkill, so you'll keep seeing new decoders 
added using the old one in the future.
But similarly, new decoders can and will be added using the decoupled IO 
callback, so this change is necessary so any future decoder that intends 
to have frame threading isn't forced to use the old callback when it 
could benefit from the new. An obvious case would be the (hopefully) 
eventual native AV1 decoder.




So adding the ability for frame threading to work for everything seems 
natural and neccesary to me.


Yes.
___
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] amfenc: Update the min version to 1.4.28.0 for AMF SDK.

2022-12-20 Thread Jean-Baptiste Kempf
Hello,

When was this release released?
Is it headers only or is it runtime too?

Best

jb

On Tue, 20 Dec 2022, at 16:20, Dmitrii Ovchinnikov wrote:
> From: Dmitrii Ovchinnikov 
>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 2180ebb4f1..8a20d67612 100755
> --- a/configure
> +++ b/configure
> @@ -7034,7 +7034,7 @@ fi
> 
>  enabled amf &&
>  check_cpp_condition amf "AMF/core/Version.h" \
> -"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
> AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 
> 0x000100040009"
> +"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
> AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 
> 0x00010004001c"
> 
>  # Funny iconv installations are not unusual, so check it after all 
> flags have been set
>  if enabled libc_iconv; then
> -- 
> 2.38.1.windows.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".

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
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 5/5] avcodec/wavpack: Avoid undefined shift in get_tail()

2022-12-20 Thread Michael Niedermayer
On Sun, Dec 18, 2022 at 07:14:27PM +0100, Paul B Mahol wrote:
> On 12/18/22, Michael Niedermayer  wrote:
> > Fixes: left shift of 1208485947 by 1 places cannot be represented in type
> > 'int'
> > Fixes:
> > 54058/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5827521084260352
> >
> 
> Please use something else than casting.

ok will apply with * 2U

thx

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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

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


Re: [FFmpeg-devel] [PATCH 3/5] avcodec/apac: Sanity check bits_per_coded_sample

2022-12-20 Thread Michael Niedermayer
On Mon, Dec 19, 2022 at 08:35:45PM +0100, Paul B Mahol wrote:
> On 12/18/22, Michael Niedermayer  wrote:
> > Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type
> > 'int'
> > Fixes:
> > 53931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-6072913738727424
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/apac.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/apac.c b/libavcodec/apac.c
> > index 030f81adce..2501209681 100644
> > --- a/libavcodec/apac.c
> > +++ b/libavcodec/apac.c
> > @@ -75,7 +75,9 @@ static av_cold int apac_init(AVCodecContext *avctx)
> >  avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
> >
> >  if (avctx->ch_layout.nb_channels < 1 ||
> > -avctx->ch_layout.nb_channels > 2)
> > +avctx->ch_layout.nb_channels > 2 ||
> > +avctx->bits_per_coded_sample > 32U
> > +)
> >  return AVERROR_INVALIDDATA;
> >
> >  for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
> > --
> > 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".
> >
> 
> Pretty sure bps cant be <8 and >16

ok, will apply <8  || >16 check then

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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

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


Re: [FFmpeg-devel] [PATCH 1/2] amfenc: Update the min version to 1.4.28.0 for AMF SDK.

2022-12-20 Thread Dmitrii Ovchinnikov
Hi,

>>When was this release released?
The release was 13.12.2022
>> Is it headers only or is it runtime too?
it still supports old drivers, but to use the av1 encoder, you need an
up-to-date driver version and a supported graphics card.
___
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/mediacodecdec: add AV1 decoding support

2022-12-20 Thread Tomas Härdin
mån 2022-12-19 klockan 20:45 +0800 skrev Zhao Zhili:
> From: Zhao Zhili 
> 
> Signed-off-by: Zhao Zhili 
> ---
>  configure  |  2 ++
>  libavcodec/Makefile    |  1 +
>  libavcodec/allcodecs.c |  1 +
>  libavcodec/mediacodecdec.c | 16 +++-
>  libavcodec/version.h   |  4 ++--
>  5 files changed, 21 insertions(+), 3 deletions(-)

Looks OK

/Tomas

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec_wrapper: include stdbool.h

2022-12-20 Thread Tomas Härdin
mån 2022-12-19 klockan 10:11 +0800 skrev zhilizhao(赵志立):
> 
> 
> > On Dec 16, 2022, at 11:39, Zhao Zhili 
> > wrote:
> > 
> > From: Zhao Zhili 
> > 
> > Since NDK failed to do that:
> > https://github.com/android/ndk/issues/1281
> > ---
> > libavcodec/mediacodec_wrapper.c | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> > diff --git a/libavcodec/mediacodec_wrapper.c
> > b/libavcodec/mediacodec_wrapper.c
> > index 7ddf93ccc7..4d6e9487b8 100644
> > --- a/libavcodec/mediacodec_wrapper.c
> > +++ b/libavcodec/mediacodec_wrapper.c
> > @@ -22,6 +22,7 @@
> > 
> > #include 
> > #include 
> > +#include 
> > #include 
> > #include 
> > #include 
> > -- 
> 
> Pushed as 48d5aecfc4386be096dfb5d4c021af247ef0d803.

Nice. I had in mind to submit a patch very much like this

/Tomas

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

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


Re: [FFmpeg-devel] [PATCH v3 3/7] avcodec/mediacodecenc: use bsf to handle crop

2022-12-20 Thread Tomas Härdin
tor 2022-12-15 klockan 01:37 +0800 skrev Zhao Zhili:
> On Wed, 2022-12-14 at 18:08 +0100, Tomas Härdin wrote:
> 
> > 
> > I think we might want something for this inside lavf somewhere, so
> > that
> > encoders can signal dimension alignment requirements. Some
> > containers
> > (MXF, MOV) support such cropping in a codec-agnostic manner.
> 
> From my own experience, dimension mismatch between codec and
> container
> makes a lot of trouble. ISO base format specification specified how
> to
> crop/scale after decoding clear, however, I don't think it has been
> widely supported, including FFmpeg. We can fix that inside of FFmpeg,
> but we should avoid such cases as much as we can.

This is the difference between stored, sampled and display dimensions
in MXF. For example 1080i video has StoredHeight = 544, SampledHeight =
540 and DisplayHeight = 540 (see AS-10). When you add VBLANK and HBLANK
to the mix then all three dimensions are typically different.

Anyway specifying at the NAL level whenever the essence isn't a
multiple of 16x16 is obviously normal. The only complication I can
think of is 4:2:2 and 4:4:4. Does MC require 16x16 also in those cases?
I'd expect 16x8 and 8x8 respectively.

/Tomas

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

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


Re: [FFmpeg-devel] [PATCH v3 3/7] avcodec/mediacodecenc: use bsf to handle crop

2022-12-20 Thread zhilizhao(赵志立)


> On Dec 21, 2022, at 02:24, Tomas Härdin  wrote:
> 
> tor 2022-12-15 klockan 01:37 +0800 skrev Zhao Zhili:
>> On Wed, 2022-12-14 at 18:08 +0100, Tomas Härdin wrote:
>> 
>>> 
>>> I think we might want something for this inside lavf somewhere, so
>>> that
>>> encoders can signal dimension alignment requirements. Some
>>> containers
>>> (MXF, MOV) support such cropping in a codec-agnostic manner.
>> 
>> From my own experience, dimension mismatch between codec and
>> container
>> makes a lot of trouble. ISO base format specification specified how
>> to
>> crop/scale after decoding clear, however, I don't think it has been
>> widely supported, including FFmpeg. We can fix that inside of FFmpeg,
>> but we should avoid such cases as much as we can.
> 
> This is the difference between stored, sampled and display dimensions
> in MXF. For example 1080i video has StoredHeight = 544, SampledHeight =
> 540 and DisplayHeight = 540 (see AS-10). When you add VBLANK and HBLANK
> to the mix then all three dimensions are typically different.
> 
> Anyway specifying at the NAL level whenever the essence isn't a
> multiple of 16x16 is obviously normal. The only complication I can
> think of is 4:2:2 and 4:4:4. Does MC require 16x16 also in those cases?
> I'd expect 16x8 and 8x8 respectively.

It’s still 16x16. From H.264 specification:

macroblock: A 16x16 block of luma samples and two corresponding blocks of
chroma samples of a picture that has three sample arrays, or a 16x16 block
of samples of a monochrome picture or a picture that is coded using three
separate colour planes.

Macroblock has been replaced by coding tree unit with H.265, which can be
between 16×16 pixels and 64×64 pixels in size.

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