예제 #1
0
        public static void AddIVTC(FieldOrder order, bool hybrid, bool mostlyFilm,
                                   List <DeinterlaceFilter> filters)
        {
            StringBuilder script = new StringBuilder();

            if (order == FieldOrder.TFF)
            {
                script.Append("AssumeTFF().");
            }
            else if (order == FieldOrder.BFF)
            {
                script.Append("AssumeBFF().");
            }

            script.Append("Telecide(guide=1).Decimate(");

            if (hybrid)
            {
                if (mostlyFilm)
                {
                    script.Append("mode=3,");
                }
                else
                {
                    script.Append("mode=1,");
                }

                script.Append("threshold=2.0");
            }

            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            "Decomb IVTC",
                            script.ToString()));
        }
예제 #2
0
        public async Task <IActionResult> PutFieldOrder([FromRoute] int id, [FromBody] FieldOrder fieldOrder)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != fieldOrder.AutoId)
            {
                return(BadRequest());
            }

            _context.Entry(fieldOrder).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FieldOrderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #3
0
        private void finishProcessing()
        {
            if (error)
            {
                finishedAnalysis(null, true, errorMessage);
                return;
            }

            if (!continueWorking)
            {
                return;
            }

            if (fieldOrder == FieldOrder.VARIABLE &&
                d2vFileName.Length == 0) // We are stuck for field order information, lets just go for what we have most of
            {
                fieldOrder = (bffCount > tffCount) ? FieldOrder.BFF : FieldOrder.TFF;
            }

            SourceInfo info = new SourceInfo();

            info.sourceType   = type;
            info.decimateM    = decimateM;
            info.fieldOrder   = fieldOrder;
            info.majorityFilm = majorityFilm;


            finishedAnalysis(info, false, null);
        }
예제 #4
0
 public static void AddYadif(FieldOrder order, List <DeinterlaceFilter> filters, bool bobber)
 {
     filters.Add(new DeinterlaceFilter(
                     bobber ? "Yadif (with Bob)" : "Yadif",
                     string.Format("Load_Stdcall_Plugin(\"{0}\"){1}Yadif({2}order={3})",
                                   MainForm.Instance.Settings.YadifPath, Environment.NewLine,
                                   bobber ? "mode=1, " : "", Order(order))));
 }
예제 #5
0
 public static void AddYadif(FieldOrder order, List <DeinterlaceFilter> filters)
 {
     filters.Add(new DeinterlaceFilter(
                     "Yadif",
                     string.Format("Load_Stdcall_Plugin(\"{0}\"){1}Yadif(order={2})",
                                   MainForm.Instance.Settings.YadifPath, Environment.NewLine,
                                   Order(order))));
 }
예제 #6
0
 public static void AddYadif(FieldOrder order, List <DeinterlaceFilter> filters)
 {
     filters.Add(new DeinterlaceFilter(
                     "Yadif",
                     string.Format("Load_Stdcall_Plugin(\"{0}\"){1}Yadif(order={2})",
                                   @"C:\programs\MeGUI\tools\avisynth_plugin\yadif.dll", Environment.NewLine,
                                   Order(order))));
 }
예제 #7
0
        public static void AddYadif(FieldOrder order, List <DeinterlaceFilter> filters, bool bobber)
        {
            string path = Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "yadifmod2.dll");

            filters.Add(new DeinterlaceFilter(
                            bobber ? "Yadif (with Bob)" : "Yadif",
                            string.Format("LoadPlugin(\"{0}\"){1}Yadifmod2({2}order={3})",
                                          path, Environment.NewLine,
                                          bobber ? "mode=1, " : "", Order(order))));
        }
예제 #8
0
        public ActionResult <FieldOrder> Create([FromBody] FieldOrder fieldOrder)
        {
            if (fieldOrder == null || !ModelState.IsValid)
            {
                return(BadRequest());
            }

            _fieldOderRepository.Create(fieldOrder);

            return(CreatedAtAction(nameof(GetFieldOrderById), new { fieldOrderId = fieldOrder.FieldOrderID }, fieldOrder));
        }
예제 #9
0
        public async Task <IActionResult> PostFieldOrder([FromBody] FieldOrder fieldOrder)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.FieldOrder.Add(fieldOrder);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFieldOrder", new { id = fieldOrder.AutoId }, fieldOrder));
        }
예제 #10
0
        void OrderFields(FieldOrder fieldOrder)
        {
            if (fieldOrder == FieldOrder.First)
            {
                OrderFieldToControl(pnlFirstFields, pnlSecondFields);
            }

            else if (fieldOrder == FieldOrder.Second)
            {
                OrderFieldToControl(pnlSecondFields, pnlFirstFields);
            }
        }
