                                           masked)
  
          if self.args.avg_color_adjust:
              for _ in [0, 1]:
                  np.clip(masked, 0.0, 255.0, out=masked)
                  diff = frame - masked
                  avg_diff = np.sum(diff * image_mask, axis=(0, 1))
                  adjustment = avg_diff / np.sum(image_mask, axis=(0, 1))
                  masked = masked + adjustment
  
          if self.args.match_histogram:
 
</s> remove                 masked = masked + adjustment
 </s> add                 new_image = new_image + adjustment </s> remove             np.clip(masked, 0.0, 255.0, out=masked)
            masked = self.color_hist_match(masked, frame, image_mask)
 </s> add             np.clip(new_image, 0.0, 255.0, out=new_image)
            new_image = self.color_hist_match(new_image, frame, image_mask) </s> remove                                          masked)
 </s> add                                          new_image) </s> remove         masked = new_image  # * image_mask
 </s> add  </s> remove             np.clip(masked, 0.0, 255.0, out=masked)
 </s> add             np.clip(new_image, 0.0, 255.0, out=new_image)
                np.clip(new_image, 0.0, 255.0, out=new_image)
                diff = frame - new_image
                                           masked)
  
          if self.args.avg_color_adjust:
              for _ in [0, 1]:
                np.clip(new_image, 0.0, 255.0, out=new_image)
                diff = frame - new_image
                np.clip(new_image, 0.0, 255.0, out=new_image)
                diff = frame - new_image
                  avg_diff = np.sum(diff * image_mask, axis=(0, 1))
                  adjustment = avg_diff / np.sum(image_mask, axis=(0, 1))
                  masked = masked + adjustment
  
          if self.args.match_histogram:
keep keep keep keep replace replace keep keep keep keep keep
 auto smooth edges size and clarify naming 
plugins/convert/masked.py