xpra icon
Bug tracker and wiki

Ticket #2044: gradual-setup-cost.patch

File gradual-setup-cost.patch, 4.1 KB (added by Antoine Martin, 2 years ago)

gradual decrease in setup cost

  • xpra/server/window/video_scoring.py

     
    8080                       target_quality, min_quality,
    8181                       target_speed, min_speed,
    8282                       current_csce, current_ve,
    83                        client_score_delta):
     83                       client_score_delta, damage_events_count):
    8484    """
    8585        Given an optional csc step (csc_format and csc_spec), and
    8686        and a required encoding step (encoder_spec and width/height),
     
    9999    qscore = clamp(get_quality_score(enc_in_format, csc_spec, encoder_spec, scaling, target_quality, min_quality))
    100100    sscore = clamp(get_speed_score(enc_in_format, csc_spec, encoder_spec, scaling, target_speed, min_speed))
    101101
     102    #mutliplier for setup_cost:
     103    #(quickly goes to 1)
     104    setup_cost_mult = max(1, 10-damage_events_count)
     105
    102106    #how well the codec deals with larger screen sizes:
    103107    sizescore = 100
    104108    mpixels = width*height/(1024.0*1024.0)
     
    131135           type(current_csce)!=csc_spec.codec_class or \
    132136           current_csce.get_src_width()!=csc_width or current_csce.get_src_height()!=csc_height:
    133137            #if we have to change csc, account for new csc setup cost:
    134             ecsc_score = max(0, 80 - csc_spec.setup_cost*80.0/100.0)
     138            ecsc_score = max(0, 80 - int(csc_spec.setup_cost*setup_cost_mult*80//100))
    135139        else:
    136140            ecsc_score = 80
    137141        ecsc_score += csc_spec.score_boost
     
    175179       current_ve.get_src_format()!=enc_in_format or \
    176180       current_ve.get_width()!=enc_width or current_ve.get_height()!=enc_height:
    177181        #account for new encoder setup cost:
    178         ee_score = 100 - encoder_spec.setup_cost
     182        ee_score = 100 - int(encoder_spec.setup_cost*setup_cost_mult)
    179183        ee_score += encoder_spec.score_boost
    180184    #edge resistance score: average of csc and encoder score:
    181     er_score = (ecsc_score + ee_score) / 2.0
     185    er_score = (ecsc_score + ee_score) // 2
    182186    #gpu vs cpu
    183187    gpu_score = max(0, GPU_BIAS-50)*encoder_spec.gpu_cost//50
    184188    cpu_score = max(0, 50-GPU_BIAS)*encoder_spec.cpu_cost//50
  • xpra/server/window/window_source.py

     
    11511151        now = monotonic_time()
    11521152        if not options.get("auto_refresh", False) and not options.get("polling", False) and not self.is_shadow:
    11531153            self.statistics.last_damage_events.append((now, x,y,w,h))
    1154         self.global_statistics.damage_events_count += 1
    1155         self.statistics.damage_events_count += 1
     1154            self.global_statistics.damage_events_count += 1
     1155            self.statistics.damage_events_count += 1
    11561156        if self.window_dimensions != (ww, wh):
    11571157            self.statistics.last_resized = now
    11581158            self.window_dimensions = ww, wh
  • xpra/server/window/window_video_source.py

     
    12121212                    client_score_delta = self.encoding_options.get("%s.score-delta" % encoding, 0)
    12131213                    score_data = get_pipeline_score(enc_in_format, csc_spec, encoder_spec, width, height, scaling,
    12141214                                                    target_q, min_q, target_s, min_s,
    1215                                                     self._csc_encoder, self._video_encoder, client_score_delta)
     1215                                                    self._csc_encoder, self._video_encoder, client_score_delta,
     1216                                                    self.statistics.damage_events_count)
    12161217                    if score_data:
    12171218                        scores.append(score_data)
    12181219            if not FORCE_CSC or src_format==FORCE_CSC_MODE: