Getting Started: First all parameters default to reasonable values so SmoothD2() should work, though it will provide only very weak deblocking. The most important parameter is quant, which is the primary control of deblocking strength. If you can get the amount of deblocking needed then try using the Zero Weight parameters to recover some detail. If you could not get as much deblocking as desired then try using a different Matrix. If you still can't get enough deblocking then try a different Qtype. SmoothD2 (clip clip, clip "ZWmask", int "quant", int "num_shift", int "Matrix", int "Qtype", int "ZW", int "ZWce", int "ZWlmDark", int "ZWlmBright", int "ncpu") clip = Input clip. clip ZWmask = Null Zero Weight mask. This clip specifies the zero weight value to be applied to each pixel in the source clip. Any pixel values greater than 16 will be clipped to 16. int quant = 3 This parameter specifies the quantizer value used (1 to 31). Larger values mean stronger filtering. int num_shift = 3 Specifies the number of shifted versions used for filtering providing a speed vs. quality trade-off. A larger value is more accurate and time consuming. 1 : Uses 4 shifted versions. 2 : Uses 8 shifted versions. 3 : Uses 16 shifted versions. Best speed vs. Quality 4 : Uses 64 shifted versions If using num_shift = 1 there are not enough samples to eliminate "beat" artifacts when using Qtypes > 1. "Beat" artifacts may be visible for Qtype=2 with quant>16 or Qtype=4 with quant>9. The following table gives the quant values that may produce "beat" artifacts for Qtype=3 for each matrix. nt Matrix = 3 Selects a prebuilt matrix to use (1 to 110). 1 thru 9 are either "standard" matrices that I found on the net or slightly modified versions of them. They are ordered according to their deblocking strength from weak to strong. They are the only ones with calibrated strengths which allows the ZW arguments to produce consistent results. Note Matrix is not used by used by Qtype’s 2 and 4 which use the built in h263 matrices. int Qtype = 1 Quant Type. Selects the type of quant-dequant processing that is used in the filtering. They are ordered by their deblocking strength from least strong to strongest. h263 intra and h263 inter, Qtype’s 2 and 4, ignore the matrix argument and use their own built in matrix. 1 : mpeg intra 2 : h263 intra 3 : mpeg inter 4 : h263 inter The intra in Qtypes 1 and 2 referes to the encoding done for I-Frames. The inter in Qtypes 3 and 4 refers to the encoding done for P-frames and B-Frames. See A Beginners Guide for MPEG2 Standard for a good introduction to mpeg coding. Different matrices are usually used when encoding I-Frames then when encoding P-Frames and B-Frames. All the information about how a particular frame was originally encoded, I-Frame, P-Frame, B-Frame, and Matrix value, has been lost by the time SmoothD2 is passed a frame to process, SmoothD2 does not do automatic intra-inter Qtype or matrix switching. Zero Weight Arguments: The Zero Weight arguments can be used to control the strength of filtering. The strength can be specified for the frame as a whole, by the distance from a macroblock edge, and at the individual pixel level. The strength can also be specified based upon the brightness of the pixel. The ZW arguments control the filtering strength by changing the number of original unfiltered images added to the shifted and filtered images before they are averaged to produce the output image. Obviously the more unfiltered images that are added the less filtering will occur. Internally the amount of filtering is normalized so that the lowest value for an argument produces full filtering strength and the highest value produces virtually no filtering of the original image. For ZW values 1-16 this attempts to be independent of the quant, num_shift, Matrix (for Matrix values less then 10), and Qtype values. Internally, at each pixel location, each argument will produce a normalized value. The 4 normalized values are added and the result is clipped to the value that will produce almost zero filtering. int ZW = 1 Zero Weight (0 to 16). Specifies the relative weight of the non-shifted original image to the weight of the shifted and processed images. A higher value counteracts filtering but keeps more detail. This operates on the frame as a whole. Note that ZW values 1-16 are normalized so that the perceived effect of the reduction of filtering due to ZWremains constant when changes are made to quant, num_shift, Matrix (for Matrix values less then 10), and Qtype values. ZW=0 does not include the non-shifted original image in the output image and will produce the strongest filtering. int ZWce = 1 Zero Weight Center to Edge (1 to 20). This argument allows the center of all 8x8 macroblocks to have less filtering then the edge of the macroblock. The edge of the macroblock always receives the amount of filtering determined by the other arguments. This allows for less detail loss while maintaining strong deblocking. ZWce specifies the entry in a table which is used to determine the the processing strength from the center of a macroblock to its edge. There are 4 possible values that VP1, VP2 and VP3 can have. 0 - Full filtering strength 1 - Medium filtering strength 2 - Low filtering strength 3 - Almost zero filtering The values ZWce can take start from 1 which sets values VP1, VP2 and VP3 to 0 which means there is full filtering strength everywhere in the macroblock. As the values get larger the filtering gets stronger from the center outward. When ZWce equals 5 VP1, VP2 are 0 and VP3 is 4 which means the the center 4 pixels have no filtering applied (the source pixel values are copied to the output frame) and the rest of the pixels in the block are filtered at full strength. This will usually produce obvious artifacts. int ZWlmDark = 0 Zero Weight Luma Dark Value (0 to 255). The filter strength is reduced for any pixel value starting at ZWlmDark and reaching 0 filtering strength as the pixel value approaches 0. The filtering strength is reduced less at block boundaries. Values between 32-64 are a good place to start. This argument allows more detail to be retained in dark areas which might otherwise appear over smoothed. Obviously when setting this value it is important that the monitor you are working on displays dark grey to black with reasonable fidelity. int ZWlmBright = 255 Zero Weight Luma Bright Value (0 to 255). Any source pixel value that is = ZWlmBright will be filtered at the value specified by the ZW argument. This can be used to reduce bright spots that ZWce might otherwise let through. Values > 192 are a good place to start. int ncpu = 1 Number of cpu cores to use (1 to 4). The multithreading code path is completely bypassed if only 1 cpu is used.