Example #1
0
        public static int GetDefaultRCLookahead(x264PresetLevelModes oPresetLevel, bool bTuneZeroLatency)
        {
            int iDefaultSetting = 0;

            if (bTuneZeroLatency)
            {
                return(iDefaultSetting);
            }

            switch (oPresetLevel)
            {
            case x264Settings.x264PresetLevelModes.ultrafast:
            case x264Settings.x264PresetLevelModes.superfast:   iDefaultSetting = 0; break;

            case x264Settings.x264PresetLevelModes.veryfast:    iDefaultSetting = 10; break;

            case x264Settings.x264PresetLevelModes.faster:      iDefaultSetting = 20; break;

            case x264Settings.x264PresetLevelModes.fast:        iDefaultSetting = 30; break;

            case x264Settings.x264PresetLevelModes.medium:      iDefaultSetting = 40; break;

            case x264Settings.x264PresetLevelModes.slow:        iDefaultSetting = 50; break;

            case x264Settings.x264PresetLevelModes.slower:
            case x264Settings.x264PresetLevelModes.veryslow:
            case x264Settings.x264PresetLevelModes.placebo:     iDefaultSetting = 60; break;
            }
            return(iDefaultSetting);
        }
Example #2
0
        public static int GetDefaultNumberOfBFrames(x264PresetLevelModes oPresetLevel, x264PsyTuningModes oTuningMode, bool bTuneZeroLatency, int oAVCProfile, x264Device oDevice, bool blurayCompat)
        {
            int iDefaultSetting = 0;

            if (oAVCProfile == 0) // baseline
            {
                return(iDefaultSetting);
            }
            if (bTuneZeroLatency)
            {
                return(iDefaultSetting);
            }

            switch (oPresetLevel)
            {
            case x264Settings.x264PresetLevelModes.ultrafast: iDefaultSetting = 0; break;

            case x264Settings.x264PresetLevelModes.superfast:
            case x264Settings.x264PresetLevelModes.veryfast:
            case x264Settings.x264PresetLevelModes.faster:
            case x264Settings.x264PresetLevelModes.fast:
            case x264Settings.x264PresetLevelModes.medium:
            case x264Settings.x264PresetLevelModes.slow:
            case x264Settings.x264PresetLevelModes.slower: iDefaultSetting = 3; break;

            case x264Settings.x264PresetLevelModes.veryslow: iDefaultSetting = 8; break;

            case x264Settings.x264PresetLevelModes.placebo: iDefaultSetting = 16; break;
            }
            if (oTuningMode == x264PsyTuningModes.ANIMATION)
            {
                iDefaultSetting += 2;
            }
            if (iDefaultSetting > 16)
            {
                iDefaultSetting = 16;
            }
            if (blurayCompat)
            {
                iDefaultSetting = Math.Min(3, iDefaultSetting);
            }
            if (oDevice != null && oDevice.BFrames > -1)
            {
                return(Math.Min(oDevice.BFrames, iDefaultSetting));
            }
            else
            {
                return(iDefaultSetting);
            }
        }
Example #3
0
        public static int GetDefaultAQMode(x264PresetLevelModes oPresetLevel, x264PsyTuningModes oTuningMode)
        {
            if (oTuningMode == x264PsyTuningModes.SSIM)
            {
                return(2);
            }

            if (oTuningMode == x264PsyTuningModes.PSNR || oPresetLevel == x264Settings.x264PresetLevelModes.ultrafast)
            {
                return(0);
            }

            return(1);
        }
Example #4
0
        public static int GetDefaultAQMode(x264PresetLevelModes oPresetLevel, int oTuningMode)
        {
            if (oTuningMode == 5) // SSIM
            {
                return(2);
            }

            if (oTuningMode == 4 || oPresetLevel == x264Settings.x264PresetLevelModes.ultrafast) // PSNR
            {
                return(0);
            }

            return(1);
        }
