Browse Source

Imported Upstream version 0.2.0

Bernd Zeimetz 10 years ago
parent
commit
3e022c838d
100 changed files with 7211 additions and 1100 deletions
  1. 34
    0
      ChangeLog
  2. 1
    1
      Makefile.am
  3. 7
    3
      Makefile.in
  4. 18
    0
      NEWS
  5. 18
    13
      README
  6. 2
    0
      TODO
  7. 143
    72
      aclocal.m4
  8. 5
    2
      autogen.sh
  9. 3
    3
      config.guess
  10. 2
    2
      config.h.in
  11. 7
    3
      config.sub
  12. 609
    191
      configure
  13. 16
    6
      configure.ac
  14. 30
    5
      docs/Makefile
  15. 17
    6
      docs/README
  16. 3177
    448
      docs/liblqr_manual.docbook
  17. 3
    0
      docs/lqr_style.xsl
  18. 9
    14
      examples/liquidrescale-basic.cpp
  19. 2
    7
      examples/liquidrescale-basic.h
  20. 95
    19
      examples/liquidrescale.cpp
  21. 2
    7
      examples/liquidrescale.h
  22. 9
    2
      lqr/Makefile.am
  23. 18
    5
      lqr/Makefile.in
  24. 3
    2
      lqr/lqr.h
  25. 3
    2
      lqr/lqr_all.h
  26. 20
    2
      lqr/lqr_base.h
  27. 433
    149
      lqr/lqr_carver.c
  28. 2
    2
      lqr/lqr_carver.h
  29. 30
    17
      lqr/lqr_carver_bias.c
  30. 2
    2
      lqr/lqr_carver_bias.h
  31. 2
    2
      lqr/lqr_carver_bias_priv.h
  32. 4
    4
      lqr/lqr_carver_bias_pub.h
  33. 7
    3
      lqr/lqr_carver_list.c
  34. 2
    2
      lqr/lqr_carver_list.h
  35. 2
    2
      lqr/lqr_carver_list_priv.h
  36. 2
    2
      lqr/lqr_carver_list_pub.h
  37. 103
    9
      lqr/lqr_carver_priv.h
  38. 32
    14
      lqr/lqr_carver_pub.h
  39. 179
    0
      lqr/lqr_carver_rigmask.c
  40. 29
    0
      lqr/lqr_carver_rigmask.h
  41. 33
    0
      lqr/lqr_carver_rigmask_priv.h
  42. 38
    0
      lqr/lqr_carver_rigmask_pub.h
  43. 7
    8
      lqr/lqr_cursor.c
  44. 2
    2
      lqr/lqr_cursor.h
  45. 3
    4
      lqr/lqr_cursor_priv.h
  46. 2
    2
      lqr/lqr_cursor_pub.h
  47. 2
    2
      lqr/lqr_gradient.c
  48. 2
    2
      lqr/lqr_gradient.h
  49. 2
    2
      lqr/lqr_gradient_priv.h
  50. 2
    2
      lqr/lqr_gradient_pub.h
  51. 13
    3
      lqr/lqr_progress.c
  52. 2
    2
      lqr/lqr_progress.h
  53. 2
    2
      lqr/lqr_progress_priv.h
  54. 2
    2
      lqr/lqr_progress_pub.h
  55. 20
    14
      lqr/lqr_vmap.c
  56. 2
    2
      lqr/lqr_vmap.h
  57. 6
    2
      lqr/lqr_vmap_list.c
  58. 2
    2
      lqr/lqr_vmap_list.h
  59. 2
    2
      lqr/lqr_vmap_list_priv.h
  60. 2
    2
      lqr/lqr_vmap_list_pub.h
  61. 2
    2
      lqr/lqr_vmap_priv.h
  62. 2
    2
      lqr/lqr_vmap_pub.h
  63. 42
    16
      ltmain.sh
  64. 74
    0
      man/LqrColDepth.3
  65. 46
    0
      man/LqrRetVal.3
  66. 64
    0
      man/Makefile.am
  67. 450
    0
      man/Makefile.in
  68. 66
    0
      man/lqr_carver_attach.3
  69. 1
    0
      man/lqr_carver_bias_add.3
  70. 102
    0
      man/lqr_carver_bias_add_area.3
  71. 1
    0
      man/lqr_carver_bias_add_rgb.3
  72. 1
    0
      man/lqr_carver_bias_add_rgb_area.3
  73. 38
    0
      man/lqr_carver_destroy.3
  74. 54
    0
      man/lqr_carver_flatten.3
  75. 1
    0
      man/lqr_carver_get_bpp.3
  76. 45
    0
      man/lqr_carver_get_channels.3
  77. 38
    0
      man/lqr_carver_get_col_depth.3
  78. 38
    0
      man/lqr_carver_get_height.3
  79. 38
    0
      man/lqr_carver_get_width.3
  80. 54
    0
      man/lqr_carver_init.3
  81. 41
    0
      man/lqr_carver_list_current.3
  82. 81
    0
      man/lqr_carver_list_foreach.3
  83. 40
    0
      man/lqr_carver_list_next.3
  84. 54
    0
      man/lqr_carver_list_start.3
  85. 71
    0
      man/lqr_carver_new.3
  86. 1
    0
      man/lqr_carver_new_ext.3
  87. 51
    0
      man/lqr_carver_resize.3
  88. 1
    0
      man/lqr_carver_rigmask_add.3
  89. 109
    0
      man/lqr_carver_rigmask_add_area.3
  90. 1
    0
      man/lqr_carver_rigmask_add_rgb.3
  91. 1
    0
      man/lqr_carver_rigmask_add_rgb_area.3
  92. 76
    0
      man/lqr_carver_scan.3
  93. 49
    0
      man/lqr_carver_scan_by_row.3
  94. 1
    0
      man/lqr_carver_scan_ext.3
  95. 72
    0
      man/lqr_carver_scan_line.3
  96. 1
    0
      man/lqr_carver_scan_line_ext.3
  97. 39
    0
      man/lqr_carver_scan_reset.3
  98. 65
    0
      man/lqr_carver_set_dump_vmaps.3
  99. 72
    0
      man/lqr_carver_set_gradient_function.3
  100. 0
    0
      man/lqr_carver_set_no_dump_vmaps.3

+ 34
- 0
ChangeLog View File

@@ -1,3 +1,37 @@
1
+2008-10-12  Carlo Baldassi  <carlobaldassi@gmail.com>
2
+
3
+	* Added 32 bit and 64 bit floating point support
4
+	* Added get_col_depth
5
+	* Turned all internal floating point maps from
6
+	  gdouble to gfloat
7
+	* Collapsed all the nonstandard constructors
8
+	  and span functions to a single version (*_ext)
9
+
10
+2008-09-04  Carlo Baldassi  <carlobaldassi@gmail.com>
11
+
12
+	* Added set_no_dump_vmaps
13
+
14
+2008-09-04  Carlo Baldassi  <carlobaldassi@gmail.com>
15
+
16
+	* Hid private symbols
17
+
18
+2008-07-30  Carlo Baldassi  <carlobaldassi@gmail.com>
19
+
20
+	* Optimized vsmap memory management
21
+	* Bugfixes
22
+
23
+2008-04-06  Carlo Baldassi  <carlobaldassi@gmail.com>
24
+
25
+	* Added 16 bit support
26
+
27
+2008-02-25  Carlo Baldassi  <carlobaldassi@gmail.com>
28
+
29
+	* Added left-right switches
30
+
31
+2008-02-20  Carlo Baldassi  <carlobaldassi@gmail.com>
32
+
33
+	* Added rigidity mask
34
+
1 35
 2007-12-07  Carlo Baldassi  <carlobaldassi@yahoo.it>
2 36
 
3 37
 	* initial revision.

+ 1
- 1
Makefile.am View File

@@ -1,6 +1,6 @@
1 1
 ## Process this file with automake to produce Makefile.in
2 2
 
3
-SUBDIRS = lqr
3
+SUBDIRS = lqr man
4 4
 
5 5
 EXTRA_DIST = \
6 6
 	docs/liblqr_manual.docbook \

+ 7
- 3
Makefile.in View File

@@ -39,8 +39,8 @@ host_triplet = @host@
39 39
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
40 40
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
41 41
 	$(srcdir)/lqr-1.pc.in $(top_srcdir)/configure AUTHORS COPYING \
42
-	COPYING.LESSER ChangeLog INSTALL NEWS config.guess config.sub \
43
-	depcomp install-sh ltmain.sh missing mkinstalldirs
42
+	COPYING.LESSER ChangeLog INSTALL NEWS TODO config.guess \
43
+	config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
44 44
 subdir = .
45 45
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
46 46
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -105,6 +105,7 @@ CYGPATH_W = @CYGPATH_W@
105 105
 DATADIR = @DATADIR@
106 106
 DEFS = @DEFS@
107 107
 DEPDIR = @DEPDIR@
108
+DSYMUTIL = @DSYMUTIL@
108 109
 ECHO = @ECHO@
109 110
 ECHO_C = @ECHO_C@
110 111
 ECHO_N = @ECHO_N@
@@ -121,6 +122,8 @@ INSTALL_DATA = @INSTALL_DATA@
121 122
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
122 123
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
123 124
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
125
+INSTMAN_FALSE = @INSTMAN_FALSE@
126
+INSTMAN_TRUE = @INSTMAN_TRUE@
124 127
 LDFLAGS = @LDFLAGS@
125 128
 LIBOBJS = @LIBOBJS@
126 129
 LIBRARY_BASE_NAME = @LIBRARY_BASE_NAME@
@@ -135,6 +138,7 @@ MAINT = @MAINT@
135 138
 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
136 139
 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
137 140
 MAKEINFO = @MAKEINFO@
141
+NMEDIT = @NMEDIT@
138 142
 OBJEXT = @OBJEXT@
139 143
 PACKAGE = @PACKAGE@
140 144
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -197,7 +201,7 @@ sbindir = @sbindir@
197 201
 sharedstatedir = @sharedstatedir@
198 202
 sysconfdir = @sysconfdir@
199 203
 target_alias = @target_alias@
200
-SUBDIRS = lqr
204
+SUBDIRS = lqr man
201 205
 EXTRA_DIST = \
202 206
 	docs/liblqr_manual.docbook \
203 207
 	docs/lqr_style.xsl \

+ 18
- 0
NEWS View File

@@ -0,0 +1,18 @@
1
+Version 0.2.0:
2
+
3
+* New fetures:
4
+  * Support for 16-bit, 32-bit and 64-bit
5
+    per channel images
6
+  * Rigidity masks
7
+  * Left-right/top-bottom balance
8
+
9
+* Performace related:
10
+  * Improved attached visibility maps
11
+    management (lower memory requirements)
12
+  * All internal buffers turned from
13
+    double to float, improving both speed
14
+    and memory requirements
15
+
16
+* Documentation:
17
+  * Reviewed manual and completed refence
18
+  * Added man pages

+ 18
- 13
README View File

@@ -1,6 +1,6 @@
1 1
 
2
-LiquidRescale library
3
-=====================
2
+LiquidRescale library 0.2.0
3
+===========================
4 4
 
5 5
 Table of contents
6 6
 -----------------
@@ -28,8 +28,9 @@ and converts them to a multi-size representation.
28 28
 Following is a list of features:
29 29
 
30 30
   * Easy to use API
31
+  * Currently supports 8 bit to 64 bit per channel images
31 32
   * Areas in the image can be marked for preservation or
32
-    discard
33
+    discard, or for additional seam rigidity
33 34
   * Once the image has been fully processed, the scaling can
34 35
     be done in real-time. In fact, the information can be saved
35 36
     and read out later without any further processing
@@ -52,9 +53,9 @@ Following is a list of features:
52 53
 + Installation
53 54
 --------------
54 55
 
55
-++ Requirements
56 56
 
57
-The lqr library requires the glib-2.0 libraries
57
+The lqr library depends on the glib-2.0 libraries
58 58
 
59 59
 ++ Normal setup
60 60
 
@@ -64,15 +65,18 @@ commands on Unix systems are simply
64 65
 ./configure --prefix=/usr && make && sudo make install
65 66
 
66 67
 The last step requires administrative privileges.