예제 #11
0
        public ActionResult Update([FromBody] FieldOrder fieldOrder)
        {
            var e = GetFieldOrderById(fieldOrder.FieldOrderID);

            if (e == null)
            {
                return(BadRequest());
            }

            _fieldOderRepository.Update(fieldOrder);

            return(NoContent());
        }
예제 #12
0
        public static void AddTMC(FieldOrder order, List <DeinterlaceFilter> filters)
        {
            string strPluginPath = Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TomsMoComp.dll");

            if (!File.Exists(strPluginPath))
            {
                return;
            }

            filters.Add(new DeinterlaceFilter(
                            "TomsMoComp",
                            string.Format("LoadPlugin(\"{0}\"){1}TomsMoComp({2},5,1)", strPluginPath, Environment.NewLine, Order(order))));
        }
예제 #13
0
        public static int Order(FieldOrder order)
        {
            int i_order = -1;

            if (order == FieldOrder.BFF)
            {
                i_order = 0;
            }
            if (order == FieldOrder.TFF)
            {
                i_order = 1;
            }
            return(i_order);
        }
예제 #14
0
        public static void AddTDeint(FieldOrder order, List <DeinterlaceFilter> filters, bool processAll, bool eedi2, bool bob)
        {
            StringBuilder script = new StringBuilder();

            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TDeint.dll") + "\")\r\n");
            if (eedi2)
            {
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "EEDI2.dll") + "\")\r\n");
                script.Append("edeintted = last.");
                if (order == FieldOrder.TFF)
                {
                    script.Append("AssumeTFF().");
                }
                else if (order == FieldOrder.BFF)
                {
                    script.Append("AssumeBFF().");
                }
                script.Append("SeparateFields().");
                if (!bob)
                {
                    script.Append("SelectEven().");
                }
                script.Append("EEDI2(field=-1)\r\n");
            }
            script.Append("TDeint(");

            if (bob)
            {
                script.Append("mode=1,");
            }
            if (order != FieldOrder.VARIABLE)
            {
                script.Append("order=" + Order(order) + ",");
            }
            if (!processAll) // For hybrid clips
            {
                script.Append("full=false,");
            }
            if (eedi2)
            {
                script.Append("edeint=edeintted,");
            }

            script = new StringBuilder(script.ToString().TrimEnd(new char[] { ',' }));
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            bob ? (eedi2 ? "TDeint (with EDI + Bob)" : "TDeint (with Bob)") : (eedi2 ? "TDeint (with EDI)" : "TDeint"),
                            script.ToString()));
        }
예제 #15
0
        public static string GetFixedFieldString(string FOrder)
        {
            FieldOrder eFOrder = (FieldOrder)Enum.Parse(typeof(FieldOrder), FOrder);

            if (eFOrder == FieldOrder.UNKNOWN)
            {
                return("Unknown");
            }
            else if (eFOrder == FieldOrder.VARIABLE)
            {
                return("Variable");
            }
            else
            {
                return(FOrder);
            }
        }
 public void AddField(string fieldName, System.Data.DbType fieldType, int length, bool isPrimaryKey, bool requireUnique, FieldOrder searchOrder)
 {
     if (this.Registered & !this.AllowRuntimeChanges) throw new InvalidOperationException("The Entity is already registered, it cannot be modified");
     if (this.Registered & isPrimaryKey) throw new ArgumentException("The Entity is already registered, you cannot add a primary key", "isPrimaryKey");
     var attr = new FieldAttribute();
     attr.FieldName = fieldName;
     attr.DataType = fieldType;
     attr.AllowsNulls = !isPrimaryKey;
     attr.IsPrimaryKey = isPrimaryKey;
     attr.IsIdentity = EntityAttribute.KeyScheme == KeyScheme.Identity & isPrimaryKey & this.Fields.KeyFields.Count <= 0;
     attr.Length = length;
     attr.RequireUniqueValue = requireUnique;
     attr.SearchOrder = searchOrder;
     this.Fields.Add(attr);
     if (this.Registered && EntityDefinitionChanged != null)
         EntityDefinitionChanged.Invoke(this, new EntityTypeChangedArgs(this, attr));
 }
