]> git.sesse.net Git - ffmpeg/commitdiff
lavc/snowenc: Expose an option to set the rc_eq expression
authorAlexander Strasser <eclipse7@gmx.net>
Fri, 7 Aug 2020 19:40:40 +0000 (21:40 +0200)
committerAlexander Strasser <eclipse7@gmx.net>
Wed, 12 Aug 2020 15:35:38 +0000 (17:35 +0200)
Snow uses the ratecontrol module, but does not expose a way to set
the rc_eq expression. The default expression, set in the ratecontrol
module, will always be used.

Make it possible to set rc_eq by adding an AVOption to snowenc.

The option definition is mostly a copy from the mpegvideo common
options definition of rc_eq (libavcodec/mpegvideo.h), with some
minor style adjustments to be closer to the other snowenc option
initializer expressions.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
libavcodec/snowenc.c

index b1cf1426eeba46585273c5359134b1948c7622a3..16d2b7c302ef33e2f2ad58d0aa1b4ba6f990b8c7 100644 (file)
@@ -1948,6 +1948,11 @@ static const AVOption options[] = {
     { "pred",           "Spatial decomposition type",                                OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, DWT_97, DWT_53, VE, "pred" },
         { "dwt97", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
         { "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
+    { "rc_eq", "Set rate control equation. When computing the expression, besides the standard functions "
+     "defined in the section 'Expression Evaluation', the following functions are available: "
+     "bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv "
+     "fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.",
+                                                                                  OFFSET(m.rc_eq), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE },
     { NULL },
 };