diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-30 21:13:53 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-30 21:29:53 +0300 |
commit | f312f890f1bf035db52f3518ca9583a62999cf02 (patch) | |
tree | fc1a66f2aab9b857a608ce79e6aa4332cd59f707 /source/blender/blenkernel/intern/tracking_util.c | |
parent | 606329d0f872d675faf9362f9d2f89cf0551dd25 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/tracking_util.c')
-rw-r--r-- | source/blender/blenkernel/intern/tracking_util.c | 28 |
1 files changed, 15 insertions, 13 deletions
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. |