fix distance 0 save, better error messages
This commit is contained in:
parent
63d2da6a1d
commit
4e28039c02
@ -141,7 +141,7 @@ vips_foreign_load_jxl_error( VipsForeignLoadJxl *jxl, const char *details )
|
|||||||
|
|
||||||
/* TODO ... jxl has no way to get error messages at the moment.
|
/* TODO ... jxl has no way to get error messages at the moment.
|
||||||
*/
|
*/
|
||||||
vips_error( class->nickname, "%s", details );
|
vips_error( class->nickname, "error %s", details );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -279,7 +279,8 @@ vips_foreign_load_jxl_print_status( JxlDecoderStatus status )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
printf( "JXL_DEC_<unknown>\n" );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ vips_foreign_save_jxl_error( VipsForeignSaveJxl *jxl, const char *details )
|
|||||||
|
|
||||||
/* TODO ... jxl has no way to get error messages at the moment.
|
/* TODO ... jxl has no way to get error messages at the moment.
|
||||||
*/
|
*/
|
||||||
vips_error( class->nickname, "%s", details );
|
vips_error( class->nickname, "error %s", details );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -200,6 +200,32 @@ vips_foreign_save_jxl_print_format( JxlPixelFormat *format )
|
|||||||
printf( " endianness = %d\n", format->endianness );
|
printf( " endianness = %d\n", format->endianness );
|
||||||
printf( " align = %zd\n", format->align );
|
printf( " align = %zd\n", format->align );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_foreign_save_jxl_print_status( JxlEncoderStatus status )
|
||||||
|
{
|
||||||
|
switch( status ) {
|
||||||
|
case JXL_ENC_SUCCESS:
|
||||||
|
printf( "JXL_ENC_SUCCESS\n" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JXL_ENC_ERROR:
|
||||||
|
printf( "JXL_ENC_ERROR\n" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JXL_ENC_NEED_MORE_OUTPUT:
|
||||||
|
printf( "JXL_ENC_NEED_MORE_OUTPUT\n" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JXL_ENC_NOT_SUPPORTED:
|
||||||
|
printf( "JXL_ENC_NOT_SUPPORTED\n" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf( "JXL_ENC_<unknown>\n" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -224,6 +250,11 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
|||||||
0.1 + (100 - jxl->Q) * 0.09 :
|
0.1 + (100 - jxl->Q) * 0.09 :
|
||||||
6.4 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f;
|
6.4 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f;
|
||||||
|
|
||||||
|
/* Distance 0 is lossless. libjxl will fail for lossy distance 0.
|
||||||
|
*/
|
||||||
|
if( jxl->distance == 0 )
|
||||||
|
jxl->lossless = TRUE;
|
||||||
|
|
||||||
jxl->runner = JxlThreadParallelRunnerCreate( NULL,
|
jxl->runner = JxlThreadParallelRunnerCreate( NULL,
|
||||||
vips_concurrency_get() );
|
vips_concurrency_get() );
|
||||||
jxl->encoder = JxlEncoderCreate( NULL );
|
jxl->encoder = JxlEncoderCreate( NULL );
|
||||||
@ -390,6 +421,9 @@ vips_foreign_save_jxl_build( VipsObject *object )
|
|||||||
default:
|
default:
|
||||||
vips_foreign_save_jxl_error( jxl,
|
vips_foreign_save_jxl_error( jxl,
|
||||||
"JxlEncoderProcessOutput" );
|
"JxlEncoderProcessOutput" );
|
||||||
|
#ifdef DEBUG
|
||||||
|
vips_foreign_save_jxl_print_status( status );
|
||||||
|
#endif /*DEBUG*/
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
} while( status != JXL_ENC_SUCCESS );
|
} while( status != JXL_ENC_SUCCESS );
|
||||||
|
Loading…
Reference in New Issue
Block a user