예제 #17
0
        private void button_analyse_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            SourceDetector sd = new SourceDetector(m);

            if (sd.IsErrors)
            {
                //Сбрасываем результаты
                m.interlace_results = null;
                SetAnalyseToolTip();
            }
            else if (sd.m != null)
            {
                DeinterlaceType olddeint = m.deinterlace;
                FieldOrder      oldfo    = m.fieldOrder;
                SourceType      olditype = m.interlace;

                m = sd.m.Clone();

                if (m.deinterlace != olddeint ||
                    m.fieldOrder != oldfo ||
                    m.interlace != olditype)
                {
                    m = Format.GetOutInterlace(m);
                    m = Calculate.UpdateOutFramerate(m);
                    SetFramerateCombo(m.outframerate);

                    //обновляем форму
                    combo_fieldorder.SelectedItem = GetFixedFieldString(m.fieldOrder.ToString());
                    combo_sourcetype.SelectedItem = GetFixedSTypeString(m.interlace.ToString());

                    combo_deinterlace.SelectedValue = m.deinterlace;
                    combo_outinterlace.SelectedItem = Format.GetCodecOutInterlace(m);

                    //обновляем конечное колличество фреймов, с учётом режима деинтерелейса
                    m             = Calculate.UpdateOutFrames(m);
                    m.outfilesize = Calculate.GetEncodingSize(m);

                    Refresh();
                }

                //Выводим результаты
                SetAnalyseToolTip();
            }
        }
예제 #18
0
        public static DataOrder GetDataOrder(this FieldOrder order)
        {
            switch (order)
            {
            case FieldOrder.Big:
                return(DataOrder.Big);

            case FieldOrder.InversedMiddle:
                return(DataOrder.InversedMiddle);

            case FieldOrder.Little:
                return(DataOrder.Little);

            case FieldOrder.Middle:
                return(DataOrder.Middle);
            }

            throw new NotSupportedException($"FieldOrder Not Supported {order}");
        }
예제 #19
0
        private void AnalyseFF()
        {
            if ((((double)oSourceInfo.sectionCountTFF + (double)oSourceInfo.sectionCountBFF) / 100.0 * (double)settings.HybridFOPercent) > oSourceInfo.sectionCountBFF)
            {
                analysis  += "Source is declared tff by a margin of " + oSourceInfo.sectionCountTFF + " to " + oSourceInfo.sectionCountBFF + ".";
                fieldOrder = FieldOrder.TFF;
            }
            else if ((((double)oSourceInfo.sectionCountTFF + (double)oSourceInfo.sectionCountBFF) / 100.0 * (double)settings.HybridFOPercent) > oSourceInfo.sectionCountTFF)
            {
                analysis  += "Source is declared bff by a margin of " + oSourceInfo.sectionCountBFF + " to " + oSourceInfo.sectionCountTFF + ".";
                fieldOrder = FieldOrder.BFF;
            }
            else
            {
                analysis  += "Source is hybrid bff and tff at " + oSourceInfo.sectionCountBFF + " bff and " + oSourceInfo.sectionCountTFF + " tff.";
                fieldOrder = FieldOrder.VARIABLE;
            }

            FinishProcessing();
        }
예제 #20
0
        public static void AddFieldDeint(FieldOrder order, List <DeinterlaceFilter> filters, bool processAll, bool blend)
        {
            string name = "FieldDeinterlace";

            if (!blend)
            {
                name = "FieldDeinterlace (no blend)";
            }

            StringBuilder script = new StringBuilder();

            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "Decomb.dll") + "\")\r\n");
            if (order == FieldOrder.TFF)
            {
                script.Append("AssumeTFF().");
            }
            else if (order == FieldOrder.BFF)
            {
                script.Append("AssumeBFF().");
            }

            script.Append("FieldDeinterlace(");

            if (!blend)
            {
                script.Append("blend=false");
            }

            if (!processAll)
            {
                if (!blend)
                {
                    script.Append(",");
                }
                script.Append("full=false");
            }
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            name,
                            script.ToString()));
        }
예제 #21
0
        public static void AddFieldDeint(FieldOrder order, List <DeinterlaceFilter> filters, bool processAll, bool blend)
        {
            string name = "FieldDeinterlace";

            if (!blend)
            {
                name = "FieldDeinterlace (no blend)";
            }

            StringBuilder script = new StringBuilder();

            if (order == FieldOrder.TFF)
            {
                script.Append("AssumeTFF().");
            }
            else if (order == FieldOrder.BFF)
            {
                script.Append("AssumeBFF().");
            }

            script.Append("FieldDeinterlace(");

            if (!blend)
            {
                script.Append("blend=false");
            }

            if (!processAll)
            {
                if (!blend)
                {
                    script.Append(",");
                }
                script.Append("full=false");
            }
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            name,
                            script.ToString()));
        }
