xpra icon
Bug tracker and wiki

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


Ticket #784: bpg-stub.patch

File bpg-stub.patch, 4.9 KB (added by Antoine Martin, 7 years ago)

stub for bpg support

  • xpra/codecs/bpg/__init__.py

     
     1# This file is part of Xpra.
     2# Copyright (C) 2015 Antoine Martin <antoine@devloop.org.uk>
     3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
     4# later version. See the file COPYING for details.
  • xpra/codecs/bpg/decode.pyx

     
     1# This file is part of Xpra.
     2# Copyright (C) 2015 Antoine Martin <antoine@devloop.org.uk>
     3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
     4# later version. See the file COPYING for details.
     5
     6from xpra.log import Logger
     7log = Logger("encoder", "bpg")
     8
     9
     10from libc.stdint cimport uint8_t, uint32_t
     11
     12cdef extern from *:
     13    ctypedef unsigned long size_t
     14
     15cdef extern from "stdlib.h":
     16    void free(void *ptr)
     17
     18
     19cdef extern from "../buffers/memalign.h":
     20    void *xmemalign(size_t size)
     21
     22cdef extern from "../buffers/buffers.h":
     23    object memory_as_pybuffer(void* ptr, Py_ssize_t buf_len, int readonly)
     24
     25
     26def get_version():
     27    return 1
     28
     29def get_encodings():
     30    return ["bpg"]
     31
     32
     33def decompress(data, has_alpha, rgb_format=None):
     34    return None
  • xpra/codecs/bpg/encode.pyx

     
     1# This file is part of Xpra.
     2# Copyright (C) 2015 Antoine Martin <antoine@devloop.org.uk>
     3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
     4# later version. See the file COPYING for details.
     5
     6import os
     7
     8from xpra.log import Logger
     9log = Logger("encoder", "bpg")
     10
     11from libc.stdint cimport uint8_t, uint32_t
     12
     13cdef extern from "string.h":
     14    void * memset ( void * ptr, int value, size_t num )
     15
     16cdef extern from *:
     17    ctypedef unsigned long size_t
     18
     19cdef extern from "stdlib.h":
     20    void free(void *ptr)
     21
     22
     23cdef extern from "../buffers/buffers.h":
     24    int    object_as_buffer(object obj, const void ** buffer, Py_ssize_t * buffer_len)
     25
     26
     27def get_encodings():
     28    return ["bpg"]
     29
     30def get_version():
     31    return 1
     32
     33def compress(pixels, width, height, stride=0, quality=50, speed=50, has_alpha=False):
     34    return None
  • setup.py

     
    124124enc_x264_ENABLED        = True          #too important to detect
    125125enc_x265_ENABLED        = pkg_config_ok("--exists", "x265")
    126126webp_ENABLED            = pkg_config_ok("--atleast-version=0.3", "libwebp", fallback=WIN32)
     127bpg_ENABLED             = False
    127128vpx_ENABLED             = pkg_config_ok("--atleast-version=1.0", "vpx", fallback=WIN32) or pkg_config_ok("--atleast-version=1.0", "libvpx", fallback=WIN32)
    128129#ffmpeg 2 onwards:
    129130dec_avcodec2_ENABLED    = pkg_config_ok("--atleast-version=55", "libavcodec", fallback=WIN32)
     
    158159#allow some of these flags to be modified on the command line:
    159160SWITCHES = ["enc_x264", "enc_x265",
    160161            "nvenc3", "nvenc4", "cuda",
    161             "vpx", "webp",
     162            "vpx", "webp", "bpg",
    162163            "dec_avcodec2", "csc_swscale",
    163164            "csc_opencl", "csc_cython",
    164165            "memoryview",
     
    844845                   "xpra/codecs/enc_x265/encoder.c",
    845846                   "xpra/codecs/webp/encode.c",
    846847                   "xpra/codecs/webp/decode.c",
     848                   "xpra/codecs/bpg/encode.c",
     849                   "xpra/codecs/bpg/decode.c",
    847850                   "xpra/codecs/dec_avcodec2/decoder.c",
    848851                   "xpra/codecs/csc_swscale/colorspace_converter.c",
    849852                   "xpra/codecs/csc_swscale/constants.pxi",
     
    962965    webp_lib_dir        = webp_path+"\\lib"
    963966    webp_bin_dir        = webp_path+"\\bin"
    964967    webp_lib_names      = ["libwebp"]
     968    #bpg: no DLLs available yet??
    965969    #cuda:
    966970    cuda_path = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v5.5"
    967971    cuda_include_dir    = os.path.join(cuda_path, "include")
     
    18511855                ["xpra/codecs/webp/decode.pyx"]+membuffers_c,
    18521856                **webp_pkgconfig))
    18531857
     1858toggle_packages(bpg_ENABLED, "xpra.codecs.bpg")
     1859if bpg_ENABLED:
     1860    bpg_pkgconfig = pkgconfig("bpg")
     1861    cython_add(Extension("xpra.codecs.bpg.encode",
     1862                ["xpra/codecs/bpg/encode.pyx", buffers_c],
     1863                **bpg_pkgconfig))
     1864    cython_add(Extension("xpra.codecs.bpg.decode",
     1865                ["xpra/codecs/bpg/decode.pyx"]+membuffers_c,
     1866                **bpg_pkgconfig))
     1867
     1868
    18541869toggle_packages(dec_avcodec2_ENABLED, "xpra.codecs.dec_avcodec2")
    18551870if dec_avcodec2_ENABLED:
    18561871    avcodec2_pkgconfig = pkgconfig("avcodec", "avutil")