-
-
Notifications
You must be signed in to change notification settings - Fork 700
svgload: introduce rgb128 parameter for SVG 128-bit load support #4523
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
base: master
Are you sure you want to change the base?
svgload: introduce rgb128 parameter for SVG 128-bit load support #4523
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work well! I marked a few style things that I think need changing.
meson.build
Outdated
@@ -657,6 +664,7 @@ build_summary = { | |||
'enable Analyze7 load': [get_option('analyze')], | |||
'enable PPM load/save': [get_option('ppm')], | |||
'enable GIF load': [get_option('nsgif')], | |||
'enable SVG 128-bit rendering': [svg_128bit_support] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably go -- it's not really a build option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, removed.
... and thank you for doing this work, Konrad, good job. |
3e74ffb
to
9ca1b76
Compare
9ca1b76
to
c6ffae0
Compare
Thanks for your review @jcupitt . I did my best to apply all your great suggestions. Please take a look again at your convenience. |
Commit kleisauke@c4d898f has some minor formatting improvements and fixes the compilation when ../libvips/foreign/svgload.c: In function ‘vips_foreign_load_svg_load’:
../libvips/foreign/svgload.c:707:13: error: ‘svg’ undeclared (first use in this function)
707 | if (svg->rgb128) {
| ^~~
../libvips/foreign/svgload.c:707:13: note: each undeclared identifier is reported only once for each function it appears in
../libvips/foreign/svgload.c:708:28: error: ‘class’ undeclared (first use in this function)
708 | vips_error(class->nickname, "128-bit rendering is not supported with this version");
| ^~~~~ Feel free to cherry-pick. |
Thanks @kleisauke ! I cherry-picked whole your commit. |
Great! It's looking rather neat now, I think. We need two more things:
|
Sorry to bring this up so late, but I wonder if Savers use Does anyone have any thoughts on this? |
That's a very good point. I was also thinking about it for a while. I did some quick research and haven't found any loaders exposing such option. On one hand - I'm happy to refactor it to be |
Thanks! I'd postpone applying this for a while till we have a conclusion re: |
@@ -5784,6 +5784,7 @@ class VImage : public VObject { | |||
* - **access** -- Required access pattern for this file, VipsAccess. | |||
* - **fail_on** -- Error level to fail on, VipsFailOn. | |||
* - **revalidate** -- Don't use a cached result for this operation, bool. | |||
* - **rgb128** -- Enable 128-bit rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These doc comments are generated automatically, so you don't need to include them in a PR.
This text will be replaced by the _("Enable 128-bit SVG rendering")
in the ARG declaration next time this script runs:
https://github.com/libvips/libvips/blob/master/cplusplus/gen-operators.py
(no need for you to do anything, just a note)
* Processes ''n'' pixels in the ''p'' buffer. | ||
* The data is assumed to be RGBA (R, G, B, A) 32-bit floats per pixel. | ||
*/ | ||
void vips__rgba128f_unpremultiplied(float *p, int n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to go through clang-format
. libvips style is:
void
vips__rgba128f_unpremultiplied(float *p, int n)
{
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've just realised this name is wrong :( I should have said this before.
The other converters are named as eg. vips__premultiplied_bgra2rgba()
, meaning "from cairo-style premultiplied bgra to libvips rgba".
Your converter is premultiplied rgba128 to libvips scrgba, so it should be called vips__premultiplied_rgb1282scrgba()
.
With the increasing demand for high quality images - a need of rendering SVG with increased color-depth (more than 8 bit) has also appeared.
Given Cairo introduced support for new data format unlocking this option for libvips -
CAIRO_FORMAT_RGBA128F
: https://www.cairographics.org/news/cairo-1.17.2/ - this PR is an attempt to introducergb128
flag intosvgload
to enable high-bit SVG rendering if needed.