[Spice-devel] principle of compute_lines_gradual_score

邱星翔 anudorannador at gmail.com
Tue Apr 26 04:22:58 UTC 2016


Oh, I see. And now I can understand what the code mean. But the
question is that the same picture but different size would output
different result, for e.g, use this picture(
http://www.tophdwallpaersland.com/wp-content/uploads/2015/01/windows-desktop-widescreen-backgrounds.jpg)
as the desktop, when used the resolution 1920×1080, clicked refresh
and then  I got the result is BITMAP_GRADUAL_MEDIUM from
`_get_bitmap_graduality_level`, (of curse, there is some  optimization
so that the size of bitmap is 1920×1050, no 50 px for taskbar), but
used the resolution 1024×768 (actually is 1024×738), refreshed and
then I got the result is BITMAP_GRADUAL_HIGH and it means using jpeg
compress.

I think the key point is these two macro CONTRAST_TH and ADMPLE_JUMP
in server/red_bitmap_utils.h which result in same picture but
different BitmapGradualType. Or using the OpenCV calculating the
histogram to judge the image ?

2016-04-25 21:01 GMT+08:00 Frediano Ziglio <fziglio at redhat.com>:
>>
>> Hi, I'm a beginner at SPICE project. Today, I was reading the code,
>> the function which named `_get_bitmap_graduality_level` at line 5979
>> in file server/red_worker.c (the version of spice is 0.12.7 and my OS
>> is Fedora 23). It seems that get a score value from a image by the
>> function and I also found the function `void
>> FNAME(compute_lines_gradual_score)` at line 116 in file
>> server/red_bitmap_utils.h. I really can't understand the what these
>> two functions do, the logic, I mean.
>>
>> So the question is that could you tell me the principle of the
>> algorithm? thanks : )
>
> Basically try to detect if a picture is a natural one or a result of
> a draw.
> Natural picture are better to be compressed with some algorithms (like
> jpeg).
> The idea is that you take some samples in the image and score based on
> the variation (let's say for instance the color change less that 20%
> from a pixel to the next you score 1 otherwise you score 0).
>
> Frediano


More information about the Spice-devel mailing list