Beispiel #1
0
        /// <summary>
        /// Calculates the --vbv-maxrate value
        /// </summary>
        /// <returns>the --vbv-maxrate value</returns>
        public int getVBVMaxrate(AVCLevels.Levels avcLevel, bool bIsHighProfile)
        {
            string strCustomValue;
            int    iTemp = _xs.VBVMaxBitrate;

            extractCustomCommand("vbv-maxrate", out strCustomValue);
            if (Int32.TryParse(strCustomValue, out iTemp))
            {
                _xs.VBVMaxBitrate = iTemp;
            }

            if (_device.VBVMaxrate > -1 && (_xs.VBVMaxBitrate > _device.VBVMaxrate || _xs.VBVMaxBitrate == 0))
            {
                if (_log != null)
                {
                    _log.LogEvent("changing --vbv-maxrate to " + _device.VBVMaxrate + " as required for the selected device");
                }
                _xs.VBVMaxBitrate = _device.VBVMaxrate;
            }

            if (_log != null && avcLevel != AVCLevels.Levels.L_UNRESTRICTED)
            {
                AVCLevels al = new AVCLevels();
                iTemp = al.getMaxBR(avcLevel, bIsHighProfile);
                if (_xs.VBVMaxBitrate == 0)
                {
                    _log.LogEvent("--vbv-maxrate is not restricted. Maximum value for level " + AVCLevels.GetLevelText(avcLevel) + " is " + iTemp + ". Playback may be affected. Reselect AVC level/profile or target playback device in the x264 preset to set the proper value.", ImageType.Warning);
                }
            }

            return(_xs.VBVMaxBitrate);
        }
Beispiel #2
0
        private void EnforceLevel(x264Settings inputSettings)
        {
            if (avcLevel.SelectedIndex > -1)
            {
                AVCLevels al = new AVCLevels();
                AVCLevelEnforcementReturn enforcement;
                x264Settings verifiedSettings = al.EnforceSettings(avcLevel.SelectedIndex, inputSettings, BytesPerFrame, out enforcement);
                // Set the correct input enable states
                if (enforcement.EnableP4x4mv)
                {
                    if (this.macroblockOptions.SelectedIndex == 2)
                    {
                        this.x264P4x4mv.Enabled = true;
                    }
                    else
                    {
                        this.x264P4x4mv.Enabled = false;
                    }
                }
                else
                {
                    this.x264P4x4mv.Enabled = false;
                }
                if (enforcement.EnableVBVMaxRate)
                {
                    this.x264VBVMaxRate.Enabled = true;
                }
                else
                {
                    this.x264VBVMaxRate.Enabled = false;
                }
                if (enforcement.EnableVBVBufferSize)
                {
                    this.x264VBVBufferSize.Enabled = true;
                }
                else
                {
                    this.x264VBVBufferSize.Enabled = false;
                }
                if (enforcement.Altered)
                {
                    levelEnforced = true;
                    this.Settings = verifiedSettings;
                    levelEnforced = false;

                    // Set the config boxes to the correct values
                    // if (!enforcement.EnableP4x4mv)
                    //     this.x264P4x4mv.Checked = false;
                    // if (!enforcement.EnableVBVMaxRate)
                    //     this.x264VBVMaxRate.Text = "";
                    // if (!enforcement.EnableVBVBufferSize)
                    //     this.x264VBVBufferSize.Text = "";
                    if (enforcement.Panic)
                    {
                        MessageBox.Show(enforcement.PanicString, "Level Violation", MessageBoxButtons.OK);
                    }
                }
            }
        }
Beispiel #3
0
        public x264ConfigurationPanel(MainForm mainForm, VideoInfo info)
            : base(mainForm, info)
        {
            InitializeComponent();
            AVCLevels al = new AVCLevels();

            this.avcLevel.Items.AddRange(al.getLevels());
        }
Beispiel #4
0
        /// <summary>
        /// Calculates the AVC level number
        /// </summary>
        /// <returns>the AVC level value</returns>
        public int getLevel()
        {
            string strCustomValue;

            extractCustomCommand("level", out strCustomValue);
            switch (strCustomValue.ToLower(System.Globalization.CultureInfo.InvariantCulture).Replace(".", "").Trim())
            {
            case "1":
            case "10": _xs.Level = 0; break;

            case "11": _xs.Level = 1; break;

            case "12": _xs.Level = 2; break;

            case "13": _xs.Level = 3; break;

            case "2":
            case "20": _xs.Level = 4; break;

            case "21": _xs.Level = 5; break;

            case "22": _xs.Level = 6; break;

            case "3":
            case "30": _xs.Level = 7; break;

            case "31": _xs.Level = 8; break;

            case "32": _xs.Level = 9; break;

            case "4":
            case "40": _xs.Level = 10; break;

            case "41": _xs.Level = 11; break;

            case "42": _xs.Level = 12; break;

            case "5":
            case "50": _xs.Level = 13; break;

            case "51": _xs.Level = 14; break;
            }

            if (_log == null)
            {
                return(_xs.Level);
            }

            if (_device.Level > -1 && _xs.Level > _device.Level)
            {
                _log.LogEvent(strDevice + "changing --level to " + AVCLevels.getCLILevelNames()[_device.Level]);
                _xs.Profile = _device.Profile;
            }

            return(_xs.Level);
        }
        public x264ConfigurationPanel()
            : base()
        {
            InitializeComponent();
            cqmComboBox1.StandardItems = new string[] { "Flat (none)", "JVT" };
            this.AdvancedToolTips      = MainForm.Instance.Settings.UseAdvancedTooltips;
            AVCLevels al = new AVCLevels();

            this.avcLevel.Items.AddRange(al.getLevels());
        }
        private void doAVCLevelAdjustments()
        {
            AVCLevels avcLevel       = new AVCLevels();
            int       avcLevelVerify = avcLevel.Verifyx264Settings(this.Settings as x264Settings, this.avcLevel.SelectedIndex, this.BytesPerFrame);

            if (avcLevelVerify != 0)
            {
                avcLevelDialog("Reverting to Unrestrained Level", avcLevelVerify);
                this.avcLevel.SelectedIndex = 15;
            }
        }
Beispiel #7
0
        /// <summary>
        /// gets the maximum ref count based upon the given level
        /// </summary>
        /// <param name="level">the AVC level</param>
        /// <param name="hRes">the horizontal resolution</param>
        /// <param name="vRes">the vertical resolution</param>
        /// <returns>the maximum reference count; -1 if no restriction</returns>
        public static int getMaxRefForLevel(AVCLevels.Levels avcLevel, int hRes, int vRes)
        {
            if (hRes <= 0 || vRes <= 0 || avcLevel == AVCLevels.Levels.L_UNRESTRICTED)  // Unrestricted/Autoguess
            {
                return(-1);
            }

            AVCLevels oAVC             = new AVCLevels();
            int       maxDPB           = (int)oAVC.getMaxDPB(avcLevel); // the maximum picture decoded buffer for the given level
            int       frameHeightInMbs = (int)System.Math.Ceiling((double)vRes / 16);
            int       frameWidthInMbs  = (int)System.Math.Ceiling((double)hRes / 16);
            int       maxRef           = (int)System.Math.Floor((double)maxDPB / (frameHeightInMbs * frameWidthInMbs));

            return(System.Math.Min(maxRef, 16));
        }