[FFmpeg-cvslog] libfdk-aacdec: Apply the decoder's output delay on timestamps

2020-02-11 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Feb  4 
16:03:57 2020 +0200| [0f2b6594fc893c84e383e28136af5c9a3631e311] | committer: 
Martin Storsjö

libfdk-aacdec: Apply the decoder's output delay on timestamps

The delay is normally zero when the level limiter is disabled,
but if enabled, there's a small delay.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f2b6594fc893c84e383e28136af5c9a3631e311
---

 libavcodec/libfdk-aacdec.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index 1abe1d8438..d9b080cf3e 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -57,6 +57,7 @@ typedef struct FDKAACDecContext {
 int drc_effect;
 int drc_cut;
 int level_limit;
+int output_delay;
 } FDKAACDecContext;
 
 
@@ -115,6 +116,9 @@ static int get_stream_info(AVCodecContext *avctx)
 }
 avctx->sample_rate = info->sampleRate;
 avctx->frame_size  = info->frameSize;
+#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
+s->output_delay= info->outputDelay;
+#endif
 
 for (i = 0; i < info->numChannels; i++) {
 AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
@@ -367,6 +371,11 @@ static int fdk_aac_decode_frame(AVCodecContext *avctx, 
void *data,
 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
 goto end;
 
+if (frame->pts != AV_NOPTS_VALUE)
+frame->pts -= av_rescale_q(s->output_delay,
+   (AVRational){1, avctx->sample_rate},
+   avctx->time_base);
+
 memcpy(frame->extended_data[0], s->decoder_buffer,
avctx->channels * avctx->frame_size *
av_get_bytes_per_sample(avctx->sample_fmt));

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

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

[FFmpeg-cvslog] libfdk-aacdec: Allow explicitly disabling the DRC reference level option

2020-02-11 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Feb  4 
16:23:27 2020 +0200| [e8cbdb9adbe5fff49f9fca8879ad8660801c007e] | committer: 
Martin Storsjö

libfdk-aacdec: Allow explicitly disabling the DRC reference level option

Previously, it was always left in the automatic mode, if the option
was set to the only special (negative) value. Now there's two separate
special values for this option, -1 for automatic (metadata based)
and -2 for explicitly disabled.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e8cbdb9adbe5fff49f9fca8879ad8660801c007e
---

 libavcodec/libfdk-aacdec.c | 10 --
 libavcodec/version.h   |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index ec7f236ce7..1a86dffe4b 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -76,8 +76,8 @@ static const AVOption fdk_aac_dec_options[] = {
  OFFSET(drc_boost),  AV_OPT_TYPE_INT,   { .i64 = -1 }, 
-1, 127, AD, NULL},
 { "drc_cut",   "Dynamic Range Control: attenuation factor, where [0] is 
none and [127] is max compression",
  OFFSET(drc_cut),AV_OPT_TYPE_INT,   { .i64 = -1 }, 
-1, 127, AD, NULL},
-{ "drc_level", "Dynamic Range Control: reference level, quantized to 
0.25dB steps where [0] is 0dB and [127] is -31.75dB",
- OFFSET(drc_level),  AV_OPT_TYPE_INT,   { .i64 = -1},  
-1, 127, AD, NULL},
+{ "drc_level", "Dynamic Range Control: reference level, quantized to 
0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 for auto, and -2 for 
disabled",
+ OFFSET(drc_level),  AV_OPT_TYPE_INT,   { .i64 = -1},  
-2, 127, AD, NULL},
 { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on 
(RF mode) and [0] is off",
  OFFSET(drc_heavy),  AV_OPT_TYPE_INT,   { .i64 = -1},  
-1, 1,   AD, NULL},
 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
@@ -299,6 +299,12 @@ static av_cold int fdk_aac_decode_init(AVCodecContext 
*avctx)
 }
 
 if (s->drc_level != -1) {
+// This option defaults to -1, i.e. not calling
+// aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults
+// to the level from DRC metadata, if available. The user can set
+// -drc_level -2, which calls aacDecoder_SetParam(
+// AAC_DRC_REFERENCE_LEVEL) with a negative value, which then
+// explicitly disables the feature.
 if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, 
s->drc_level) != AAC_DEC_OK) {
 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in 
the decoder\n");
 return AVERROR_UNKNOWN;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4511556f41..bc6630ea42 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  68
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

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

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

[FFmpeg-cvslog] libfdk-aacdec: Use the decoder's default level limiter settings

2020-02-11 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Feb  4 
16:07:06 2020 +0200| [5835adee248ff80e0c743fe454261ffa85f459a6] | committer: 
Martin Storsjö

libfdk-aacdec: Use the decoder's default level limiter settings

It was disabled by default in 2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e
as it added delay, but now we compensate for the delay properly
by offsetting timestamps.

Signed-off-by: Martin Storsjö 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5835adee248ff80e0c743fe454261ffa85f459a6
---

 libavcodec/libfdk-aacdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index d9b080cf3e..ec7f236ce7 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -81,7 +81,8 @@ static const AVOption fdk_aac_dec_options[] = {
 { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on 
(RF mode) and [0] is off",
  OFFSET(drc_heavy),  AV_OPT_TYPE_INT,   { .i64 = -1},  
-1, 1,   AD, NULL},
 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
-{ "level_limit", "Signal level limiting", OFFSET(level_limit), 
AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD },
+{ "level_limit", "Signal level limiting",
+ OFFSET(level_limit),AV_OPT_TYPE_BOOL,  { .i64 = -1 }, 
-1, 1, AD },
 #endif
 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
 { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none 
and [6] is general",
@@ -312,6 +313,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext 
*avctx)
 }
 
 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
+// Setting this parameter to -1 enables the auto behaviour in the library.
 if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) 
