Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for --disable-deprecated (#1273) #1593

Merged
merged 14 commits into from
Jun 28, 2020

Conversation

kleisauke
Copy link
Member

@kleisauke kleisauke commented Mar 24, 2020

Marked this PR as draft since the whole mosaicing folder has yet to be converted to vips8.

This PR resolves #1273 and #798.

@kleisauke
Copy link
Member Author

This PR is almost done, the whole mosaicing folder was converted to vips8 with commit 2105b76. I'm still working out a few kinks, but feel free to review/comment. Possible further improvements has been preceded by TODO(kleisauke):.

There's now a unit test for vips_mosaic and vips_globalbalance (ported from the 1 point mosaic nip2 demo). Although vips_globalbalance seems to output correctly for int_output=True the float output however seems to be wrong.

I also added a new vips8 class named vips_inversematrix (perhaps it should be named vips_invertmatrix(?)) for inverting square matrices. This class has been converted from im_matinv. The logic for transposing and multiplying matrices are small, so these functions (named vips__transposematrix and vips__multiplymatrix) are included in global_balance.c.

@kleisauke
Copy link
Member Author

Although vips_globalbalance seems to output correctly for int_output=True the float output however seems to be wrong.

Fixed with 5b1b8cd.

@kleisauke

This comment has been minimized.

@kleisauke
Copy link
Member Author

Ignore my previous comment, it looks like non-assigned inputs (i.e. input that is not explicitly assigned by the user) are automatically finalized, TIL. So for example the vips_object_local here:

VipsInterpolate *interpolate;
if( !(interpolate = vips_interpolate_new( nickname )) )
return( -1 );
vips_object_local( object, interpolate );

Is correct, but not necessary if you do this in vips_affine_build.

@jcupitt
Copy link
Member

jcupitt commented Jun 18, 2020

Hello Kleis, yes, I think the verb form is usually better, so invertmatrix.

Actually, we have matrixload, so perhaps matrixinvert might be better?

@kleisauke
Copy link
Member Author

OK, I cleaned up the commits and renamed it to matrixinvert with kleisauke@45f9999.

This is now ready for reviewing. The mosaic changes are very large, so I think it's wise to fuzz it for a few days before the 8.10 release.

As an aside, I noticed that the test_descriptors with make check is currently failing when building with libspng.

** seq open ..
** crop1, avg ..
** crop2, avg ..
** unref ..
** shutdown ..
lt-test_descriptors: /home/kleisauke/libvips/test/test-suite/images/sample.png: fd not closed after first read
** seq open ..
** crop1, avg ..
FAIL test_descriptors.sh (exit status: 1)

@kleisauke kleisauke marked this pull request as ready for review June 18, 2020 13:03
@kleisauke kleisauke changed the title [WIP] Fix for --disable-deprecated (#1273) Fix for --disable-deprecated (#1273) Jun 18, 2020
@jcupitt
Copy link
Member

jcupitt commented Jun 18, 2020

Ooop, you're fight, it was missing minimise support. It should be fixed now.

Well done on getting all this refactoring sorted out Kleis! I'll try to read it all next week, then perhaps we can aim for July for the 8.10 release.

@@ -43,26 +43,29 @@
#include <vips/internal.h>
#include <vips/transform.h>

/* DBL_MIN is smallest *normalized* double precision float */
#define TOO_SMALL 2.0 * DBL_MIN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be (2.0 * DBL_MIN)

@@ -24,7 +24,7 @@ SUBDIRS = \
iofuncs \
morphology \
mosaicing \
create
create \
.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird, I wonder why "." was here? Let's remove this later.

/* Older glibs were showing G_LOG_LEVEL_{INFO,DEBUG} messages
* by default
*/
#if GLIB_CHECK_VERSION ( 2, 31, 0 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice!

/*NOTEACHED*/
}

return( 0 );
}

static int
vips__transposematrix( VipsImage *in, VipsImage **out )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps should be matrixtranspose, though it doesn't really matter in a static.

@jcupitt jcupitt merged commit e3a5002 into libvips:master Jun 28, 2020
@jcupitt
Copy link
Member

jcupitt commented Jun 28, 2020

OK, I read the whole thing, nice work! You found a lot of useful small fixes too, and even fixed some spelling.

I wonder how useful some of that old mosaicing stuff is. Nicos wrote most it back in the early 90s. Perhaps it should be moved out of the core library? That's another question I suppose.

Anyway, it looks great, let's merge.

