Commit: 65eac851810a48860586bdc867e926bb018685aa
Author: Richard Antalik
Date:   Tue Mar 16 15:01:56 2021 +0100
Branches: temp-vse-h264-proxy
https://developer.blender.org/rB65eac851810a48860586bdc867e926bb018685aa

Implement quality setting based on UI slider

===================================================================

M       source/blender/imbuf/intern/indexer.c

===================================================================

diff --git a/source/blender/imbuf/intern/indexer.c 
b/source/blender/imbuf/intern/indexer.c
index 7de82555711..edaa1b973d0 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -27,6 +27,7 @@
 #include "BLI_endian_switch.h"
 #include "BLI_fileops.h"
 #include "BLI_ghash.h"
+#include "BLI_math.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
 #include "BLI_threads.h"
@@ -529,9 +530,15 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
   rv->c->time_base.num = 1;
   rv->st->time_base = rv->c->time_base;
 
+  /* This range matches eFFMpegCrf. Crf_range_min corresponds to lowest 
quality, crf_range_max to
+   * highest quality. */
+  const int crf_range_min = 32;
+  const int crf_range_max = 17;
+  int crf = round_fl_to_int((quality / 100.0f) * (crf_range_max - 
crf_range_min) + crf_range_min);
+
   AVDictionary *codec_opts = NULL;
   /* High quality preset value. */
-  av_dict_set_int(&codec_opts, "crf", 20, 0);
+  av_dict_set_int(&codec_opts, "crf", crf, 0);
   /* Prefer smaller filesize. */
   av_dict_set(&codec_opts, "preset", "slow", 0);
   /* Thread count. */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to