67
-(If the dynamic linker path includes /usr/local/lib, the --prefix
68
+(If the dynamic linker path includes /usr/local/lib, the `--prefix'
68 69
 option is not needed.)
69 70
 
71
+If you want to also install the man pages for the library functions,
72
+add the option `--enable-install-man' in the call to ./configure.
73
+
70 74
 See the INSTALL file for a full description.
71 75
 
72 76
 
73 77
 
74
-+ Using the library
75
-------------------------
78
++ Using the library for development
79
+-------------------------------------
76 80
 
77 81
 In order to use the library functions and structures from
78 82
 a C or C++ program, you have to add this include line in 
@@ -95,11 +99,13 @@ flags.
95 99
 
96 100
 See the README file in that directory for more information.
97 101
 
98
-The complete description of the library functions, together with
102
+The complete manual and reference for the library, together with
99 103
 some additional notes, can be found in the `docs' directory in
100
-docbook format. The makefile in that directory (hopefully)
101
-generates the html version, using docbook2html;
102
-you'll find the index named after `liblqr_manual_index.html'
104
+docbook format. The reference is also provided in man page format.
105
+The makefile in that directory (hopefully) generates the manual in
106
+html format, using xsltproc; then you'll find the index named after
107
+`liblqr_manual_index.html'.
108
+See the README file in that directory for further information.
103 109
 
104 110
 
105 111
 
@@ -116,5 +122,5 @@ http://www.faculty.idc.ac.il/arik/imret.pdf
116 122
 + Copyright
117 123
 -----------
118 124
 
119
-Copyright (C) 2007 Carlo Baldassi <carlobaldassi@gmail.com>
125
+Copyright (C) 2007-2008 Carlo Baldassi <carlobaldassi@gmail.com>
120 126
 

+ 2
- 0
TODO View File

@@ -0,0 +1,2 @@
1
+* use babl library
2
+* exceptions?

+ 143
- 72
aclocal.m4 View File

@@ -13,7 +13,7 @@
13 13
 
14 14
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
15 15
 
16
-# serial 51 Debian 1.5.24-1ubuntu1 AC_PROG_LIBTOOL
16
+# serial 52 Debian 1.5.26-1ubuntu1 AC_PROG_LIBTOOL
17 17
 
18 18
 
19 19
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
@@ -101,7 +101,6 @@ AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
101 101
 AC_REQUIRE([AC_OBJEXT])dnl
102 102
 AC_REQUIRE([AC_EXEEXT])dnl
103 103
 dnl
104
-
105 104
 AC_LIBTOOL_SYS_MAX_CMD_LEN
106 105
 AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
107 106
 AC_LIBTOOL_OBJDIR
@@ -203,6 +202,8 @@ file_magic*)
203 202
   ;;
204 203
 esac
205 204
 
205
+_LT_REQUIRED_DARWIN_CHECKS
206
+
206 207
 AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
207 208
 AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
208 209
 enable_win32_dll=yes, enable_win32_dll=no)
@@ -282,9 +283,80 @@ ac_outfile=conftest.$ac_objext
282 283
 echo "$lt_simple_link_test_code" >conftest.$ac_ext
283 284
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
284 285
 _lt_linker_boilerplate=`cat conftest.err`
285
-$rm conftest*
286
+$rm -r conftest*
286 287
 ])# _LT_LINKER_BOILERPLATE
287 288
 
289
+# _LT_REQUIRED_DARWIN_CHECKS
290
+# --------------------------
291
+# Check for some things on darwin
292
+AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
293
+  case $host_os in
294
+    rhapsody* | darwin*)
295
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
296
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
297
+
298
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
299
+      [lt_cv_apple_cc_single_mod=no
300
+      if test -z "${LT_MULTI_MODULE}"; then
301
+   # By default we will add the -single_module flag. You can override
302
+   # by either setting the environment variable LT_MULTI_MODULE
303
+   # non-empty at configure time, or by adding -multi_module to the
304
+   # link flags.
305
+   echo "int foo(void){return 1;}" > conftest.c
306
+   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
307
+     -dynamiclib ${wl}-single_module conftest.c
308
+   if test -f libconftest.dylib; then
309
+     lt_cv_apple_cc_single_mod=yes
310
+     rm -rf libconftest.dylib*
311
+   fi
312
+   rm conftest.c
313
+      fi])
314
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
315
+      [lt_cv_ld_exported_symbols_list],
316
+      [lt_cv_ld_exported_symbols_list=no
317
+      save_LDFLAGS=$LDFLAGS
318
+      echo "_main" > conftest.sym
319
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
320
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
321
+   [lt_cv_ld_exported_symbols_list=yes],
322
+   [lt_cv_ld_exported_symbols_list=no])
323
+   LDFLAGS="$save_LDFLAGS"
324
+    ])
325
+    case $host_os in
326
+    rhapsody* | darwin1.[[0123]])
327
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
328
+    darwin1.*)
329
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
330
+    darwin*)
331
+      # if running on 10.5 or later, the deployment target defaults
332
+      # to the OS version, if on x86, and 10.4, the deployment
333
+      # target defaults to 10.4. Don't you love it?
334
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
335
+   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
336
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
337
+   10.[[012]]*)
338
+     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
339
+   10.*)
340
+     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
341
+      esac
342
+    ;;
343
+  esac
344
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
345
+      _lt_dar_single_mod='$single_module'
346
+    fi
347
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
348
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
349
+    else
350
+      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
351
+    fi
352
+    if test "$DSYMUTIL" != ":"; then
353
+      _lt_dsymutil="~$DSYMUTIL \$lib || :"
354
+    else
355
+      _lt_dsymutil=
356
+    fi
357
+    ;;
358
+  esac
359
+])
288 360
 
289 361
 # _LT_AC_SYS_LIBPATH_AIX
290 362
 # ----------------------
@@ -609,7 +681,11 @@ sparc*-*solaris*)
609 681
     *64-bit*)
610 682
       case $lt_cv_prog_gnu_ld in
611 683
       yes*) LD="${LD-ld} -m elf64_sparc" ;;
612
-      *)    LD="${LD-ld} -64" ;;
684
+      *)
685
+        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
686
+	  LD="${LD-ld} -64"
687
+	fi
688
+	;;
613 689
       esac
614 690
       ;;
615 691
     esac
@@ -702,7 +778,7 @@ AC_CACHE_CHECK([$1], [$2],
702 778
        $2=yes
703 779
      fi
704 780
    fi
705
-   $rm conftest*
781
+   $rm -r conftest*
706 782
    LDFLAGS="$save_LDFLAGS"
707 783
 ])
708 784
 
@@ -973,7 +1049,7 @@ else
973 1049
     AC_CHECK_FUNC([shl_load],
974 1050
 	  [lt_cv_dlopen="shl_load"],
975 1051
       [AC_CHECK_LIB([dld], [shl_load],
976
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
1052
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
977 1053
 	[AC_CHECK_FUNC([dlopen],
978 1054
 	      [lt_cv_dlopen="dlopen"],
979 1055
 	  [AC_CHECK_LIB([dl], [dlopen],
@@ -981,7 +1057,7 @@ else
981 1057
 	    [AC_CHECK_LIB([svld], [dlopen],
982 1058
 		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
983 1059
 	      [AC_CHECK_LIB([dld], [dld_link],
984
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
1060
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
985 1061
 	      ])
986 1062
 	    ])
987 1063
 	  ])
@@ -1298,7 +1374,7 @@ aix3*)
1298 1374
   soname_spec='${libname}${release}${shared_ext}$major'
1299 1375
   ;;
1300 1376
 
1301
-aix4* | aix5*)
1377
+aix[[4-9]]*)
1302 1378
   version_type=linux
1303 1379
   need_lib_prefix=no
1304 1380
   need_version=no
@@ -1831,6 +1907,13 @@ esac
1831 1907
 AC_MSG_RESULT([$dynamic_linker])
1832 1908
 test "$dynamic_linker" = no && can_build_shared=no
1833 1909
 
1910
+AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
1911
+[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
1912
+sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
1913
+AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
1914
+[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
1915
+sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
1916
+
1834 1917
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
1835 1918
 if test "$GCC" = yes; then
1836 1919
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
@@ -2330,7 +2413,7 @@ lt_cv_deplibs_check_method='unknown'
2330 2413
 # whether `pass_all' will *always* work, you probably want this one.
2331 2414
 
2332 2415
 case $host_os in
2333
-aix4* | aix5*)
2416
+aix[[4-9]]*)
2334 2417
   lt_cv_deplibs_check_method=pass_all
2335 2418
   ;;
2336 2419
 
@@ -2766,7 +2849,7 @@ aix3*)
2766 2849
   fi
2767 2850
   ;;
2768 2851
 
2769
-aix4* | aix5*)
2852
+aix[[4-9]]*)
2770 2853
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
2771 2854
     test "$enable_shared" = yes && enable_static=no
2772 2855
   fi
@@ -2823,6 +2906,7 @@ _LT_AC_TAGVAR(postdep_objects, $1)=
2823 2906
 _LT_AC_TAGVAR(predeps, $1)=
2824 2907
 _LT_AC_TAGVAR(postdeps, $1)=
2825 2908
 _LT_AC_TAGVAR(compiler_lib_search_path, $1)=
2909
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
2826 2910
 
2827 2911
 # Source file extension for C++ test sources.
2828 2912
 ac_ext=cpp
@@ -2932,7 +3016,7 @@ case $host_os in
2932 3016
     # FIXME: insert proper C++ library support
2933 3017
     _LT_AC_TAGVAR(ld_shlibs, $1)=no
2934 3018
     ;;
2935
-  aix4* | aix5*)
3019
+  aix[[4-9]]*)
2936 3020
     if test "$host_cpu" = ia64; then
2937 3021
       # On IA64, the linker does run time linking by default, so we don't
2938 3022
       # have to do anything special.
@@ -2945,7 +3029,7 @@ case $host_os in
2945 3029
       # Test if we are trying to use run time linking or normal
2946 3030
       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
2947 3031
       # need to do runtime linking.
2948
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
3032
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
2949 3033
 	for ld_flag in $LDFLAGS; do
2950 3034
 	  case $ld_flag in
2951 3035
 	  *-brtl*)
@@ -3091,51 +3175,23 @@ case $host_os in
3091 3175
     fi
3092 3176
   ;;
3093 3177
       darwin* | rhapsody*)
3094
-        case $host_os in
3095
-        rhapsody* | darwin1.[[012]])
3096
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
3097
-         ;;
3098
-       *) # Darwin 1.3 on
3099
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
3100
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
3101
-         else
3102
-           case ${MACOSX_DEPLOYMENT_TARGET} in
3103
-             10.[[012]])
3104
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
3105
-               ;;
3106
-             10.*)
3107
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
3108
-               ;;
3109
-           esac
3110
-         fi
3111
-         ;;
3112
-        esac
3113 3178
       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
3114 3179
       _LT_AC_TAGVAR(hardcode_direct, $1)=no
3115 3180
       _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
3116 3181
       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
3117 3182
       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
3118 3183
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
3119
-
3120
-    if test "$GXX" = yes ; then
3121
-      lt_int_apple_cc_single_mod=no
3184
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
3185
+      if test "$GXX" = yes ; then
3122 3186
       output_verbose_link_cmd='echo'
3123
-      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
3124
-       lt_int_apple_cc_single_mod=yes
3187
+      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
3188
+      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
3189
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
3190
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
3191
+      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
3192
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
3193
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
3125 3194
       fi
3126
-      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
3127
-       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
3128
-      else
3129
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
3130
-        fi
3131
-        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
3132
-        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
3133
-          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
3134
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
3135
-          else
3136
-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
3137
-          fi
3138
-            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
3139 3195
       else
3140 3196
       case $cc_basename in
3141 3197
         xlc*)
@@ -3386,7 +3442,7 @@ case $host_os in
3386 3442
 	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
3387 3443
 	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
3388 3444
 	;;
3389
-      pgCC*)
3445
+      pgCC* | pgcpp*)
3390 3446
         # Portland Group C++ compiler
3391 3447
 	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
3392 3448
   	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
@@ -3821,7 +3877,8 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
3821 3877
 # compiler output when linking a shared library.
3822 3878
 # Parse the compiler output and extract the necessary
3823 3879
 # objects, libraries and library flags.
3824
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
3880
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
3881
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
3825 3882
 dnl we can't use the lt_simple_compile_test_code here,
3826 3883
 dnl because it contains code intended for an executable,
3827 3884
 dnl not a library.  It's possible we should let each
@@ -3946,6 +4003,11 @@ fi
3946 4003
 
3947 4004
 $rm -f confest.$objext
3948 4005
 
4006
+_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
4007
+if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
4008
+  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
4009
+fi
4010
+
3949 4011
 # PORTME: override above test on systems where it is broken
3950 4012
 ifelse([$1],[CXX],
3951 4013
 [case $host_os in
@@ -4002,7 +4064,6 @@ solaris*)
4002 4064
   ;;
4003 4065
 esac
4004 4066
 ])
