slightly less stupid float->int mask
still not quite right
This commit is contained in:
parent
f32ab06a1c
commit
03a4e54649
8
TODO
8
TODO
@ -1,11 +1,3 @@
|
||||
- test suite is broken, float->int mask I guess
|
||||
|
||||
yes, what about the case where float mask sums to zero, we'll /0 when scaling
|
||||
the output mask
|
||||
|
||||
not sure the fix is right, think again
|
||||
|
||||
maybe look at change in sum? add difference to scale?
|
||||
|
||||
- looks like we have a race in tiled threadcache? see
|
||||
|
||||
|
@ -25,6 +25,7 @@ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
|
||||
|
||||
SETUP_FILES = \
|
||||
$(content_files) \
|
||||
$(expand_content_files) \
|
||||
$(DOC_MAIN_SGML_FILE) \
|
||||
$(DOC_MODULE)-sections.txt \
|
||||
$(DOC_MODULE)-overrides.txt
|
||||
@ -86,7 +87,7 @@ GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
|
||||
|
||||
setup-build.stamp:
|
||||
-$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
|
||||
files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
|
||||
files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
|
||||
if test "x$$files" != "x" ; then \
|
||||
for file in $$files ; do \
|
||||
destdir=`dirname $(abs_builddir)/$$file`; \
|
||||
@ -118,7 +119,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
|
||||
$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
|
||||
scanobj_options=""; \
|
||||
gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
|
||||
if test "$(?)" = "0"; then \
|
||||
if test "$$?" = "0"; then \
|
||||
if test "x$(V)" = "x1"; then \
|
||||
scanobj_options="--verbose"; \
|
||||
fi; \
|
||||
@ -162,17 +163,17 @@ GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
|
||||
GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
|
||||
GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
|
||||
|
||||
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
|
||||
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
|
||||
$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
|
||||
mkhtml_options=""; \
|
||||
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
|
||||
if test "$(?)" = "0"; then \
|
||||
if test "$$?" = "0"; then \
|
||||
if test "x$(V)" = "x1"; then \
|
||||
mkhtml_options="$$mkhtml_options --verbose"; \
|
||||
fi; \
|
||||
fi; \
|
||||
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
|
||||
if test "$(?)" = "0"; then \
|
||||
if test "$$?" = "0"; then \
|
||||
mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
|
||||
fi; \
|
||||
cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
|
||||
@ -194,11 +195,11 @@ GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
|
||||
GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
|
||||
GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
|
||||
|
||||
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
|
||||
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
|
||||
$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
|
||||
mkpdf_options=""; \
|
||||
gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
|
||||
if test "$(?)" = "0"; then \
|
||||
if test "$$?" = "0"; then \
|
||||
if test "x$(V)" = "x1"; then \
|
||||
mkpdf_options="$$mkpdf_options --verbose"; \
|
||||
fi; \
|
||||
@ -223,12 +224,15 @@ clean-local:
|
||||
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
|
||||
rm -f $(DOC_MODULE).types; \
|
||||
fi
|
||||
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
|
||||
rm -f $(DOC_MODULE)-sections.txt; \
|
||||
fi
|
||||
|
||||
distclean-local:
|
||||
@rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
|
||||
$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
|
||||
@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
|
||||
rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
|
||||
rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
|
||||
fi
|
||||
|
||||
maintainer-clean-local:
|
||||
|
@ -145,8 +145,8 @@ im_vips2imask( IMAGE *in, const char *filename )
|
||||
|
||||
double *data;
|
||||
int x, y;
|
||||
double double_ratio;
|
||||
int int_ratio;
|
||||
double double_result;
|
||||
int int_result;
|
||||
|
||||
/* double* only: cast if necessary.
|
||||
*/
|
||||
@ -203,11 +203,11 @@ im_vips2imask( IMAGE *in, const char *filename )
|
||||
* Imaging an input image where every pixel is 1, what will the output
|
||||
* be?
|
||||
*/
|
||||
double_ratio = 0;
|
||||
double_result = 0;
|
||||
for( y = 0; y < height; y++ )
|
||||
for( x = 0; x < width; x++ )
|
||||
double_ratio += data[x + width * y];
|
||||
double_ratio /= vips_image_get_scale( in );
|
||||
double_result += data[x + width * y];
|
||||
double_result /= vips_image_get_scale( in );
|
||||
|
||||
for( y = 0; y < height; y++ )
|
||||
for( x = 0; x < width; x++ )
|
||||
@ -222,26 +222,24 @@ im_vips2imask( IMAGE *in, const char *filename )
|
||||
VIPS_RINT( data[x + y * width] );
|
||||
|
||||
out->scale = VIPS_RINT( vips_image_get_scale( in ) );
|
||||
if( out->scale == 0 )
|
||||
out->scale = 1;
|
||||
out->offset = VIPS_RINT( vips_image_get_offset( in ) );
|
||||
|
||||
/* Now convolve a 1 everywhere image with the int version we've made,
|
||||
* what do we get?
|
||||
*/
|
||||
int_ratio = 0;
|
||||
int_result = 0;
|
||||
for( y = 0; y < height; y++ )
|
||||
for( x = 0; x < width; x++ )
|
||||
int_ratio += out->coeff[x + width * y];
|
||||
int_ratio /= out->scale;
|
||||
int_result += out->coeff[x + width * y];
|
||||
int_result /= out->scale;
|
||||
|
||||
/* And adjust the scale to get as close to a match as we can. This
|
||||
* won't work for masks which sum to zero, obviously :-(
|
||||
/* And adjust the scale to get as close to a match as we can.
|
||||
*/
|
||||
if( double_ratio != 0.0 ) {
|
||||
out->scale = VIPS_RINT( out->scale * int_ratio / double_ratio );
|
||||
if( out->scale == 0 ) {
|
||||
out->scale = 1;
|
||||
}
|
||||
}
|
||||
out->scale = VIPS_RINT( out->scale + (int_result - double_result) );
|
||||
if( out->scale == 0 )
|
||||
out->scale = 1;
|
||||
|
||||
/* We should probably do the same for offset, somehow.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user