[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44229] branches/soc-2011-tomato/source/ blender/imbuf/intern/indexer.c: Proxies: FFmpeg proxy builder wasn' t taking image quality into account at all

Sergey Sharybin sergey.vfx at gmail.com
Sat Feb 18 17:23:40 CET 2012


Revision: 44229
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44229
Author:   nazgul
Date:     2012-02-18 16:23:34 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Proxies: FFmpeg proxy builder wasn't taking image quality into account at all
which made it using default quality settings which are really bad for camera
tracking (and perhaps for CSE too).

haven't found Jpeg quality setting for FFmpeg which will behave in the same way
as quality setting for image sequence, but seems that mapping image quality
from 1..100 UI range to 31..1 range of qmin/qmax gives expected result.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/imbuf/intern/indexer.c

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/indexer.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/indexer.c	2012-02-18 16:20:24 UTC (rev 44228)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/indexer.c	2012-02-18 16:23:34 UTC (rev 44229)
@@ -459,12 +459,13 @@
 static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
 	struct anim * anim,
 	AVStream * st, int proxy_size, int width, int height,
-	int UNUSED(quality))
+	int quality)
 {
 	struct proxy_output_ctx * rv = MEM_callocN(
 		sizeof(struct proxy_output_ctx), "alloc_proxy_output");
 	
 	char fname[FILE_MAX];
+	int ffmpeg_quality;
 
 	// JPEG requires this
 	width = round_up(width, 8);
@@ -514,6 +515,12 @@
 	rv->c->time_base.num = 1;
 	rv->st->time_base = rv->c->time_base;
 
+	/* there's no  way to set JPEG quality in the same way as in AVI JPEG and image sequence,
+	 * but this seems to be giving expected quality result */
+	ffmpeg_quality = 31 * (1.0f - (float)quality / 100.0f);
+	av_set_int(rv->c, "qmin", ffmpeg_quality);
+	av_set_int(rv->c, "qmax", ffmpeg_quality);
+
 	if (rv->of->flags & AVFMT_GLOBALHEADER) {
 		rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER;
 	}




More information about the Bf-blender-cvs mailing list