public static int GetDefaultNumberOfRefFrames(int oPreset, int oTuningMode, X264Device oDevice, int iLevel, int hRes, int vRes) { int iDefaultSetting = 1; switch (oPreset) { case 0: case 1: case 2: iDefaultSetting = 1; break; case 3: case 4: iDefaultSetting = 2; break; case 5: iDefaultSetting = 3; break; case 6: iDefaultSetting = 5; break; case 7: iDefaultSetting = 8; break; case 8: case 9: iDefaultSetting = 16; break; } if (oTuningMode == 1 && iDefaultSetting > 1) // animation iDefaultSetting *= 2; if (iDefaultSetting > 16) iDefaultSetting = 16; if (oDevice != null && oDevice.ReferenceFrames > -1) iDefaultSetting = Math.Min(oDevice.ReferenceFrames, iDefaultSetting); if (iLevel > -1 && hRes > 0 && vRes > 0) { int iMaxRefForLevel = GetMaxRefForLevel(iLevel, hRes, vRes); if (iMaxRefForLevel > -1 && iMaxRefForLevel < iDefaultSetting) iDefaultSetting = iMaxRefForLevel; } return iDefaultSetting; }
public static int GetDefaultNumberOfBFrames(int oPresetLevel, int oTuningMode, int oAVCProfile, X264Device oDevice) { int iDefaultSetting = 0; if (oAVCProfile == 0) // baseline return iDefaultSetting; switch (oPresetLevel) { case 0: iDefaultSetting = 0; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: iDefaultSetting = 3; break; case 8: iDefaultSetting = 8; break; case 9: iDefaultSetting = 16; break; } if (oTuningMode == 1) // animation iDefaultSetting += 2; if (iDefaultSetting > 16) iDefaultSetting = 16; if (oDevice != null && oDevice.BFrames > -1) return Math.Min(oDevice.BFrames, iDefaultSetting); return iDefaultSetting; }
public static int GetDefaultNumberOfRefFrames(int oPreset, int oTuningMode, X264Device oDevice, int iLevel, int hRes, int vRes) { int iDefaultSetting = 1; switch (oPreset) { case 0: case 1: case 2: iDefaultSetting = 1; break; case 3: case 4: iDefaultSetting = 2; break; case 5: iDefaultSetting = 3; break; case 6: iDefaultSetting = 5; break; case 7: iDefaultSetting = 8; break; case 8: case 9: iDefaultSetting = 16; break; } if (oTuningMode == 1 && iDefaultSetting > 1) // animation { iDefaultSetting *= 2; } if (iDefaultSetting > 16) { iDefaultSetting = 16; } if (oDevice != null && oDevice.ReferenceFrames > -1) { iDefaultSetting = Math.Min(oDevice.ReferenceFrames, iDefaultSetting); } if (iLevel > -1 && hRes > 0 && vRes > 0) { int iMaxRefForLevel = GetMaxRefForLevel(iLevel, hRes, vRes); if (iMaxRefForLevel > -1 && iMaxRefForLevel < iDefaultSetting) { iDefaultSetting = iMaxRefForLevel; } } return(iDefaultSetting); }
private static int GetBPyramid(X264Profile inProfile, X264Device device) { int bPyramid = inProfile.BPyramid; if (device.BluRay && inProfile.BPyramid > 1) { bPyramid = 1; } if (device.BPyramid > -1 && bPyramid != device.BPyramid) { bPyramid = device.BPyramid; } return bPyramid; }
private static int GetBFrames(X264Profile inProfile, X264Device device) { int numBframes = inProfile.NumBFrames; if (device.BFrames > -1 && inProfile.NumBFrames > device.BFrames) { numBframes = device.BFrames; } return numBframes; }
private static bool GetAud(X264Profile inProfile, X264Device device) { bool aud = inProfile.UseAccessUnitDelimiters || device.BluRay && inProfile.UseAccessUnitDelimiters == false; return aud; }
private static int GetWeightp(X264Profile inProfile, X264Device device) { int weightP = inProfile.PFrameWeightedPrediction; if (device.BluRay && weightP > 1) { weightP = 1; } return weightP; }
private static int GetVBVMaxrate(X264Profile inProfile, X264Device device) { int vbvMaxRate = inProfile.VBVMaxRate; if (device.VBVMaxrate > -1 && (vbvMaxRate > device.VBVMaxrate || vbvMaxRate == 0)) { vbvMaxRate = device.VBVMaxrate; } return vbvMaxRate; }
public static int GetDefaultNumberOfRefFrames(int oPreset, int oTuningMode, X264Device oDevice) { return(GetDefaultNumberOfRefFrames(oPreset, oTuningMode, oDevice, -1, -1, -1)); }
private static int GetSlices(X264Profile inProfile, X264Device device) { int numSlices = inProfile.NumSlices; if (device.BluRay && numSlices != 4) { numSlices = 4; } return numSlices; }
private static int GetRefFrames(int hRes, int vRes, X264Profile inProfile, X264Device device) { int refFrames = inProfile.NumRefFrames; if (device.ReferenceFrames > -1 && refFrames > device.ReferenceFrames) { refFrames = device.ReferenceFrames; } int iMaxRefForLevel = X264Settings.GetMaxRefForLevel(inProfile.AVCLevel, hRes, vRes); if (iMaxRefForLevel > -1 && iMaxRefForLevel < refFrames) { refFrames = iMaxRefForLevel; } return refFrames; }
private static int GetNalHrd(X264Profile inProfile, X264Device device) { int nalHrd = inProfile.HRDInfo; if (device.BluRay && nalHrd < 1) { nalHrd = 1; } return nalHrd; }
private static int GetMinKeyInt(int fpsN, int fpsD, int minGop, int maxGop, X264Device device, int gopCalculation) { int keyInt = 0; double fps = (double)fpsN / fpsD; if (gopCalculation == 1) // calculate min-keyint based on 25fps keyInt = (int)(minGop / 25.0 * fps); int maxValue = maxGop / 2 + 1; if (device.MaxGOP > -1 && minGop > maxValue) { int Default = maxGop / 10; keyInt = Default; } return keyInt; }
private static int GetKeyInt(int fpsN, int fpsD, int maxGop, X264Device device, int gopCalculation) { int keyInt = 0; if (gopCalculation == 1)// calculate min-keyint based on 25fps keyInt = (int)Math.Round(maxGop / 25.0 * (fpsN / (double)fpsD), 0); int fps = (int)Math.Round((decimal)fpsN / fpsD, 0); if (device.MaxGOP > -1 && maxGop > fps * device.MaxGOP) { keyInt = fps * device.MaxGOP; } return keyInt; }
public static int GetDefaultNumberOfRefFrames(int oPreset, int oTuningMode, X264Device oDevice) { return GetDefaultNumberOfRefFrames(oPreset, oTuningMode, oDevice, -1, -1, -1); }
private static int GetVBVBufsize(X264Profile inProfile, X264Device device) { int vbvBufSize = inProfile.VBVBufSize; if (device.VBVBufsize > -1 && (vbvBufSize > device.VBVBufsize || vbvBufSize == 0)) { vbvBufSize = device.VBVBufsize; } return vbvBufSize; }
public static int GetDefaultNumberOfBFrames(int oPresetLevel, int oTuningMode, int oAVCProfile, X264Device oDevice) { int iDefaultSetting = 0; if (oAVCProfile == 0) // baseline { return(iDefaultSetting); } switch (oPresetLevel) { case 0: iDefaultSetting = 0; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: iDefaultSetting = 3; break; case 8: iDefaultSetting = 8; break; case 9: iDefaultSetting = 16; break; } if (oTuningMode == 1) // animation { iDefaultSetting += 2; } if (iDefaultSetting > 16) { iDefaultSetting = 16; } if (oDevice != null && oDevice.BFrames > -1) { return(Math.Min(oDevice.BFrames, iDefaultSetting)); } return(iDefaultSetting); }