9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re:[9fans] image resampling
@ 2002-04-15 15:57 rog
  0 siblings, 0 replies; 8+ messages in thread
From: rog @ 2002-04-15 15:57 UTC (permalink / raw)
  To: 9fans

> But trying to track down all the bugs made my brain freeze, so I wrote
> the trivial, slow, but non-crashing version you see, using a kaiser
> window.

% wc /sys/src_o/fb/resample.c
    186     641    4559 /sys/src_o/fb/resample.c
% wc /sys/src/cmd/resample.c
    364    1123    7726 /sys/src/cmd/resample.c

is anyone else amused that rob found it easier to rewrite from scratch
a 300+ line program rather than debug an existing 180 line program?
says something about the nature of software, i think.

  rog.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 17:38 rob pike, esq.
  0 siblings, 0 replies; 8+ messages in thread
From: rob pike, esq. @ 2002-04-15 17:38 UTC (permalink / raw)
  To: 9fans

> is this "because there were so many and it's tedious, involved
> work" or "because they were really complicated and dificult to
> track down"?

Mostly the latter. Lots of probes to invalid array addresses, plus
incorrect handling of the situation where the kernel overlaps
the edge of the array.

> would it be possible to
> release however far you got, or even the now-fully-obsolete
> 2nd edition fb suite, under the current license?

I don't have what I did any more because I was promised a rewrite.
I'm not keen to release the fb code because it's obsolete, doesn't
handle our image formats, and doesn't work.  If someone wants to
update it so we can make it available under the new license, that's
fine with me, but a) it's a lot of work and b) these arrangements
have been tried in the past without success.

-rob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 17:20 anothy
  0 siblings, 0 replies; 8+ messages in thread
From: anothy @ 2002-04-15 17:20 UTC (permalink / raw)
  To: 9fans

//But trying to track down all the bugs made my brain freeze...

is this "because there were so many and it's tedious, involved
work" or "because they were really complicated and dificult to
track down"? if the later, i probably don't even want to _look_
at the code. but if the former, could maybe some of us help
with that? i've longed for various tools from the fb suite many
times now, and would be interested in helping to get them out
under the 3rd edition (i've got a 2nd edition license, but have
lost my CD, and am not as excited about doing this sort of
work if i can't share it with people). would it be possible to
release however far you got, or even the now-fully-obsolete
2nd edition fb suite, under the current license?
ア



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 17:20 rog
  0 siblings, 0 replies; 8+ messages in thread
From: rog @ 2002-04-15 17:20 UTC (permalink / raw)
  To: 9fans

> That's a little unfair, since most of those 360+ lines needed to be
> added to the existing 180+ lines to make it work with the new image
> format.

that's true...
plus the fact that i'd put the manual page as comments at the
start of the source :-)

oh well, so much for trite observations.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 16:32 rob pike, esq.
  0 siblings, 0 replies; 8+ messages in thread
From: rob pike, esq. @ 2002-04-15 16:32 UTC (permalink / raw)
  To: 9fans

That's a little unfair, since most of those 360+ lines needed to be
added to the existing 180+ lines to make it work with the new image
format.

-rob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 15:33 rob pike, esq.
  0 siblings, 0 replies; 8+ messages in thread
From: rob pike, esq. @ 2002-04-15 15:33 UTC (permalink / raw)
  To: 9fans

> one of things that impressed me about macos X was the
> speed that it appeared to scale bitmap images. (i.e. real time)
> does anyone know what algorithms they'd be using?

The old resampler from the fb suite used a much more sophisticated
algorithm.  When I tried to convert it to run with the new images,
however, I found the code was riddled with off-by-one (and more)
errors.  The algorithm is clever and sophisticated, generating a
custom filter kernel based on the relative factors of the two sizes.
But trying to track down all the bugs made my brain freeze, so I wrote
the trivial, slow, but non-crashing version you see, using a kaiser
window.  I figured eventually someone would care enough to write a
fancier, faster version.  EHG made such a promise...

That said, the image you get from the existing resampler is, in
information-theoretic terms, very good.  The filter kernel is
excellent; it's just the implementation that's naive.

-rob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15 15:26 rog
  0 siblings, 0 replies; 8+ messages in thread
From: rog @ 2002-04-15 15:26 UTC (permalink / raw)
  To: 9fans

> To downconvert an image you must first filter it and then resample it
[...]
> A lot depends on how "good" your results need to be.

russ's resampler seems to produce nice results, but is
quite slow.

one of things that impressed me about macos X was the
speed that it appeared to scale bitmap images. (i.e. real time)
does anyone know what algorithms they'd be using?

  rog.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re:[9fans] image resampling
@ 2002-04-15  9:39 steve.simon
  0 siblings, 0 replies; 8+ messages in thread
From: steve.simon @ 2002-04-15  9:39 UTC (permalink / raw)
  To: 9fans

Hi,

To downconvert an image you must first filter it and then resample it - If you
don't filter first then
you get aliasing (similar to the effect of cart-wheels going backwards in
movies, though this is
temporal not spatial aliasing).

The filtering is often done with a few (6 or 7) fixed lowpass filters used to
cover a wide
range of downconversion ratios. (a "good enough" solution) - really one should
use a
fixed filter per downconversion ratio.

For simple down conversion ratios (2, 4, etc) the sub-sampling is easily done
using pixle dropping, however
for arbitary ratios you really need a set of polyphase filters & a phase
accumulator - not difficult but needs
some thinking about.

A lot depends on how "good" your results need to be.

-Steve



____________________Reply Separator____________________
Subject:    [9fans] image resampling
Author: 9fans@cse.psu.edu
Date:       12/04/02 16:38

Hi, friends,

can anyone advise me how to resample (scale down) a big bitmap image?
I browsed through iconv(1), crop(1), jpg(1) ... still having no idea.
Just wanna look at my pictures without going to linux 'convert' :-((

TIA,
++pac.



----------------------------------------------------------------------
The contents of this communication are confidential to the normal user of
the email address to which it was sent.  If you have received this email
in error, any use, dissemination, forwarding, printing or copying of this
email is strictly prohibited.  If this is the case, please notify the
sender and delete this message.
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-04-15 17:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-15 15:57 Re:[9fans] image resampling rog
  -- strict thread matches above, loose matches on Subject: below --
2002-04-15 17:38 rob pike, esq.
2002-04-15 17:20 anothy
2002-04-15 17:20 rog
2002-04-15 16:32 rob pike, esq.
2002-04-15 15:33 rob pike, esq.
2002-04-15 15:26 rog
2002-04-15  9:39 steve.simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).