Example #5
0
        public static int GetDefaultNumberOfRefFrames(x264PresetLevelModes oPreset, x264PsyTuningModes oTuningMode, x264Device oDevice, AVCLevels.Levels avcLevel, bool blurayCompat, int hRes, int vRes)
        {
            int iDefaultSetting = 1;

            switch (oPreset)
            {
            case x264Settings.x264PresetLevelModes.ultrafast:
            case x264Settings.x264PresetLevelModes.superfast:
            case x264Settings.x264PresetLevelModes.veryfast:    iDefaultSetting = 1; break;

            case x264Settings.x264PresetLevelModes.faster:
            case x264Settings.x264PresetLevelModes.fast:        iDefaultSetting = 2; break;

            case x264Settings.x264PresetLevelModes.medium:      iDefaultSetting = 3; break;

            case x264Settings.x264PresetLevelModes.slow:        iDefaultSetting = 5; break;

            case x264Settings.x264PresetLevelModes.slower:      iDefaultSetting = 8; break;

            case x264Settings.x264PresetLevelModes.veryslow:
            case x264Settings.x264PresetLevelModes.placebo:     iDefaultSetting = 16; break;
            }
            if (oTuningMode == x264PsyTuningModes.ANIMATION && iDefaultSetting > 1)
            {
                iDefaultSetting *= 2;
            }
            if (iDefaultSetting > 16)
            {
                iDefaultSetting = 16;
            }
            if (blurayCompat)
            {
                iDefaultSetting = Math.Min(6, iDefaultSetting);
            }
            if (oDevice != null && oDevice.ReferenceFrames > -1)
            {
                iDefaultSetting = Math.Min(oDevice.ReferenceFrames, iDefaultSetting);
            }
            if (hRes > 0 && vRes > 0)
            {
                int iMaxRefForLevel = MeGUI.packages.video.x264.x264SettingsHandler.getMaxRefForLevel(avcLevel, hRes, vRes);
                if (iMaxRefForLevel > -1 && iMaxRefForLevel < iDefaultSetting)
                {
                    iDefaultSetting = iMaxRefForLevel;
                }
            }
            return(iDefaultSetting);
        }
Example #6
0
        public static int GetDefaultNumberOfBFrames(x264PresetLevelModes oPresetLevel, int oTuningMode, int oAVCProfile, x264Device oDevice)
        {
            int iDefaultSetting = 0;

            if (oAVCProfile == 0) // baseline
            {
                return(iDefaultSetting);
            }
            switch (oPresetLevel)
            {
            case x264Settings.x264PresetLevelModes.ultrafast: iDefaultSetting = 0; break;

            case x264Settings.x264PresetLevelModes.superfast:
            case x264Settings.x264PresetLevelModes.veryfast:
            case x264Settings.x264PresetLevelModes.faster:
            case x264Settings.x264PresetLevelModes.fast:
            case x264Settings.x264PresetLevelModes.medium:
            case x264Settings.x264PresetLevelModes.slow:
            case x264Settings.x264PresetLevelModes.slower: iDefaultSetting = 3; break;

            case x264Settings.x264PresetLevelModes.veryslow: iDefaultSetting = 8; break;

            case x264Settings.x264PresetLevelModes.placebo: iDefaultSetting = 16; break;
            }
            if (oTuningMode == 2) // animation
            {
                iDefaultSetting += 2;
            }
            if (iDefaultSetting > 16)
            {
                iDefaultSetting = 16;
            }
            if (oDevice != null && oDevice.BFrames > -1)
            {
                return(Math.Min(oDevice.BFrames, iDefaultSetting));
            }
            else
            {
                return(iDefaultSetting);
            }
        }