예제 #22
0
        public static void AddTDeint(FieldOrder order, List <DeinterlaceFilter> filters, bool processAll, bool eedi2)
        {
            StringBuilder script = new StringBuilder();

            if (eedi2)
            {
                script.Append("edeintted = last.");
                if (order == FieldOrder.TFF)
                {
                    script.Append("AssumeTFF().");
                }
                else if (order == FieldOrder.BFF)
                {
                    script.Append("AssumeBFF().");
                }
                script.Append("SeparateFields().SelectEven().EEDI2(field=-1)\r\n");
            }
            script.Append("TDeint(");


            if (order != FieldOrder.VARIABLE)
            {
                script.Append("order=" + Order(order) + ",");
            }
            if (!processAll) // For hybrid clips
            {
                script.Append("full=false,");
            }
            if (eedi2)
            {
                script.Append("edeint=edeintted,");
            }

            script = new StringBuilder(script.ToString().TrimEnd(new char[] { ',' }));
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            eedi2 ? "TDeint (with EDI)" : "TDeint",
                            script.ToString()));
        }
예제 #23
0
        private void FinishProcessing()
        {
            _mre.Set();  // Make sure nothing is waiting for pause to stop

            isStopped = true;

            if (error)
            {
                finishedAnalysis(null, ExitType.ERROR, errorMessage);
                return;
            }

            if (!continueWorking)
            {
                finishedAnalysis(null, ExitType.ABORT, String.Empty);
                return;
            }

            if (fieldOrder == FieldOrder.VARIABLE &&
                d2vFileName.Length == 0) // We are stuck for field order information, lets just go for what we have most of
            {
                fieldOrder = (bffCount > tffCount) ? FieldOrder.BFF : FieldOrder.TFF;
            }

            SourceInfo info = new SourceInfo();

            info.sourceType = type;
            if (type == SourceType.DECIMATING)
            {
                info.decimateM = decimateM;
            }
            info.fieldOrder     = fieldOrder;
            info.majorityFilm   = majorityFilm;
            info.analysisResult = analysis;
            info.isAnime        = isAnime;

            finishedAnalysis(info, ExitType.OK, String.Empty);
        }
예제 #24
0
        //        public static System.Web.Mvc.SelectList ToSelectList<TEnum>(this TEnum obj)
        //where TEnum : struct, IComparable, IFormattable, IConvertible
        //        {
        //            return new SelectList(TicketPriority.GetValues(typeof(TEnum))
        //            .OfType<TicketPriority>()
        //            .Select(x => new SelectListItem
        //            {
        //                Text = TicketPriority.GetName(typeof(TEnum), x),
        //                Value = (Convert.ToInt32(x))
        //                .ToString()
        //            }), "Value", "Text");
        //        }


        public JsonResult GetFields()
        {
            //string[] str;
            //List<string[]> s = new List<string[]>();
            //s.Add(new string[] { "name", "Subject" });
            //s.Add(new string[] { "name", "StatusName" });

            string s = @"[{ ""name"": ""Subject"" }, { ""name"": ""Status"" }]";

            int uid = Convert.ToInt32(Session["uid"]);

            //List<FieldOrder> fl = FieldOrder.GetByuid(uid);
            //s = "[";
            //foreach (FieldOrder f in fl)
            //{
            //    s += @"{ ""name"": """+ f.FieldName +@""" },";
            //}
            //s += s.TrimEnd(',') + "]";
            //s = @"[{ ""name"": ""Subject"" }, { ""name"": ""Status"" }]";

            s = FieldOrder.GetFields(uid);

            return(Json(s, JsonRequestBehavior.AllowGet));
        }
예제 #25
0
        public static void AddIVTC(FieldOrder order, bool hybrid, bool mostlyFilm,
                                   List <DeinterlaceFilter> filters)
        {
            StringBuilder script = new StringBuilder();

            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "Decomb.dll") + "\")\r\n");
            if (order == FieldOrder.TFF)
            {
                script.Append("AssumeTFF().");
            }
            else if (order == FieldOrder.BFF)
            {
                script.Append("AssumeBFF().");
            }

            script.Append("Telecide(guide=1).Decimate(");

            if (hybrid)
            {
                if (mostlyFilm)
                {
                    script.Append("mode=3,");
                }
                else
                {
                    script.Append("mode=1,");
                }

                script.Append("threshold=2.0");
            }

            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            "Decomb IVTC",
                            script.ToString()));
        }