!= AAC_DEC_OK) {
 av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in 
the decoder\n");
 return AVERROR_UNKNOWN;

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

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

[FFmpeg-cvslog] avfilter/vf_colorkey: add support for commands

2020-02-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Feb 11 13:57:43 
2020 +0100| [52cd7a63374c1d62a188a0e425fb998848a70bf8] | committer: Paul B Mahol

avfilter/vf_colorkey: add support for commands

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52cd7a63374c1d62a188a0e425fb998848a70bf8
---

 doc/filters.texi  | 14 ++
 libavfilter/vf_colorkey.c |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index bdc5700973..f396819a79 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7378,6 +7378,13 @@ ffmpeg -i background.png -i video.mp4 -filter_complex 
"[1:v]colorkey=0x3BBD1E:0.
 @end example
 @end itemize
 
+@subsection Commands
+This filter supports same @ref{commands} as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @section colorhold
 Remove all color information for all RGB colors except for certain one.
 
@@ -7396,6 +7403,13 @@ Blend percentage. 0.0 makes pixels fully gray.
 Higher values result in more preserved color.
 @end table
 
+@subsection Commands
+This filter supports same @ref{commands} as options.
+The command accepts the same syntax of the corresponding option.
+
+If the specified expression is not valid, it is kept at its current
+value.
+
 @section colorlevels
 
 Adjust video input frames using levels.
diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
index 4e37c7f0c9..3cc3961a92 100644
--- a/libavfilter/vf_colorkey.c
+++ b/libavfilter/vf_colorkey.c
@@ -199,7 +199,7 @@ static const AVFilterPad colorkey_outputs[] = {
 };
 
 #define OFFSET(x) offsetof(ColorkeyContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+#define FLAGS 
AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 #if CONFIG_COLORKEY_FILTER
 
@@ -222,6 +222,7 @@ AVFilter ff_vf_colorkey = {
 .inputs= colorkey_inputs,
 .outputs   = colorkey_outputs,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | 
AVFILTER_FLAG_SLICE_THREADS,
+.process_command = ff_filter_process_command,
 };
 
 #endif /* CONFIG_COLORKEY_FILTER */
@@ -246,6 +247,7 @@ AVFilter ff_vf_colorhold = {
 .inputs= colorkey_inputs,
 .outputs   = colorkey_outputs,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | 
AVFILTER_FLAG_SLICE_THREADS,
+.process_command = ff_filter_process_command,
 };
 
 #endif /* CONFIG_COLORHOLD_FILTER */

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

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

[FFmpeg-cvslog] avfilter/vf_colorlevels: add support for commands

2020-02-11 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Feb 11 14:19:56 
2020 +0100| [cf92f42672b1d696e0a17dbb9cda56b6a80c1466] | committer: Paul B Mahol

avfilter/vf_colorlevels: add support for commands

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf92f42672b1d696e0a17dbb9cda56b6a80c1466
---

 doc/filters.texi | 4 
 libavfilter/vf_colorlevels.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index f396819a79..7c25bbaf97 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7479,6 +7479,10 @@ colorlevels=romin=0.5:gomin=0.5:bomin=0.5
 @end example
 @end itemize
 
+@subsection Commands
+
+This filter supports the all above options as @ref{commands}.
+
 @section colormatrix
 
 Convert color matrix.
diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c
index fadb39e004..c03e288e4a 100644
--- a/libavfilter/vf_colorlevels.c
+++ b/libavfilter/vf_colorlevels.c
@@ -48,7 +48,7 @@ typedef struct ColorLevelsContext {
 } ColorLevelsContext;
 
 #define OFFSET(x) offsetof(ColorLevelsContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+#define FLAGS 
AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 static const AVOption colorlevels_options[] = {
 { "rimin", "set input red black point",OFFSET(range[R].in_min),  
AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
 { "gimin", "set input green black point",  OFFSET(range[G].in_min),  
AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
@@ -325,4 +325,5 @@ AVFilter ff_vf_colorlevels = {
 .inputs= colorlevels_inputs,
 .outputs   = colorlevels_outputs,
 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | 
AVFILTER_FLAG_SLICE_THREADS,
+.process_command = ff_filter_process_command,
 };

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

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

[FFmpeg-cvslog] avcodec/libvpxenc: add a way to explicitly set temporal layer id

2020-02-11 Thread Wonkap Jang
ffmpeg | branch: master | Wonkap Jang  | Mon 
Feb 10 10:30:09 2020 -0800| [f3bb59209f255aa0376937edbee48c2ac7782dc6] | 
committer: James Zern

avcodec/libvpxenc: add a way to explicitly set temporal layer id

In order for rate control to correctly allocate bitrate to each temporal
layer, correct temporal layer id has to be set to each frame. This
commit provides the ability to set correct temporal layer id for each
frame.

Signed-off-by: James Zern 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3bb59209f255aa0376937edbee48c2ac7782dc6
---

 doc/encoders.texi  | 12 +++-
 libavcodec/libvpxenc.c | 13 -
 libavcodec/version.h   |  2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7bae39435e..e23b6b32fe 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1918,7 +1918,17 @@ Currently supports the following options.
 @table @option
 @item 0
 No temporal layering flags are provided internally,
-relies on flags being passed in using metadata in AVFrame.
+relies on flags being passed in using @code{metadata} field in @code{AVFrame}
+with following keys.
+@table @option
+@item vp8-flags
+Sets the flags passed into the encoder to indicate the referencing scheme for
+the current frame.
+Refer to function @code{vpx_codec_encode} in @code{vpx/vpx_encoder.h} for more
+details.
+@item temporal_id
+Explicitly sets the temporal id of the current frame to encode.
+@end table
 @item 2
 Two temporal layers. 0-1...
 @item 3
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index d522c43928..60a858853d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
*pkt,
 #endif
 if (frame->pict_type == AV_PICTURE_TYPE_I)
 flags |= VPX_EFLAG_FORCE_KF;
-if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 && 
frame->metadata) {
+if (frame->metadata) {
 AVDictionaryEntry* en = av_dict_get(frame->metadata, "vp8-flags", 
NULL, 0);
 if (en) {
 flags |= strtoul(en->value, NULL, 10);
 }
+
+memset(&layer_id, 0, sizeof(layer_id));
+
+en = av_dict_get(frame->metadata, "temporal_id", NULL, 0);
+if (en) {
+layer_id.temporal_layer_id = strtoul(en->value, NULL, 10);
+#ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
+layer_id.temporal_layer_id_per_spatial[0] = 
layer_id.temporal_layer_id;
+#endif
+layer_id_valid = 1;
+}
 }
 
 if (sd) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index bc6630ea42..6bf2a05145 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  68
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

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

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

[FFmpeg-cvslog] avformat/utils: Fix undefined behavior in ff_configure_buffers_for_index()

2020-02-11 Thread Dale Curtis
ffmpeg | branch: master | Dale Curtis  | Tue Jan 28 
16:49:14 2020 -0800| [f15007afa90a3eb3639848d9702c1cc3ac3e896b] | committer: 
Michael Niedermayer

avformat/utils: Fix undefined behavior in ff_configure_buffers_for_index()

When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of
e2_pts - e1_pts will overflow an int64_t.

Signed-off-by: Dale Curtis 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f15007afa90a3eb3639848d9702c1cc3ac3e896b
---

 libavformat/utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e22ca7cab8..81ea239a66 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2108,6 +2108,8 @@ void ff_configure_buffers_for_index(AVFormatContext *s, 
int64_t time_tolerance)
 //We could use URLProtocol flags here but as many user applications do not 
use URLProtocols this would be unreliable
 const char *proto = avio_find_protocol_name(s->url);
 
+av_assert0(time_tolerance >= 0);
+
 if (!proto) {
 av_log(s, AV_LOG_INFO,
"Protocol name not provided, cannot determine if input is local 
or "
@@ -2135,7 +2137,7 @@ void ff_configure_buffers_for_index(AVFormatContext *s, 
int64_t time_tolerance)
 for (; i2 < st2->nb_index_entries; i2++) {
 AVIndexEntry *e2 = &st2->index_entries[i2];
 int64_t e2_pts = av_rescale_q(e2->timestamp, 
st2->time_base, AV_TIME_BASE_Q);
-if (e2_pts - e1_pts < time_tolerance)
+if (e2_pts < e1_pts || e2_pts - (uint64_t)e1_pts < 
time_tolerance)
 continue;
 pos_delta = FFMAX(pos_delta, e1->pos - e2->pos);
 break;

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

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