📄 queueentity.java
字号:
package autoencodeinfinit.QueueProcess;import java.util.*;import org.w3c.dom.*;/** * The Entity of the queue , include all the parameter of codec options * change this class so that support more codec! * @author ulysess */public class QueueEntity { {/*private String BitrateQuantizer = "1000", KeyframeInterval = "250" , NbBframes = "0",MinQuantizer = "10" ,MaxQuantizer = "51", Turbo = "0" , V4MV = "false" , QPel = "false" , Trellis = "false", CreditsQuantizer = "40" , MaxNumberOfPasses ="2" ,NbThreads = "0", NoDCTDecimate = "false" , PSNRCalculation ="false" , noFastPSkip ="false", NoiseReduction = "0" , MixedRefs = "true" , X264Trellis = "1" , NbRefFrames ="8",AlphaDeblock = "1", BetaDeblock = "1" , SubPelRefinement = "5" , MaxQuantDelta = "4" , TempQuantBlur = "0" , BframePredictionMode = "0" , VBVBufferSize = "-1" ,VBVMaxBitrate = "-1", METype = "2" , MERange = "12" , MinGOPSize = "25" , Profile = "2", Level = "15", IPFactor = "1.4" , PBFactor = "1.3", ChromaQPOffset = "0", VBVInitialBuffer = "0.9" ,BitrateVariance = "1.0" ,QuantCompression = "0.6", BframeBias = "0",Deblock = "true" , Cabac = "true" , WeightedBPrediction = "true", AdaptiveBframes = "true", BRDO ="true", biME = "true" , ChromaME = "false" , P8x8mv = "true" , B8x8mv = "true" , I4x4mv = "true" , I8x8mv = "true" , P4x4mv = "false" ,AdaptiveDCT = "false",BFramePyramid = "true" ,Lossless = "false", DeadZoneInter = "21" ,DeadZoneIntra = "11" ;*/} private Hashtable values = new Hashtable() , parameter = new Hashtable(); //value is the setting of the parameter private String Identity = null , inadd = null , outadd = null; private static final Hashtable parastr = new Hashtable(); { parastr.put("BitrateQuantizer" , "1000"); parastr.put("KeyframeInterval" , "250"); parastr.put("NbBframes" , "0"); parastr.put("MinQuantizer" , "10"); parastr.put("MaxQuantizer" , "51"); parastr.put("Turbo" , "0"); parastr.put("V4MV" , "false"); parastr.put("QPel" , "false"); parastr.put("Trellis" , "false"); parastr.put("CreditsQuantizer" , "40"); parastr.put("MaxNumberOfPasses" , "2"); parastr.put("NbThreads" , "0"); parastr.put("NoDCTDecimate" , "false"); parastr.put("PSNRCalculation" , "false"); parastr.put("noFastPSkip" , "false"); parastr.put("NoiseReduction" , "0"); parastr.put("MixedRefs" , "true"); parastr.put("X264Trellis" , "1"); parastr.put("NbRefFrames" , "8"); parastr.put("AlphaDeblock" , "1"); parastr.put("BetaDeblock" , "1"); parastr.put("SubPelRefinement" , "6"); parastr.put("MaxQuantDelta" , "4"); parastr.put("TempQuantBlur" , "0"); parastr.put("BframePredictionMode" , "spatial"); parastr.put("VBVBufferSize" , "0"); parastr.put("VBVMaxBitrate" , "0"); parastr.put("METype" , "2"); parastr.put("MERange" , "12"); parastr.put("MinGOPSize" , "25"); parastr.put("Profile" , "2"); parastr.put("Level" , "15"); parastr.put("IPFactor" , "1.4"); parastr.put("PBFactor" , "1.3"); parastr.put("ChromaQPOffset" , "0"); parastr.put("VBVInitialBuffer" , "0.9"); parastr.put("BitrateVariance" , "1.0"); parastr.put("QuantCompression" , "0.6"); parastr.put("BframeBias" , "0"); parastr.put("Deblock" , "true"); parastr.put("Cabac" , "true"); parastr.put("WeightedBPrediction" , "true"); parastr.put("AdaptiveBframes" , "true"); parastr.put("BRDO" , "true"); parastr.put("biME" , "true"); parastr.put("ChromaME" , "true"); parastr.put("P8x8mv" , "true"); parastr.put("B8x8mv" , "true"); parastr.put("I4x4mv" , "true"); parastr.put("I8x8mv" , "true"); parastr.put("P4x4mv" , "false"); parastr.put("AdaptiveDCT" , "false"); parastr.put("BFramePyramid" , "true"); parastr.put("Lossless" , "false"); parastr.put("DeadZoneInter" , "21"); parastr.put("DeadZoneIntra","11"); } private QueueEntity next = null; /** * Constructor : create a Hashtable of the parameter * @param Setting the NodeList of settings which can get from the parent element */ public QueueEntity(NodeList Setting , String inputadd , String outputadd) { Hashtable parastrcp = (Hashtable) parastr.clone(); //copy a new hashtable from the default hashtable for(int i = 0 ; i < Setting.getLength() ; i++){ Node ele = Setting.item(i); if(!(ele instanceof Element)) { continue; } if(ele.hasChildNodes()){ values.put(ele.getNodeName() , ele.getFirstChild().getNodeValue()); } } for(Object it : values.keySet() ) { if(parastrcp.containsKey(it)) { parastrcp.put(it, values.get(it)); } } values=(Hashtable) parastrcp.clone(); /* this method create a hash table parastr use the default value of parameter * and then read all element nodename from the nodelist to create a new hash table. * next step is to compare two hash table's same key while find the same * key replace the maping value of that key! */ this.inadd = inputadd; this.outadd = outputadd; } /** * transform the parameter string into mencoder format * @return ovc options parameter of mencoder */ public String toMencoderParameter() { parameter.put("bitrate" , values.get("BitrateQuantizer") ); parameter.put("keyint" , values.get("KeyframeInterval") ); parameter.put("bframes" , values.get("NbBframes") ); parameter.put("qp_min" , values.get("MinQuantizer") ); parameter.put("qp_max" , values.get("MaxQuantizer") ); parameter.put("pass" , values.get("MaxNumberOfPasses") ); parameter.put("nodct_decimate" , values.get("NoDCTDecimate") ); parameter.put("psnr" , values.get("PSNRCalculation") ); parameter.put("fast_pskip" , values.get("noFastPSkip") ); parameter.put("nr" , values.get("NoiseReduction") ); parameter.put("mixed_refs" , values.get("MixedRefs") ); parameter.put("trellis" , values.get("X264Trellis") ); parameter.put("frameref" , values.get("NbRefFrames") ); parameter.put("deblock" , values.get("AlphaDeblock") ); parameter.put("deblock" , parameter.get("deblock")+","+values.get("BetaDeblock") ); parameter.put("subq" , values.get("SubPelRefinement") ); parameter.put("qp_step" , values.get("MaxQuantDelta") ); parameter.put("direct_pred" , values.get("BframePredictionMode") ); int temp = Integer.valueOf((String) values.get("BframePredictionMode")).intValue(); switch (temp) { case 0:parameter.put("direct_pred", "none"); case 1:parameter.put("direct_pred", "spatial"); case 2:parameter.put("direct_pred", "temporal"); case 3:parameter.put("direct_pred", "auto"); } temp =Integer.parseInt((String) values.get("VBVBufferSize")); if ( temp > 0 ){ parameter.put("vbv_bufsize" , values.get("VBVBufferSize") ); parameter.put("vbv_maxrate" , values.get("VBVMaxBitrate") ); } temp = Integer.valueOf((String) values.get("METype")).intValue(); switch (temp) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -