[FFmpeg-devel] [PATCH] avcodec/libaomenc: add support for AQ-mode setting
James Almer
jamrial at gmail.com
Thu Mar 29 23:01:09 EEST 2018
Ported and adapted from the libvpx encoder wrapper.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/libaomenc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index f075bf4de7..67c9d5678c 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -66,6 +66,7 @@ typedef struct AOMEncoderContext {
int static_thresh;
int drop_threshold;
int noise_sensitivity;
+ int aq_mode;
} AOMContext;
static const char *const ctlidstr[] = {
@@ -73,6 +74,7 @@ static const char *const ctlidstr[] = {
[AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
[AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
[AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
+ [AV1E_SET_AQ_MODE] = "AV1E_SET_AQ_MODE",
[AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE",
[AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES",
[AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
@@ -449,6 +451,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
if (ctx->crf >= 0)
codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf);
+ if (ctx->aq_mode >= 0)
+ codecctl_int(avctx, AV1E_SET_AQ_MODE, ctx->aq_mode);
codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
@@ -708,6 +712,11 @@ static const AVOption options[] = {
"by the bool decoder, meaning that partitions can be decoded even "
"though earlier partitions have been lost. Note that intra predicition"
" is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"},
+ { "aq-mode", "adaptive quantization mode", OFFSET(aq_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3, VE, "aq_mode"},
+ { "none", "Aq not used", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, VE, "aq_mode" },
+ { "variance", "Variance based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "aq_mode" },
+ { "complexity", "Complexity based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "aq_mode" },
+ { "cyclic", "Cyclic Refresh Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "aq_mode" },
{ "crf", "Select the quality for constant quality mode", offsetof(AOMContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE },
{ "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ "drop-threshold", "Frame drop threshold", offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
--
2.16.2
More information about the ffmpeg-devel
mailing list