4005
-
4006 4067
 case " $_LT_AC_TAGVAR(postdeps, $1) " in
4007 4068
 *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
4008 4069
 esac
@@ -4087,7 +4148,7 @@ aix3*)
4087 4148
     postinstall_cmds='$RANLIB $lib'
4088 4149
   fi
4089 4150
   ;;
4090
-aix4* | aix5*)
4151
+aix[[4-9]]*)
4091 4152
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
4092 4153
     test "$enable_shared" = yes && enable_static=no
4093 4154
   fi
@@ -4264,6 +4325,7 @@ if test -f "$ltmain"; then
4264 4325
     _LT_AC_TAGVAR(predeps, $1) \
4265 4326
     _LT_AC_TAGVAR(postdeps, $1) \
4266 4327
     _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
4328
+    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
4267 4329
     _LT_AC_TAGVAR(archive_cmds, $1) \
4268 4330
     _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
4269 4331
     _LT_AC_TAGVAR(postinstall_cmds, $1) \
@@ -4326,7 +4388,7 @@ ifelse([$1], [],
4326 4388
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
4327 4389
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
4328 4390
 #
4329
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4391
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4330 4392
 # Free Software Foundation, Inc.
4331 4393
 #
4332 4394
 # This file is part of GNU Libtool:
@@ -4563,6 +4625,10 @@ predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
4563 4625
 # shared library.
4564 4626
 postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
4565 4627
 
4628
+# The directories searched by this compiler when creating a shared
4629
+# library
4630
+compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
4631
+
4566 4632
 # The library search path used internally by the compiler when linking
4567 4633
 # a shared library.
4568 4634
 compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
@@ -4912,7 +4978,7 @@ EOF
4912 4978
     echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
4913 4979
     cat conftest.$ac_ext >&5
4914 4980
   fi
4915
-  rm -f conftest* conftst*
4981
+  rm -rf conftest* conftst*
4916 4982
 
4917 4983
   # Do not use the global_symbol_pipe unless it works.
4918 4984
   if test "$pipe_works" = yes; then
@@ -4969,7 +5035,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
4969 5035
       # built for inclusion in a dll (and should export symbols for example).
4970 5036
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
4971 5037
       # (--disable-auto-import) libraries
4972
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
5038
+      m4_if([$1], [GCJ], [],
5039
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4973 5040
       ;;
4974 5041
     darwin* | rhapsody*)
4975 5042
       # PIC is the default on this platform
@@ -5006,7 +5073,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5006 5073
     esac
5007 5074
   else
5008 5075
     case $host_os in
5009
-      aix4* | aix5*)
5076
+      aix[[4-9]]*)
5010 5077
 	# All AIX code is PIC.
5011 5078
 	if test "$host_cpu" = ia64; then
5012 5079
 	  # AIX 5 now supports IA64 processor
@@ -5102,7 +5169,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5102 5169
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
5103 5170
 	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
5104 5171
 	    ;;
5105
-	  pgCC*)
5172
+	  pgCC* | pgcpp*)
5106 5173
 	    # Portland Group C++ compiler.
5107 5174
 	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
5108 5175
 	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
@@ -5253,7 +5320,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5253 5320
       # built for inclusion in a dll (and should export symbols for example).
5254 5321
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
5255 5322
       # (--disable-auto-import) libraries
5256
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
5323
+      m4_if([$1], [GCJ], [],
5324
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
5257 5325
       ;;
5258 5326
 
5259 5327
     darwin* | rhapsody*)
@@ -5323,7 +5391,8 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5323 5391
     mingw* | cygwin* | pw32* | os2*)
5324 5392
       # This hack is so that the source file can tell whether it is being
5325 5393
       # built for inclusion in a dll (and should export symbols for example).
5326
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
5394
+      m4_if([$1], [GCJ], [],
5395
+	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
5327 5396
       ;;
5328 5397
 
5329 5398
     hpux9* | hpux10* | hpux11*)
@@ -5460,7 +5529,7 @@ AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
5460 5529
 #
5461 5530
 if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
5462 5531
   AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
5463
-    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
5532
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
5464 5533
     [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
5465 5534
     [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
5466 5535
      "" | " "*) ;;
@@ -5484,7 +5553,7 @@ esac
5484 5553
 #
5485 5554
 wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
5486 5555
 AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
5487
-  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
5556
+  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
5488 5557
   $lt_tmp_static_flag,
5489 5558
   [],
5490 5559
   [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
@@ -5500,7 +5569,7 @@ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
5500 5569
 ifelse([$1],[CXX],[
5501 5570
   _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
5502 5571
   case $host_os in
5503
-  aix4* | aix5*)
5572
+  aix[[4-9]]*)
5504 5573
     # If we're using GNU nm, then we don't want the "-C" option.
5505 5574
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
5506 5575
     if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
@@ -5522,6 +5591,7 @@ ifelse([$1],[CXX],[
5522 5591
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
5523 5592
   ;;
5524 5593
   esac
5594
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
5525 5595
 ],[
5526 5596
   runpath_var=
5527 5597
   _LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -5552,12 +5622,14 @@ ifelse([$1],[CXX],[
5552 5622
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
5553 5623
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
5554 5624
   # as well as any symbol that contains `d'.
5555
-  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
5625
+  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
5556 5626
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
5557 5627
   # platforms (ab)use it in PIC code, but their linkers get confused if
5558 5628
   # the symbol is explicitly referenced.  Since portable code cannot
5559 5629
   # rely on this symbol name, it's probably fine to never include it in
5560 5630
   # preloaded symbol tables.
5631
+  # Exclude shared library initialization/finalization symbols.
5632
+dnl Note also adjust exclude_expsyms for C++ above.
5561 5633
   extract_expsyms_cmds=
5562 5634
   # Just being paranoid about ensuring that cc_basename is set.
5563 5635
   _LT_CC_BASENAME([$compiler])
@@ -5607,7 +5679,7 @@ ifelse([$1],[CXX],[
5607 5679
 
5608 5680
     # See if GNU ld supports shared libraries.
5609 5681
     case $host_os in
5610
-    aix3* | aix4* | aix5*)
5682
+    aix[[3-9]]*)
5611 5683
       # On AIX/PPC, the GNU linker is very broken
5612 5684
       if test "$host_cpu" != ia64; then
5613 5685
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -5827,7 +5899,7 @@ _LT_EOF
5827 5899
       fi
5828 5900
       ;;
5829 5901
 
5830
-    aix4* | aix5*)
5902
+    aix[[4-9]]*)
5831 5903
       if test "$host_cpu" = ia64; then
5832 5904
 	# On IA64, the linker does run time linking by default, so we don't
5833 5905
 	# have to do anything special.
@@ -5847,7 +5919,7 @@ _LT_EOF
5847 5919
 	# Test if we are trying to use run time linking or normal
5848 5920
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
5849 5921
 	# need to do runtime linking.
5850
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
5922
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
5851 5923
 	  for ld_flag in $LDFLAGS; do
5852 5924
   	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
5853 5925
   	    aix_use_runtimelinking=yes
@@ -6007,11 +6079,10 @@ _LT_EOF
6007 6079
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
6008 6080
     if test "$GCC" = yes ; then
6009 6081
     	output_verbose_link_cmd='echo'
6010
-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
6011
-      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
6012
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
6013
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
6014
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
6082
+        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
6083
+        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
6084
+        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
6085
+        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
6015 6086
     else
6016 6087
       case $cc_basename in
6017 6088
         xlc*)

+ 5
- 2
autogen.sh View File

@@ -62,6 +62,9 @@ elif (automake-1.8 --version) < /dev/null > /dev/null 2>&1; then
62 62
 elif (automake-1.9 --version) < /dev/null > /dev/null 2>&1; then
63 63
    AUTOMAKE=automake-1.9
64 64
    ACLOCAL=aclocal-1.9
65
+elif (automake-1.10 --version) < /dev/null > /dev/null 2>&1; then
66
+   AUTOMAKE=automake-1.10
67
+   ACLOCAL=aclocal-1.10
65 68
 elif (automake-1.6 --version) < /dev/null > /dev/null 2>&1; then
66 69
    AUTOMAKE=automake-1.6
67 70
    ACLOCAL=aclocal-1.6
@@ -112,7 +115,7 @@ test $TEST_TYPE $FILE || {
112 115
 echo
113 116
 echo "I am going to run ./configure with the following arguments:"
114 117
 echo
115
-echo "  --enable-maintainer-mode --prefix=/usr $AUTOGEN_CONFIGURE_ARGS $@"
118
+echo "  --enable-maintainer-mode --prefix=/usr --enable-install-man $AUTOGEN_CONFIGURE_ARGS $@"
116 119
 echo
117 120
 
118 121
 if test -z "$*"; then
@@ -161,7 +164,7 @@ libtoolize --force --copy || exit 1
161 164
 
162 165
 cd $ORIGDIR
163 166
 
164
-$srcdir/configure --enable-maintainer-mode --prefix=/usr $AUTOGEN_CONFIGURE_ARGS "$@"
167
+$srcdir/configure --enable-maintainer-mode --prefix=/usr --enable-install-man $AUTOGEN_CONFIGURE_ARGS "$@"
165 168
 RC=$?
166 169
 if test $RC -ne 0; then
167 170
   echo

+ 3
- 3
config.guess View File

@@ -4,7 +4,7 @@
4 4
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
5 5
 #   Inc.
6 6
 
7
-timestamp='2007-03-06'
7
+timestamp='2007-07-22'
8 8
 
9 9
 # This file is free software; you can redistribute it and/or modify it
10 10
 # under the terms of the GNU General Public License as published by
@@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
330 330
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331 331
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
332 332
 	exit ;;
333
-    i86pc:SunOS:5.*:*)
333
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
334 334
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335 335
 	exit ;;
336 336
     sun4*:SunOS:6*:*)
@@ -793,7 +793,7 @@ EOF
793 793
 	exit ;;
794 794
     *:Interix*:[3456]*)
795 795
     	case ${UNAME_MACHINE} in
796
-	    x86) 
796
+	    x86)
797 797
 		echo i586-pc-interix${UNAME_RELEASE}
798 798
 		exit ;;
799 799
 	    EM64T | authenticamd)

+ 2
- 2
config.h.in View File

@@ -42,8 +42,8 @@
42 42
 /* Library current version */
43 43
 #undef LTVERSION_CURRENT
44 44
 
45
-/* Library release */
46
-#undef LTVERSION_RELEASE
45
+/* Library revision */
46
+#undef LTVERSION_REVISON
47 47
 
48 48
 /* Name of package */
49 49
 #undef PACKAGE

+ 7
- 3
config.sub View File

@@ -4,7 +4,7 @@
4 4
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
5 5
 #   Inc.
6 6
 
7
-timestamp='2007-01-18'
7
+timestamp='2007-06-28'
8 8
 
9 9
 # This file is (in principle) common to ALL GNU software.
10 10
 # The presence of a machine in this file suggests that SOME GNU software
@@ -475,8 +475,8 @@ case $basic_machine in
475 475
 		basic_machine=craynv-cray
476 476
 		os=-unicosmp
477 477
 		;;
478
-	cr16c)
479
-		basic_machine=cr16c-unknown
478
+	cr16)
479
+		basic_machine=cr16-unknown
480 480
 		os=-elf
481 481
 		;;
482 482
 	crds | unos)
@@ -683,6 +683,10 @@ case $basic_machine in
683 683
 		basic_machine=i386-pc
684 684
 		os=-mingw32
685 685
 		;;
686
+	mingw32ce)
687
+		basic_machine=arm-unknown
688
+		os=-mingw32ce
689
+		;;
686 690
 	miniframe)
687 691
 		basic_machine=m68000-convergent
688 692
 		;;

+ 609
- 191
configure
File diff suppressed because it is too large
View File


+ 16
- 6
configure.ac View File

@@ -14,15 +14,15 @@ m4_define([library_name], [liblqr-api_version])
14 14
 
15 15
 dnl These three define the library version number
16 16
 m4_define([package_major_version], [0])
17
-m4_define([package_minor_version], [1])
17
+m4_define([package_minor_version], [2])
18 18
 m4_define([package_micro_version], [0])
19 19
 
20 20
 m4_define([package_version],
21 21
           [package_major_version.package_minor_version.package_micro_version])
22 22
 
23
-m4_define([ltversion_current], [0])
24
-m4_define([ltversion_release], [0])
25
-m4_define([ltversion_age], [0])
23
+m4_define([ltversion_current], [1])
24
+m4_define([ltversion_revision], [0])
25
+m4_define([ltversion_age], [1])
26 26
 