예제 #26
0
        public static void AddTIVTC(string d2vFile, bool anime, bool hybrid, bool mostlyFilm, bool advancedDeinterlacing,
            FieldOrder fieldOrder, List<DeinterlaceFilter> filters)
        {
            StringBuilder script = new StringBuilder();
            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TIVTC.dll") + "\")\r\n");
            if (advancedDeinterlacing)
            {
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "EEDI2.dll") + "\")\r\n");
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TDeint.dll") + "\")\r\n");
                script.Append("edeintted = ");
                if (fieldOrder == FieldOrder.TFF)
                    script.Append("AssumeTFF().");
                else if (fieldOrder == FieldOrder.BFF)
                    script.Append("AssumeBFF().");
                script.AppendFormat("SeparateFields().SelectEven().EEDI2(field=-1)\r\n");
                script.Append("tdeintted = TDeint(edeint=edeintted");
                if (fieldOrder != FieldOrder.VARIABLE)
                    script.Append(",order=" + Order(fieldOrder));
                script.Append(")\r\n");
            }

            script.Append("tfm(");
            if (d2vFile.Length <= 0)
                script.AppendFormat("order={0}", Order(fieldOrder));
            if (advancedDeinterlacing)
            {
                if (d2vFile.Length <= 0)
                    script.Append(",");
                script.Append("clip2=tdeintted");
            }
            script.Append(")");

            script.Append(".tdecimate(");
            if (anime)
                script.Append("mode=1");
            if (hybrid)
            {
                if (anime)
                    script.Append(",");
                if (mostlyFilm)
                    script.Append("hybrid=1");
                else
                    script.Append("hybrid=3");

            }
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                advancedDeinterlacing ? "TIVTC + TDeint(EDI) -- slow" : "TIVTC",
                script.ToString()));
        }
 public override object[] Fetch(Type entityType, int fetchCount, int firstRowOffset, string sortField, FieldOrder sortOrder, FilterCondition filter, bool fillReferences, bool filterReferences)
 {
     throw new NotSupportedException("Fetch is not currently supported with this Provider.");
 }
예제 #28
0
        public static void AddTIVTC(string d2vFile, bool anime, bool hybrid, bool mostlyFilm, bool advancedDeinterlacing,
                                    FieldOrder fieldOrder, List <DeinterlaceFilter> filters)
        {
            StringBuilder script = new StringBuilder();

            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TIVTC.dll") + "\")\r\n");
            if (advancedDeinterlacing)
            {
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "EEDI2.dll") + "\")\r\n");
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TDeint.dll") + "\")\r\n");
                script.Append("edeintted = ");
                if (fieldOrder == FieldOrder.TFF)
                {
                    script.Append("AssumeTFF().");
                }
                else if (fieldOrder == FieldOrder.BFF)
                {
                    script.Append("AssumeBFF().");
                }
                script.AppendFormat("SeparateFields().SelectEven().EEDI2(field=-1)\r\n");
                script.Append("tdeintted = TDeint(edeint=edeintted");
                if (fieldOrder != FieldOrder.VARIABLE)
                {
                    script.Append(",order=" + Order(fieldOrder));
                }
                script.Append(")\r\n");
            }

            script.Append("tfm(");
            if (d2vFile.Length <= 0)
            {
                script.AppendFormat("order={0}", Order(fieldOrder));
            }
            if (advancedDeinterlacing)
            {
                if (d2vFile.Length <= 0)
                {
                    script.Append(",");
                }
                script.Append("clip2=tdeintted");
            }
            script.Append(")");

            script.Append(".tdecimate(");
            if (anime)
            {
                script.Append("mode=1");
            }
            if (hybrid)
            {
                if (anime)
                {
                    script.Append(",");
                }
                if (mostlyFilm)
                {
                    script.Append("hybrid=1");
                }
                else
                {
                    script.Append("hybrid=3");
                }
            }
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                            advancedDeinterlacing ? "TIVTC + TDeint(EDI) -- slow" : "TIVTC",
                            script.ToString()));
        }
