]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libxavs2.c
avcodec/ffwavesynth: Fix integer overflows in pink noise addition
[ffmpeg] / libavcodec / libxavs2.c
index 52c50a119f2a8ac2459f014df133ab1fae3e2a72..0179a1eb15b26df9edd92599d834ac4da27f7904 100644 (file)
@@ -31,7 +31,7 @@
     int err; \
     av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
     err = cae->api->opt_set2(cae->param, name, opt_str); \
-    if (err) {\
+    if (err < 0) {\
         av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\
     }\
 } while(0);
@@ -46,7 +46,6 @@ typedef struct XAVS2EContext {
     int min_qp;
     int preset_level;
     int log_level;
-    int hierarchical_reference;
 
     void *encoder;
     char *xavs2_opts;
@@ -110,8 +109,8 @@ static av_cold int xavs2_init(AVCodecContext *avctx)
         xavs2_opt_set2("RateControl",   "%d", 1);
         xavs2_opt_set2("TargetBitRate", "%"PRId64"", avctx->bit_rate);
         xavs2_opt_set2("InitialQP",     "%d", cae->initial_qp);
-        xavs2_opt_set2("MaxQP",         "%d", cae->max_qp);
-        xavs2_opt_set2("MinQP",         "%d", cae->min_qp);
+        xavs2_opt_set2("MaxQP",         "%d", avctx->qmax >= 0 ? avctx->qmax : cae->max_qp);
+        xavs2_opt_set2("MinQP",         "%d", avctx->qmin >= 0 ? avctx->qmin : cae->min_qp);
     } else {
         xavs2_opt_set2("InitialQP",     "%d", cae->qp);
     }