Skip to content

Commit

Permalink
#1257: lower pipeline quality for video encoding of video region (mor…
Browse files Browse the repository at this point in the history
…e likely to use pixel subsampling), raise quality for non-video (less likely to use subsampling)

git-svn-id: https://xpra.org/svn/Xpra/trunk@13051 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 20, 2016
1 parent bafcf20 commit 6c1a4de
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/xpra/server/window/window_video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,27 @@ def get_video_pipeline_options(self, encoding, width, height, src_format, force_
if not encoder_specs:
scorelog("get_video_pipeline_options: no encoder specs for %s", encoding)
return []
scorelog("get_video_pipeline_options%s speed: %s (min %s), quality: %s (min %s)", (encoding, width, height, src_format), self._current_speed, self._fixed_min_speed, int(self._current_quality), self._fixed_min_quality)
target_q = int(self._current_quality)
min_q = self._fixed_min_quality
target_s = int(self._current_speed)
min_s = self._fixed_min_speed
#tune quality target for (non-)video region:
vr = self.video_subregion.rectangle
if self.video_subregion.enabled and vr:
mw = abs(width - vr.width) & self.width_mask
mh = abs(height - vr.height) & self.height_mask
if mw==0 and mh==0:
if target_q<100:
#dealing with the video region at less than 100% quality,
#lower quality a bit more since this is definitely video:
target_q = max(min_q, int(target_q*0.75))
scorelog("lowering quality for video encoding of video region")
else:
if target_q<100:
#not the video region, raise quality a bit:
target_q = min(100, int(target_q*1.33))
scorelog("raising quality for video encoding of non-video region")
scorelog("get_video_pipeline_options%s speed: %s (min %s), quality: %s (min %s)", (encoding, width, height, src_format), target_s, min_s, target_q, min_q)
scores = []
def add_scores(info, csc_spec, enc_in_format):
scorelog("add_scores(%s, %s, %s)", info, csc_spec, enc_in_format)
Expand All @@ -974,8 +994,7 @@ def add_scores(info, csc_spec, enc_in_format):
continue
scaling = self.calculate_scaling(width, height, encoder_spec.max_w, encoder_spec.max_h)
score_data = get_pipeline_score(enc_in_format, csc_spec, encoder_spec, width, height, scaling,
self._current_quality, self._fixed_min_quality,
self._current_speed, self._fixed_min_speed,
target_q, min_q, target_s, min_s,
self._csc_encoder, self._video_encoder)
if score_data:
scores.append(score_data)
Expand Down

0 comments on commit 6c1a4de

Please sign in to comment.