Skip to content

Commit 9e82dc6

Browse files
committed
Revert "Never set the PFM header to little endian (#4242)"
This reverts commit 2aca66d.
1 parent 2aca66d commit 9e82dc6

File tree

9 files changed

+17
-134
lines changed

9 files changed

+17
-134
lines changed

ChangeLog

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
8.17.0
2-
3-
- add Magic Kernel support [akimon658]
4-
51
8.16.1
62

73
- support multipage JXL

libvips/foreign/jxlload.c

+8-60
Original file line numberDiff line numberDiff line change
@@ -439,56 +439,6 @@ vips_foreign_load_jxl_print_format(JxlPixelFormat *format)
439439
printf(" endianness = %d\n", format->endianness);
440440
printf(" align = %zd\n", format->align);
441441
}
442-
443-
static const char *
444-
vips_foreign_load_jxl_blend_mode(JxlBlendMode blendmode)
445-
{
446-
switch (blendmode) {
447-
case JXL_BLEND_REPLACE:
448-
return "JXL_BLEND_REPLACE";
449-
450-
case JXL_BLEND_ADD:
451-
return "JXL_BLEND_ADD";
452-
453-
case JXL_BLEND_BLEND:
454-
return "JXL_BLEND_BLEND";
455-
456-
case JXL_BLEND_MULADD:
457-
return "JXL_BLEND_MULADD";
458-
459-
case JXL_BLEND_MUL:
460-
return "JXL_BLEND_MUL";
461-
462-
default:
463-
return "<unknown JxlBlendMode";
464-
}
465-
}
466-
467-
static void
468-
vips_foreign_load_jxl_print_frame_header(JxlFrameHeader *h)
469-
{
470-
printf("JxlFrameHeader:\n");
471-
printf(" duration = %u\n", h->duration);
472-
printf(" timecode = %u\n", h->timecode);
473-
printf(" name_length = %u\n", h->name_length);
474-
printf(" is_last = %s\n", h->is_last ? "TRUE" : "FALSE");
475-
printf(" layer_info.have_crop = %s\n",
476-
h->layer_info.have_crop ? "TRUE" : "FALSE");
477-
printf(" layer_info.crop_x0 = %d\n", h->layer_info.crop_x0);
478-
printf(" layer_info.crop_y0 = %d\n", h->layer_info.crop_y0);
479-
printf(" layer_info.xsize = %u\n", h->layer_info.xsize);
480-
printf(" layer_info.ysize = %u\n", h->layer_info.ysize);
481-
printf(" layer_info.blend_info.blendmode = %s\n",
482-
vips_foreign_load_jxl_blend_mode(h->layer_info.blend_info.blendmode));
483-
printf(" layer_info.blend_info.source = %u\n",
484-
h->layer_info.blend_info.source);
485-
printf(" layer_info.blend_info.alpha = %u\n",
486-
h->layer_info.blend_info.alpha);
487-
printf(" layer_info.blend_info.clamp = %s\n",
488-
h->layer_info.blend_info.clamp ? "TRUE" : "FALSE");
489-
printf(" layer_info.save_as_reference = %u\n",
490-
h->layer_info.save_as_reference);
491-
}
492442
#endif /*DEBUG*/
493443

494444
static JxlDecoderStatus
@@ -505,9 +455,9 @@ vips_foreign_load_jxl_process(VipsForeignLoadJxl *jxl)
505455
size_t bytes_remaining;
506456
int bytes_read;
507457

508-
#ifdef DEBUG_VERBOSE
458+
#ifdef DEBUG
509459
printf("vips_foreign_load_jxl_process: reading ...\n");
510-
#endif /*DEBUG_VERBOSE*/
460+
#endif /*DEBUG*/
511461