27 27
 AC_INIT([library_name], [package_version])
28 28
 
@@ -33,7 +33,7 @@ AC_DEFINE(PACKAGE_MINOR_VERSION, package_minor_version, [Package minor version])
33 33
 AC_DEFINE(PACKAGE_MICRO_VERSION, package_micro_version, [Package micro version])
34 34
 
35 35
 AC_DEFINE(LTVERSION_CURRENT, ltversion_current, [Library current version])
36
-AC_DEFINE(LTVERSION_RELEASE, ltversion_release, [Library release])
36
+AC_DEFINE(LTVERSION_REVISON, ltversion_revision, [Library revision])
37 37
 AC_DEFINE(LTVERSION_AGE, ltversion_age, [Library age])
38 38
 
39 39
 LIBRARY_BASE_NAME=library_base_name
@@ -48,7 +48,7 @@ AC_SUBST(LIBRARY_SNAME)
48 48
 PACKAGE_VERSION=package_major_version.package_minor_version.package_micro_version
49 49
 AC_SUBST(PACKAGE_VERSION)
50 50
 
51
-LTVERSION=ltversion_current:ltversion_release:ltversion_age
51
+LTVERSION=ltversion_current:ltversion_revision:ltversion_age
52 52
 AC_SUBST(LTVERSION)
53 53
 
54 54
 AC_CONFIG_SRCDIR([lqr/lqr_carver.c])
@@ -103,8 +103,18 @@ AC_SUBST(DATADIR)
103 103
 AC_CONFIG_FILES([
104 104
 Makefile
105 105
 lqr/Makefile
106
+man/Makefile
106 107
 lqr-1.pc
107 108
 ])
108 109
 
110
+AC_ARG_ENABLE([install-man],
111
+     [  --enable-install-man    Install man pages],
112
+     [case "${enableval}" in
113
+       yes) install_man=true ;;
114
+       no)  install_man=false ;;
115
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-install-man]) ;;
116
+     esac],[install_man=false])
117
+AM_CONDITIONAL([INSTMAN], [test x$install_man = xtrue])
118
+
109 119
 
110 120
 AC_OUTPUT

+ 30
- 5
docs/Makefile View File

@@ -1,22 +1,26 @@
1 1
 name = liblqr_manual
2 2
 source = $(name).docbook
3 3
 dest = html/index.html
4
+dest_op = $(name)_onepage.html
5
+dest_man = man3/lqr_carver_new.3
6
+dest_dist_man = ../man/lqr_carver_new.3
4 7
 main = $(name).html
5 8
 
6 9
 stylesheet = lqr_style.xsl
10
+stylesheet_op = lqr_style_onepage.xsl
11
+stylesheet_man = lqr_style_man.xsl
7 12
 redir = redir-html
8 13
 
9
-.PHONY : all sgml xml
14
+.PHONY : all sgml xml onepage man dist-man clean-dist-man
10 15
 
11
-
12
-all: xml
16
+all: html
13 17
 
14 18
 #sgml : $(dest)
15 19
 
16 20
 #$(dest): $(source)
17 21
 #	docbook2html $(source) -o html
18 22
 
19
-xml: $(main)
23
+html: $(main)
20 24
 
21 25
 $(main) : $(dest)
22 26
 	cp -f $(redir) $(main)
@@ -26,5 +30,26 @@ $(dest): $(source) $(stylesheet)
26 30
 	cd html; \
27 31
 	xsltproc ../$(stylesheet) ../$(source)
28 32
 
33
+man : $(dest_man)
34
+
35
+$(dest_man) : $(source) $(stylesheet_man)
36
+	[ -d man3 ] || mkdir man3
37
+	xsltproc -o man3/ $(stylesheet_man) $(source)
38
+
39
+onepage: $(dest_op)
40
+	
41
+$(dest_op): $(source) $(stylesheet_op)
42
+	xsltproc -o $(dest_op) $(stylesheet_op) $(source)
43
+
44
+dist-man : $(dest_dist_man)
45
+
46
+$(dest_dist_man) : man
47
+	[ -d ../man ] || mkdir ../man; \
48
+	cp man3/*.3 ../man; \
49
+	./gen-man-makefile.am
50
+
29 51
 clean:
30
-	rm -f html/* $(main)
52
+	rm -f html/* man3/* $(main) $(dest_op)
53
+
54
+clean-dist-man:
55
+	rm -f ../man/*.3

+ 17
- 6
docs/README View File

@@ -2,13 +2,24 @@ LiquidRescale Library Manual
2 2
 ============================
3 3
 
4 4
 The library manual is provided in docbook format.
5
-You can compile an html version of it by just issuing `make'.
6 5
 
7
-However, this assumes that your html specification is located at:
6
+Stylesheets and a makefile are also provided to get html versions and
7
+manual pages.
8 8
 
9
-/usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
9
+*) Issuing `make' or `make html' will produce the manual in html format,
10
+   with the file `liblqr_manual.html' pointing to the manual index.
10 11
 
11
-If this is not the case, edit the file `lqr_style' accordingly.
12
+*) Issuing `make onepage' will produce the manual in html formal in a single
13
+   page, under the name `liblqr_manual_onepage.html'.
12 14
 
13
-After compilation, the file `liblqr_manual.html' will point to
14
-the manual index.
15
+*) Issuing `make man' will produce the man pages in the directory `man3/'.
16
+
17
+However, these assume that `xsltproc' is installed in your system and that
18
+your docbook specifications are located at:
19
+
20
+ html:    /usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
21
+ onepage: /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl
22
+ man:     /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl
23
+
24
+If this is not the case, edit the `lqr_style.xsl', `lqr_style_onepage.xsl'
25
+and `lqr_style_man.xsl' files accordingly.

+ 3177
- 448
docs/liblqr_manual.docbook
File diff suppressed because it is too large
View File


+ 3
- 0
docs/lqr_style.xsl View File

@@ -4,6 +4,9 @@
4 4
 	<!--<xsl:import href="/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl"/>-->
5 5
 	<xsl:param name="use.id.as.filename" select="1"/>
6 6
 	<xsl:param name="funcsynopsis.style">ansi</xsl:param>
7
+	<xsl:param name="function.parens" select="1"></xsl:param>
8
+	<xsl:param name="make.single.year.ranges" select="1"></xsl:param>
9
+	<xsl:param name="make.year.ranges" select="1"></xsl:param>
7 10
 	<xsl:param name="generate.section.toc.level" select="1"></xsl:param>
8 11
 </xsl:stylesheet>
9 12
 

+ 9
- 14
examples/liquidrescale-basic.cpp View File

@@ -1,15 +1,10 @@
1 1
 /* LiquidRescaling Library EXAMPLE program
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5
- * This library implements the algorithm described in the paper
6
- * "Seam Carving for Content-Aware Image Resizing"
7
- * by Shai Avidan and Ariel Shamir
8
- * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
9
- *
10 5
  * This program is free software; you can redistribute it and/or modify
11 6
  * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
7
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 8
 
14 9
  * This program is distributed in the hope that it will be useful,
15 10
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -221,17 +216,17 @@ void help(char *command)
221 216
 guchar *
222 217
 rgb_buffer_from_image (pngwriter * png)
223 218
 {/*{{{*/
224
-  gint x, y, k, bpp;
219
+  gint x, y, k, channels;
225 220
   gint w, h;
226 221
   guchar *buffer;
227 222
 
228 223
   /* get info from the image */
229 224
   w = png->getwidth ();
230 225
   h = png->getheight ();
231
-  bpp = 3;                      // we assume an RGB image here 
226
+  channels = 3;                      // we assume an RGB image here 
232 227
 
233
-  /* allocate memory to store w * h * bpp unsigned chars */
234
-  buffer = g_try_new (guchar, bpp * w * h);
228
+  /* allocate memory to store w * h * channels unsigned chars */
229
+  buffer = g_try_new (guchar, channels * w * h);
235 230
   g_assert (buffer != NULL);
236 231
 
237 232
   /* start iteration (always y first, then x, then colours) */