예제 #29
0
        private void analyseFF(string filename)
        {
            CultureInfo ci = new CultureInfo("en-us");
            StreamReader instream;
            try
            {
                instream = new StreamReader(filename);
            }
            catch (Exception)
            {
                instream = null;
                error = true;
                errorMessage = "Opening the field order analysis file failed.";
                finishProcessing();
                return;
            }
            int countA = 0, countB = 0, countEqual = 0;
            int localCountA = 0, localCountB = 0, sectionCountA = 0, sectionCountB = 0;
            double sumA = 0, sumB = 0;
            double valueA, valueB;
            int count = 0;

            string line = instream.ReadLine();
            while (line != null)
            {
                if (count != 0 && line.IndexOf("-1.#IND00") == -1) //Scene change or unexptected value -> ignore
                {
                    string[] contents = line.Split(new char[] { '-' });
                    try
                    {
                        valueA = Double.Parse(contents[0], ci);
                        valueB = Double.Parse(contents[1], ci);
                    }
                    catch (Exception)
                    {
                        error = true;
                        errorMessage = "Unexpected value in file " + filename + "\r\n" +
                            "This error should not have occurred. Please report it on \r\n" +
                            "post it on http://sourceforge.net/projects/megui with the file named above.";
                        errorMessage += "\r\nMore debugging info:\r\n" +
                            "Line contents: " + line + "\r\n";
                        finishProcessing();
                        return;
                    }
                    if (valueA > valueB)
                    {
                        countA++;
                        localCountA++;
                    }
                    else if (valueB > valueA)
                    {
                        countB++;
                        localCountB++;
                    }
                    else
                        countEqual++;
                    sumA += valueA;
                    sumB += valueB;
                }
                count++;
                if (count == 10)
                {
                    count = 0;
                    // Truly interlaced sections should always make one of the counts be 5 and the other 0.
                    // Progressive sections will be randomly distributed between localCountA and localCountB,
                    // so this algorithm successfully ignores those sections.
                    // Film sections will always have two frames which show the actual field order, and the other
                    // frames will show an arbitrary field order. This algorithm (luckily) seems to work very well
                    // with film sections as well. Using this thresholding as opposed to just comparing countB to countA
                    // produces _much_ more heavily-sided results.
                    if (localCountA > localCountB && localCountB == 0)
                        sectionCountA++;
                    if (localCountB > localCountA && localCountA == 0)
                        sectionCountB++;
                    localCountA = 0;
                    localCountB = 0;
                }
                line = instream.ReadLine();
            }
            instream.Close();
            if ((((double)sectionCountA +(double)sectionCountB) / 100.0 * (double)settings.HybridFOPercent) > sectionCountB)
            {
                analysis += "Source is declared tff by a margin of " + sectionCountA + " to " + sectionCountB + ".";
                fieldOrder = FieldOrder.TFF;
            }
            else if ((((double)sectionCountA +(double)sectionCountB) / 100.0 * (double)settings.HybridFOPercent) > sectionCountA)
            {
                analysis += "Source is declared bff by a margin of " + sectionCountB + " to " + sectionCountA + ".";
                fieldOrder = FieldOrder.BFF;
            }
            else
            {
                analysis += "Source is hybrid bff and tff at " + sectionCountB + " bff and " + sectionCountA + " tff.";
                fieldOrder = FieldOrder.VARIABLE;
            }

            tffCount = countA;
            bffCount = countB;
            finishProcessing();
        }
예제 #30
0
 public static void AddLeakDeint(FieldOrder order, List <DeinterlaceFilter> filters)
 {
     filters.Add(new DeinterlaceFilter(
                     "LeakKernelDeint",
                     string.Format("LoadPlugin(\"{0}\"){1}LeakKernelDeint(order={2},sharp=true)", Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "LeakKernelDeint.dll"), Environment.NewLine, Order(order))));
 }
예제 #31
0
        public static void AddFieldDeint(FieldOrder order, List<DeinterlaceFilter> filters, bool processAll, bool blend)
        {
            string name = "FieldDeinterlace";
            if (!blend)
                name = "FieldDeinterlace (no blend)";

            StringBuilder script = new StringBuilder();
            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "Decomb.dll") + "\")\r\n");
            if (order == FieldOrder.TFF)
                script.Append("AssumeTFF().");
            else if (order == FieldOrder.BFF)
                script.Append("AssumeBFF().");

            script.Append("FieldDeinterlace(");

            if (!blend)
                script.Append("blend=false");

            if (!processAll)
            {
                if (!blend)
                    script.Append(",");
                script.Append("full=false");
            }
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                name,
                script.ToString()));
        }
예제 #32
0
        private void finishProcessing()
        {
            if (error)
            {
                finishedAnalysis(null, true, errorMessage);
                return;
            }

            if (!continueWorking)
            {
                return;
            }

            if (fieldOrder == FieldOrder.VARIABLE &&
                d2vFileName.Length == 0) // We are stuck for field order information, lets just go for what we have most of
                fieldOrder = (bffCount > tffCount) ? FieldOrder.BFF : FieldOrder.TFF;

            SourceInfo info = new SourceInfo();
            info.sourceType = type;
            info.decimateM = decimateM;
            info.fieldOrder = fieldOrder;
            info.majorityFilm = majorityFilm;

            finishedAnalysis(info, false, null);
        }
예제 #33
0
 public static void AddLeakDeint(FieldOrder order, List<DeinterlaceFilter> filters)
 {
     filters.Add(new DeinterlaceFilter(
         "LeakKernelDeint",
         string.Format("LoadPlugin(\"{0}\"){1}LeakKernelDeint(order={2},sharp=true)", Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "LeakKernelDeint.dll"), Environment.NewLine, Order(order))));
 }
