Skip to content

Commit

Permalink
Revert "Revert "vspreview/core/types.py: use Qt 10-bit RGB30 image fo…
Browse files Browse the repository at this point in the history
…rmat""

This reverts commit 67d747a.
  • Loading branch information
AkarinVS committed Jul 29, 2022
1 parent b601851 commit 3d7212a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vspreview/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,9 @@ def __init__(self, vs_output: Union[vs.VideoNode, vs.AlphaOutputTuple], index: i

def prepare_vs_output(self, vs_output: vs.VideoNode, alpha: bool = False) -> vs.VideoNode:
resizer = self.main.VS_OUTPUT_RESIZER
akarin = 'API R4.' in vs.core.version()
akarin = vs.__api_version__.api_major >= 4
resizer_kwargs = {
'format' : vs.RGB24 if akarin else vs.COMPATBGR32,
'format' : vs.RGB30 if akarin else vs.COMPATBGR32,
'matrix_in_s' : self.main.VS_OUTPUT_MATRIX,
'transfer_in_s' : self.main.VS_OUTPUT_TRANSFER,
'primaries_in_s': self.main.VS_OUTPUT_PRIMARIES,
Expand Down Expand Up @@ -785,9 +785,10 @@ def prepare_vs_output(self, vs_output: vs.VideoNode, alpha: bool = False) -> vs.
regfmt = vs.core.query_video_format
except AttributeError:
regfmt = vs.core.register_format
#return vs.core.libp2p.Pack(vs_output)
fmt = regfmt(vs.GRAY, vs.INTEGER, 32, 0, 0)
# convert vs.RGB24 to non-planar vs.COMPATBGR32.
return vs.core.akarin.Expr([ vs.core.std.ShufflePlanes(vs_output, i, vs.GRAY) for i in range(3) ], 'x 0x10000 * y 0x100 * + z + 0xff000000 +', fmt, opt=1)
# convert vs.RGB30 to non-planar Qt RGB30.
return vs.core.akarin.Expr([ vs.core.std.ShufflePlanes(vs_output, i, vs.GRAY) for i in range(3) ], 'x 0x100000 * y 0x400 * + z + 0xc0000000 +', fmt, opt=1)

return vs_output

Expand All @@ -811,7 +812,7 @@ def render_raw_videoframe(self, vs_frame: vs.VideoFrame, vs_frame_alpha: Optiona
)
frame_image = Qt.QImage(
frame_data_pointer.contents, vs_frame.width, vs_frame.height,
vs_frame.get_stride(0), Qt.QImage.Format_RGB32)
vs_frame.get_stride(0), Qt.QImage.Format_RGB30 if vs.__api_version__.api_major >= 4 else Qt.QImage.Format_RGB32)

if vs_frame_alpha is None:
return frame_image
Expand Down

0 comments on commit 3d7212a

Please sign in to comment.