16.10.2017, 22:22
I've found out why Vapoursynth doesn't like CS_YUV420P16 returned by DGSource(fulldepth=True). Following is the code in avisynth_compat.cpp. It's pretty obvious that Vapoursynth simply does not accept CS_YUV420P16 from Avisynth+. It should be easy to add support. Maybe someone can ask Myrsloik about this. Based on my experience he won't want to hear anything from me, although really I have no grudge against Vapoursynth.
Interestingly, the vs_normalizeRational() call is a bit surprising, considering how not so long ago Myrsloik refused to do that and insisted all filters must do it themselves.
It seems we just have to add two lines to the if-else:
Interestingly, the vs_normalizeRational() call is a bit surprising, considering how not so long ago Myrsloik refused to do that and insisted all filters must do it themselves.
static void VS_CC avisynthFilterInit(VSMap *in, VSMap *out, void **instanceData, VSNode *node, VSCore *core, const VSAPI *vsapi) {
WrappedClip *clip = (WrappedClip *) * instanceData;
if (!clip->preFetchClips.empty())
clip->fakeEnv->uglyNode = clip->preFetchClips.front();
const VideoInfo &viAvs = clip->clip->GetVideoInfo();
::VSVideoInfo vi;
vi.height = viAvs.height;
vi.width = viAvs.width;
vi.numFrames = viAvs.num_frames;
vi.fpsNum = viAvs.fps_numerator;
vi.fpsDen = viAvs.fps_denominator;
vs_normalizeRational(&vi.fpsNum, &vi.fpsDen);
if (viAvs.IsYV12())
vi.format = vsapi->getFormatPreset(pfYUV420P8, core);
else if (viAvs.IsYV24())
vi.format = vsapi->getFormatPreset(pfYUV444P8, core);
else if (viAvs.IsYV16())
vi.format = vsapi->getFormatPreset(pfYUV422P8, core);
else if (viAvs.IsYV411())
vi.format = vsapi->getFormatPreset(pfYUV411P8, core);
else if (viAvs.IsColorSpace(VideoInfo::CS_YUV9))
vi.format = vsapi->getFormatPreset(pfYUV410P8, core);
else if (viAvs.IsY8())
vi.format = vsapi->getFormatPreset(pfGray8, core);
else if (viAvs.IsYUY2())
vi.format = vsapi->getFormatPreset(pfCompatYUY2, core);
else if (viAvs.IsRGB32())
vi.format = vsapi->getFormatPreset(pfCompatBGR32, core);
else
vsapi->setError(out, "Avisynth Compat: Only YV12, YUY2 and RGB32 supported");
vi.flags = 0;
vsapi->setVideoInfo(&vi, 1, node);
}
It seems we just have to add two lines to the if-else:
else if (viAvs.IsColorSpace(VideoInfo::CS_YUV420P16))
vi.format = vsapi->getFormatPreset(pfYUV420P16, core);