[FFmpeg-devel] [PATCH] Added more commandline options for libaom encoder.
The following are the newly added options:
arnr_max_frames, arnr_strength, aq_mode, denoise_noise_level,
denoise_block_size,
rc_undershoot_pct, rc_overshoot_pct, minsection_pct, maxsection_pct,
frame_parallel,
enable_cdef, enable_global_motion, and intrabc.
Also added macros for compiling for aom 1.0.0 and fixed the default values.
---
libavcodec/libaomenc.c | 97 --
1 file changed, 93 insertions(+), 4 deletions(-)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index faec61cacd..6d2441b4ed 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -66,36 +66,69 @@ typedef struct AOMEncoderContext {
struct FrameListData *coded_frame_list;
int cpu_used;
int auto_alt_ref;
+int arnr_max_frames;
+int arnr_strength;
+int aq_mode;
int lag_in_frames;
int error_resilient;
int crf;
int static_thresh;
int drop_threshold;
+int denoise_noise_level;
+int denoise_block_size;
uint64_t sse[4];
int have_sse; /**< true if we have pending sse[] */
uint64_t frame_number;
+int rc_undershoot_pct;
+int rc_overshoot_pct;
+int minsection_pct;
+int maxsection_pct;
+int frame_parallel;
int tile_cols, tile_rows;
int tile_cols_log2, tile_rows_log2;
aom_superblock_size_t superblock_size;
int uniform_tiles;
int row_mt;
+int enable_cdef;
+int enable_global_motion;
+int enable_intrabc;
} AOMContext;
static const char *const ctlidstr[] = {
[AOME_SET_CPUUSED] = "AOME_SET_CPUUSED",
[AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
[AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
+[AOME_SET_ARNR_MAXFRAMES] = "AOME_SET_ARNR_MAXFRAMES",
+[AOME_SET_ARNR_STRENGTH]= "AOME_SET_ARNR_STRENGTH",
[AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
[AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE",
[AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES",
[AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
[AV1E_SET_TRANSFER_CHARACTERISTICS] = "AV1E_SET_TRANSFER_CHARACTERISTICS",
+[AV1E_SET_AQ_MODE] = "AV1E_SET_AQ_MODE",
+[AV1E_SET_FRAME_PARALLEL_DECODING] = "AV1E_SET_FRAME_PARALLEL_DECODING",
[AV1E_SET_SUPERBLOCK_SIZE] = "AV1E_SET_SUPERBLOCK_SIZE",
[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
#ifdef AOM_CTRL_AV1E_SET_ROW_MT
[AV1E_SET_ROW_MT] = "AV1E_SET_ROW_MT",
#endif
+#ifdef AV1E_SET_DENOISE_NOISE_LEVEL
+[AV1E_SET_DENOISE_NOISE_LEVEL] = "AV1E_SET_DENOISE_NOISE_LEVEL",
+#endif
+#ifdef AV1E_SET_DENOISE_BLOCK_SIZE
+[AV1E_SET_DENOISE_BLOCK_SIZE] = "AV1E_SET_DENOISE_BLOCK_SIZE",
+#endif
+#ifdef AV1E_SET_MAX_REFERENCE_FRAMES
+[AV1E_SET_MAX_REFERENCE_FRAMES] = "AV1E_SET_MAX_REFERENCE_FRAMES",
+#endif
+#ifdef AV1E_SET_ENABLE_GLOBAL_MOTION
+[AV1E_SET_ENABLE_GLOBAL_MOTION] = "AV1E_SET_ENABLE_GLOBAL_MOTION",
+#endif
+#ifdef AV1E_SET_ENABLE_INTRABC
+[AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC",
+#endif
+[AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF",
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -567,10 +600,14 @@ static av_cold int aom_init(AVCodecContext *avctx,
// 0-100 (0 => CBR, 100 => VBR)
enccfg.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100);
-if (avctx->bit_rate)
+if (ctx->minsection_pct >= 0)
+enccfg.rc_2pass_vbr_minsection_pct = ctx->minsection_pct;
+else if (avctx->bit_rate)
enccfg.rc_2pass_vbr_minsection_pct =
avctx->rc_min_rate * 100LL / avctx->bit_rate;
-if (avctx->rc_max_rate)
+if (ctx->maxsection_pct >= 0)
+enccfg.rc_2pass_vbr_maxsection_pct = ctx->maxsection_pct;
+else if (avctx->rc_max_rate)
enccfg.rc_2pass_vbr_maxsection_pct =
avctx->rc_max_rate * 100LL / avctx->bit_rate;
@@ -582,6 +619,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
avctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate;
enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6;
+if (ctx->rc_undershoot_pct >= 0)
+enccfg.rc_undershoot_pct = ctx->rc_undershoot_pct;
+if (ctx->rc_overshoot_pct >= 0)
+enccfg.rc_overshoot_pct = ctx->rc_overshoot_pct;
+
// _enc_init() will balk if kf_min_dist differs from max w/AOM_KF_AUTO
if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size)
enccfg.kf_min_dist = avctx->keyint_min;
@@ -643,7 +685,12 @@ static av_cold int aom_init(AVCodecContext *avctx,
codecctl_int(avctx, AOME_SET_CPUUSED, ctx->cpu_used);
if (ctx->auto_alt_ref >= 0)
codecctl_int(avctx, AOME_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
-
+if (ctx->arnr_max_frames >= 0)
+codecctl_int(avctx, AOME_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames);
+if (ctx->arnr_strength >= 0
[FFmpeg-devel] [PATCH] Updated the documentation about the encoding options for libaom-av1 encoder.
---
doc/encoders.texi | 46 ++
1 file changed, 46 insertions(+)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 94337d009c..a669ac3739 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1434,6 +1434,12 @@ value is 1, which will be slow and high quality.
Enable use of alternate reference frames. Defaults to the internal
default of the library.
+@item arnr-max-frames
+Set altref noise reduction max frame count.
+
+@item arnr-strength
+Set altref noise reduction filter strength.
+
@item lag-in-frames
Set the maximum number of frames which the encoder may keep in flight
at any one time for lookahead purposes. Defaults to the internal
@@ -1466,6 +1472,33 @@ buffer falls below this percentage, frames will be
dropped until it
has refilled above the threshold. Defaults to zero (no frames are
dropped).
+@item denoise-noise-level
+Amount of noise to be removed for grain synthesis. Grain synthesis is disabled
if
+it is not set or set to 0.
+
+@item denoise-block-size
+Block size used for denoising for grain synthesis. If not set, AV1 codec
+uses the default value of 32.
+
+@item undershoot-pct
+Set datarate undershoot (min) percentage of the target bitrate.
+
+@item overshoot-pct
+Set datarate overshoot (max) percentage of the target bitrate.
+
+@item maxrate (@emph{maxsection-pct})
+Set GOP max bitrate in bits/s. Note @command{libaom-av1}'s option
maxsection-pct is
+specified as a percentage of the target bitrate. If maxsection-pct is not set,
the
+libaomenc wrapper computes it as follows: @code{(maxrate * 100 / bitrate)}.
+
+@item minrate (@emph{minsection-pct})
+Set GOP min bitrate in bits/s. Note @command{libaom-av1}'s option
minsection-pct is
+specified as a percentage of the target bitrate. If minsection-pct is not set,
the
+libaomenc wrapper computes it as follows: @code{(minrate * 100 / bitrate)}.
+
+@item frame-parallel @var{boolean}
+Enable frame parallel decodability features. The default value is true.
+
@item tiles
Set the number of tiles to encode the input video with, as columns x
rows. Larger numbers allow greater parallelism in both encoding and
@@ -1480,6 +1513,19 @@ Provided for compatibility with libvpx/VP9.
@item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
Enable row based multi-threading. Disabled by default.
+@item enable-cdef @var{boolean}
+Flag to enable or disable Constrianed Directional Enhancement Filter. The
libaom-av1
+encoder enables CDEF by default.
+
+@item enable-global-motion @var{boolean}
+Flag to enable or disable the use of global motion for block prediction.
+The default value is true.
+
+@item enable-intrabc @var{boolean}
+Flag to enable or disable block copy mode for intra block prediction. This
mode is
+useful for screen content. The default value is true.
+
+
@end table
@section libkvazaar
--
2.21.0.392.gf8f6787159e-goog
___
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
[FFmpeg-devel] [PATCH] Updated the documentation for libaom encoder options.
---
doc/encoders.texi | 47 +++
1 file changed, 47 insertions(+)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 94337d009c..15b9199549 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1434,6 +1434,16 @@ value is 1, which will be slow and high quality.
Enable use of alternate reference frames. Defaults to the internal
default of the library.
+@item arnr-max-frames
+Set altref noise reduction max frame count.
+
+@item arnr-strength
+Set altref noise reduction filter strength.
+
+@item aq-mode
+Set adaptive quantization mode (0: off (default), 1: variance 2: complexity, 3:
+cyclic refresh).
+
@item lag-in-frames
Set the maximum number of frames which the encoder may keep in flight
at any one time for lookahead purposes. Defaults to the internal
@@ -1466,6 +1476,31 @@ buffer falls below this percentage, frames will be
dropped until it
has refilled above the threshold. Defaults to zero (no frames are
dropped).
+@item denoise-noise-level
+Amount of noise to be removed for grain synthesis. Grain synthesis is disabled
if
+this option is not set or set to 0.
+
+@item denoise-block-size
+Block size used for denoising for grain synthesis. If not set, AV1 codec
+uses the default value of 32.
+
+@item undershoot-pct
+Set datarate undershoot (min) percentage of the target bitrate.
+
+@item overshoot-pct
+Set datarate overshoot (max) percentage of the target bitrate.
+
+@item maxsection-pct
+Maximum percentage variation of the GOP bitrate from the target bitrate. If
maxsection-pct
+is not set, the libaomenc wrapper computes it as follows: @code{(maxrate * 100
/ bitrate)}.
+
+@item minrate
+Minimum percentage variation of the GOP bitrate from the target bitrate. If
minsection-pct
+is not set, the libaomenc wrapper computes it as follows: @code{(minrate * 100
/ bitrate)}.
+
+@item frame-parallel @var{boolean}
+Enable frame parallel decodability features. The default value is true.
+
@item tiles
Set the number of tiles to encode the input video with, as columns x
rows. Larger numbers allow greater parallelism in both encoding and
@@ -1480,6 +1515,18 @@ Provided for compatibility with libvpx/VP9.
@item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
Enable row based multi-threading. Disabled by default.
+@item enable-cdef @var{boolean}
+Flag to enable or disable Constrained Directional Enhancement Filter. The
libaom-av1
+encoder enables CDEF by default.
+
+@item enable-global-motion @var{boolean}
+Flag to enable or disable the use of global motion for block prediction.
+The default value is true.
+
+@item enable-intrabc @var{boolean}
+Flag to enable or disable block copy mode for intra block prediction. This
mode is
+useful for screen content. The default value is true.
+
@end table
@section libkvazaar
--
2.21.0.392.gf8f6787159e-goog
___
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Updated the documentation about the encoding options for libaom-av1 encoder.
James,
Thanks for the review. I am sending the updated patch now.
libaom-av1 enables global-motion/intrabc by default. These options were
added to enable/disable these tools to reduce the complexity. The default
value is set to -1.
On Thu, Apr 4, 2019 at 10:31 AM James Almer wrote:
> On 4/2/2019 9:49 PM, Sam John via ffmpeg-devel wrote:
> > ---
> > doc/encoders.texi | 46 ++
> > 1 file changed, 46 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 94337d009c..a669ac3739 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -1434,6 +1434,12 @@ value is 1, which will be slow and high quality.
> > Enable use of alternate reference frames. Defaults to the internal
> > default of the library.
> >
> > +@item arnr-max-frames
> > +Set altref noise reduction max frame count.
> > +
> > +@item arnr-strength
> > +Set altref noise reduction filter strength.
> > +
> > @item lag-in-frames
> > Set the maximum number of frames which the encoder may keep in flight
> > at any one time for lookahead purposes. Defaults to the internal
> > @@ -1466,6 +1472,33 @@ buffer falls below this percentage, frames will
> be dropped until it
> > has refilled above the threshold. Defaults to zero (no frames are
> > dropped).
> >
> > +@item denoise-noise-level
> > +Amount of noise to be removed for grain synthesis. Grain synthesis is
> disabled if
> > +it is not set or set to 0.
> > +
> > +@item denoise-block-size
> > +Block size used for denoising for grain synthesis. If not set, AV1 codec
> > +uses the default value of 32.
> > +
> > +@item undershoot-pct
> > +Set datarate undershoot (min) percentage of the target bitrate.
> > +
> > +@item overshoot-pct
> > +Set datarate overshoot (max) percentage of the target bitrate.
> > +
> > +@item maxrate (@emph{maxsection-pct})
> > +Set GOP max bitrate in bits/s. Note @command{libaom-av1}'s option
> maxsection-pct is
> > +specified as a percentage of the target bitrate. If maxsection-pct is
> not set, the
> > +libaomenc wrapper computes it as follows: @code{(maxrate * 100 /
> bitrate)}.
> > +
> > +@item minrate (@emph{minsection-pct})
> > +Set GOP min bitrate in bits/s. Note @command{libaom-av1}'s option
> minsection-pct is
> > +specified as a percentage of the target bitrate. If minsection-pct is
> not set, the
> > +libaomenc wrapper computes it as follows: @code{(minrate * 100 /
> bitrate)}.
> > +
> > +@item frame-parallel @var{boolean}
> > +Enable frame parallel decodability features. The default value is true.
> > +
> > @item tiles
> > Set the number of tiles to encode the input video with, as columns x
> > rows. Larger numbers allow greater parallelism in both encoding and
> > @@ -1480,6 +1513,19 @@ Provided for compatibility with libvpx/VP9.
> > @item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
> > Enable row based multi-threading. Disabled by default.
> >
> > +@item enable-cdef @var{boolean}
> > +Flag to enable or disable Constrianed Directional Enhancement Filter.
> The libaom-av1
> > +encoder enables CDEF by default.
> > +
> > +@item enable-global-motion @var{boolean}
> > +Flag to enable or disable the use of global motion for block
> prediction.
> > +The default value is true.
> > +
> > +@item enable-intrabc @var{boolean}
> > +Flag to enable or disable block copy mode for intra block prediction.
> This mode is
> > +useful for screen content. The default value is true.
>
> Maybe "The libaom-av1 encoder enables global-motion/intrabc by default"
> like you did for cdef. For all three the default value is -1, meaning up
> to the library.
>
> > +
> > +
> > @end table
> >
> > @section libkvazaar
> >
>
> ___
> ffmpeg-devel mailing list
> [email protected]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> [email protected] with subject "unsubscribe".
___
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Updated the documentation for libaom encoder options.
Hi,
Is there anything to be done for this patch ?
Thanks
Sam John
On Tue, Apr 9, 2019 at 5:55 PM Sam John wrote:
> ---
> doc/encoders.texi | 47 +++
> 1 file changed, 47 insertions(+)
>
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 94337d009c..15b9199549 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -1434,6 +1434,16 @@ value is 1, which will be slow and high quality.
> Enable use of alternate reference frames. Defaults to the internal
> default of the library.
>
> +@item arnr-max-frames
> +Set altref noise reduction max frame count.
> +
> +@item arnr-strength
> +Set altref noise reduction filter strength.
> +
> +@item aq-mode
> +Set adaptive quantization mode (0: off (default), 1: variance 2:
> complexity, 3:
> +cyclic refresh).
> +
> @item lag-in-frames
> Set the maximum number of frames which the encoder may keep in flight
> at any one time for lookahead purposes. Defaults to the internal
> @@ -1466,6 +1476,31 @@ buffer falls below this percentage, frames will be
> dropped until it
> has refilled above the threshold. Defaults to zero (no frames are
> dropped).
>
> +@item denoise-noise-level
> +Amount of noise to be removed for grain synthesis. Grain synthesis is
> disabled if
> +this option is not set or set to 0.
> +
> +@item denoise-block-size
> +Block size used for denoising for grain synthesis. If not set, AV1 codec
> +uses the default value of 32.
> +
> +@item undershoot-pct
> +Set datarate undershoot (min) percentage of the target bitrate.
> +
> +@item overshoot-pct
> +Set datarate overshoot (max) percentage of the target bitrate.
> +
> +@item maxsection-pct
> +Maximum percentage variation of the GOP bitrate from the target bitrate.
> If maxsection-pct
> +is not set, the libaomenc wrapper computes it as follows: @code{(maxrate
> * 100 / bitrate)}.
> +
> +@item minrate
> +Minimum percentage variation of the GOP bitrate from the target bitrate.
> If minsection-pct
> +is not set, the libaomenc wrapper computes it as follows: @code{(minrate
> * 100 / bitrate)}.
> +
> +@item frame-parallel @var{boolean}
> +Enable frame parallel decodability features. The default value is true.
> +
> @item tiles
> Set the number of tiles to encode the input video with, as columns x
> rows. Larger numbers allow greater parallelism in both encoding and
> @@ -1480,6 +1515,18 @@ Provided for compatibility with libvpx/VP9.
> @item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
> Enable row based multi-threading. Disabled by default.
>
> +@item enable-cdef @var{boolean}
> +Flag to enable or disable Constrained Directional Enhancement Filter. The
> libaom-av1
> +encoder enables CDEF by default.
> +
> +@item enable-global-motion @var{boolean}
> +Flag to enable or disable the use of global motion for block prediction.
> +The default value is true.
> +
> +@item enable-intrabc @var{boolean}
> +Flag to enable or disable block copy mode for intra block prediction.
> This mode is
> +useful for screen content. The default value is true.
> +
> @end table
>
> @section libkvazaar
> --
> 2.21.0.392.gf8f6787159e-goog
>
>
___
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".
