Merge branch '8.13'
This commit is contained in:
commit
332d3a9093
@ -16,6 +16,7 @@ master
|
|||||||
- better 0 detection in unpremultiply
|
- better 0 detection in unpremultiply
|
||||||
- fix low bitdepth spng save [jeffska]
|
- fix low bitdepth spng save [jeffska]
|
||||||
- fix PNG low bitdepth save of high bitdepth images
|
- fix PNG low bitdepth save of high bitdepth images
|
||||||
|
- add support for libjxl 0.7 [kleisauke]
|
||||||
|
|
||||||
21/11/21 started 8.13
|
21/11/21 started 8.13
|
||||||
- configure fails for requested but unmet dependencies [remicollet]
|
- configure fails for requested but unmet dependencies [remicollet]
|
||||||
|
@ -158,21 +158,6 @@ vips_foreign_load_jxl_build( VipsObject *object )
|
|||||||
|
|
||||||
jxl->runner = JxlThreadParallelRunnerCreate( NULL,
|
jxl->runner = JxlThreadParallelRunnerCreate( NULL,
|
||||||
vips_concurrency_get() );
|
vips_concurrency_get() );
|
||||||
jxl->decoder = JxlDecoderCreate( NULL );
|
|
||||||
|
|
||||||
if( JxlDecoderSubscribeEvents( jxl->decoder,
|
|
||||||
JXL_DEC_COLOR_ENCODING |
|
|
||||||
JXL_DEC_BASIC_INFO |
|
|
||||||
JXL_DEC_FULL_IMAGE ) ) {
|
|
||||||
vips_foreign_load_jxl_error( jxl, "JxlDecoderSubscribeEvents" );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
if( JxlDecoderSetParallelRunner( jxl->decoder,
|
|
||||||
JxlThreadParallelRunner, jxl->runner ) ) {
|
|
||||||
vips_foreign_load_jxl_error( jxl,
|
|
||||||
"JxlDecoderSetParallelRunner" );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( VIPS_OBJECT_CLASS( vips_foreign_load_jxl_parent_class )->
|
if( VIPS_OBJECT_CLASS( vips_foreign_load_jxl_parent_class )->
|
||||||
build( object ) )
|
build( object ) )
|
||||||
@ -378,10 +363,13 @@ vips_foreign_load_jxl_process( VipsForeignLoadJxl *jxl )
|
|||||||
JXL_DEC_NEED_MORE_INPUT ) {
|
JXL_DEC_NEED_MORE_INPUT ) {
|
||||||
size_t bytes_remaining;
|
size_t bytes_remaining;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf( "vips_foreign_load_jxl_process: reading ...\n" );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
bytes_remaining = JxlDecoderReleaseInput( jxl->decoder );
|
bytes_remaining = JxlDecoderReleaseInput( jxl->decoder );
|
||||||
if( vips_foreign_load_jxl_fill_input( jxl, bytes_remaining ) )
|
if( vips_foreign_load_jxl_fill_input( jxl, bytes_remaining ) )
|
||||||
return( JXL_DEC_ERROR );
|
return( JXL_DEC_ERROR );
|
||||||
|
|
||||||
JxlDecoderSetInput( jxl->decoder,
|
JxlDecoderSetInput( jxl->decoder,
|
||||||
jxl->input_buffer, jxl->bytes_in_buffer );
|
jxl->input_buffer, jxl->bytes_in_buffer );
|
||||||
}
|
}
|
||||||
@ -505,10 +493,24 @@ vips_foreign_load_jxl_header( VipsForeignLoad *load )
|
|||||||
printf( "vips_foreign_load_jxl_header:\n" );
|
printf( "vips_foreign_load_jxl_header:\n" );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( vips_source_rewind( jxl->source ) )
|
/* Build the decoder we will use for the header.
|
||||||
return( -1 );
|
*/
|
||||||
|
jxl->decoder = JxlDecoderCreate( NULL );
|
||||||
|
if( JxlDecoderSubscribeEvents( jxl->decoder,
|
||||||
|
JXL_DEC_COLOR_ENCODING |
|
||||||
|
JXL_DEC_BASIC_INFO ) ) {
|
||||||
|
vips_foreign_load_jxl_error( jxl, "JxlDecoderSubscribeEvents" );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
if( JxlDecoderSetParallelRunner( jxl->decoder,
|
||||||
|
JxlThreadParallelRunner, jxl->runner ) ) {
|
||||||
|
vips_foreign_load_jxl_error( jxl,
|
||||||
|
"JxlDecoderSetParallelRunner" );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
if( vips_foreign_load_jxl_fill_input( jxl, 0 ) )
|
if( vips_source_rewind( jxl->source ) ||
|
||||||
|
vips_foreign_load_jxl_fill_input( jxl, 0 ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
JxlDecoderSetInput( jxl->decoder,
|
JxlDecoderSetInput( jxl->decoder,
|
||||||
jxl->input_buffer, jxl->bytes_in_buffer );
|
jxl->input_buffer, jxl->bytes_in_buffer );
|
||||||
@ -618,13 +620,26 @@ vips_foreign_load_jxl_load( VipsForeignLoad *load )
|
|||||||
if( vips_foreign_load_jxl_set_header( jxl, t[0] ) )
|
if( vips_foreign_load_jxl_set_header( jxl, t[0] ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* We have to reset the reader ... we can't reply onb the read point
|
/* We have to make a new decoder ... we can't be certain the header
|
||||||
* being left just after the header.
|
* decoder left the input in the correct place.
|
||||||
*/
|
*/
|
||||||
if( vips_source_rewind( jxl->source ) )
|
VIPS_FREEF( JxlDecoderDestroy, jxl->decoder );
|
||||||
return( -1 );
|
|
||||||
|
|
||||||
if( vips_foreign_load_jxl_fill_input( jxl, 0 ) )
|
jxl->decoder = JxlDecoderCreate( NULL );
|
||||||
|
if( JxlDecoderSubscribeEvents( jxl->decoder,
|
||||||
|
JXL_DEC_FULL_IMAGE ) ) {
|
||||||
|
vips_foreign_load_jxl_error( jxl, "JxlDecoderSubscribeEvents" );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
if( JxlDecoderSetParallelRunner( jxl->decoder,
|
||||||
|
JxlThreadParallelRunner, jxl->runner ) ) {
|
||||||
|
vips_foreign_load_jxl_error( jxl,
|
||||||
|
"JxlDecoderSetParallelRunner" );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( vips_source_rewind( jxl->source ) ||
|
||||||
|
vips_foreign_load_jxl_fill_input( jxl, 0 ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
JxlDecoderSetInput( jxl->decoder,
|
JxlDecoderSetInput( jxl->decoder,
|
||||||
jxl->input_buffer, jxl->bytes_in_buffer );
|
jxl->input_buffer, jxl->bytes_in_buffer );
|
||||||
|
@ -229,7 +229,11 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
|||||||
VipsForeignSaveJxl *jxl = (VipsForeignSaveJxl *) object;
|
VipsForeignSaveJxl *jxl = (VipsForeignSaveJxl *) object;
|
||||||
VipsImage **t = (VipsImage **) vips_object_local_array( object, 5 );
|
VipsImage **t = (VipsImage **) vips_object_local_array( object, 5 );
|
||||||
|
|
||||||
JxlEncoderOptions *options;
|
#ifdef HAVE_LIBJXL_0_7
|
||||||
|
JxlEncoderFrameSettings *frame_settings;
|
||||||
|
#else
|
||||||
|
JxlEncoderOptions *frame_settings;
|
||||||
|
#endif
|
||||||
JxlEncoderStatus status;
|
JxlEncoderStatus status;
|
||||||
VipsImage *in;
|
VipsImage *in;
|
||||||
VipsBandFormat format;
|
VipsBandFormat format;
|
||||||
@ -415,29 +419,44 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
|||||||
if( vips_image_wio_input( in ) )
|
if( vips_image_wio_input( in ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
options = JxlEncoderOptionsCreate( jxl->encoder, NULL );
|
#ifdef HAVE_LIBJXL_0_7
|
||||||
JxlEncoderOptionsSetDecodingSpeed( options, jxl->tier );
|
frame_settings = JxlEncoderFrameSettingsCreate( jxl->encoder, NULL );
|
||||||
JxlEncoderOptionsSetDistance( options, jxl->distance );
|
JxlEncoderFrameSettingsSetOption( frame_settings,
|
||||||
JxlEncoderOptionsSetEffort( options, jxl->effort );
|
JXL_ENC_FRAME_SETTING_DECODING_SPEED, jxl->tier );
|
||||||
JxlEncoderOptionsSetLossless( options, jxl->lossless );
|
JxlEncoderSetFrameDistance( frame_settings, jxl->distance );
|
||||||
|
JxlEncoderFrameSettingsSetOption( frame_settings,
|
||||||
|
JXL_ENC_FRAME_SETTING_EFFORT, jxl->effort );
|
||||||
|
JxlEncoderSetFrameLossless( frame_settings, jxl->lossless );
|
||||||
|
#else
|
||||||
|
frame_settings = JxlEncoderOptionsCreate( jxl->encoder, NULL );
|
||||||
|
JxlEncoderOptionsSetDecodingSpeed( frame_settings, jxl->tier );
|
||||||
|
JxlEncoderOptionsSetDistance( frame_settings, jxl->distance );
|
||||||
|
JxlEncoderOptionsSetEffort( frame_settings, jxl->effort );
|
||||||
|
JxlEncoderOptionsSetLossless( frame_settings, jxl->lossless );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
vips_foreign_save_jxl_print_info( &jxl->info );
|
vips_foreign_save_jxl_print_info( &jxl->info );
|
||||||
vips_foreign_save_jxl_print_format( &jxl->format );
|
vips_foreign_save_jxl_print_format( &jxl->format );
|
||||||
printf( "JxlEncoderOptions:\n" );
|
printf( "JxlEncoderFrameSettings:\n" );
|
||||||
printf( " tier = %d\n", jxl->tier );
|
printf( " tier = %d\n", jxl->tier );
|
||||||
printf( " distance = %g\n", jxl->distance );
|
printf( " distance = %g\n", jxl->distance );
|
||||||
printf( " effort = %d\n", jxl->effort );
|
printf( " effort = %d\n", jxl->effort );
|
||||||
printf( " lossless = %d\n", jxl->lossless );
|
printf( " lossless = %d\n", jxl->lossless );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( JxlEncoderAddImageFrame( options, &jxl->format,
|
if( JxlEncoderAddImageFrame( frame_settings, &jxl->format,
|
||||||
VIPS_IMAGE_ADDR( in, 0, 0 ),
|
VIPS_IMAGE_ADDR( in, 0, 0 ),
|
||||||
VIPS_IMAGE_SIZEOF_IMAGE( in ) ) ) {
|
VIPS_IMAGE_SIZEOF_IMAGE( in ) ) ) {
|
||||||
vips_foreign_save_jxl_error( jxl, "JxlEncoderAddImageFrame" );
|
vips_foreign_save_jxl_error( jxl, "JxlEncoderAddImageFrame" );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function must be called after the final frame and/or box,
|
||||||
|
* otherwise the codestream will not be encoded correctly.
|
||||||
|
*/
|
||||||
|
JxlEncoderCloseInput( jxl->encoder );
|
||||||
|
|
||||||
do {
|
do {
|
||||||
uint8_t *out;
|
uint8_t *out;
|
||||||
size_t avail_out;
|
size_t avail_out;
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
|
||||||
#define DEBUG_VERBOSE
|
#define DEBUG_VERBOSE
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -484,6 +484,9 @@ if libjxl_found
|
|||||||
if cc.has_function('JxlEncoderInitBasicInfo', prefix: '#include <jxl/encode.h>', dependencies: libjxl_dep)
|
if cc.has_function('JxlEncoderInitBasicInfo', prefix: '#include <jxl/encode.h>', dependencies: libjxl_dep)
|
||||||
cfg_var.set('HAVE_LIBJXL_JXLENCODERINITBASICINFO', '1')
|
cfg_var.set('HAVE_LIBJXL_JXLENCODERINITBASICINFO', '1')
|
||||||
endif
|
endif
|
||||||
|
if libjxl_dep.version().version_compare('>=0.7')
|
||||||
|
cfg_var.set('HAVE_LIBJXL_0_7', '1')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libpoppler_dep = dependency('poppler-glib', version: '>=0.16.0', required: get_option('poppler'))
|
libpoppler_dep = dependency('poppler-glib', version: '>=0.16.0', required: get_option('poppler'))
|
||||||
|
Loading…
Reference in New Issue
Block a user