Skip to content

Commit f277bf1

Browse files
将协议标注方式改为SPDX
1 parent e73204d commit f277bf1

File tree

10 files changed

+4095
-30
lines changed

10 files changed

+4095
-30
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ cache/
1010
.coverage
1111
.pytest_cache
1212
src/pylibde265/pyde265.c
13+
*.c

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
graft src/pylibde265
2-
graft libde265/build/libde265/Release
3-
include libde265/build/libde265/de265-version.h
2+
graft libde265

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ authors = [
1717
description = "Decode HEVC(H.265) video in python"
1818
keywords = ["libde265", "h265", "vedio", "decode", "mp4", "hevc", "python"]
1919
readme = "README.md"
20+
license = "GPL-3.0-or-later"
2021
requires-python = ">=3.9"
2122
dependencies = [
2223
"scipy>=1.14.0",
@@ -25,7 +26,6 @@ dependencies = [
2526
classifiers = [
2627
"Programming Language :: Python :: 3",
2728
"Programming Language :: Cython",
28-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
2929
"Operating System :: Microsoft :: Windows",
3030
]
3131

@@ -36,8 +36,6 @@ dependencies = [
3636
[tool.setuptools.dynamic]
3737
version = {attr = "pylibde265.__version__"}
3838

39-
[tool.cyright]
40-
4139
[project.urls]
4240
Homepage = "https://github.com/Puiching-Memory/pylibde265"
4341
Issues = "https://github.com/Puiching-Memory/pylibde265/issues"

setup.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,36 @@
88

99
ext_modules = [
1010
Extension(
11-
"pylibde265.pyde265",
12-
sources=["./src/pylibde265/pyde265.pyx"],
13-
include_dirs=["./libde265/build/", "./libde265/libde265/", np.get_include()],
11+
"pylibde265.de265",
12+
sources=["./src/pylibde265/de265.pyx"],
13+
include_dirs=[
14+
"./libde265/build/",
15+
"./libde265/libde265/",
16+
np.get_include(),
17+
],
1418
library_dirs=["./libde265/build/libde265/Release/"],
1519
libraries=["de265"],
16-
extra_compile_args=["/openmp"], # only for Windows
20+
extra_compile_args=[
21+
"/openmp",
22+
# "/showIncludes"
23+
], # only for Windows MSVC
24+
),
25+
Extension(
26+
"pylibde265.visualize",
27+
sources=["./src/pylibde265/visualize.pyx"],
28+
include_dirs=[
29+
"./libde265/build/",
30+
"./libde265/",
31+
"./libde265/libde265/",
32+
np.get_include(),
33+
],
34+
library_dirs=["./libde265/build/libde265/Release/"],
35+
libraries=["de265"],
36+
extra_compile_args=[
37+
"/openmp",
38+
# "/showIncludes"
39+
], # only for Windows MSVC
40+
language='c++',
1741
),
1842
]
1943

File renamed without changes.

src/pylibde265/pyde265.pyx renamed to src/pylibde265/de265.pyx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ from cython.parallel import prange
44
import numpy as np
55
cimport numpy as cnp
66
# from scipy.ndimage import zoom
7-
from pylibde265 cimport pyde265
7+
from pylibde265 cimport de265
88

99
def get_version():
10-
return pyde265.de265_get_version().decode('ascii')
10+
return de265.de265_get_version().decode('ascii')
1111

1212
cdef class decoder(object):
1313
cdef int threads
1414
cdef int buffer_size
15-
cdef pyde265.de265_decoder_context* ctx
15+
cdef de265.de265_decoder_context* ctx
1616
cdef readonly int w,h,chroma,bps,pts,ttd_max,ttd
1717
cdef readonly int wC,hC
1818

1919
def __cinit__(self,int threads,int buffer_size=102400):
20-
self.ctx = pyde265.de265_new_decoder()
21-
pyde265.de265_start_worker_threads(self.ctx,threads)
20+
self.ctx = de265.de265_new_decoder()
21+
de265.de265_start_worker_threads(self.ctx,threads)
2222

2323
def __init__(self,int threads,int buffer_size=102400):
2424
self.buffer_size = buffer_size
2525

2626
def __dealloc__(self):
27-
pyde265.de265_free_decoder(self.ctx)
27+
de265.de265_free_decoder(self.ctx)
2828

2929
def load(self,str vedio_path):
3030
buffer = bytearray(self.buffer_size)
@@ -37,12 +37,12 @@ cdef class decoder(object):
3737
bytes_read = data.readinto(buffer)
3838

3939
while bytes_read > 0:
40-
dec_error = pyde265.de265_push_data(self.ctx, ba, bytes_read, pts, &user_data)
40+
dec_error = de265.de265_push_data(self.ctx, ba, bytes_read, pts, &user_data)
4141
# print([dec_error,bytes_read])
4242
pts += bytes_read
4343
bytes_read = data.readinto(buffer)
4444

45-
dec_error = pyde265.de265_flush_data(self.ctx)
45+
dec_error = de265.de265_flush_data(self.ctx)
4646
data.close()
4747

4848
return dec_error
@@ -61,22 +61,22 @@ cdef class decoder(object):
6161
more = 0
6262

6363
with nogil:
64-
dec_error = pyde265.de265_decode(self.ctx, &more)
64+
dec_error = de265.de265_decode(self.ctx, &more)
6565
# print(f'decode:{dec_error},more?{more}')
66-
image_ptr = pyde265.de265_get_next_picture(self.ctx)
66+
image_ptr = de265.de265_get_next_picture(self.ctx)
6767

6868
if image_ptr == NULL:
6969
# print("Image pointer is null -> not yielding any image")
7070
continue
7171

7272
# print('get image')
73-
self.w = pyde265.de265_get_image_width(image_ptr,0)
74-
self.h = pyde265.de265_get_image_height(image_ptr,0)
75-
self.chroma = pyde265.de265_get_chroma_format(image_ptr)
76-
self.bps = pyde265.de265_get_bits_per_pixel(image_ptr,0)
77-
self.pts = pyde265.de265_get_image_PTS(image_ptr)
78-
self.ttd_max = pyde265.de265_get_highest_TID(self.ctx)
79-
self.ttd = pyde265.de265_get_current_TID(self.ctx)
73+
self.w = de265.de265_get_image_width(image_ptr,0)
74+
self.h = de265.de265_get_image_height(image_ptr,0)
75+
self.chroma = de265.de265_get_chroma_format(image_ptr)
76+
self.bps = de265.de265_get_bits_per_pixel(image_ptr,0)
77+
self.pts = de265.de265_get_image_PTS(image_ptr)
78+
self.ttd_max = de265.de265_get_highest_TID(self.ctx)
79+
self.ttd = de265.de265_get_current_TID(self.ctx)
8080

8181
if self.chroma == 1: # 4:2:0
8282
self.wC = self.w // 2
@@ -90,9 +90,9 @@ cdef class decoder(object):
9090
else: # chroma==0
9191
raise ValueError(f"unsupport chroma format:{self.chroma}")
9292

93-
bufferY = pyde265.de265_get_image_plane(image_ptr,0,&ystride)
94-
bufferCb = pyde265.de265_get_image_plane(image_ptr,1,&cstride)
95-
bufferCr = pyde265.de265_get_image_plane(image_ptr,2,&cstride)
93+
bufferY = de265.de265_get_image_plane(image_ptr,0,&ystride)
94+
bufferCb = de265.de265_get_image_plane(image_ptr,1,&cstride)
95+
bufferCr = de265.de265_get_image_plane(image_ptr,2,&cstride)
9696

9797
image = np.empty((self.h, self.w, 3), dtype=np.uint8)
9898

@@ -122,5 +122,5 @@ cdef class decoder(object):
122122
self.free_image()
123123

124124
def free_image(self):
125-
pyde265.de265_release_next_picture(self.ctx)
125+
de265.de265_release_next_picture(self.ctx)
126126

src/pylibde265/en265.pxd

Whitespace-only changes.

0 commit comments

Comments
 (0)