@@ -239,10 +234,10 @@ rgb_buffer_from_image (pngwriter * png)
239 234
     {
240 235
       for (x = 0; x < w; x++)
241 236
         {
242
-          for (k = 0; k < bpp; k++)
237
+          for (k = 0; k < channels; k++)
243 238
             {
244 239
               /* read the image channel k at position x,y */
245
-              buffer[(y * w + x) * bpp + k] =
240
+              buffer[(y * w + x) * channels + k] =
246 241
                 (guchar) (png->dread (x + 1, y + 1, k + 1) * 255);
247 242
               /* note : the x+1,y+1,k+1 on the right side are
248 243
                *        specific the pngwriter library */
@@ -263,7 +258,7 @@ write_carver_to_image (LqrCarver * r, pngwriter * png)
263 258
   gint w, h;
264 259
 
265 260
   /* make sure the image is RGB */
266
-  CATCH_F (r->bpp == 3);
261
+  CATCH_F (lqr_carver_get_channels(r) == 3);
267 262
 
268 263
   /* resize the image canvas as needed to
269 264
    * fit for the new size

+ 2
- 7
examples/liquidrescale-basic.h View File

@@ -1,15 +1,10 @@
1 1
 /* LiquidRescaling Library EXAMPLE program
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5
- * This library implements the algorithm described in the paper
6
- * "Seam Carving for Content-Aware Image Resizing"
7
- * by Shai Avidan and Ariel Shamir
8
- * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
9
- *
10 5
  * This program is free software; you can redistribute it and/or modify
11 6
  * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
7
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 8
 
14 9
  * This program is distributed in the hope that it will be useful,
15 10
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 95
- 19
examples/liquidrescale.cpp View File

@@ -1,15 +1,10 @@
1 1
 /* LiquidRescaling Library DEMO program
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5
- * This library implements the algorithm described in the paper
6
- * "Seam Carving for Content-Aware Image Resizing"
7
- * by Shai Avidan and Ariel Shamir
8
- * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
9
- *
10 5
  * This program is free software; you can redistribute it and/or modify
11 6
  * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
7
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 8
 
14 9
  * This program is distributed in the hope that it will be useful,
15 10
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -35,6 +30,8 @@ gchar *disc_infile = NULL;
35 30
 gchar *disc_outfile = NULL;
36 31
 gchar *vmap_infile = NULL;
37 32
 gchar *vmap_outfile = NULL;
33
+gchar *rigmask_infile = NULL;
34
+gchar *rigmask_outfile = NULL;
38 35
 gint new_width = 0;
39 36
 gint new_height = 0;
40 37
 gfloat rigidity = 0;
@@ -42,6 +39,7 @@ gint max_step = 1;
42 39
 gint pres_strength = 1000;
43 40
 gint disc_strength = 1000;
44 41
 LqrResizeOrder res_order = LQR_RES_ORDER_HOR;
42
+gint side_switch_frequency = 0;
45 43
 
46 44
 gfloat new_width_p = 0;
47 45
 gfloat new_height_p = 0;
@@ -172,11 +170,42 @@ main (int argc, char **argv)
172 170
 	}
173 171
     }
174 172
 
173
+  /*** read and check the rigidity mask ***/
174
+  pngwriter png_rigmask;
175
+
176
+  if (rigmask_infile)
177
+    {
178
+      info_msg ("will read rigidity mask from", rigmask_infile);
179
+      if (rigmask_outfile)
180
+        {
181
+	  info_msg ("will write rigidity mask to", rigmask_outfile);
182
+	  png_pmask.pngwriter_rename(rigmask_outfile);
183
+	}
184
+      png_rigmask.readfromfile (rigmask_infile);
185
+      if (rigmask_outfile)
186
+        {
187
+	  if (png_rigmask.getwidth () != old_width)
188
+	    {
189
+	      cerr << "Fatal error: rigidity mask width does not match input file width" << endl;
190
+	      cerr << "cannot honour the --rigmask-out-file option" << endl;
191
+	      exit (1);
192
+	    }
193
+	  if (png_rigmask.getheight () != old_height)
194
+	    {
195
+	      cerr << "Fatal error: rigidity mask height does not match input file height" << endl;
196
+	      cerr << "cannot honour the --rigmask-out-file option" << endl;
197
+	      exit (1);
198
+	    }
199
+	}
200
+    }
201
+
202
+
175 203
   /* convert the images into rgb buffers to use them with the library */
176 204
 
177 205
   guchar *rgb_buffer;
178 206
   guchar *rgb_pres_buffer = NULL;
179 207
   guchar *rgb_disc_buffer = NULL;
208
+  guchar *rgb_rigmask_buffer = NULL;
180 209
 
181 210
   TRAP_N (rgb_buffer = rgb_buffer_from_image (&png));
182 211
   if (pres_infile)
@@ -187,6 +216,10 @@ main (int argc, char **argv)
187 216
     {
188 217
       TRAP_N (rgb_disc_buffer = rgb_buffer_from_image (&png_dmask));
189 218
     }
219
+  if (rigmask_infile)
220
+    {
221
+      TRAP_N (rgb_rigmask_buffer = rgb_buffer_from_image (&png_rigmask));
222
+    }
190 223
 
191 224
   if (!quiet)
192 225
     {
@@ -222,6 +255,13 @@ main (int argc, char **argv)
222 255
       TRAP (lqr_carver_attach(carver, disc_carver));
223 256
     }
224 257
 
258
+  LqrCarver *rigmask_carver;
259
+  if (rigmask_outfile)
260
+    {
261
+      TRAP_N (rigmask_carver = lqr_carver_new(rgb_rigmask_buffer, old_width, old_height, 3));
262
+      TRAP (lqr_carver_attach(carver, rigmask_carver));
263
+    }
264
+
225 265
   /* (I.3) next step depends on whether we have a pre-computed
226 266
    *       map to use or not*/
227 267
   if (!vmap_infile)
@@ -241,6 +281,13 @@ main (int argc, char **argv)
241 281
 	  TRAP_N (rgb_disc_buffer = rgb_buffer_from_image (&png_dmask));
242 282
 	  TRAP (lqr_carver_bias_add_rgb (carver, rgb_disc_buffer, -disc_strength, 3)); 
243 283
 	}
284
+      if (rigmask_infile)
285
+	{
286
+	  TRAP_N (rgb_rigmask_buffer = rgb_buffer_from_image (&png_rigmask));
287
+	  TRAP (lqr_carver_rigmask_add_rgb (carver, rgb_rigmask_buffer, 3)); 
288
+	}
289
+      /* (I.3b.3) set the side switch frequency */
290
+      lqr_carver_set_side_switch_frequency(carver, side_switch_frequency);
244 291
     }
245 292
   else
246 293
     {
@@ -322,8 +369,13 @@ main (int argc, char **argv)
322 369
   if (disc_outfile)
323 370
     {
324 371
       TRAP (write_carver_to_image (lqr_carver_list_current(carver_list), &png_dmask));
372
+      lqr_carver_list_next(carver_list);
325 373
     }
326
-
374
+  if (rigmask_outfile)
375
+    {
376
+      TRAP (write_carver_to_image (lqr_carver_list_current(carver_list), &png_rigmask));
377
+    }
378
+ 
327 379
 
328 380
 
329 381
   /*** close files (write the images on disk) ***/
@@ -337,6 +389,10 @@ main (int argc, char **argv)
337 389
     {
338 390
       png_dmask.close();
339 391
     }
392
+  if (rigmask_outfile)
393
+    {
394
+      png_rigmask.close();
395
+    }
340 396
 
341 397
 
342 398
   return 0;
@@ -361,9 +417,12 @@ LqrRetVal parse_command_line (int argc, char **argv)
361 417
     {"disc-file", required_argument, NULL, 'd'},
362 418
     {"disc-out-file", required_argument, NULL, 'D'},
363 419
     {"disc-strength", required_argument, NULL, 'x'},
420
+    {"rigmask-file", required_argument, NULL, 'k'},
421
+    {"rigmask-out-file", required_argument, NULL, 'K'},
364 422
     {"vmap-out-file", required_argument, NULL, 'v'},
365 423
     {"vmap-in-file", required_argument, NULL, 'V'},
366 424
     {"vertical-first", no_argument, NULL, 't'},
425
+    {"side-switch-frequency", no_argument, NULL, 'n'},
367 426
     {"quiet", no_argument, NULL, 'q'},
368 427
     {"help", no_argument, NULL, '#'},
369 428
     {NULL,0,NULL,0}
@@ -371,7 +430,7 @@ LqrRetVal parse_command_line (int argc, char **argv)
371 430
 
372 431
 
373 432
 
374
-  while ((c = getopt_long(argc, argv, "f:,o:,w:,h:,r:,s:,p:,P:,z:,d:,D:,x:,v:,V:,tq", lopts, &i)) != EOF) {
433
+  while ((c = getopt_long(argc, argv, "f:,o:,w:,h:,r:,s:,p:,P:,z:,d:,D:,x:,k:,K:,v:,V:,t,n:,q", lopts, &i)) != EOF) {
375 434
     switch (c)
376 435
     {
377 436
       case 'f':
@@ -426,6 +485,12 @@ LqrRetVal parse_command_line (int argc, char **argv)
426 485
       case 'x':
427 486
 	disc_strength = atoi (optarg);
428 487
 	break;
488
+      case 'k':
489
+	rigmask_infile = optarg;
490
+	break;
491
+      case 'K':
492
+	rigmask_outfile = optarg;
493
+	break;
429 494
       case 'v':
430 495
 	vmap_infile = optarg;
431 496
 	break;
@@ -435,6 +500,9 @@ LqrRetVal parse_command_line (int argc, char **argv)
435 500
       case 't':
436 501
 	res_order = LQR_RES_ORDER_VERT;
437 502
 	break;
503
+      case 'n':
504
+	side_switch_frequency = atoi(optarg);
505
+	break;
438 506
       case 'q':
439 507
 	quiet = 1;
440 508
 	break;
@@ -477,6 +545,13 @@ LqrRetVal parse_command_line (int argc, char **argv)
477 545
       return LQR_ERROR;
478 546
     }
479 547
 
548
+  if (rigmask_outfile && !rigmask_infile)
549
+    {
550
+      cerr << "Option --rigmask-out-file can't be used without --rigmask-in-file." << endl;
551
+      return LQR_ERROR;
552
+    }
553
+
554
+
480 555
   if (pres_strength < 0)
481 556
     {
482 557
       cerr << "Preservation strength cannot be negative." << endl;
@@ -549,6 +624,8 @@ void help(char *command)
549 624
   cout << "        Writes the visibility map in the specified file. Currently, only the first one." << endl;
550 625
   cout << "    -t or --vertical-first" << endl;
551 626
   cout << "        Rescale vertically first (instead of horizontally)." << endl;
627
+  cout << "    -n <frequency> or --side-switch-frequency <frequency>" << endl;
628
+  cout << "        Set the number of switches of the side choice for each size modification." << endl;
552 629
   cout << "    -q or --quiet" << endl;
553 630
   cout << "        Quiet mode." << endl;
554 631
   cout << "    --help" << endl;
@@ -562,17 +639,17 @@ void help(char *command)
562 639
 guchar *
563 640
 rgb_buffer_from_image (pngwriter * png)
564 641
 {/*{{{*/
565
-  gint x, y, k, bpp;
642
+  gint x, y, k, channels;
566 643
   gint w, h;
567 644
   guchar *buffer;
568 645
 
569 646
   /* get info from the image */
570 647
   w = png->getwidth ();
571 648
   h = png->getheight ();
572
-  bpp = 3;                      // we assume an RGB image here 
649
+  channels = 3;                      // we assume an RGB image here 
573 650
 
574
-  /* allocate memory to store w * h * bpp unsigned chars */
575
-  buffer = g_try_new (guchar, bpp * w * h);
651
+  /* allocate memory to store w * h * channels unsigned chars */
652
+  buffer = g_try_new (guchar, channels * w * h);
576 653
   g_assert (buffer != NULL);
577 654
 
578 655
   /* start iteration (always y first, then x, then colours) */
@@ -580,10 +657,10 @@ rgb_buffer_from_image (pngwriter * png)
580 657
     {
581 658
       for (x = 0; x < w; x++)
582 659
         {
583
-          for (k = 0; k < bpp; k++)
660
+          for (k = 0; k < channels; k++)
584 661
             {
585 662
               /* read the image channel k at position x,y */
586
-              buffer[(y * w + x) * bpp + k] =
663
+              buffer[(y * w + x) * channels + k] =
587 664
                 (guchar) (png->dread (x + 1, y + 1, k + 1) * 255);
588 665
               /* note : the x+1,y+1,k+1 on the right side are
589 666
                *        specific the pngwriter library */
@@ -604,11 +681,10 @@ write_carver_to_image (LqrCarver * r, pngwriter * png)
604 681
   gint w, h;
605 682
 
606 683
   /* make sure the image is RGB */
607
-  CATCH_F (lqr_carver_get_bpp(r) == 3);
684
+  CATCH_F (lqr_carver_get_channels(r) == 3);
608 685
 
609 686
   /* resize the image canvas as needed to
610
-   * fit for the new size
611
-   * (remember it may be transposed) */
687
+   * fit for the new size */
612 688
   w = lqr_carver_get_width (r);
613 689
   h = lqr_carver_get_height (r);
614 690
   png->resize (w, h);
@@ -616,7 +692,7 @@ write_carver_to_image (LqrCarver * r, pngwriter * png)
616 692
   /* initialize image reading */
617 693
   lqr_carver_scan_reset (r);
618 694
 
619
-  /* readout (no nedd to init rgb) */
695
+  /* readout (no need to init rgb) */
620 696
   while (lqr_carver_scan(r, &x, &y, &rgb))
621 697
     {
622 698
       /* convert the output into doubles */

+ 2
- 7
examples/liquidrescale.h View File

@@ -1,15 +1,10 @@
1 1
 /* LiquidRescaling Library DEMO program
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5
- * This library implements the algorithm described in the paper
6
- * "Seam Carving for Content-Aware Image Resizing"
7
- * by Shai Avidan and Ariel Shamir
8
- * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
9
- *
10 5
  * This program is free software; you can redistribute it and/or modify
11 6
  * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
7
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 8
 
14 9
  * This program is distributed in the hope that it will be useful,
15 10
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 9
- 2
lqr/Makefile.am View File

@@ -28,6 +28,10 @@ liblqr_1_la_SOURCES = \
28 28
 	lqr_carver_bias.h    \
29 29
 	lqr_carver_bias_pub.h    \
30 30
 	lqr_carver_bias_priv.h    \
31
+	lqr_carver_rigmask.c    \
32
+	lqr_carver_rigmask.h    \
33
+	lqr_carver_rigmask_pub.h    \
34
+	lqr_carver_rigmask_priv.h    \
31 35
 	lqr_vmap.c \
32 36
 	lqr_vmap.h \
33 37
 	lqr_vmap_pub.h \
@@ -41,13 +45,15 @@ liblqr_1_la_SOURCES = \
41 45
 	lqr_progress_pub.h  \
42 46
 	lqr_progress_priv.h
43 47
 
44
-liblqr_1_la_LDFLAGS = -version-info @LTVERSION@ $(GLIB_LIBS) -lm
48
+liblqr_1_la_LDFLAGS = -version-info @LTVERSION@
49
+liblqr_1_la_LIBADD = $(GLIB_LIBS) -lm
45 50
 
46 51
 AM_CPPFLAGS = \
47 52
 	-DDATADIR=\""$(DATADIR)"\"		\
48 53
 	-I$(top_srcdir)		\
49 54
 	@GLIB_CFLAGS@		\
50
-	-I$(includedir)
55
+	-I$(includedir)		\
56
+	-fvisibility=hidden
51 57
 
52 58
 lqr_include0_HEADERS = lqr.h
53 59
 
@@ -59,6 +65,7 @@ lqr_include_HEADERS = lqr_base.h \
59 65
 		      lqr_carver_pub.h \
60 66
 		      lqr_carver_list_pub.h \
61 67
 		      lqr_carver_bias_pub.h    \
68
+		      lqr_carver_rigmask_pub.h    \
62 69
 		      lqr_vmap_pub.h \
63 70
 		      lqr_vmap_list_pub.h \
64 71
 		      lqr_progress_pub.h

+ 18
- 5
lqr/Makefile.in View File

@@ -57,10 +57,11 @@ am__installdirs = "$(DESTDIR)$(lqrdir)" "$(DESTDIR)$(lqr_includedir)" \
57 57
 	"$(DESTDIR)$(lqr_include0dir)"
58 58
 lqrLTLIBRARIES_INSTALL = $(INSTALL)
59 59
 LTLIBRARIES = $(lqr_LTLIBRARIES)
60
-liblqr_1_la_LIBADD =
60
+am__DEPENDENCIES_1 =
61
+liblqr_1_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
61 62
 am_liblqr_1_la_OBJECTS = lqr_gradient.lo lqr_cursor.lo lqr_carver.lo \
62
-	lqr_carver_list.lo lqr_carver_bias.lo lqr_vmap.lo \
63
-	lqr_vmap_list.lo lqr_progress.lo
63
+	lqr_carver_list.lo lqr_carver_bias.lo lqr_carver_rigmask.lo \
64
+	lqr_vmap.lo lqr_vmap_list.lo lqr_progress.lo
64 65
 liblqr_1_la_OBJECTS = $(am_liblqr_1_la_OBJECTS)
65 66
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
66 67
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -104,6 +105,7 @@ CYGPATH_W = @CYGPATH_W@
104 105
 DATADIR = @DATADIR@
105 106
 DEFS = @DEFS@
106 107
 DEPDIR = @DEPDIR@
108
+DSYMUTIL = @DSYMUTIL@
107 109
 ECHO = @ECHO@
108 110
 ECHO_C = @ECHO_C@
109 111
 ECHO_N = @ECHO_N@
@@ -120,6 +122,8 @@ INSTALL_DATA = @INSTALL_DATA@
120 122
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
121 123
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
122 124
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
125
+INSTMAN_FALSE = @INSTMAN_FALSE@
126
+INSTMAN_TRUE = @INSTMAN_TRUE@
123 127
 LDFLAGS = @LDFLAGS@
124 128
 LIBOBJS = @LIBOBJS@
125 129
 LIBRARY_BASE_NAME = @LIBRARY_BASE_NAME@
@@ -134,6 +138,7 @@ MAINT = @MAINT@
134 138
 MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
135 139
 MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
136 140
 MAKEINFO = @MAKEINFO@
141
+NMEDIT = @NMEDIT@
137 142
 OBJEXT = @OBJEXT@
138 143
 PACKAGE = @PACKAGE@
139 144
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -222,6 +227,10 @@ liblqr_1_la_SOURCES = \
222 227
 	lqr_carver_bias.h    \
223 228
 	lqr_carver_bias_pub.h    \
224 229
 	lqr_carver_bias_priv.h    \
230
+	lqr_carver_rigmask.c    \
231
+	lqr_carver_rigmask.h    \
232
+	lqr_carver_rigmask_pub.h    \
233
+	lqr_carver_rigmask_priv.h    \
225 234
 	lqr_vmap.c \
226 235
 	lqr_vmap.h \
227 236
 	lqr_vmap_pub.h \
@@ -235,12 +244,14 @@ liblqr_1_la_SOURCES = \
235 244
 	lqr_progress_pub.h  \
236 245
 	lqr_progress_priv.h
237 246
 
238
-liblqr_1_la_LDFLAGS = -version-info @LTVERSION@ $(GLIB_LIBS) -lm
247
+liblqr_1_la_LDFLAGS = -version-info @LTVERSION@
248
+liblqr_1_la_LIBADD = $(GLIB_LIBS) -lm
239 249
 AM_CPPFLAGS = \
240 250
 	-DDATADIR=\""$(DATADIR)"\"		\
241 251
 	-I$(top_srcdir)		\
242 252
 	@GLIB_CFLAGS@		\
243
-	-I$(includedir)
253
+	-I$(includedir)		\
254
+	-fvisibility=hidden
244 255
 
245 256
 lqr_include0_HEADERS = lqr.h
246 257
 lqr_include0dir = $(includedir)/@LIBRARY_SNAME@
@@ -250,6 +261,7 @@ lqr_include_HEADERS = lqr_base.h \
250 261
 		      lqr_carver_pub.h \
251 262
 		      lqr_carver_list_pub.h \
252 263
 		      lqr_carver_bias_pub.h    \
264
+		      lqr_carver_rigmask_pub.h    \
253 265
 		      lqr_vmap_pub.h \
254 266
 		      lqr_vmap_list_pub.h \
255 267
 		      lqr_progress_pub.h
@@ -327,6 +339,7 @@ distclean-compile:
327 339
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_carver.Plo@am__quote@
328 340
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_carver_bias.Plo@am__quote@
329 341
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_carver_list.Plo@am__quote@
342
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_carver_rigmask.Plo@am__quote@
330 343
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_cursor.Plo@am__quote@
331 344
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_gradient.Plo@am__quote@
332 345
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lqr_progress.Plo@am__quote@

+ 3
- 2
lqr/lqr.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
36 36
 #include <lqr/lqr_vmap_list_pub.h>
37 37
 #include <lqr/lqr_carver_list_pub.h>
38 38
 #include <lqr/lqr_carver_bias_pub.h>
39
+#include <lqr/lqr_carver_rigmask_pub.h>
39 40
 #include <lqr/lqr_carver_pub.h>
40 41
 
41 42
 G_END_DECLS

+ 3
- 2
lqr/lqr_all.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
36 36
 #include <lqr/lqr_vmap_list.h>
37 37
 #include <lqr/lqr_carver_list.h>
38 38
 #include <lqr/lqr_carver_bias.h>
39
+#include <lqr/lqr_carver_rigmask.h>
39 40
 #include <lqr/lqr_carver.h>
40 41
 
41 42
 G_END_DECLS

+ 20
- 2
lqr/lqr_base.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,6 +26,8 @@
26 26
 
27 27
 #define LQR_MAX_NAME_LENGTH (1024)
28 28
 
29
+#define LQR_PUBLIC __attribute__((visibility("default")))
30
+
29 31
 #define TRY_N_N(assign) if ((assign) == NULL) { return NULL; }
30 32
 //#define TRY_N_F(assign) if ((assign) == NULL) { return FALSE; }
31 33
 //#define TRY_F_N(assign) if ((assign) == FALSE) { return NULL; }
@@ -77,6 +79,22 @@ typedef enum _LqrRetVal LqrRetVal;
77 79
 } G_STMT_END
78 80
 
79 81
 
82
+/**** IMAGE DEPTH ****/
83
+enum _LqrColDepth
84
+{
85
+  LQR_COLDEPTH_8I,
86
+  LQR_COLDEPTH_16I,
87
+  LQR_COLDEPTH_32F,
88
+  LQR_COLDEPTH_64F,
89
+};
90
+
91
+typedef enum _LqrColDepth LqrColDepth;
92
+
93
+/**** IMAGE BASE TYPES ****/
94
+typedef guchar lqr_t_8i;
95
+typedef gint16 lqr_t_16i;
96
+typedef gfloat lqr_t_32f;
97
+typedef gdouble lqr_t_64f;
80 98
 
81 99
 /**** RESIZE ORDER ****/
82 100
 enum _LqrResizeOrder

+ 433
- 149
lqr/lqr_carver.c
File diff suppressed because it is too large
View File


+ 2
- 2
lqr/lqr_carver.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 30
- 17
lqr/lqr_carver_bias.c View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -30,19 +30,25 @@
30 30
 
31 31
 /**** LQR_CARVER_BIAS STRUCT FUNTIONS ****/
32 32
 
33
+LQR_PUBLIC
33 34
 LqrRetVal
34 35
 lqr_carver_bias_add_area(LqrCarver *r, gdouble *buffer, gint bias_factor, gint width, gint height, gint x_off, gint y_off)
35 36
 {
36 37
   gint x, y;
37 38
   gint x1, y1, x2, y2;
38
-  gdouble bias;
39
+  gfloat bias;
39 40
 
40 41
   if (bias_factor == 0)
41 42
     {
42
-      return TRUE;
43
+      return LQR_OK;
43 44
     }
44 45
 
45 46
   CATCH_F (r->active);
47
+  if ((r->w != r->w0) || (r->w_start != r->w0) ||
48
+      (r->h != r->h0) || (r->h_start != r->h0))
49
+    {
50
+      CATCH (lqr_carver_flatten(r));
51
+    }
46 52
   if (r->transposed)
47 53
     {
48 54
       CATCH (lqr_carver_transpose(r));
@@ -57,7 +63,7 @@ lqr_carver_bias_add_area(LqrCarver *r, gdouble *buffer, gint bias_factor, gint w
57 63
     {
58 64
       for (x = 0; x < x2 - x1; x++)
59 65
         {
60
-          bias = (double) bias_factor * buffer[y * width + x] / 2;
66
+          bias = (gfloat) ((gdouble) bias_factor * buffer[y * width + x] / 2);
61 67
 
62 68
           r->bias[(y + y1) * r->w0 + (x + x1)] += bias;
63 69
 
@@ -69,21 +75,23 @@ lqr_carver_bias_add_area(LqrCarver *r, gdouble *buffer, gint bias_factor, gint w
69 75
 }
70 76
 
71 77
 
78
+LQR_PUBLIC
72 79
 LqrRetVal
73 80
 lqr_carver_bias_add(LqrCarver *r, gdouble *buffer, gint bias_factor)
74 81
 {
75 82
   return lqr_carver_bias_add_area(r, buffer, bias_factor, r->w0, r->h0, 0, 0);
76 83
 }
77 84
 
85
+LQR_PUBLIC
78 86
 LqrRetVal
79
-lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *rgb, gint bias_factor, gint bpp, gint width, gint height, gint x_off, gint y_off)
87
+lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *rgb, gint bias_factor, gint channels, gint width, gint height, gint x_off, gint y_off)
80 88
 {
81
-  gint x, y, k, c_bpp;
89
+  gint x, y, k, c_channels;
82 90
   gboolean has_alpha;
83 91
   gint x0, y0, x1, y1, x2, y2;
84 92
   gint transposed = 0;
85 93
   gint sum;
86
-  gdouble bias;
94
+  gfloat bias;
87 95
 
88 96
   if (bias_factor == 0)
89 97
     {
@@ -91,15 +99,19 @@ lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *rgb, gint bias_factor, gint b
91 99
     }
92 100
 
93 101
   CATCH_F (r->active);
94
-  CATCH (lqr_carver_flatten(r));
102
+  if ((r->w != r->w0) || (r->w_start != r->w0) ||
103
+      (r->h != r->h0) || (r->h_start != r->h0))
104
+    {
105
+      CATCH (lqr_carver_flatten(r));
106
+    }
95 107
   if (r->transposed)
96 108
     {
97 109
       transposed = 1;
98 110
       CATCH (lqr_carver_transpose(r));
99 111
     }
100 112
 
101
-  has_alpha = (bpp == 2 || bpp >= 4);
102
-  c_bpp = bpp - (has_alpha ? 1 : 0);
113
+  has_alpha = (channels == 2 || channels >= 4);
114
+  c_channels = channels - (has_alpha ? 1 : 0);
103 115
 
104 116
   x0 = MIN (0, x_off);
105 117
   y0 = MIN (0, y_off);
@@ -113,15 +125,15 @@ lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *rgb, gint bias_factor, gint b
113 125
       for (x = 0; x < x2 - x1; x++)
114 126
         {
115 127
           sum = 0;
116
-          for (k = 0; k < c_bpp; k++)
128
+          for (k = 0; k < c_channels; k++)
117 129
             {
118
-              sum += rgb[((y - y0) * width + (x - x0)) * bpp + k];
130
+              sum += rgb[((y - y0) * width + (x - x0)) * channels + k];
119 131
             }
120 132
 
121
-          bias = (double) bias_factor * sum / (2 * 255 * c_bpp);
133
+          bias = (gfloat) ((gdouble) bias_factor * sum / (2 * 255 * c_channels));
122 134
           if (has_alpha)
123 135
             {
124
-	      bias *= (gdouble) rgb[((y - y0) * width + (x - x0) + 1) * bpp - 1] / 255;
136
+	      bias *= (gfloat) rgb[((y - y0) * width + (x - x0) + 1) * channels - 1] / 255;
125 137
             }
126 138
 
127 139
           r->bias[(y + y1) * r->w0 + (x + x1)] += bias;
@@ -138,10 +150,11 @@ lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *rgb, gint bias_factor, gint b
138 150
   return LQR_OK;
139 151
 }
140 152
 
153
+LQR_PUBLIC
141 154
 LqrRetVal
142
-lqr_carver_bias_add_rgb(LqrCarver *r, guchar *rgb, gint bias_factor, gint bpp)
155
+lqr_carver_bias_add_rgb(LqrCarver *r, guchar *rgb, gint bias_factor, gint channels)
143 156
 {
144
-  return lqr_carver_bias_add_rgb_area(r, rgb, bias_factor, bpp, r->w0, r->h0, 0, 0);
157
+  return lqr_carver_bias_add_rgb_area(r, rgb, bias_factor, channels, r->w0, r->h0, 0, 0);
145 158
 }
146 159
 
147 160
 

+ 2
- 2
lqr/lqr_carver_bias.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2
- 2
lqr/lqr_carver_bias_priv.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 4
- 4
lqr/lqr_carver_bias_pub.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -29,8 +29,8 @@
29 29
 
30 30
 /* PUBLIC BIAS-RELATED FUNCTIONS */
31 31
 
32
-LqrRetVal lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *buffer, gint bias_factor, gint bpp, gint width, gint height, gint x_off, gint y_off);
33
-LqrRetVal lqr_carver_bias_add_rgb(LqrCarver *r, guchar *buffer, gint bias_factor, gint bpp);
32
+LqrRetVal lqr_carver_bias_add_rgb_area(LqrCarver *r, guchar *buffer, gint bias_factor, gint channels, gint width, gint height, gint x_off, gint y_off);
33
+LqrRetVal lqr_carver_bias_add_rgb(LqrCarver *r, guchar *buffer, gint bias_factor, gint channels);
34 34
 LqrRetVal lqr_carver_bias_add_area(LqrCarver *r, gdouble *buffer, gint bias_factor, gint width, gint height, gint x_off, gint y_off);
35 35
 LqrRetVal lqr_carver_bias_add(LqrCarver *r, gdouble *buffer, gint bias_factor);
36 36
 

+ 7
- 3
lqr/lqr_carver_list.c View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +22,7 @@
22 22
 
23 23
 #include <glib.h>
24 24
 
25
-#include <lqr/lqr_all.h>
25
+#include <lqr.h>
26 26
 
27 27
 #ifdef __LQR_DEBUG__
28 28
 #include <assert.h>
@@ -69,12 +69,14 @@ lqr_carver_list_destroy(LqrCarverList * list)
69 69
     }
70 70
 }
71 71
 
72
+LQR_PUBLIC
72 73
 LqrCarverList *
73 74
 lqr_carver_list_start (LqrCarver *r)
74 75
 {
75 76
   return r->attached_list;
76 77
 }
77 78
 
79
+LQR_PUBLIC
78 80
 LqrCarverList *
79 81
 lqr_carver_list_next (LqrCarverList * list)
80 82
 {
@@ -82,6 +84,7 @@ lqr_carver_list_next (LqrCarverList * list)
82 84
   return list->next;
83 85
 }
84 86
 
87
+LQR_PUBLIC
85 88
 LqrCarver *
86 89
 lqr_carver_list_current (LqrCarverList * list)
87 90
 {
@@ -89,6 +92,7 @@ lqr_carver_list_current (LqrCarverList * list)
89 92
   return list->current;
90 93
 }
91 94
 
95
+LQR_PUBLIC
92 96
 LqrRetVal
93 97
 lqr_carver_list_foreach (LqrCarverList * list, LqrCarverFunc func, LqrDataTok data)
94 98
 {

+ 2
- 2
lqr/lqr_carver_list.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2
- 2
lqr/lqr_carver_list_priv.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2
- 2
lqr/lqr_carver_list_pub.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 103
- 9
lqr/lqr_carver_priv.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -43,8 +43,100 @@
43 43
 #error "lqr_vmap_list.h must be included prior to lqr_carver_priv.h"
44 44
 #endif /* __LQR_VMAP_LIST_H__ */
45 45
 
46
+/* Macros for internal use */
47
+
48
+#define AS_8I(x) ((lqr_t_8i*)x)
49
+#define AS_16I(x) ((lqr_t_16i*)x)
50
+#define AS_32F(x) ((lqr_t_32f*)x)
51
+#define AS_64F(x) ((lqr_t_64f*)x)
52
+
53
+#define AS2_8I(x) ((lqr_t_8i**)x)
54
+#define AS2_16I(x) ((lqr_t_16i**)x)
55
+#define AS2_32F(x) ((lqr_t_32f**)x)
56
+#define AS2_64F(x) ((lqr_t_64f**)x)
57
+
58
+#define PXL_COPY(dest, dest_ind, src, src_ind, col_depth) \
59
+	do { \
60
+          switch (col_depth) \
61
+            { \
62
+              case LQR_COLDEPTH_8I: \
63
+                AS_8I(dest)[dest_ind] = AS_8I(src)[src_ind]; \
64
+                break; \
65
+              case LQR_COLDEPTH_16I: \
66
+                AS_16I(dest)[dest_ind] = AS_16I(src)[src_ind]; \
67
+                break; \
68
+              case LQR_COLDEPTH_32F: \
69
+                AS_32F(dest)[dest_ind] = AS_32F(src)[src_ind]; \
70
+                break; \
71
+              case LQR_COLDEPTH_64F: \
72
+                AS_64F(dest)[dest_ind] = AS_64F(src)[src_ind]; \
73
+                break; \
74
+            } \
75
+	} while (0)
76
+
77
+#define BUF_POINTER_COPY(dest, src, col_depth) \
78
+	do { \
79
+          switch (col_depth) \
80
+            { \
81
+              case LQR_COLDEPTH_8I: \
82
+                *AS2_8I(dest) = AS_8I(src); \
83
+                break; \
84
+              case LQR_COLDEPTH_16I: \
85
+                *AS2_16I(dest) = AS_16I(src); \
86
+                break; \
87
+              case LQR_COLDEPTH_32F: \
88
+                *AS2_32F(dest) = AS_32F(src); \
89
+                break; \
90
+              case LQR_COLDEPTH_64F: \
91
+                *AS2_64F(dest) = AS_64F(src); \
92
+                break; \
93
+            } \
94
+	} while (0)
95
+
96
+#define BUF_TRY_NEW_RET_POINTER(dest, size, col_depth) \
97
+	do { \
98
+          switch (col_depth) \
99
+            { \
100
+              case LQR_COLDEPTH_8I: \
101
+                TRY_N_N (dest = g_try_new (lqr_t_8i, size)); \
102
+                break; \
103
+              case LQR_COLDEPTH_16I: \
104
+                TRY_N_N (dest = g_try_new (lqr_t_16i, size)); \
105
+                break; \
106
+              case LQR_COLDEPTH_32F: \
107
+                TRY_N_N (dest = g_try_new (lqr_t_32f, size)); \
108
+                break; \
109
+              case LQR_COLDEPTH_64F: \
110
+                TRY_N_N (dest = g_try_new (lqr_t_64f, size)); \
111
+                break; \
112
+            } \
113
+        } while (0)
114
+
115
+#define BUF_TRY_NEW0_RET_LQR(dest, size, col_depth) \
116
+	do { \
117
+          switch (col_depth) \
118
+            { \
119
+              case LQR_COLDEPTH_8I: \
120
+                CATCH_MEM (dest = g_try_new0 (lqr_t_8i, size)); \
121
+                break; \
122
+              case LQR_COLDEPTH_16I: \
123
+                CATCH_MEM (dest = g_try_new0 (lqr_t_16i, size)); \
124
+                break; \
125
+              case LQR_COLDEPTH_32F: \
126
+                CATCH_MEM (dest = g_try_new0 (lqr_t_32f, size)); \
127
+                break; \
128
+              case LQR_COLDEPTH_64F: \
129
+                CATCH_MEM (dest = g_try_new0 (lqr_t_64f, size)); \
130
+                break; \
131
+            } \
132
+        } while (0)
133
+
134
+
46 135
 /* LQR_CARVER CLASS PRIVATE FUNCTIONS */
47 136
 
137
+/* constructor base */
138
+LqrCarver * lqr_carver_new_common (gint width, gint height, gint channels);
139
+
48 140
 /* build maps */
49 141
 LqrRetVal lqr_carver_build_maps (LqrCarver * r, gint depth);     /* build all */
50 142
 void lqr_carver_build_emap (LqrCarver * r);     /* energy */
@@ -52,7 +144,7 @@ void lqr_carver_build_mmap (LqrCarver * r);     /* minpath */
52 144
 LqrRetVal lqr_carver_build_vsmap (LqrCarver * r, gint depth);    /* visibility */
53 145
 
54 146
 /* internal functions for maps computation */
55
-inline gdouble lqr_carver_read (LqrCarver * r, gint x, gint y); /* read the average value at given point */
147
+inline gfloat lqr_carver_read (LqrCarver * r, gint x, gint y); /* read the average value at given point */
56 148
 void lqr_carver_compute_e (LqrCarver * r, gint x, gint y);      /* compute energy of point at c (fast) */
57 149
 void lqr_carver_update_emap (LqrCarver * r);    /* update energy map after seam removal */
58 150
 void lqr_carver_update_mmap (LqrCarver * r);    /* minpath */
@@ -60,20 +152,22 @@ void lqr_carver_build_vpath (LqrCarver * r);    /* compute seam path */
60 152
 void lqr_carver_carve (LqrCarver * r);  /* updates the "raw" buffer */
61 153
 void lqr_carver_update_vsmap (LqrCarver * r, gint l);   /* update visibility map after seam removal */
62 154
 void lqr_carver_finish_vsmap (LqrCarver * r);   /* complete visibility map (last seam) */
63
-void lqr_carver_copy_vsmap (LqrCarver * r, LqrCarver * dest);   /* copy vsmap on another carver */
64 155
 LqrRetVal lqr_carver_inflate (LqrCarver * r, gint l);    /* adds enlargment info to map */
156
+LqrRetVal lqr_carver_propagate_vsmap (LqrCarver * r);    /* propagates vsmap on attached carvers */
65 157
 
66 158
 /* image manipulations */
67 159
 LqrRetVal lqr_carver_resize_width (LqrCarver * r, gint w1);   /* liquid resize width */
68 160
 LqrRetVal lqr_carver_resize_height (LqrCarver * r, gint h1);   /* liquid resize height */
69 161
 void lqr_carver_set_width (LqrCarver * r, gint w1);
70 162
 LqrRetVal lqr_carver_transpose (LqrCarver * r);
163
+void lqr_carver_scan_reset_all (LqrCarver * r);
71 164
 
72 165
 /* auxiliary */
73
-LqrRetVal lqr_carver_set_width1 (LqrCarver * r, LqrDataTok data);
74
-LqrRetVal lqr_carver_flatten1 (LqrCarver * r, LqrDataTok data);
75
-LqrRetVal lqr_carver_transpose1 (LqrCarver * r, LqrDataTok data);
76
-LqrRetVal lqr_carver_copy_vsmap1 (LqrCarver * r, LqrDataTok data);
77
-LqrRetVal lqr_carver_inflate1 (LqrCarver * r, LqrDataTok data);
166
+LqrRetVal lqr_carver_scan_reset_attached (LqrCarver * r, LqrDataTok data);
167
+LqrRetVal lqr_carver_set_width_attached (LqrCarver * r, LqrDataTok data);
168
+LqrRetVal lqr_carver_inflate_attached (LqrCarver * r, LqrDataTok data);
169
+LqrRetVal lqr_carver_flatten_attached (LqrCarver * r, LqrDataTok data);
170
+LqrRetVal lqr_carver_transpose_attached (LqrCarver * r, LqrDataTok data);
171
+LqrRetVal lqr_carver_propagate_vsmap_attached (LqrCarver * r, LqrDataTok data);
78 172
 
79 173
 #endif /* __LQR_CARVER_PRIV_H__ */

+ 32
- 14
lqr/lqr_carver_pub.h View File

@@ -1,5 +1,5 @@
1 1
 /* LiquidRescaling Library
2
- * Copyright (C) 2007 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 3
  * All Rights Reserved.
4 4
  *
5 5
  * This library implements the algorithm described in the paper
@@ -9,7 +9,7 @@
9 9
  *
10 10
  * This program is free software; you can redistribute it and/or modify
11 11
  * it under the terms of the GNU Lesser General Public License as published by
12
- * the Free Software Foundation; version 3 dated June, 2007.
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13 13
 
14 14
  * This program is distributed in the hope that it will be useful,
15 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +27,10 @@
27 27
 #error "lqr_base.h must be included prior to lqr_carver_pub.h"
28 28
 #endif /* __LQR_BASE_H__ */
29 29
 
30
+#ifndef __LQR_CURSOR_PUB_H__
31
+#error "lqr_cursor_pub.h must be included prior to lqr_carver_pub.h"
32
+#endif /* __LQR_CURSOR_PUB_H__ */
33
+
30 34
 #ifndef __LQR_GRADIENT_PUB_H__
31 35
 #error "lqr_gradient_pub.h must be included prior to lqr_carver_pub.h"
32 36
 #endif /* __LQR_GRADIENT_PUB_H__ */
@@ -39,11 +43,12 @@
39 43
 #error "lqr_vmap_list_pub.h must be included prior to lqr_carver_pub.h"
40 44
 #endif /* __LQR_VMAP_LIST_PUB_H__ */
41 45
 
46
+#ifndef __LQR_PROGRESS_PUB_H__
47
+#error "lqr_progress_pub.h must be included prior to lqr_carver_pub.h"
48
+#endif /* __LQR_PROGRESS_PUB_H__ */
49
+
42 50
 /**** LQR_CARVER CLASS DEFINITION ****/
43
-/* This is the representation of the multisize image
44
- * The image is stored internally as a one-dimentional
45
- * array of LqrData points, called map.
46
- * The points are ordered by rows. */
51
+/* This is the representation of the multisize image */
47 52
 struct _LqrCarver
48 53
 {
49 54
   gint w_start, h_start;        /* original width & height */
@@ -57,10 +62,12 @@ struct _LqrCarver
57 62
                                  * since levels are shifted upon inflation
58 63
                                  */
59 64
 
60
-  gint bpp;                     /* number of bpp of the image */
65
+  gint channels;                /* number of colour channels of the image */
66
+  LqrColDepth col_depth;	/* image colour depth */
61 67
 
62 68
   gint transposed;              /* flag to set transposed state */
63 69
   gboolean active;              /* flag to set if carver is active */
70
+  LqrCarver* root;              /* pointer to the root carver */
64 71
 
65 72
   gboolean resize_aux_layers;   /* flag to determine whether the auxiliary layers are resized */
66 73
   gboolean dump_vmaps;         /* flag to determine whether to output the seam map */
@@ -69,26 +76,30 @@ struct _LqrCarver
69 76
   LqrCarverList *attached_list; /* list of attached carvers */
70 77
 
71 78
   gfloat rigidity;              /* rigidity value (can straighten seams) */
72
-  gdouble *rigidity_map;        /* the rigidity function */
79
+  gfloat *rigidity_map;        /* the rigidity function */
80
+  gfloat *rigidity_mask;	/* the rigidity mask */
73 81
   gint delta_x;                 /* max displacement of seams (currently is only meaningful if 0 or 1 */
74 82
 
75
-  guchar *rgb;                  /* array of rgb points */
83
+  void *rgb;                    /* array of rgb points */
76 84
   gint *vs;                     /* array of visibility levels */
77
-  gdouble *en;                  /* array of energy levels */
78
-  gdouble *bias;                /* array of energy levels */
79
-  gdouble *m;                   /* array of auxiliary energy values */
85
+  gfloat *en;                  /* array of energy levels */
86
+  gfloat *bias;                /* bias mask */
87
+  gfloat *m;                   /* array of auxiliary energy values */
80 88
   gint *least;                  /* array of pointers */
81 89
   gint *_raw;                   /* array of array-coordinates, for seam computation */
82 90
   gint **raw;                   /* array of array-coordinates, for seam computation */
83 91
 
84 92
   LqrCursor *c;                 /* cursor to be used as image reader */
85
-  guchar *rgb_ro_buffer;	/* readout buffer */
93
+  void *rgb_ro_buffer;	        /* readout buffer */
86 94
 
87 95
   gint *vpath;                  /* array of array-coordinates representing a vertical seam */
88 96
   gint *vpath_x;                /* array of abscisses representing a vertical seam */
89 97
 
90 98
   LqrGradFunc gf;                    /* pointer to a gradient function */
91 99
 
100
+  gint leftright;		/* whether to favor left or right seams */
101
+  gint lr_switch_frequency;	/* interval between leftright switches */
102
+
92 103
   LqrProgress * progress;	/* pointer to progress update functions */
93 104
 
94 105
   LqrVMapList * flushed_vs;  /* linked list of pointers to flushed visibility maps buffers */
@@ -99,7 +110,8 @@ struct _LqrCarver
99 110
 /* LQR_CARVER CLASS PUBLIC FUNCTIONS */
100 111
 
101 112
 /* constructor & destructor */
102
-LqrCarver * lqr_carver_new (guchar * buffer, gint width, gint height, gint bpp);
113
+LqrCarver * lqr_carver_new (guchar * buffer, gint width, gint height, gint channels);
114
+LqrCarver * lqr_carver_new_ext (void * buffer, gint width, gint height, gint channels, LqrColDepth colour_depth);
103 115
 void lqr_carver_destroy (LqrCarver * r);
104 116
 
105 117
 /* initialize */
@@ -108,7 +120,9 @@ LqrRetVal lqr_carver_init (LqrCarver *r, gint delta_x, gfloat rigidity);
108 120
 /* set attributes */
109 121
 void lqr_carver_set_gradient_function (LqrCarver * r, LqrGradFuncType gf_ind);
110 122
 void lqr_carver_set_dump_vmaps (LqrCarver *r);
123
+void lqr_carver_set_no_dump_vmaps (LqrCarver *r);
111 124
 void lqr_carver_set_resize_order (LqrCarver *r, LqrResizeOrder resize_order);
125
+void lqr_carver_set_side_switch_frequency (LqrCarver *r, guint switch_frequency);
112 126
 LqrRetVal lqr_carver_attach (LqrCarver * r, LqrCarver * aux);
113 127
 void lqr_carver_set_progress (LqrCarver *r, LqrProgress *p);
114 128
 
@@ -119,11 +133,15 @@ LqrRetVal lqr_carver_flatten (LqrCarver * r);    /* flatten the multisize image
119 133
 /* readout */
120 134
 void lqr_carver_scan_reset (LqrCarver * r);
121 135
 gboolean lqr_carver_scan (LqrCarver *r, gint *x, gint *y, guchar ** rgb);
136
+gboolean lqr_carver_scan_ext (LqrCarver *r, gint *x, gint *y, void ** rgb);
122 137
 gboolean lqr_carver_scan_line (LqrCarver * r, gint * n, guchar ** rgb);
138
+gboolean lqr_carver_scan_line_ext (LqrCarver * r, gint * n, void ** rgb);
123 139
 gboolean lqr_carver_scan_by_row (LqrCarver *r);
124 140
 gint lqr_carver_get_bpp (LqrCarver *r);
141
+gint lqr_carver_get_channels (LqrCarver *r);
125 142
 gint lqr_carver_get_width (LqrCarver * r);
126 143
 gint lqr_carver_get_height (LqrCarver * r);
144
+LqrColDepth lqr_carver_get_col_depth (LqrCarver * r);
127 145
 
128 146
 
129 147
 #endif /* __LQR_CARVER_PUB_H__ */

+ 179
- 0
lqr/lqr_carver_rigmask.c View File

@@ -0,0 +1,179 @@
1
+/* LiquidRescaling Library
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3
+ * All Rights Reserved.
4
+ *
5
+ * This library implements the algorithm described in the paper
6
+ * "Seam Carving for Content-Aware Image Resizing"
7
+ * by Shai Avidan and Ariel Shamir
8
+ * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU Lesser General Public License as published by
12
+ * the Free Software Foundation; version 3 dated June, 2007-2008.
13
+
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU Lesser General Public License for more details.
18
+ 
19
+ * You should have received a copy of the GNU Lesser General Public License
20
+ * along with this program; if not, see <http://www.gnu.org/licenses/> 
21
+ */
22
+
23
+#include <stdio.h>
24
+
25
+#include <lqr/lqr_all.h>
26
+
27
+#ifdef __LQR_DEBUG__
28
+#include <assert.h>
29
+#endif
30
+
31
+/**** LQR_CARVER_RIGMASK STRUCT FUNTIONS ****/
32
+
33
+LqrRetVal
34
+lqr_carver_rigmask_init (LqrCarver *r)
35
+{
36
+  gint y, x;
37
+
38
+  CATCH_F (r->active == TRUE);
39
+
40
+  CATCH_MEM (r->rigidity_mask = g_try_new (gfloat, r->w * r->h));
41
+
42
+  for (y = 0; y < r->h; y++)
43
+    {
44
+      for (x = 0; x < r->w_start; x++)
45
+        {
46
+	  r->rigidity_mask[y * r->w_start + x] = 1;
47
+	}
48
+    }
49
+  return LQR_OK;
50
+}
51
+
52
+
53
+LQR_PUBLIC
54
+LqrRetVal
55
+lqr_carver_rigmask_add_area(LqrCarver *r, gdouble *buffer, gint width, gint height, gint x_off, gint y_off)
56
+{
57
+  gint x, y;
58
+  gint x1, y1, x2, y2;
59
+
60
+  CATCH_F (r->active);
61
+  if (r->rigidity_mask == NULL)
62
+    {
63
+      CATCH (lqr_carver_rigmask_init(r));
64
+    }
65
+
66
+
67
+  if (r->rigidity == 0)
68
+    {
69
+      return LQR_OK;
70
+    }
71
+
72
+  if (r->transposed)
73
+    {
74
+      CATCH (lqr_carver_transpose(r));
75
+    }
76
+
77
+  x1 = MAX (0, x_off);
78
+  y1 = MAX (0, y_off);
79
+  x2 = MIN (r->w, width + x_off);
80
+  y2 = MIN (r->h, height + y_off);
81
+
82
+  for (y = 0; y < y2 - y1; y++)
83
+    {
84
+      for (x = 0; x < x2 - x1; x++)
85
+        {
86
+          r->rigidity_mask[(y + y1) * r->w0 + (x + x1)] = (gfloat) buffer[y * width + x];
87
+        }
88
+
89
+    }
90
+
91
+  return LQR_OK;
92
+}
93
+
94
+
95
+LQR_PUBLIC
96
+LqrRetVal
97
+lqr_carver_rigmask_add(LqrCarver *r, gdouble *buffer)
98
+{
99
+  return lqr_carver_rigmask_add_area(r, buffer, r->w0, r->h0, 0, 0);
100
+}
101
+
102
+LQR_PUBLIC
103
+LqrRetVal
104
+lqr_carver_rigmask_add_rgb_area(LqrCarver *r, guchar *rgb, gint channels, gint width, gint height, gint x_off, gint y_off)
105
+{
106
+  gint x, y, k, c_channels;
107
+  gboolean has_alpha;
108
+  gint x0, y0, x1, y1, x2, y2;
109
+  gint transposed = 0;
110
+  gint sum;
111
+  gdouble rigmask;
112
+
113
+  CATCH_F (r->active);
114
+  if (r->rigidity_mask == NULL)
115
+    {
116
+      CATCH (lqr_carver_rigmask_init(r));
117
+    }
118
+
119
+  if (r->rigidity == 0)
120
+    {
121
+      return TRUE;
122
+    }
123
+
124
+  CATCH (lqr_carver_flatten(r));
125
+  if (r->transposed)
126
+    {
127
+      transposed = 1;
128
+      CATCH (lqr_carver_transpose(r));
129
+    }
130
+
131
+  has_alpha = (channels == 2 || channels >= 4);
132
+  c_channels = channels - (has_alpha ? 1 : 0);
133
+
134
+  x0 = MIN (0, x_off);
135
+  y0 = MIN (0, y_off);
136
+  x1 = MAX (0, x_off);
137
+  y1 = MAX (0, y_off);
138
+  x2 = MIN (r->w0, width + x_off);
139
+  y2 = MIN (r->h0, height + y_off);
140
+
141
+  for (y = 0; y < y2 - y1; y++)
142
+    {
143
+      for (x = 0; x < x2 - x1; x++)
144
+        {
145
+          sum = 0;
146
+          for (k = 0; k < c_channels; k++)
147
+            {
148
+              sum += rgb[((y - y0) * width + (x - x0)) * channels + k];
149
+            }
150
+
151
+          rigmask = (gdouble) sum / (255 * c_channels);
152
+          if (has_alpha)
153
+            {
154
+	      rigmask *= (gdouble) rgb[((y - y0) * width + (x - x0) + 1) * channels - 1] / 255;
155
+            }
156
+
157
+          r->rigidity_mask[(y + y1) * r->w0 + (x + x1)] = (gfloat) rigmask;
158
+
159
+        }
160
+
161
+    }
162
+
163
+  if (transposed)
164
+    {
165
+      CATCH (lqr_carver_transpose(r));
166
+    }
167
+
168
+  return LQR_OK;
169
+}
170
+
171
+LQR_PUBLIC
172
+LqrRetVal
173
+lqr_carver_rigmask_add_rgb(LqrCarver *r, guchar *rgb, gint channels)
174
+{
175
+  return lqr_carver_rigmask_add_rgb_area(r, rgb, channels, r->w0, r->h0, 0, 0);
176
+}
177
+
178
+
179
+/**** END OF LQR_CARVER_RIGMASK CLASS FUNCTIONS ****/

+ 29
- 0
lqr/lqr_carver_rigmask.h View File

@@ -0,0 +1,29 @@
1
+/* LiquidRescaling Library
2
+ * Copyright (C) 2007-2008 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3
+ * All Rights Reserved.
4
+ *