jcupitt added a commit that referenced this pull request Jun 28, 2020
- move matrixinvert to mosaicing, fix a leak
- add note to changelog
- small fixes

see #1593
@jcupitt
Copy link
Member

jcupitt commented Jun 28, 2020

I moved matrixinvert to mosaicing (create/ was supposed to just be things that create images), fixed a small memleak, and added a note about your achievement to the main changelog.

@kleisauke
Copy link
Member Author

Thanks! The mosaicing stuff could still be useful for museums, but I'm not sure if it's often used. Perhaps Operation Night Watch uses this?

Could the vips_matrixinvert_get_type call also be moved to the vips_mosaicing_operation_init function?

vips_matrixinvert_get_type();

The POTFILES.in needs to be regenerated too.

libvips/create/matrixinvert.c

(It should be much easier with these instructions now)

@kleisauke kleisauke deleted the disable-deprecated branch June 28, 2020 11:54
@jcupitt
Copy link
Member

jcupitt commented Jun 28, 2020

OK, done!

@kleisauke
Copy link
Member Author

I had a go to check the ABI compatibility after this PR, see the abi-compliance-checker result:
https://kleisauke.nl/compat_reports/vips/8.9.2_to_master/compat_report.html

I guess we still have to write some vips7 compat wrappers for the im_correl, im_lrmosaic, im_tbmosaic, im_lrmerge and im_tbmerge functions in deprecated/vips7compat.c? I could pick this up, if you want.

@jcupitt
Copy link
Member

jcupitt commented Jun 29, 2020

If you have time, that would be great!

We'll need to make vips_lrmerge() etc. more vips8-y too I think, or there will be API breaks when (if) we eventually make them into classes too. They'll need at least the ..., NULL) parameter ending.

@kleisauke
Copy link
Member Author

OK, I started to rework vips_correl as vips8 class, see: master...kleisauke:mosaicing-vips8.

I'm not sure if I should rework im_{lr,tb}mosaic and im_{lr,tb}merge as vips8 classes, since vips_mosaic and vips_merge are already there. Should I try to merge these left-right/top-bottom functions within vips_merge/vips_mosaic? The compat layer can then call up these functions with the appropriate VipsDirection.

@jcupitt
Copy link
Member

jcupitt commented Jun 29, 2020

Ah I'd actually forgotten about them, heh. That was a while ago.

Yes, you're right, vips_merge() is the vips8 class interface to the old im_lrmerge() and im_tbmerge(). We should rename your vips_lrmerge() as vips__lrmerge() and have it as internal API. As you say, we could even fold them into merge.c, though that would make the file very large.

Shall I do this?

I wonder if correl is very useful. Perhaps it should just be internal API. If we make it an official part of vips8, we'll have to support the stupid thing for all time.

@jcupitt
Copy link
Member

jcupitt commented Jun 29, 2020

Off-topic: I had a go at a first draft of "what's new in 8.10":

https://github.com/libvips/libvips/blob/whatsnew-8.10/_posts/2020-06-18-What's-new-in-8.10.md

Any comments very welcome etc.

@kleisauke
Copy link
Member Author

I agree, lets make vips_correl, vips_{lr,tb}mosaic and vips_{lr,tb}merge part of the internal API. vips_correl as a vips8 class will also lead to confusion since there is already a vips_correlation function.

I've already prepared the vips7 compat wrapper functions, see: master...kleisauke:mosaicing-vips8.

ABI compatibility looks OK now, only some internal API symbols have been removed.
https://kleisauke.nl/compat_reports/vips/8.9.2_to_mosaicing-vips8/compat_report.html

Feel free to mark those mosaicing functions as internal, I can do a rebase after that.

@kleisauke
Copy link
Member Author

The "what's new in 8.10" news post looks great! The only thing I noticed is that libspng is mentioned twice in the ChangeLog, see:

- add experimental libspng reader

- load PNGs with libspng, if possible

@jcupitt
Copy link
Member

jcupitt commented Jun 30, 2020

OK, I'll shift them to internal-only. Thanks for the note about the changelog, I've fixed that too.

@randy408
Copy link
Contributor

If the Windows release will default to libspng for loading PNGs it would mean a lot if it was mentioned in the changelog or blogpost.

@jcupitt
Copy link
Member

jcupitt commented Jul 1, 2020

Good idea @randy408, I'll add a note.

@kleisauke kleisauke mentioned this pull request Mar 3, 2022
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix --disable-deprecated
3 participants