public override void Initialize(AVSValue args, ScriptEnvironment env) { width = Child?.GetVideoInfo().width ?? args[1].AsInt(); height = Child?.GetVideoInfo().height ?? args[2].AsInt(); left = args[3].AsInt(left); top = args[4].AsInt(top); right = args[5].AsInt(right); bottom = args[6].AsInt(bottom); noise = args[7].AsBool(noise); gradient = args[8].AsBool(gradient); if (!noise && !gradient) { env.ThrowError("No gradient, no noise"); } seed = args[9].AsInt(seed); var vi = GetVideoInfo(); vi.width = width; vi.height = height; vi.pixel_type = Child?.GetVideoInfo().pixel_type ?? ColorSpaces.CS_BGR24; vi.num_frames = Child?.GetVideoInfo().num_frames ?? 1000; vi.fps_numerator = Child?.GetVideoInfo().fps_numerator ?? 25; vi.fps_denominator = Child?.GetVideoInfo().fps_denominator ?? 1; SetVideoInfo(ref vi); realPlanar = Child == null || OverlayUtils.IsRealPlanar(Child); //Y8 is interleaved rgb = GetVideoInfo().IsRGB(); }
protected override void Initialize(AVSValue args) { LimitedRange = LimitedRange && GetVideoInfo().IsPlanar(); planes = GetVideoInfo().pixel_type.HasFlag(ColorSpaces.CS_INTERLEAVED) ? new[] { default(YUVPlanes) } : (Channels ?? "yuv").ToCharArray().Select(p => Enum.Parse(typeof(YUVPlanes), "PLANAR_" + p, true)) .Cast <YUVPlanes>().ToArray(); realChannels = GetVideoInfo().IsPlanar() ? new[] { 0 } : (Channels ?? "rgb").ToLower().ToCharArray().Select(p => "bgr".IndexOf(p)).ToArray(); if (!OverlayUtils.IsRealPlanar(Child)) { planes = new[] { default(YUVPlanes) } } ; sampleBits = Sample.GetVideoInfo().pixel_type.GetBitDepth(); referenceBits = Reference.GetVideoInfo().pixel_type.GetBitDepth(); var vi = GetVideoInfo(); vi.pixel_type = vi.pixel_type.ChangeBitDepth(referenceBits); SetVideoInfo(ref vi); var cacheSize = tr * 2 + 1; var cacheKey = StaticEnv.GetEnv2() == null ? CacheType.CACHE_25_ALL : CacheType.CACHE_GENERIC; Child.SetCacheHints(cacheKey, cacheSize); Sample.SetCacheHints(cacheKey, cacheSize); Reference.SetCacheHints(cacheKey, cacheSize); SampleMask?.SetCacheHints(cacheKey, cacheSize); ReferenceMask?.SetCacheHints(cacheKey, cacheSize); if (Intensity < 1 && sampleBits != referenceBits) { throw new AvisynthException("Intensity < 1 is not allowed when sample and reference bit depth are not equal"); } }
public override void Initialize(AVSValue args, ScriptEnvironment env) { low = args[1].AsInt(byte.MinValue); high = args[2].AsInt(byte.MaxValue); width = GetVideoInfo().width; height = GetVideoInfo().height; realPlanar = OverlayUtils.IsRealPlanar(Child); }
protected override void Initialize(AVSValue args) { LimitedRange = LimitedRange && GetVideoInfo().IsPlanar(); planes = GetVideoInfo().IsRGB() ? new[] { default(YUVPlanes) } : (Channels ?? "yuv").ToCharArray().Select(p => Enum.Parse(typeof(YUVPlanes), "PLANAR_" + p, true)) .Cast <YUVPlanes>().ToArray(); realChannels = GetVideoInfo().IsPlanar() ? new[] { 0 } : (Channels ?? "rgb").ToLower().ToCharArray().Select(p => "bgr".IndexOf(p)).ToArray(); if (!OverlayUtils.IsRealPlanar(Child)) { planes = new[] { default(YUVPlanes) } } ; var vi = GetVideoInfo(); var refVi = Reference.GetVideoInfo(); sampleBits = vi.pixel_type.GetBitDepth(); referenceBits = refVi.pixel_type.GetBitDepth(); vi.pixel_type = vi.pixel_type.ChangeBitDepth(referenceBits); SetVideoInfo(ref vi); }