예제 #34
0
        public static void AddIVTC(FieldOrder order, bool hybrid, bool mostlyFilm,
            List<DeinterlaceFilter> filters)
        {
            StringBuilder script = new StringBuilder();
            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "Decomb.dll") + "\")\r\n");
            if (order == FieldOrder.TFF)
                script.Append("AssumeTFF().");
            else if (order == FieldOrder.BFF)
                script.Append("AssumeBFF().");

            script.Append("Telecide(guide=1).Decimate(");

            if (hybrid)
            {
                if (mostlyFilm)
                    script.Append("mode=3,");
                else
                    script.Append("mode=1,");

                script.Append("threshold=2.0");
            }

            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                "Decomb IVTC",
                script.ToString()));
        }
예제 #35
0
        public static void AddTDeint(FieldOrder order, List<DeinterlaceFilter> filters, bool processAll, bool eedi2, bool bob)
        {
            StringBuilder script = new StringBuilder();
            script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TDeint.dll") + "\")\r\n");
            if (eedi2)
            {
                script.Append("LoadPlugin(\"" + Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "EEDI2.dll") + "\")\r\n");
                script.Append("edeintted = last.");
                if (order == FieldOrder.TFF)
                    script.Append("AssumeTFF().");
                else if (order == FieldOrder.BFF)
                    script.Append("AssumeBFF().");
                script.Append("SeparateFields().SelectEven().EEDI2(field=-1)\r\n");
            }
            script.Append("TDeint(");

            if (bob)
                script.Append("mode=1,");
            if (order != FieldOrder.VARIABLE)
                script.Append("order=" + Order(order) + ",");
            if (!processAll) // For hybrid clips
                script.Append("full=false,");
            if (eedi2)
                script.Append("edeint=edeintted,");

            script = new StringBuilder(script.ToString().TrimEnd(new char[] { ',' }));
            script.Append(")");
            filters.Add(new DeinterlaceFilter(
                bob ? (eedi2 ? "TDeint (with EDI + Bob)" : "TDeint (with Bob)") : (eedi2 ? "TDeint (with EDI)" : "TDeint"),
                script.ToString()));
        }
예제 #36
0
        protected override string VerifyIndex(string entityName, string fieldName, FieldOrder searchOrder, IDbConnection connection)
        {
            bool localConnection = false;

            if (connection == null)
            {
                localConnection = true;
                connection      = GetConnection(true);
            }
            try
            {
                var indexName = string.Format("ORM_IDX_{0}_{1}_{2}", entityName, fieldName,
                                              searchOrder == FieldOrder.Descending ? "DESC" : "ASC");

                if (m_indexNameCache.FirstOrDefault(ii => ii.Name == indexName) != null)
                {
                    return(indexName);
                }

                using (var command = GetNewCommandObject())
                {
                    command.Connection = connection;

                    var sql = string.Format("SELECT COUNT(*) FROM sqlite_master WHERE type = 'index' AND name = '{0}'", indexName);
                    command.CommandText = sql;

                    var i = (long)command.ExecuteScalar();

                    if (i == 0)
                    {
                        sql = string.Format("CREATE INDEX {0} ON {1}({2} {3})",
                                            indexName,
                                            entityName,
                                            fieldName,
                                            searchOrder == FieldOrder.Descending ? "DESC" : string.Empty);

                        Debug.WriteLine(sql);

                        command.CommandText = sql;
                        command.ExecuteNonQuery();
                    }

                    var indexinfo = new IndexInfo
                    {
                        Name          = indexName,
                        MaxCharLength = -1
                    };

                    m_indexNameCache.Add(indexinfo);
                }

                return(indexName);
            }
            finally
            {
                if (localConnection)
                {
                    DoneWithConnection(connection, true);
                }
            }
        }
예제 #37
0
 public void Create(FieldOrder fieldOrder)
 {
     _context.FieldOrders.InsertOne(fieldOrder);
 }
예제 #38
0
 public static int Order(FieldOrder order)
 {
     int i_order = -1;
     if (order == FieldOrder.BFF)
         i_order = 0;
     if (order == FieldOrder.TFF)
         i_order = 1;
     return i_order;
 }
