File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ functions operate strictly with RGB or grayscale formats listed below.
7474ncomp dtype pix_fmt Description
7575===== ===== ========= ===================================
7676 1 |u8 gray grayscale
77- 1 <u2 gray16le 16-bit grayscale
77+ 1 <u2 gray10le 10-bit grayscale
78+ 1 <u2 gray12le 12-bit grayscale
79+ 1 <u2 gray14le 14-bit grayscale
80+ 1 <u2 gray16le 16-bit grayscale (default for <u2)
7881 1 <f4 grayf32le floating-point grayscale
7982 2 |u1 ya8 grayscale with alpha channel
8083 2 <u2 ya16le 16-bit grayscale with alpha channel
@@ -87,7 +90,6 @@ ncomp dtype pix_fmt Description
8790Note that each video pixel format has a specific `dtype ` (or `dtype_in `) str argument, which
8891follows the NumPy array data type convention.
8992
90-
9193Audio Sample Formats :code: `sample_fmt `
9294---------------------------------------
9395
Original file line number Diff line number Diff line change @@ -171,7 +171,10 @@ def open(
171171 ncomp dtype pix_fmt Description
172172 ===== ===== ========= ===================================
173173 1 \|u8 gray grayscale
174- 1 <u2 gray16le 16-bit grayscale
174+ 1 <u2 gray10le 10-bit grayscale
175+ 1 <u2 gray12le 12-bit grayscale
176+ 1 <u2 gray14le 14-bit grayscale
177+ 1 <u2 gray16le 16-bit grayscale (default <u2 choice)
175178 1 <f4 grayf32le floating-point grayscale
176179 2 \|u1 ya8 grayscale with alpha channel
177180 2 <u2 ya16le 16-bit grayscale with alpha channel
Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ def get_pixel_config(input_pix_fmt, pix_fmt=None):
228228 ncomp dtype pix_fmt Description
229229 ===== ===== ========= ===================================
230230 1 |u1 gray grayscale
231+ 1 <u2 gray10le 10-bit grayscale
232+ 1 <u2 gray12le 12-bit grayscale
233+ 1 <u2 gray14le 14-bit grayscale
231234 1 <u2 gray16le 16-bit grayscale
232235 1 <f4 grayf32le floating-point grayscale
233236 2 |u1 ya8 grayscale with alpha channel
@@ -257,12 +260,16 @@ def get_pixel_config(input_pix_fmt, pix_fmt=None):
257260 elif n_in == 4 :
258261 pix_fmt = "rgba" if bpp <= 32 else "rgba64le"
259262
260- if pix_fmt != input_pix_fmt :
263+ if pix_fmt == input_pix_fmt :
264+ n_out = n_in
265+ elif n_in == 1 and pix_fmt == 'gray16le' :
266+ # sub-16-bit pixel format, use the input format
267+ pix_fmt = input_pix_fmt
268+ n_out = n_in
269+ else :
261270 fmt_info = caps .pix_fmts ()[pix_fmt ]
262271 n_out = fmt_info ["nb_components" ]
263272 bpp = fmt_info ["bits_per_pixel" ]
264- else :
265- n_out = n_in
266273
267274 return (
268275 pix_fmt ,
@@ -307,6 +314,9 @@ def get_pixel_format(fmt):
307314 try :
308315 return dict (
309316 gray = ("|u1" , 1 ),
317+ gray10le = ("<u2" , 1 ),
318+ gray12le = ("<u2" , 1 ),
319+ gray14le = ("<u2" , 1 ),
310320 gray16le = ("<u2" , 1 ),
311321 grayf32le = ("<f4" , 1 ),
312322 ya8 = ("|u1" , 2 ),
You can’t perform that action at this time.
0 commit comments