xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #618: jpeg2000-v2.patch

File jpeg2000-v2.patch, 5.2 KB (added by Antoine Martin, 4 years ago)

updated patch

  • xpra/client/ui_client_base.py

     
    741741    def do_get_core_encodings(self):
    742742        """
    743743            This method returns the actual encodings supported.
    744             ie: ["rgb24", "vp8", "webp", "png", "png/L", "png/P", "jpeg", "h264", "vpx"]
     744            ie: ["rgb24", "vp8", "webp", "png", "png/L", "png/P", "jpeg", "jpeg2000", "h264", "vpx"]
    745745            It is often overriden in the actual client class implementations,
    746746            where extra encodings can be added (generally just 'rgb32' for transparency),
    747747            or removed if the toolkit implementation class is more limited.
  • xpra/codecs/codec_constants.py

     
    66
    77import weakref
    88from xpra.log import Logger
    9 log = Logger("util")
     9log = Logger("util", "encoding")
    1010
    1111
    1212#value: how much smaller the output is
  • xpra/codecs/loader.py

     
    241241
    242242#note: this is just for defining the order of encodings,
    243243#so we have both core encodings (rgb24/rgb32) and regular encodings (rgb) in here:
    244 PREFERED_ENCODING_ORDER = ["h264", "vp9", "vp8", "mpeg4", "mpeg4+mp4", "h264+mp4", "mpeg4+mp4", "vp8+webm", "vp9+webm", "png", "png/P", "png/L", "webp", "rgb", "rgb24", "rgb32", "jpeg", "h265"]
     244PREFERED_ENCODING_ORDER = ["h264", "vp9", "vp8", "mpeg4", "mpeg4+mp4", "h264+mp4", "mpeg4+mp4", "vp8+webm", "vp9+webm", "png", "png/P", "png/L", "webp", "rgb", "rgb24", "rgb32", "jpeg", "h265", "jpeg2000"]
    245245#encoding order for edges (usually one pixel high or wide):
    246246EDGE_ENCODING_ORDER = ["rgb24", "rgb32", "jpeg", "png", "webp", "png/P", "png/L", "rgb"]
    247247
     
    267267          "png/P"   : "PNG (8bpp colour)",
    268268          "png/L"   : "PNG (8bpp grayscale)",
    269269          "jpeg"    : "JPEG",
     270          "jpeg2000": "JPEG 2000",
    270271          "rgb"     : " + ".join(get_rgb_compression_options()) + " (24/32bpp)",
    271272        }
    272273    return ENCODINGS_TO_NAME.get(encoding, encoding)
     
    286287          "png/L"   : "Portable Network Graphics (lossy, 8bpp grayscale)",
    287288          "webp"    : "WebP compression (supports lossless and lossy modes)",
    288289          "jpeg"    : "JPEG lossy compression",
     290          "jpeg2000": "JPEG 2000 lossy compression (slow)",
    289291          "rgb"     : "Raw RGB pixels, lossless, compressed using %s (24bpp or 32bpp for transparency)" % (" or ".join(compressors)),
    290292          }.get(encoding)
    291293
    292 HELP_ORDER = ("auto", "h264", "h265", "vp8", "vp9", "mpeg4", "png", "png/P", "png/L", "webp", "rgb", "jpeg")
     294HELP_ORDER = ("auto", "h264", "h265", "vp8", "vp9", "mpeg4", "png", "png/P", "png/L", "webp", "rgb", "jpeg", "jpeg2000")
    293295
    294296#those are currently so useless that we don't want the user to select them by mistake
    295297PROBLEMATIC_ENCODINGS = ("h265", )
  • xpra/codecs/pillow/decode.py

     
    2020def do_get_encodings():
    2121    log("PIL.Image.OPEN=%s", Image.OPEN)
    2222    encodings = []
    23     for encoding in ["png", "png/L", "png/P", "jpeg"]:
     23    for encoding in ["png", "png/L", "png/P", "jpeg", "jpeg2000"]:
    2424        #strip suffix (so "png/L" -> "png")
    2525        stripped = encoding.split("/")[0].upper()
    2626        if stripped in Image.OPEN:
  • xpra/codecs/pillow/encode.py

     
    2727def do_get_encodings():
    2828    log("PIL.Image.SAVE=%s", Image.SAVE)
    2929    encodings = []
    30     for encoding in ["png", "png/L", "png/P", "jpeg", "webp"]:
     30    for encoding in ["png", "png/L", "png/P", "jpeg", "jpeg2000", "webp"]:
    3131        #strip suffix (so "png/L" -> "png")
    3232        stripped = encoding.split("/")[0].upper()
    3333        if stripped in Image.SAVE:
     
    121121        raise
    122122    buf = BytesIOClass()
    123123    client_options = {}
    124     if coding in ("jpeg", "webp"):
     124    if coding in ("jpeg", "webp", "jpeg2000"):
    125125        #newer versions of pillow require explicit conversion to non-alpha:
    126126        if pixel_format.find("A")>=0:
    127127            im = im.convert("RGB")
  • xpra/server/window/window_source.py

     
    759759            are = self.client_refresh_encodings
    760760        else:
    761761            #sane defaults:
    762             ropts = set(("webp", "png", "rgb24", "rgb32"))          #default encodings for auto-refresh
     762            ropts = set(("webp", "png", "rgb24", "rgb32", "jpeg2000"))  #default encodings for auto-refresh
    763763            if AUTO_REFRESH_QUALITY<100 and self.image_depth>16:
    764764                ropts.add("jpeg")
    765765            are = [x for x in PREFERED_ENCODING_ORDER if x in ropts]