Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
On Fri, Apr 10, 2020 at 11:18 PM James Zern wrote: > > On Fri, Apr 10, 2020 at 10:50 PM James Zern wrote: > > > > On Fri, Apr 3, 2020 at 2:07 PM Wang Cao wrote: > > > > > > Signed-off-by: Wang Cao > > > --- > > > doc/encoders.texi | 9 + > > > libavcodec/libaomenc.c | 7 +++ > > > libavcodec/version.h | 2 +- > > > 3 files changed, 17 insertions(+), 1 deletion(-) > > > > > > > lgtm. I'll apply this soon. > > I missed that the choosen -> chosen fix was missing. fixed locally. applied. thanks. ___ 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 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
On Fri, Apr 3, 2020 at 2:07 PM Wang Cao wrote: > > Signed-off-by: Wang Cao > --- > doc/encoders.texi | 9 + > libavcodec/libaomenc.c | 7 +++ > libavcodec/version.h | 2 +- > 3 files changed, 17 insertions(+), 1 deletion(-) > lgtm. I'll apply this soon. ___ 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 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
On Fri, Apr 10, 2020 at 10:50 PM James Zern wrote: > > On Fri, Apr 3, 2020 at 2:07 PM Wang Cao wrote: > > > > Signed-off-by: Wang Cao > > --- > > doc/encoders.texi | 9 + > > libavcodec/libaomenc.c | 7 +++ > > libavcodec/version.h | 2 +- > > 3 files changed, 17 insertions(+), 1 deletion(-) > > > > lgtm. I'll apply this soon. I missed that the choosen -> chosen fix was missing. fixed locally. ___ 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 v2 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Signed-off-by: Wang Cao --- doc/encoders.texi | 9 + libavcodec/libaomenc.c | 7 +++ libavcodec/version.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index e23b6b32fe..18bfe8f2eb 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1508,6 +1508,15 @@ Complexity-based. Cyclic refresh. @end table +@item tune (@emph{tune}) +Set the distortion metric the encoder is tuned with. Default is @code{psnr}. + +@table @samp +@item psnr (@emph{0}) + +@item ssim (@emph{1}) +@end table + @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 diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 096aadbe1c..20b0e5c8e9 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -94,6 +94,7 @@ typedef struct AOMEncoderContext { int enable_intrabc; int enable_restoration; int usage; +int tune; } AOMContext; static const char *const ctlidstr[] = { @@ -132,6 +133,7 @@ static const char *const ctlidstr[] = { [AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC", #endif [AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF", +[AOME_SET_TUNING] = "AOME_SET_TUNING", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -699,6 +701,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->tune >= 0) +codecctl_int(avctx, AOME_SET_TUNING, ctx->tune); codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries); codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); @@ -1096,6 +1100,9 @@ static const AVOption options[] = { { "usage", "Quality and compression efficiency vs speed tradeof", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "usage"}, { "good","Good quality", 0, AV_OPT_TYPE_CONST, {.i64 = 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"}, { "realtime","Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"}, +{ "tune","The metric that encoder tunes. Automatically choosen by the encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, AOM_TUNE_SSIM, VE, "tune"}, +{ "psnr",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"}, +{ "ssim",NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"}, { NULL }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index f4d1d4de21..dadca75430 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 77 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 2.26.0.292.g33ef6b2f38-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".
Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Hi, On Thu, Mar 5, 2020 at 6:38 PM Wang Cao wrote: > > Signed-off-by: Wang Cao > --- > Made changes according to the review. > - Bump the MICRO version of libavcodec. > - Use enum for 'tune' option consts for better consistency > > doc/encoders.texi | 11 +++ > libavcodec/libaomenc.c | 7 +++ > libavcodec/version.h | 2 +- > 3 files changed, 19 insertions(+), 1 deletion(-) > Just some cosmetics. > diff --git a/doc/encoders.texi b/doc/encoders.texi > index e23b6b32fe..0a74ecce9b 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -1508,6 +1508,17 @@ Complexity-based. > Cyclic refresh. > @end table > > +@item tune (@emph{tune}) > +Set the distortion metric the encoder is tune with. Default is @code{psnr}. > + ...the encoder is tuned with... > +@table @samp > +@item psnr (@emph{0}) > +PSNR as distortion metric > + Given the description above and the name of the options the extra text may be redundant. > [...] > @@ -1096,6 +1100,9 @@ static const AVOption options[] = { > { "usage", "Quality and compression efficiency vs speed > tradeof", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, > "usage"}, > { "good","Good quality", 0, AV_OPT_TYPE_CONST, {.i64 = > 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"}, > { "realtime","Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = > 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"}, > +{ "tune","The metric that encoder tunes for. Automatically > choosen by encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, > -1, AOM_TUNE_SSIM, VE, "tune"}, ...that the encoder tunes...chosen by the encoder... > +{ "psnr","PSNR as distortion metric", 0, > AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"}, > +{ "ssim","SSIM as distortion metric", 0, > AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"}, Like in the other table the extra descriptions may be redundant, they could be 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 v2 1/2] avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Signed-off-by: Wang Cao --- Made changes according to the review. - Bump the MICRO version of libavcodec. - Use enum for 'tune' option consts for better consistency doc/encoders.texi | 11 +++ libavcodec/libaomenc.c | 7 +++ libavcodec/version.h | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index e23b6b32fe..0a74ecce9b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1508,6 +1508,17 @@ Complexity-based. Cyclic refresh. @end table +@item tune (@emph{tune}) +Set the distortion metric the encoder is tune with. Default is @code{psnr}. + +@table @samp +@item psnr (@emph{0}) +PSNR as distortion metric + +@item ssim (@emph{1}) +SSIM as distortion metric +@end table + @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 diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 096aadbe1c..df7819b429 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -94,6 +94,7 @@ typedef struct AOMEncoderContext { int enable_intrabc; int enable_restoration; int usage; +int tune; } AOMContext; static const char *const ctlidstr[] = { @@ -132,6 +133,7 @@ static const char *const ctlidstr[] = { [AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC", #endif [AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF", +[AOME_SET_TUNING] = "AOME_SET_TUNING", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -699,6 +701,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->tune >= 0) +codecctl_int(avctx, AOME_SET_TUNING, ctx->tune); codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries); codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); @@ -1096,6 +1100,9 @@ static const AVOption options[] = { { "usage", "Quality and compression efficiency vs speed tradeof", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "usage"}, { "good","Good quality", 0, AV_OPT_TYPE_CONST, {.i64 = 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"}, { "realtime","Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"}, +{ "tune","The metric that encoder tunes for. Automatically choosen by encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, AOM_TUNE_SSIM, VE, "tune"}, +{ "psnr","PSNR as distortion metric", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"}, +{ "ssim","SSIM as distortion metric", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"}, { NULL }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 36536c3725..03d7f32f1c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 73 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 2.25.0.265.gbab2e86ba0-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".