@@ -219,13 +219,13 @@ vips_foreign_save_cgif_set_transparent( VipsForeignSaveCgif *cgif,
219
219
}
220
220
}
221
221
222
- static int
222
+ static double
223
223
vips__cgif_compare_palettes ( const VipsQuantisePalette * new ,
224
224
const VipsQuantisePalette * old )
225
225
{
226
226
int i , j ;
227
- int best_dist , dist , rd , gd , bd ;
228
- int total_dist ;
227
+ double best_dist , dist , rd , gd , bd ;
228
+ double total_dist ;
229
229
230
230
g_assert ( new -> count <= 256 );
231
231
g_assert ( old -> count <= 256 );
@@ -337,16 +337,16 @@ vips_foreign_save_cgif_pick_quantiser( VipsForeignSaveCgif *cgif,
337
337
const VipsQuantisePalette * prev = vips__quantise_get_palette (
338
338
cgif -> previous_quantisation_result );
339
339
340
- int global_diff = vips__cgif_compare_palettes ( this , global );
341
- int prev_diff = ( prev == global ) ? global_diff :
340
+ double global_diff = vips__cgif_compare_palettes ( this , global );
341
+ double prev_diff = ( prev == global ) ? global_diff :
342
342
vips__cgif_compare_palettes ( this , prev );
343
343
344
344
#ifdef DEBUG_VERBOSE
345
345
printf ( "vips_foreign_save_cgif_write_frame: "
346
- "this -> global distance = %d \n" ,
346
+ "this -> global distance = %g \n" ,
347
347
global_diff );
348
348
printf ( "vips_foreign_save_cgif_write_frame: "
349
- "this -> prev distance = %d \n" ,
349
+ "this -> prev distance = %g \n" ,
350
350
prev_diff );
351
351
printf ( "vips_foreign_save_cgif_write_frame: "
352
352
"threshold = %g\n" , cgif -> interpalette_maxerror );
@@ -864,7 +864,7 @@ vips_foreign_save_cgif_class_init( VipsForeignSaveCgifClass *class )
864
864
_ ( "Maximum inter-palette error for palette reusage" ),
865
865
VIPS_ARGUMENT_OPTIONAL_INPUT ,
866
866
G_STRUCT_OFFSET ( VipsForeignSaveCgif , interpalette_maxerror ),
867
- 0 , 256 , 40 .0 );
867
+ 0 , 256 , 3 .0 );
868
868
}
869
869
870
870
static void
@@ -875,7 +875,7 @@ vips_foreign_save_cgif_init( VipsForeignSaveCgif *gif )
875
875
gif -> bitdepth = 8 ;
876
876
gif -> interframe_maxerror = 0.0 ;
877
877
gif -> reoptimise = FALSE;
878
- gif -> interpalette_maxerror = 40 .0 ;
878
+ gif -> interpalette_maxerror = 3 .0 ;
879
879
gif -> mode = VIPS_FOREIGN_SAVE_CGIF_MODE_GLOBAL ;
880
880
}
881
881
0 commit comments