512462
bytes_remaining = JxlDecoderReleaseInput(jxl->decoder);
513463
bytes_read = vips_foreign_load_jxl_fill_input(jxl, bytes_remaining);
@@ -548,7 +498,6 @@ vips_foreign_load_jxl_read_frame(VipsForeignLoadJxl *jxl, VipsImage *frame,
548498
#ifdef DEBUG_VERBOSE
549499
printf("vips_foreign_load_jxl_read_frame: skipping %d frames\n", skip);
550500
#endif /*DEBUG_VERBOSE*/
551-
552501
JxlDecoderSkipFrames(jxl->decoder, skip);
553502
jxl->frame_no += skip;
554503
}
@@ -873,7 +822,8 @@ vips_foreign_load_jxl_header(VipsForeignLoad *load)
873822
do {
874823
switch ((status = vips_foreign_load_jxl_process(jxl))) {
875824
case JXL_DEC_ERROR:
876-
vips_foreign_load_jxl_error(jxl, "JxlDecoderProcessInput");
825+
vips_foreign_load_jxl_error(jxl,
826+
"JxlDecoderProcessInput");
877827
return -1;
878828

879829
case JXL_DEC_BOX:
@@ -957,7 +907,8 @@ vips_foreign_load_jxl_header(VipsForeignLoad *load)
957907
&jxl->format,
958908
#endif
959909
JXL_COLOR_PROFILE_TARGET_DATA, &jxl->icc_size)) {
960-
vips_foreign_load_jxl_error(jxl, "JxlDecoderGetICCProfileSize");
910+
vips_foreign_load_jxl_error(jxl,
911+
"JxlDecoderGetICCProfileSize");
961912
return -1;
962913
}
963914

@@ -986,10 +937,6 @@ vips_foreign_load_jxl_header(VipsForeignLoad *load)
986937
return -1;
987938
}
988939

989-
#ifdef DEBUG
990-
vips_foreign_load_jxl_print_frame_header(&h);
991-
#endif /*DEBUG*/
992-
993940
if (jxl->info.have_animation) {
994941
// tick duration in seconds
995942
double tick = (double) jxl->info.animation.tps_denominator /
@@ -1063,7 +1010,8 @@ vips_foreign_load_jxl_load(VipsForeignLoad *load)
10631010

10641011
JxlDecoderRewind(jxl->decoder);
10651012
if (JxlDecoderSubscribeEvents(jxl->decoder,
1066-
JXL_DEC_FRAME | JXL_DEC_FULL_IMAGE)) {
1013+
JXL_DEC_FRAME |
1014+
JXL_DEC_FULL_IMAGE)) {
10671015
vips_foreign_load_jxl_error(jxl,
10681016
"JxlDecoderSubscribeEvents");
10691017
return -1;

libvips/foreign/ppmsave.c

+3
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ vips_foreign_save_ppm_build(VipsObject *object)
411411
!vips_image_get_double(image, "pfm-scale", &scale))
412412
;
413413

414+
if (vips_amiMSBfirst())
415+
scale *= -1;
416+
414417
/* Need to be locale independent.
415418
*/
416419
g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, scale);

libvips/include/vips/resample.h

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ typedef enum {
4545
VIPS_KERNEL_MITCHELL,
4646
VIPS_KERNEL_LANCZOS2,
4747
VIPS_KERNEL_LANCZOS3,
48-
VIPS_KERNEL_MKS2013,
49-
VIPS_KERNEL_MKS2021,
5048
VIPS_KERNEL_LAST
5149
} VipsKernel;
5250

libvips/resample/reduce.c

-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@
6666
* @VIPS_KERNEL_MITCHELL: Convolve with a Mitchell kernel.
6767
* @VIPS_KERNEL_LANCZOS2: Convolve with a two-lobe Lanczos kernel.
6868
* @VIPS_KERNEL_LANCZOS3: Convolve with a three-lobe Lanczos kernel.
69-
* @VIPS_KERNEL_MKS2013: Convolve with Magic Kernel Sharp 2013.
70-
* @VIPS_KERNEL_MKS2021: Convolve with Magic Kernel Sharp 2021.
7169
*
7270
* The resampling kernels vips supports. See vips_reduce(), for example.
7371
*/

libvips/resample/reduceh.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ vips_reduce_get_points(VipsKernel kernel, double shrink)
125125
case VIPS_KERNEL_LANCZOS3:
126126
return 2 * rint(3 * shrink) + 1;
127127

128-
case VIPS_KERNEL_MKS2013:
129-
return 2 * rint(3 * shrink) + 1;
130-
131-
case VIPS_KERNEL_MKS2021:
132-
return 2 * rint(5 * shrink) + 1;
133-
134128
default:
135129
g_assert_not_reached();
136130
return 0;

libvips/resample/templates.h

-52
Original file line numberDiff line numberDiff line change
@@ -402,48 +402,6 @@ double inline filter<VIPS_KERNEL_LANCZOS3>(double x)
402402
return 0.0;
403403
}
404404

