Patchwork [2/5] vnc: JPEG should be disabled if the client don't set tight quality

login
register
mail settings
Submitter Corentin Chary
Date June 4, 2010, 1:18 p.m.
Message ID <1275657527-26032-3-git-send-email-corentincj@iksaif.net>
Download mbox | patch
Permalink /patch/54577/
State New
Headers show

Comments

Alexander Graf - June 4, 2010, 1:16 p.m.
On 04.06.2010, at 15:18, Corentin Chary wrote:

> Disable JPEG compression by default and only enable it if the
> VNC client has sent the requested quality.
> 
> Signed-off-by: Corentin Chary <corentincj@iksaif.net>
> ---
> vnc.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/vnc.c b/vnc.c
> index ed0e096..9cf38d1 100644
> --- a/vnc.c
> +++ b/vnc.c
> @@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
>     vs->features = 0;
>     vs->vnc_encoding = 0;
>     vs->tight_compression = 9;
> -    vs->tight_quality = 9;
> +    vs->tight_quality = -1; /* Lossless by default */

So what's the threshold? When do you start to be lossy?

Alex
Corentin Chary - June 4, 2010, 1:18 p.m.
Disable JPEG compression by default and only enable it if the
VNC client has sent the requested quality.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 vnc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Anthony Liguori - June 4, 2010, 1:19 p.m.
On 06/04/2010 08:16 AM, Alexander Graf wrote:
> On 04.06.2010, at 15:18, Corentin Chary wrote:
>
>    
>> Disable JPEG compression by default and only enable it if the
>> VNC client has sent the requested quality.
>>
>> Signed-off-by: Corentin Chary<corentincj@iksaif.net>
>> ---
>> vnc.c |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/vnc.c b/vnc.c
>> index ed0e096..9cf38d1 100644
>> --- a/vnc.c
>> +++ b/vnc.c
>> @@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
>>      vs->features = 0;
>>      vs->vnc_encoding = 0;
>>      vs->tight_compression = 9;
>> -    vs->tight_quality = 9;
>> +    vs->tight_quality = -1; /* Lossless by default */
>>      
> So what's the threshold? When do you start to be lossy?
>    

When the client explicitly requests it.

Regards,

Anthony Liguori

> Alex
>
>
Alexander Graf - June 4, 2010, 1:20 p.m.
On 04.06.2010, at 15:19, Anthony Liguori wrote:

> On 06/04/2010 08:16 AM, Alexander Graf wrote:
>> On 04.06.2010, at 15:18, Corentin Chary wrote:
>> 
>>   
>>> Disable JPEG compression by default and only enable it if the
>>> VNC client has sent the requested quality.
>>> 
>>> Signed-off-by: Corentin Chary<corentincj@iksaif.net>
>>> ---
>>> vnc.c |    2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/vnc.c b/vnc.c
>>> index ed0e096..9cf38d1 100644
>>> --- a/vnc.c
>>> +++ b/vnc.c
>>> @@ -1644,7 +1644,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
>>>     vs->features = 0;
>>>     vs->vnc_encoding = 0;
>>>     vs->tight_compression = 9;
>>> -    vs->tight_quality = 9;
>>> +    vs->tight_quality = -1; /* Lossless by default */
>>>     
>> So what's the threshold? When do you start to be lossy?
>>   
> 
> When the client explicitly requests it.

The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.

Alex
Corentin Chary - June 4, 2010, 1:48 p.m.
>
> The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.
>
> Alex
>
>

You can use -nojpeg for that. Most vnc clients have this options.
Alexander Graf - June 4, 2010, 1:52 p.m.
On 04.06.2010, at 15:48, Corentin Chary wrote:

>> 
>> The tight quality level is a slider on most clients. A user doesn't know when it starts being lossy. He also can only choose 0 as the lowest (iirc). And IIRC the X tightvnc client also always sent the quality level.
>> 
>> Alex
>> 
>> 
> 
> You can use -nojpeg for that. Most vnc clients have this options.

Phew - I didn't even know of that option until now. I guess that's a bad sign? :)

One way I thought of it was to start being lossy as of quality level 6 or so. That way people who accidently enable jpeg still know "high quality means lossless". I'm not sure Anthony agrees on this though.

Alex
Corentin Chary - June 4, 2010, 2:22 p.m.
> Phew - I didn't even know of that option until now. I guess that's a bad sign? :)
>
> One way I thought of it was to start being lossy as of quality level 6 or so. That way people who accidently enable jpeg still know "high quality means lossless". I'm not sure Anthony agrees on this though.
>
> Alex
>
>

If client set a quality it means that we are allowed to send something
lossy. If you don't want this behavior, you can add the lossless (or
lossy) parameter :).

Patch

diff --git a/vnc.c b/vnc.c
index ed0e096..9cf38d1 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1644,7 +1644,7 @@  static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
     vs->features = 0;
     vs->vnc_encoding = 0;
     vs->tight_compression = 9;
-    vs->tight_quality = 9;
+    vs->tight_quality = -1; /* Lossless by default */
     vs->absolute = -1;
 
     /*