Example #7
0
        public static int GetDefaultNumberOfWeightp(x264PresetLevelModes oPresetLevel, bool bFastDecode, int oAVCProfile, bool bBlurayCompat)
        {
            if (oAVCProfile == 0) // baseline
            {
                return(0);
            }
            if (bFastDecode) // Fast Decode
            {
                return(0);
            }

            int iDefaultSetting = 0;

            switch (oPresetLevel)
            {
            case x264Settings.x264PresetLevelModes.ultrafast:   iDefaultSetting = 0; break;

            case x264Settings.x264PresetLevelModes.superfast:
            case x264Settings.x264PresetLevelModes.veryfast:
            case x264Settings.x264PresetLevelModes.faster:
            case x264Settings.x264PresetLevelModes.fast:        iDefaultSetting = 1; break;

            case x264Settings.x264PresetLevelModes.medium:
            case x264Settings.x264PresetLevelModes.slow:
            case x264Settings.x264PresetLevelModes.slower:
            case x264Settings.x264PresetLevelModes.veryslow:
            case x264Settings.x264PresetLevelModes.placebo:     iDefaultSetting = 2; break;
            }
            if (bBlurayCompat)
            {
                return(Math.Min(iDefaultSetting, 1));
            }
            else
            {
                return(iDefaultSetting);
            }
        }
Example #8
0
 public static int GetDefaultNumberOfRefFrames(x264PresetLevelModes oPreset, x264PsyTuningModes oTuningMode, x264Device oDevice, AVCLevels.Levels avcLevel, bool blurayCompat)
 {
     return(GetDefaultNumberOfRefFrames(oPreset, oTuningMode, oDevice, avcLevel, blurayCompat, -1, -1));
 }
Example #9
0
 /// <summary>
 /// default constructor, initializes codec default values
 /// </summary>
 public x264Settings() : base(ID, VideoEncoderType.X264)
 {
     x264DeviceList         = x264Device.CreateDeviceList();
     preset                 = x264PresetLevelModes.medium;
     psyTuningMode          = x264PsyTuningModes.NONE;
     deadZoneInter          = 21;
     deadZoneIntra          = 11;
     noFastPSkip            = false;
     ssimCalc               = false;
     psnrCalc               = false;
     EncodingMode           = 9;
     BitrateQuantizer       = 23;
     KeyframeInterval       = 250;
     nbRefFrames            = 3;
     noMixedRefs            = false;
     NbBframes              = 3;
     deblock                = true;
     alphaDeblock           = 0;
     betaDeblock            = 0;
     cabac                  = true;
     weightedBPrediction    = true;
     weightedPPrediction    = 2;
     NewadaptiveBFrames     = 1;
     bFramePyramid          = 2;
     subPelRefinement       = 7;
     psyRDO                 = new decimal(1.0);
     psyTrellis             = new decimal(0.0);
     macroBlockOptions      = 3;
     chromaME               = true;
     p8x8mv                 = true;
     b8x8mv                 = true;
     p4x4mv                 = false;
     i4x4mv                 = true;
     i8x8mv                 = true;
     MinQuantizer           = 0;
     MaxQuantizer           = 69;
     maxQuantDelta          = 4;
     CreditsQuantizer       = new decimal(40);
     ipFactor               = new decimal(1.4);
     pbFactor               = new decimal(1.3);
     chromaQPOffset         = new decimal(0.0);
     vbvBufferSize          = 0;
     vbvMaxBitrate          = 0;
     vbvInitialBuffer       = new decimal(0.9);
     bitrateVariance        = 1;
     quantCompression       = new decimal(0.6);
     tempComplexityBlur     = 20;
     tempQuanBlurCC         = new decimal(0.5);
     bframePredictionMode   = 1;
     scdSensitivity         = new decimal(40);
     bframeBias             = new decimal(0);
     meType                 = 1;
     meRange                = 16;
     NbThreads              = 0;
     minGOPSize             = 25;
     adaptiveDCT            = true;
     quantizerMatrix        = "";
     quantizerMatrixType    = 0;          // none
     x264Trellis            = 1;
     base.MaxNumberOfPasses = 3;
     AQMode                 = 1;
     AQStrength             = new decimal(1.0);
     useQPFile              = false;
     qpfile                 = "";
     FullRange              = false;
     range                  = "auto";
     advSet                 = false;
     lookahead              = 40;
     noMBTree               = true;
     threadInput            = true;
     noPsy                  = false;
     scenecut               = true;
     slicesnb               = 0;
     maxSliceSyzeBytes      = 0;
     maxSliceSyzeMBs        = 0;
     x264Nalhrd             = 0;
     x264PullDown           = 0;
     sampleAR               = 0;
     colorMatrix            = 0;
     transfer               = 0;
     colorPrim              = 0;
     x264Aud                = false;
     profile                = 3; // Autoguess. High if using default options.
     avcLevel               = AVCLevels.Levels.L_UNRESTRICTED;
     x264SlowFirstpass      = false;
     openGop                = "False";
     picStruct              = false;
     fakeInterlaced         = false;
     nonDeterministic       = false;
     interlacedMode         = x264InterlacedModes.progressive;
     targetDevice           = x264DeviceList[0];
     blurayCompat           = false;
     _gopCalculation        = 1;
     quantizerCrf           = 23;
     tuneFastDecode         = tuneZeroLatency = false;
     stitchable             = false;
     x26410Bits             = false;
 }