405-
template <>
406-
double inline filter<VIPS_KERNEL_MKS2013>(double x)
407-
{
408-
if (x < 0.0)
409-
x = -x;
410-
411-
if (x >= 2.5)
412-
return 0.0;
413-
414-
if (x >= 1.5)
415-
return (x - 5.0 / 2.0) * (x - 5.0 / 2.0) / -8.0;
416-
417-
if (x >= 0.5)
418-
return (4.0 * x * x - 11.0 * x + 7.0) / 4.0;
419-
420-
return 17.0 / 16.0 - 7.0 * x * x / 4.0;
421-
}
422-
423-
template <>
424-
double inline filter<VIPS_KERNEL_MKS2021>(double x)
425-
{
426-
if (x < 0.0)
427-
x = -x;
428-
429-
if (x >= 4.5)
430-
return 0.0;
431-
432-
if (x >= 3.5)
433-
return (4.0 * x * x - 36.0 * x + 81.0) / -1152.0;
434-
435-
if (x >= 2.5)
436-
return (4.0 * x * x - 27.0 * x + 45.0) / 144.0;
437-
438-
if (x >= 1.5)
439-
return (24.0 * x * x - 113.0 * x + 130.0) / -144.0;
440-
441-
if (x >= 0.5)
442-
return (140.0 * x * x - 379.0 * x + 239.0) / 144.0;
443-
444-
return 577.0 / 576.0 - 239.0 * x * x / 144.0;
445-
}
446-
447405
/* Given an x in [0,1] (we can have x == 1 when building tables),
448406
* calculate c0 .. c(@n_points), the coefficients. This is called
449407
* from the interpolator as well as from the table builder.
@@ -511,16 +469,6 @@ vips_reduce_make_mask(T *c, VipsKernel kernel, const int n_points,
511469
filter<VIPS_KERNEL_LANCZOS3>, shrink, x);
512470
break;
513471

514-
case VIPS_KERNEL_MKS2013:
515-
calculate_coefficients(c, n_points,
516-
filter<VIPS_KERNEL_MKS2013>, shrink, x);
517-
break;
518-
519-
case VIPS_KERNEL_MKS2021:
520-
calculate_coefficients(c, n_points,
521-
filter<VIPS_KERNEL_MKS2021>, shrink, x);
522-
break;
523-
524472
default:
525473
g_assert_not_reached();
526474
break;

meson.build

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('vips', 'c', 'cpp',
2-
version: '8.17.0',
2+
version: '8.16.1',
33
meson_version: '>=0.55',
44
default_options: [
55
# this is what glib uses (one of our required deps), so we use it too
@@ -23,9 +23,9 @@ version_patch = version_parts[2]
2323
# binary interface changed: increment current, reset revision to 0
2424
# binary interface changes backwards compatible?: increment age
2525
# binary interface changes not backwards compatible?: reset age to 0
26-
library_revision = 0
27-
library_current = 61
28-
library_age = 19
26+
library_revision = 1
27+
library_current = 60
28+
library_age = 18
2929
library_version = '@0@.@1@.@2@'.format(library_current - library_age, library_age, library_revision)
3030
darwin_versions = [library_current + 1, '@0@.@1@'.format(library_current + 1, library_revision)]
3131

test/test-suite/test_resample.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ def test_reduce(self):
8383
for fac in [1, 1.1, 1.5, 1.999]:
8484
for fmt in all_formats:
8585
for kernel in ["nearest", "linear",
86-
"cubic", "lanczos2",
87-
"lanczos3", "mks2013", "mks2021"]:
86+
"cubic", "lanczos2", "lanczos3"]:
8887
x = im.cast(fmt)
8988
r = x.reduce(fac, fac, kernel=kernel)
9089
d = abs(r.avg() - im.avg())
@@ -94,8 +93,7 @@ def test_reduce(self):
9493
for const in [0, 1, 2, 254, 255]:
9594
im = (pyvips.Image.black(10, 10) + const).cast("uchar")
9695
for kernel in ["nearest", "linear",
97-
"cubic", "lanczos2",
98-
"lanczos3", "mks2013", "mks2021"]:
96+
"cubic", "lanczos2", "lanczos3"]:
9997
# print "testing kernel =", kernel
10098
# print "testing const =", const
10199
shr = im.reduce(2, 2, kernel=kernel)

0 commit comments

Comments
 (0)