EleonoreMizo / fmtconv

Format conversion tools for Vapoursynth and Avisynth+
Do What The F*ck You Want To Public License
67 stars 14 forks source link

Catch i14 input in fmtc.resample #38

Closed NSQY closed 1 year ago

NSQY commented 1 year ago
import vapoursynth as vs
core = vs.core

blank = core.std.BlankClip(format=vs.YUV420P14)

fmtc = core.fmtc.resample(blank, css='444').set_output()

When running this code, a strange error is produced:

vspipe -p fmtc.vpy .
Script evaluation done in 0.06 seconds
Fatal: A frame was returned by resample but an error was also set, this is not allowed
VapourSynth encountered a fatal error: A frame was returned by resample but an error was also set, this is not allowed
terminate called without an active exception
[1]    97151 IOT instruction (core dumped)  vspipe -p fmtc.vpy .

In contrast to the error produced by fmtc.bitdepth(bits=14):


Script evaluation failed:
Python exception: bitdepth: output pixel bitdepth not supported.

Traceback (most recent call last):
  File "src/cython/vapoursynth.pyx", line 2819, in vapoursynth._vpy_evaluate
  File "src/cython/vapoursynth.pyx", line 2820, in vapoursynth._vpy_evaluate
  File "fmtc.vpy", line 6, in <module>
    fmtc = core.fmtc.bitdepth(blank, bits=14).set_output()
  File "src/cython/vapoursynth.pyx", line 2565, in vapoursynth.Function.__call__
vapoursynth.Error: bitdepth: output pixel bitdepth not supported.
EleonoreMizo commented 1 year ago

Thanks for the report. There were two distinct issues: 14 to 16 bit conversion wasn’t properly supported with AVX2, and the resulting error wasn’t properly propagated, resulting in a crash. I think commits dd2fcd1ace26125291bebcdcee7e998e42979883 and 09b163b5c39b90e6a97fa654b3d1d1212c6ef6ee should address the issue. The fixed binary should be available in the next release. In the meantime you can disable AVX2 processing in resample by adding the parameter cpuopt=1.

NSQY commented 1 year ago

Thanks for the report. There were two distinct issues: 14 to 16 bit conversion wasn’t properly supported with AVX2, and the resulting error wasn’t properly propagated, resulting in a crash. I think commits dd2fcd1 and 09b163b should address the issue. The fixed binary should be available in the next release. In the meantime you can disable AVX2 processing in resample by adding the parameter cpuopt=1.

I've re-compiled master and it's working now. Thanks.