예제 #39
0
        private void AnalyseFields(string filename, int SelectLength)
        {
            StreamReader instream = new StreamReader(filename);
            int count = 0, countA = 0, countB = 0;
            double valueA, valueB;

            string line = instream.ReadLine();
            while (line != null && !IsAborted && !IsErrors)
            {
                count++;
                string[] contents = line.Split(new char[] { '-' });
                valueA = Double.Parse(contents[0], new CultureInfo("en-US"));
                valueB = Double.Parse(contents[1], new CultureInfo("en-US"));

                if (valueA > valueB) countA++;
                else if (valueB > valueA) countB++;

                if (count == SelectLength) //10
                {
                    //Секция = SelectLength, а не просто 10.
                    //------
                    // Truly interlaced sections should always make one of the counts be 5 and the other 0.
                    // Progressive sections will be randomly distributed between localCountA and localCountB,
                    // so this algorithm successfully ignores those sections.
                    // Film sections will always have two frames which show the actual field order, and the other
                    // frames will show an arbitrary field order. This algorithm (luckily) seems to work very well
                    // with film sections as well. Using this thresholding as opposed to just comparing countB to countA
                    // produces _much_ more heavily-sided results.
                    if (countA > countB && countB == 0) sectionCountA++;
                    if (countB > countA && countA == 0) sectionCountB++;
                    countA = countB = count = 0;
                }
                line = instream.ReadLine();
            }
            instream.Close();

            if (sectionCountA == 0 && sectionCountB == 0)
            {
                field_order = FieldOrder.UNKNOWN;
            }
            else if ((Math.Min(sectionCountA, sectionCountB) * 100.0 / (Math.Max(sectionCountA, sectionCountB) *
               Math.Pow(FOPercent, 1.0 / 20))) >= FOPercent || sectionCountA == sectionCountB)
            {
                field_order = FieldOrder.VARIABLE;
            }
            else if (sectionCountA > sectionCountB)
            {
                field_order = FieldOrder.TFF;
            }
            else if (sectionCountA < sectionCountB)
            {
                field_order = FieldOrder.BFF;
            }
        }
예제 #40
0
        private void AnalyseFields(string filename, int SelectLength)
        {
            StreamReader instream = new StreamReader(filename);
            int          count = 0, countA = 0, countB = 0;
            double       valueA, valueB;

            string line = instream.ReadLine();

            while (line != null && !IsAborted && !IsErrors)
            {
                count++;
                string[] contents = line.Split(new char[] { '-' });
                valueA = Double.Parse(contents[0], new CultureInfo("en-US"));
                valueB = Double.Parse(contents[1], new CultureInfo("en-US"));

                if (valueA > valueB)
                {
                    countA++;
                }
                else if (valueB > valueA)
                {
                    countB++;
                }

                if (count == SelectLength) //10
                {
                    //Секция = SelectLength, а не просто 10.
                    //------
                    // Truly interlaced sections should always make one of the counts be 5 and the other 0.
                    // Progressive sections will be randomly distributed between localCountA and localCountB,
                    // so this algorithm successfully ignores those sections.
                    // Film sections will always have two frames which show the actual field order, and the other
                    // frames will show an arbitrary field order. This algorithm (luckily) seems to work very well
                    // with film sections as well. Using this thresholding as opposed to just comparing countB to countA
                    // produces _much_ more heavily-sided results.
                    if (countA > countB && countB == 0)
                    {
                        sectionCountA++;
                    }
                    if (countB > countA && countA == 0)
                    {
                        sectionCountB++;
                    }
                    countA = countB = count = 0;
                }
                line = instream.ReadLine();
            }
            instream.Close();

            if (sectionCountA == 0 && sectionCountB == 0)
            {
                field_order = FieldOrder.UNKNOWN;
            }
            else if ((Math.Min(sectionCountA, sectionCountB) * 100.0 / (Math.Max(sectionCountA, sectionCountB) *
                                                                        Math.Pow(FOPercent, 1.0 / 20))) >= FOPercent || sectionCountA == sectionCountB)
            {
                field_order = FieldOrder.VARIABLE;
            }
            else if (sectionCountA > sectionCountB)
            {
                field_order = FieldOrder.TFF;
            }
            else if (sectionCountA < sectionCountB)
            {
                field_order = FieldOrder.BFF;
            }
        }
예제 #41
0
 public static void AddTMC(FieldOrder order, List<DeinterlaceFilter> filters)
 {
     filters.Add(new DeinterlaceFilter(
         "TomsMoComp",
         string.Format("LoadPlugin(\"{0}\"){1}TomsMoComp({2},5,1)", Path.Combine(MainForm.Instance.Settings.AvisynthPluginsPath, "TomsMoComp.dll"), Environment.NewLine, Order(order))));
 }
예제 #42
0
 public void Update(FieldOrder fieldOrder)
 {
     _context.FieldOrders.ReplaceOne(order => order.FieldOrderID == fieldOrder.FieldOrderID, fieldOrder);
 }
예제 #43
0
 public static void AddYadif(FieldOrder order, List<DeinterlaceFilter> filters, bool bobber)
 {
     filters.Add(new DeinterlaceFilter(
         bobber ? "Yadif (with Bob)" : "Yadif",
         string.Format("Load_Stdcall_Plugin(\"{0}\"){1}Yadif({2}order={3})",
             MainForm.Instance.Settings.YadifPath, Environment.NewLine,
             bobber ? "mode=1, " : "", Order(order))));
 }