Example #1
0
        private LamePreset BestGuessTwoVersions(LameVersionGroup AGroup1, LameVersionGroup AGroup2, Byte ABitrate,
                                                Byte AQuality, Byte AEncodingMethod, Byte ANoiseShaping, Byte AStereoMode,
                                                Byte AATHType, Byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset Result;

            // A bitrate-based guess is better than a non-bitrate guess which in turn is
            // better than no guess at all.

            LamePreset FirstPreset, SecondPreset;
            bool       FirstNonBitrate, SecondNonBitrate;

            FirstPreset = GuessForVersion(AGroup1, ABitrate, AQuality, AEncodingMethod,
                                          ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            FirstNonBitrate = ANonBitrate;

            SecondPreset = GuessForVersion(AGroup2, ABitrate, AQuality, AEncodingMethod,
                                           ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            SecondNonBitrate = ANonBitrate;

            if (FirstPreset == LamePreset.Unknown || (FirstNonBitrate && (SecondPreset != LamePreset.Unknown)))
            {
                Result      = SecondPreset;
                ANonBitrate = SecondNonBitrate;
            }
            else
            {
                Result      = FirstPreset;
                ANonBitrate = FirstNonBitrate;
            }

            return(Result);
        }
Example #2
0
        private LamePreset GuessForVersion(LameVersionGroup AVersionGroup, byte ABitrate, byte AQuality, byte AEncodingMethod, byte ANoiseShaping, byte AStereoMode, byte AATHType, byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset preset1 = LamePreset.Unknown;
            LamePreset preset2 = LamePreset.Unknown;

            ANonBitrate = false;
            foreach (PresetGuessRow row1 in PresetGuesser.m_PresetGuessTable)
            {
                if (((row1.HasVersionGroup(AVersionGroup) && (row1.TVs[1] == AQuality)) && ((row1.TVs[2] == AEncodingMethod) && (row1.TVs[3] == ANoiseShaping))) && (((row1.TVs[4] == AStereoMode) && (row1.TVs[5] == AATHType)) && (row1.TVs[6] == ALowpassDiv100)))
                {
                    if (row1.TVs[0] == ABitrate)
                    {
                        preset1 = row1.Res;
                        break;
                    }
                    if ((AEncodingMethod == 3) || (AEncodingMethod == 4))
                    {
                        preset2 = row1.Res;
                    }
                }
            }
            if ((preset1 == LamePreset.Unknown) && (preset2 != LamePreset.Unknown))
            {
                ANonBitrate = true;
                preset1     = preset2;
            }
            return(preset1);
        }
Example #3
0
 private LamePreset GuessForVersion(LameVersionGroup AVersionGroup, byte ABitrate, byte AQuality, byte AEncodingMethod, byte ANoiseShaping, byte AStereoMode, byte AATHType, byte ALowpassDiv100, out bool ANonBitrate)
 {
     LamePreset preset1 = LamePreset.Unknown;
     LamePreset preset2 = LamePreset.Unknown;
     ANonBitrate = false;
     foreach (PresetGuessRow row1 in PresetGuesser.m_PresetGuessTable)
     {
         if (((row1.HasVersionGroup(AVersionGroup) && (row1.TVs[1] == AQuality)) && ((row1.TVs[2] == AEncodingMethod) && (row1.TVs[3] == ANoiseShaping))) && (((row1.TVs[4] == AStereoMode) && (row1.TVs[5] == AATHType)) && (row1.TVs[6] == ALowpassDiv100)))
         {
             if (row1.TVs[0] == ABitrate)
             {
                 preset1 = row1.Res;
                 break;
             }
             if ((AEncodingMethod == 3) || (AEncodingMethod == 4))
             {
                 preset2 = row1.Res;
             }
         }
     }
     if ((preset1 == LamePreset.Unknown) && (preset2 != LamePreset.Unknown))
     {
         ANonBitrate = true;
         preset1 = preset2;
     }
     return preset1;
 }
Example #4
0
 private void Initialize(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3,
     Byte tv1, Byte tv2, Byte tv3, Byte tv4, Byte tv5, Byte tv6, Byte tv7,
     LamePreset result)
 {
     VGs[0] = vg1; VGs[1] = vg2; VGs[2] = vg3;
     TVs[0] = tv1; TVs[1] = tv2; TVs[2] = tv3; TVs[3] = tv4; TVs[4] = tv5; TVs[5] = tv6; TVs[6] = tv7;
     Res = result;
 }
Example #5
0
 private void Initialize(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3,
                         Byte tv1, Byte tv2, Byte tv3, Byte tv4, Byte tv5, Byte tv6, Byte tv7,
                         LamePreset result)
 {
     VGs[0] = vg1; VGs[1] = vg2; VGs[2] = vg3;
     TVs[0] = tv1; TVs[1] = tv2; TVs[2] = tv3; TVs[3] = tv4; TVs[4] = tv5; TVs[5] = tv6; TVs[6] = tv7;
     Res    = result;
 }
Example #6
0
 public bool HasVersionGroup(LameVersionGroup vg1)
 {
     for (int i = 0; i < 3; i++)
     {
         if (vg1 == VGs[i])
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
 public bool HasVersionGroup(LameVersionGroup vg1)
 {
     for (int num1 = 0; num1 < 3; num1++)
     {
         if (vg1 == this.VGs[num1])
         {
             return true;
         }
     }
     return false;
 }
Example #8
0
 public bool HasVersionGroup(LameVersionGroup vg1)
 {
     for (int num1 = 0; num1 < 3; num1++)
     {
         if (vg1 == this.VGs[num1])
         {
             return(true);
         }
     }
     return(false);
 }
Example #9
0
 private void Initialize(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3, byte tv1, byte tv2, byte tv3, byte tv4, byte tv5, byte tv6, byte tv7, LamePreset result)
 {
     this.VGs[0] = vg1;
     this.VGs[1] = vg2;
     this.VGs[2] = vg3;
     this.TVs[0] = tv1;
     this.TVs[1] = tv2;
     this.TVs[2] = tv3;
     this.TVs[3] = tv4;
     this.TVs[4] = tv5;
     this.TVs[5] = tv6;
     this.TVs[6] = tv7;
     this.Res    = result;
 }
Example #10
0
 private void Initialize(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3, byte tv1, byte tv2, byte tv3, byte tv4, byte tv5, byte tv6, byte tv7, LamePreset result)
 {
     this.VGs[0] = vg1;
     this.VGs[1] = vg2;
     this.VGs[2] = vg3;
     this.TVs[0] = tv1;
     this.TVs[1] = tv2;
     this.TVs[2] = tv3;
     this.TVs[3] = tv4;
     this.TVs[4] = tv5;
     this.TVs[5] = tv6;
     this.TVs[6] = tv7;
     this.Res = result;
 }
Example #11
0
 private LamePreset BestGuessTwoVersions(LameVersionGroup AGroup1, LameVersionGroup AGroup2, byte ABitrate, byte AQuality, byte AEncodingMethod, byte ANoiseShaping, byte AStereoMode, byte AATHType, byte ALowpassDiv100, out bool ANonBitrate)
 {
     LamePreset preset1;
     LamePreset preset2 = this.GuessForVersion(AGroup1, ABitrate, AQuality, AEncodingMethod, ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
     bool flag1 = ANonBitrate;
     LamePreset preset3 = this.GuessForVersion(AGroup2, ABitrate, AQuality, AEncodingMethod, ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
     bool flag2 = ANonBitrate;
     if ((preset2 == LamePreset.Unknown) || (flag1 && (preset3 != LamePreset.Unknown)))
     {
         preset1 = preset3;
         ANonBitrate = flag2;
         return preset1;
     }
     preset1 = preset2;
     ANonBitrate = flag1;
     return preset1;
 }
Example #12
0
        private LamePreset BestGuessTwoVersions(LameVersionGroup AGroup1, LameVersionGroup AGroup2, byte ABitrate, byte AQuality, byte AEncodingMethod, byte ANoiseShaping, byte AStereoMode, byte AATHType, byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset preset1;
            LamePreset preset2 = this.GuessForVersion(AGroup1, ABitrate, AQuality, AEncodingMethod, ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            bool       flag1   = ANonBitrate;
            LamePreset preset3 = this.GuessForVersion(AGroup2, ABitrate, AQuality, AEncodingMethod, ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            bool       flag2   = ANonBitrate;

            if ((preset2 == LamePreset.Unknown) || (flag1 && (preset3 != LamePreset.Unknown)))
            {
                preset1     = preset3;
                ANonBitrate = flag2;
                return(preset1);
            }
            preset1     = preset2;
            ANonBitrate = flag1;
            return(preset1);
        }
Example #13
0
        private LamePreset GuessForVersion(LameVersionGroup AVersionGroup, Byte ABitrate, Byte AQuality,
                                           Byte AEncodingMethod, Byte ANoiseShaping, Byte AStereoMode,
                                           Byte AATHType, Byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset Result = LamePreset.Unknown;

            LamePreset NonBitrateResult = LamePreset.Unknown;

            ANonBitrate = false;

            foreach (PresetGuessRow row in _presetGuessTable)
            {
                if
                ((row.HasVersionGroup(AVersionGroup)) &&
                 (row.TVs[1] == AQuality) &&
                 (row.TVs[2] == AEncodingMethod) &&
                 (row.TVs[3] == ANoiseShaping) &&
                 (row.TVs[4] == AStereoMode) &&
                 (row.TVs[5] == AATHType) &&
                 (row.TVs[6] == ALowpassDiv100))
                {
                    if (row.TVs[0] == ABitrate)
                    {
                        Result = row.Res;
                        break;
                    }
                    // Non-bitrate based guessing is only relevant to the VBR presets.
                    else if (AEncodingMethod == 3 || AEncodingMethod == 4)
                    {
                        NonBitrateResult = row.Res;
                    }
                }
            }

            if (Result == LamePreset.Unknown && NonBitrateResult != LamePreset.Unknown)
            {
                ANonBitrate = true;
                Result      = NonBitrateResult;
            }

            return(Result);
        }
Example #14
0
 public PresetGuessRow(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3,
     Byte tv1, Byte tv2, Byte tv3, Byte tv4, Byte tv5, Byte tv6, Byte tv7,
     LamePreset result)
 {
     Initialize(vg1, vg2, vg3, tv1, tv2, tv3, tv4, tv5, tv6, tv7, result);
 }
Example #15
0
        private LamePreset GuessForVersion(LameVersionGroup AVersionGroup, Byte ABitrate, Byte AQuality,
	            Byte AEncodingMethod, Byte ANoiseShaping, Byte AStereoMode,
                Byte AATHType, Byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset Result = LamePreset.Unknown;

            LamePreset NonBitrateResult = LamePreset.Unknown;

            ANonBitrate = false;

            foreach (PresetGuessRow row in _presetGuessTable)
            {
                if
                    ((row.HasVersionGroup(AVersionGroup)) &&
                    (row.TVs[1] == AQuality) &&
                    (row.TVs[2] == AEncodingMethod) &&
                    (row.TVs[3] == ANoiseShaping) &&
                    (row.TVs[4] == AStereoMode) &&
                    (row.TVs[5] == AATHType) &&
                    (row.TVs[6] == ALowpassDiv100))
                {
                    if (row.TVs[0] == ABitrate)
                    {
                        Result = row.Res;
                        break;
                    }
                    // Non-bitrate based guessing is only relevant to the VBR presets.
                    else if (AEncodingMethod == 3 || AEncodingMethod == 4)
                    {
                        NonBitrateResult = row.Res;
                    }
                }
            }

            if (Result == LamePreset.Unknown && NonBitrateResult != LamePreset.Unknown)
            {
                ANonBitrate = true;
                Result = NonBitrateResult;
            }

            return Result;
        }
Example #16
0
        private LamePreset BestGuessTwoVersions(LameVersionGroup AGroup1, LameVersionGroup AGroup2, Byte ABitrate,
                Byte AQuality, Byte AEncodingMethod, Byte ANoiseShaping, Byte AStereoMode,
                Byte AATHType, Byte ALowpassDiv100, out bool ANonBitrate)
        {
            LamePreset Result;

            // A bitrate-based guess is better than a non-bitrate guess which in turn is
            // better than no guess at all.

            LamePreset FirstPreset, SecondPreset;
            bool FirstNonBitrate, SecondNonBitrate;

            FirstPreset = GuessForVersion(AGroup1, ABitrate, AQuality, AEncodingMethod,
                            ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            FirstNonBitrate = ANonBitrate;

            SecondPreset = GuessForVersion(AGroup2, ABitrate, AQuality, AEncodingMethod,
                            ANoiseShaping, AStereoMode, AATHType, ALowpassDiv100, out ANonBitrate);
            SecondNonBitrate = ANonBitrate;

            if (FirstPreset == LamePreset.Unknown || (FirstNonBitrate && (SecondPreset != LamePreset.Unknown)))
            {
                Result = SecondPreset;
                ANonBitrate = SecondNonBitrate;
            }
            else
            {
                Result = FirstPreset;
                ANonBitrate = FirstNonBitrate;
            }

            return Result;
        }
Example #17
0
 public PresetGuessRow(LameVersionGroup vg1, byte tv1, byte tv2, byte tv3, byte tv4, byte tv5, byte tv6, byte tv7, LamePreset result)
 {
     this.VGs = new LameVersionGroup[3];
     this.TVs = new byte[7];
     this.Initialize(vg1, LameVersionGroup.None, LameVersionGroup.None, tv1, tv2, tv3, tv4, tv5, tv6, tv7, result);
 }
Example #18
0
 public PresetGuessRow(LameVersionGroup vg1, LameVersionGroup vg2, LameVersionGroup vg3,
                       Byte tv1, Byte tv2, Byte tv3, Byte tv4, Byte tv5, Byte tv6, Byte tv7,
                       LamePreset result)
 {
     Initialize(vg1, vg2, vg3, tv1, tv2, tv3, tv4, tv5, tv6, tv7, result);
 }
Example #19
0
 public PresetGuessRow(LameVersionGroup vg1, byte tv1, byte tv2, byte tv3, byte tv4, byte tv5, byte tv6, byte tv7, LamePreset result)
 {
     this.VGs = new LameVersionGroup[3];
     this.TVs = new byte[7];
     this.Initialize(vg1, LameVersionGroup.None, LameVersionGroup.None, tv1, tv2, tv3, tv4, tv5, tv6, tv7, result);
 }
Example #20
0
 public bool HasVersionGroup(LameVersionGroup vg1)
 {
     for (int i=0; i<3; i++) if (vg1 == VGs[i]) return true;
     return false;
 }