[Okular-devel] [Bug 310651] DjVu documents blurry at non-unit-fractional zoom levels

Jaan Vajakas jaanvajakas at hot.ee
Mon Dec 3 19:15:29 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=310651

Jaan Vajakas <jaanvajakas at hot.ee> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|general                     |DjVu backend
            Summary|Replace zoom level 33% with |DjVu documents blurry at
                   |1/3                         |non-unit-fractional zoom
                   |                            |levels

--- Comment #2 from Jaan Vajakas <jaanvajakas at hot.ee> ---
The superiority of 33.3333333333333% (compared to e. g. 33% or 33.4%) and of
12.5% (compared to e. g. 12% or 13%) is visible in most DjVu documents I have
seen, e. g. in
http://www.archive.org/download/flatlandaromanc01abbogoog/flatlandaromanc01abbogoog.djvu
(e. g. page 9).
In
http://www.archive.org/download/flatlandromanceo00abbouoft/flatlandromanceo00abbouoft.djvu
(e. g. page 9 again) the superiority of 33.3333333333333% is perhaps even more
visible, but that of 12.5% is less noticeable.
As for 66.66666666666667%, I cannot say it is either better or worse than 66%
in the documents I have tried.

Actually at first I thought that this might be a general rule of image scaling
that integer factors are better, but now, looking at the libdjvulibre code I
see that it comes from the bad scaling algorithm in libdjvulibre, which first
scales the image down to a unit fraction of the original size and then scales
down again to get the image at the requested zoom level. E. g. in order to
scale to 34% it seems to first scale by a factor 1/2 and then by a factor 0.68,
which gives a blurry result, but at zoom level 33.333333% it only scales the
image once, by a factor of 1/3. But djvu documents at zoom level 51% do not
look worse to me than at 50% which can be explained by the fact that in both
cases, libdjvulibre only scales the image once.

Originally I thought that theoretically unit fractional zoom levels should be
better because in that case a document containing a black pixel on a white
background would always displayed on screen as a single gray pixel on white
background, whereas with non-unit fractional zoom levels it could be displayed
as two gray pixels (still assuming that the zoom level is less than 1). But in
practice, comparing djvu files at 50% and 51% I couldn't say that 50% was any
better. So now it seems to me that unit fractional zoom levels might have an
advantage of better performance (or why else would libdjvulibre use them as
intermediate step?) but perhaps there is no significant theoretical win in
quality. But I am not an image processing expert, as you've probably
understood. 

In conclusion, it seems there are three solutions to the problem of blurry
display of DjVu documents at non-unit-fractional zoom level:
1) improve the scaling code in libdjvulibre,
2) implement own scaling in okular, 
3) my original suggestion (change the zoom levels in okular's dropdown box to
unit fractions).

1) or 2) would of course be better solutions than only 3) because e. g.  Fit
Width would still result in non-unit fractional zoom levels. With 1) or 2), a
subpixel scaling feature might also be implemented. The rationale for 2) might
be that okular could handle the scaling of all its supported raster formats in
a unified manner, but 1) would also benefit other libdjvulibre users.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list