From f312f890f1bf035db52f3518ca9583a62999cf02 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Oct 2014 23:13:53 +0500 Subject: Libmv: Support disabled color channels in tracking settings This was never ported to a new tracking pipeline and now it's done using FrameAccessor::Transform routines. Quite striaghtforward, but i've changed order of grayscale conversion in blender side with call of transform callback. This way it's much easier to perform rescaling in libmv side. --- source/blender/blenkernel/intern/tracking_util.c | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern/tracking_util.c') diff --git a/source/blender/blenkernel/intern/tracking_util.c b/source/blender/blenkernel/intern/tracking_util.c index 250b575aa14..505f705857b 100644 --- a/source/blender/blenkernel/intern/tracking_util.c +++ b/source/blender/blenkernel/intern/tracking_util.c @@ -754,19 +754,6 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor, ibuf->y / (1 << downscale)); } - if (input_mode == LIBMV_IMAGE_MODE_RGBA) { - BLI_assert(ibuf->channels == 3 || ibuf->channels == 4); - /* pass */ - } - else /* if (input_mode == LIBMV_IMAGE_MODE_MONO) */ { - ImBuf *grayscale_ibuf = make_grayscale_ibuf_copy(final_ibuf); - if (final_ibuf != orig_ibuf) { - /* We dereference original frame later. */ - IMB_freeImBuf(final_ibuf); - } - final_ibuf = grayscale_ibuf; - } - if (transform != NULL) { libmv_FloatImage input_image, output_image; ibuf_to_float_image(final_ibuf, &input_image); @@ -780,6 +767,21 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor, libmv_floatImageDestroy(&output_image); } + if (input_mode == LIBMV_IMAGE_MODE_RGBA) { + BLI_assert(ibuf->channels == 3 || ibuf->channels == 4); + /* pass */ + } + else /* if (input_mode == LIBMV_IMAGE_MODE_MONO) */ { + if (final_ibuf->channels != 1) { + ImBuf *grayscale_ibuf = make_grayscale_ibuf_copy(final_ibuf); + if (final_ibuf != orig_ibuf) { + /* We dereference original frame later. */ + IMB_freeImBuf(final_ibuf); + } + final_ibuf = grayscale_ibuf; + } + } + /* it's possible processing stil didn't happen at this point, * but we really need a copy of the buffer to be transformed * and to be put to the cache. -- cgit v1.2.3