Example #10
0
 public static int GetDefaultNumberOfRefFrames(x264PresetLevelModes oPreset, int oTuningMode, x264Device oDevice)
 {
     return(GetDefaultNumberOfRefFrames(oPreset, oTuningMode, oDevice, -1, -1, -1));
 }
Example #11
0
 /// <summary>
 /// default constructor, initializes codec default values
 /// </summary>
 public x264Settings()
     : base(ID, VideoEncoderType.X264)
 {
     preset = x264PresetLevelModes.medium;
     tune = 0;
     deadZoneInter = 21;
     deadZoneIntra = 11;
     encodeInterlaced = false;
     noFastPSkip = false;
     ssimCalc = false;
     psnrCalc = false;
     EncodingMode = 9;
     BitrateQuantizer = 23;
     KeyframeInterval = 250;
     nbRefFrames = 3;
     noMixedRefs = false;
     NbBframes = 3;
     deblock = true;
     alphaDeblock = 0;
     betaDeblock = 0;
     cabac = true;
     weightedBPrediction = true;
     weightedPPrediction = 2;
     NewadaptiveBFrames = 1;
     bFramePyramid = 2;
     subPelRefinement = 7;
     psyRDO = new decimal(1.0);
     psyTrellis = new decimal(0.0);
     macroBlockOptions = 3;
     chromaME = true;
     p8x8mv = true;
     b8x8mv = true;
     p4x4mv = false;
     i4x4mv = true;
     i8x8mv = false;
     MinQuantizer = 10;
     MaxQuantizer = 51;
     maxQuantDelta = 4;
     CreditsQuantizer = new decimal(40);
     ipFactor = new decimal(1.4);
     pbFactor = new decimal(1.3);
     chromaQPOffset = new decimal(0.0);
     vbvBufferSize = 0;
     vbvMaxBitrate = 0;
     vbvInitialBuffer = new decimal(0.9);
     bitrateVariance = 1;
     quantCompression = new decimal(0.6);
     tempComplexityBlur = 20;
     tempQuanBlurCC = new decimal(0.5);
     bframePredictionMode = 1;
     scdSensitivity = new decimal(40);
     bframeBias = new decimal(0);
     meType = 1;
     meRange = 16;
     NbThreads = 0;
     minGOPSize = 25;
     adaptiveDCT = true;
     quantizerMatrix = "";
     quantizerMatrixType = 0; // none
     x264Trellis = 1;
     base.MaxNumberOfPasses = 3;
     AQMode = 1;
     AQStrength = new decimal(1.0);
     useQPFile = false;
     qpfile = "";
     FullRange = false;
     advSet = false;
     lookahead = 40;
     noMBTree = true;
     threadInput = true;
     noPsy = false;
     scenecut = true;
     slicesnb = 0;
     maxSliceSyzeBytes = 0;
     maxSliceSyzeMBs = 0;
     x264Nalhrd = false;
     x264Aud = false;
     profile = 3; // Autoguess. High if using default options.
     level = 15;
     x264SlowFirstpass = false;
 }