Beispiel #1
0
        public static void undercrop(ref CropValues crop, modValue mValue)
        {
            int mod = MeGUI.core.util.Resolution.GetModValue(mValue, mod16Method.undercrop, true);

            if (crop.left % 2 != 0 && crop.top % 2 != 0 && crop.bottom % 2 != 0 && crop.right % 2 != 0)
            {
                throw new Exception("Cropping by odd numbers not supported in undercropping to mod" + mod);
            }

            while ((crop.left + crop.right) % mod > 0)
            {
                if (crop.left > crop.right)
                {
                    if (crop.left > 1)
                    {
                        crop.left -= 2;
                    }
                    else
                    {
                        crop.left = 0;
                    }
                }
                else
                {
                    if (crop.right > 1)
                    {
                        crop.right -= 2;
                    }
                    else
                    {
                        crop.right = 0;
                    }
                }
            }
            while ((crop.top + crop.bottom) % mod > 0)
            {
                if (crop.top > crop.bottom)
                {
                    if (crop.top > 1)
                    {
                        crop.top -= 2;
                    }
                    else
                    {
                        crop.top = 0;
                    }
                }
                else
                {
                    if (crop.bottom > 1)
                    {
                        crop.bottom -= 2;
                    }
                    else
                    {
                        crop.bottom = 0;
                    }
                }
            }
        }
Beispiel #2
0
 public AviSynthSettings()
 {
     this.Template               = "<input>\r\n<deinterlace>\r\n<crop>\r\n<resize>\r\n<denoise>\r\n"; // Default -- will act as it did before avs profiles
     this.resize                 = true;
     this.resizeMethod           = ResizeFilterType.Lanczos;                                          // Lanczos
     this.preferAnimeDeinterlace = false;
     this.denoise                = false;
     this.denoiseMethod          = 0; // UnDot
     this.mpeg2deblock           = false;
     this.colourCorrect          = true;
     this.mod16Method            = mod16Method.none;
     this.modValueUsed           = modValue.mod8;
     this.dss2   = false;
     this.upsize = false;
     this.acceptableAspectError = 1;
     this.nvResize = false;
 }
Beispiel #3
0
        /// <summary>
        /// calculates the mod value
        /// </summary>
        /// <param name="modMethod">the selected mod method</param>
        /// <param name="modMethod">the selected mod value</param>
        /// <param name="signalAR">whether or not we're going to signal the aspect ratio</param>
        /// <returns>the mod value</returns>
        public static int GetModValue(modValue modValue, mod16Method modMethod, bool signalAR)
        {
            int mod = 16;

            if (!signalAR || modMethod != mod16Method.nonMod16)
            {
                switch (modValue)
                {
                case modValue.mod8: mod = 8; break;

                case modValue.mod4: mod = 4; break;

                case modValue.mod2: mod = 2; break;
                }
            }
            else
            {
                mod = 1;
            }

            return(mod);
        }
Beispiel #4
0
        public static void overcrop(ref CropValues crop, modValue mValue)
        {
            int mod = MeGUI.core.util.Resolution.GetModValue(mValue, mod16Method.overcrop, true);

            if (crop.left % 2 != 0 && crop.top % 2 != 0 && crop.bottom % 2 != 0 && crop.right % 2 != 0)
            {
                throw new Exception("Cropping by odd numbers not supported in overcropping to mod" + mod);
            }

            bool doLeftNext = true;

            while ((crop.left + crop.right) % mod != 0)
            {
                if (doLeftNext)
                {
                    crop.left += 2;
                }
                else
                {
                    crop.right += 2;
                }
                doLeftNext = !doLeftNext;
            }

            bool doTopNext = true;

            while ((crop.top + crop.bottom) % mod != 0)
            {
                if (doTopNext)
                {
                    crop.top += 2;
                }
                else
                {
                    crop.bottom += 2;
                }
                doTopNext = !doTopNext;
            }
        }
Beispiel #5
0
        public static bool autocrop(out CropValues cropValues, IVideoReader reader, bool signalAR, mod16Method cropMethod, modValue mValue)
        {
            cropValues = Autocrop.autocrop(reader);

            if (signalAR)
            {
                if (cropMethod == mod16Method.overcrop)
                {
                    ScriptServer.overcrop(ref cropValues, mValue);
                }
                else if (cropMethod == mod16Method.mod4Horizontal)
                {
                    ScriptServer.cropMod4Horizontal(ref cropValues);
                }
                else if (cropMethod == mod16Method.undercrop)
                {
                    ScriptServer.undercrop(ref cropValues, mValue);
                }
            }

            if (cropValues.left < 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
 public AviSynthSettings(string template, ResizeFilterType resizeMethod, bool resize, bool upsize, DenoiseFilterType denoiseMethod,
                         bool denoise, bool mpeg2deblock, bool colourCorrect, mod16Method method, bool dss2, modValue modValueUsed, decimal acceptableAspectError)
 {
     this.Template              = template;
     this.Resize                = resize;
     this.ResizeMethod          = resizeMethod;
     this.DenoiseMethod         = denoiseMethod;
     this.Deinterlace           = deinterlace;
     this.Denoise               = denoise;
     this.IVTC                  = ivtc;
     this.MPEG2Deblock          = mpeg2deblock;
     this.ColourCorrect         = colourCorrect;
     this.Mod16Method           = method;
     this.DSS2                  = dss2;
     this.Upsize                = upsize;
     this.ModValue              = modValueUsed;
     this.acceptableAspectError = acceptableAspectError;
 }