Description of SIF1 settings

Contents:


Let's start with some useful advice on video encoding using SIF1

The best way to resize the original video is to use high quality interpolation functions. To obtain the best result, I recommend using Spline64Resize function from AviSynth package instead of LanczosResize function. The resulting horizontal image size should be a multiple of 16, and the vertical image size should be a multiple of 2. However, if the vertical size of the image is a multiple of 16 codec performs slightly better.

SIF1 has low sensitive to noise on image and works perfectly with noisy sources. However, psycho-visual model is set to maximum preservation of the original image. Thus, noise is not filtered out, but first codec reduces its dynamics. Noise become "stationary"; however, this doesn't make the picture look "digital" or "filtered". That is why applying denoise filter before compression makes sense only if presence of noise in the original video irritates and you want to remove it.

As for now, the codec has four different compression modes. They can be chosen from the drop-down list "Compression mode". Let's describe them one after another.


Single pass quality based encoding

This mode is extremely useful when you need to obtain defined quality of the compressed video with its minimum possible size. In this case, all the power of psycho-visual model built into the codec is used. The thing is that the codec's structure itself originally had the ability of extremely flexible adjustment to local parameters of the input image. This flexibility is unavailable in codecs made according to the traditional technology.

In the process of compression psycho-visual model continuously analyzes compressed image and calculates sensitivity of the eye to the distortions in this area. After that, for each section of the source image, compression parameters are chosen for obtaining maximum compression without exceeding selected level of visual distortions.

By the way, it is the reason why measurement of the quality of the image compressed using this codec is useless with standard linear metrics (PSNR). SSIM psycho-visual metrics gives somewhat better results; however, it is not completely adequate as well, because it analyzes each frame independently without taking picture movement into account. For SSIM, distortions on quickly moving and static objects are equal; however, it is not so for human eye. Unlike in SSIM, current psycho-visual model implemented in SIF adequately accounts local movements on the image; therefore, it surpasses all other popular metrics. Thus, the only objective criterion for judging the quality of a compressed image is your eyes. Objective metrics are good for comparison of codecs made using similar compression techniques, but they are not good for comparison of codecs made using totally different techniques.

In single pass quality based mode [1], quality of the compressed picture is controlled by Visual distortion parameter [2]. When the parameter is increased, the compression increases and the quality of the compressed video goes down.

To get oriented, you may take that:

  • With V.D. level of 20-25 you will achieve quality almost indistinguishable from the original video.
  • With V.D. level of 40-50 you will obtain ordinary video quality.
  • V.D. levels up to 60-70 are quite usable.

The above proportions are correct for virtually any type of source file: the visual quality will be nearly the same on dark and light video fragments, on statics and on dynamics.

The only exception is source with high level of noise; they require V.D. level increase. In this case, as it was said above, noise dynamics is chiefly cut, but not the picture itself.

Thus, if obtaining the exact size is not important for you, you may set the acceptable level and then use it to encode all your video without worrying for other settings.


Twopass average bitrate encoding

This classical encoding mode is useful when you need to obtain the exact size of compressed video, for instance, for its recording on CD or DVD.

First, analyzing compression pass is performed (Twopass - 1st pass mode) [3], which results in statistics file recording. Default name of the statistics file is sif_stat.sta [5]. It is saved to the folder with the compressed video.

Statistics file name and its path are set in the Stats filename field [5] on Additional settings tab.

You can save the statistics file to use it in the subsequent encoding with different bitrates.

First pass settings of the twopass encoding have a fine point - setting the value of Visual Distortion [4] for the first pass. To achieve the optimal encoding quality, V.D. level must be the same or slightly higher than average V.D. level of the final compressed file. Therefore, it is reasonable to estimate the quality level for the compressed file and to set corresponding V.D. value. For example, V.D. of the first pass should be increased on noisy sources.

Anyway, if you are not sure in these settings, it is better to preserve default values.

The speed of the codec in the first pass can be greatly accelerated if option "Fast 1st pass" [6] is selected. In this mode, selected speed codec settings are ignored, and instead included special simplified configuration for quick coding is used. Using this mode may slightly affect the quality, but can speed up first pass in approximately 2 times when encoding with standard settings for quality.

During the first pass, in addition to statistics file, an empty video file is saved, which doesn't contain any useful data.

When the first pass has finished, you may start final compression of the video. You should select second pass mode (Twopass 2nd pass) [8] and set the bitrate value you need (Target bitrate (kbps):) [9] either using the scroll or entering the value into the appropriate field. Bitrate value is set in kilobits per second without taking into account overhead of the container in which the video will be stored. For example, avi container overhead is within several kilobits per second. General bitrate of the file will increase by this value.

For calculation of the necessary bitrate, you may use calculation programs used for ordinary DivX codec. You may also use the calculator built into DivX or XviD, as they are quite suitable.

If you used special name for the statistics file in the first pass, you will need to set it in Stats Filename field. If this name wasn't changed, don't change anything for the second pass.

Quality of the video obtained in the second pass is somewhat influenced by the Buffer Size [6] parameter from Additional Settings tab. It defines the smoothing range for the first pass data when the bitrate control engine is enabled. Its default value is 8 seconds. It's better not to change it without an acknowledged necessity.

The last two compression modes are meant for video transmitting via network with obviously limited bitrate. In particular, they can be used in online streaming broadcasting.


Sngle pass ABR

This mode [10] is unique in a mechanism of interaction between the psy model and bitrate control engine.

In this mode, compression process is defined by two parameters:

  • maximum image compression quality set by Visual Distortion parameter [12],
  • and the maximum bitrate of the compressed video set by Target Bitrate (kbps): parameter [11].

Bitrate in this mode is adjusted using the following logic: if video can be compressed with a defined V.D. level and bitrate lower than set, it will be compressed in such way. Otherwise, bitrate will be limited by the Target Bitrate parameter.

ABR mode used with correct compression parameters allows obtaining files much smaller than that encoded in "classical" CBR mode.

The quality of such files will not be worse than that of original CBR. If you use this mode to encode files uploaded to server, you may save 40% and more server traffic retaining high quality of Internet broadcasting.

That's why I recommend using this mode as a substitute for classical CBR in all cases except special ones.

Target Bitrate parameter is closely connected to Buffer Size parameter [13] that defines how many seconds the stream should be buffered for continuous broadcasting with the preset bitrate. For example, target bitrate of 300 kilobauds at buffer size of 8 seconds ensures continuous broadcasting from any keyframe in the stream at the channel capacity of 300 kilobauds if the input video is buffered for 8 seconds. If the actual bitrate of the channel exceeds 300 kilobauds, the buffering time to ensure broadcasting reduces respectively.


Single pass CBR

This is classical encoding mode with constant bitrate when the codec tries to maintain the same bitrate during all the compressed file.

In my opinion this mode [14] loses out to ABR mode recommended for usage in all cases except special ones.

The bitrate of compressed video is set by Target Bitrate (kbps): parameter [15]. As it is with ABR encoding mode, it ensures continuous broadcasting of a compressed video from any keyframe if the compressed video is transmitted via the channel with the capacity equal to Target Bitrate and buffering time equal to that set in Buffer Size.


Additional Settings

Besides the above listed settings, Additional Settings tab has some more settings that may be useful sometime.

Maximum I-frame interval [16] maximum distance between keyframes. The codec supports automatic positioning of keyframes in places where the scene changes. If the picture is stable, keyframes are inserted with the period set by this parameter.

Color quantization scaling [17] this parameter sets the ratio of compression levels of color and brightness constituents of the image. It can be useful in some cases. For example, you can improve the quality of color reproduction by lowering the parameter; however, it will slightly increase general bitrate. Alternatively, you can increase the parameter for a source file with a high level of color noise and save some bitrate.

Additional quantizer [18] additional quantization level. As SIF compression algorithm is a simple form of video decomposition into objects, the compression core operation results in two data sets: "geometry" and "textures". The "textures" are additionally quantized and compressed. This parameter defines the relative threshold for compression of these "textures". Theoretically, this parameter is set for maximum compression; however, slight adjustment in each particular case can somewhat improve the final result. At the same time, incorrect adjustment of the parameter can worsen the result very much. Thus, if you are not self-confident, it is better to keep the default value.

Reset to Defaults [19]. Useful when you want to remove the consequences of experimenting with the settings...


Quality and Speed

Tab Quality and Speed is for fine adjustment between speed of the codec and quality of the result. It has settings that affect speed and quality of encoding, as well as settings affecting decoding speed.

Slider ME method [20] - Allows you to select an algorithm of motion vectors search. Moving this slider to the right will increase quality of the motion vectors search, moving it to the left will increase speed of the codec. Modes for the motion vectors search faster than Standard are purely nominal for know, since for really high-quality high-speed optimization you need to write additional code. And since multithreading optimization of SIF transform engine isn't completed, there is no much sense in making it. But of course in future high-speed compression modes will be made.

Sub-ME method [21] Specifies an algorithm for determining the optimal partition of the motion field into blocks of different sizes, and additional subpixel adjusting of motion vectors. Inherently, this option is equivalent to --subme option in x264 codec and also has big influence on the final quality. Do not select Fastest as it would greatly reduce quality of the result.

Use chroma ME [22] This option turns on search of motion vectors not only using luma values but also chroma values. Disabling this option speeds up encode, but can degrade the compression level.

Parameter Entropy codec: Max threads number: [23] - Affects the maximum number of threads supported by the entropy codec for decoding. This option is designed for supporting efficient decoding of files with very high bitrates. At the same time, this number is the maximum possible number of decoding threads. If decoding processor has fewer cores than this maximum, the entropy decoder will use nearest multiple of two number of threads. For example, choosing 8 threads in Max threads number. Supported effective operation with 8, 4, 2, and 1 thread. In this case on the processor with six cores the entropy codec will run in 4 threads. Note, this option doesn't affect speed of encoding. In the case of decoding main part of the decoder can use any number of threads up to 32. So on a 6 core processor entropy codec will use 4 threads and all the rest of the decoder will use 6.

Unfortunately, multithreaded modes of an entropy codec operation are not completely "free" for the compression effectiveness. The lower the bitrate of the encoded video, the greater the penalty for using multithreading in the entropy codec. Therefore, the optimal mode for coding is when each thread of the entropy codec have at least 5-10 megabytes of compressed data. In this mode, the penalty for using multithreading is negligible. Accordingly, I can adhere such criteria - for SD video - 1 thread. For 720p video - 1 or 2 threads depending on the bitrate, and for FullHD 2 or 4 threads. All 8 threads should be chosen only when encoding with huge bitrates like 40 mbits or more.

If you do not want to delve into these technical details you can always set option for Automatically select [24], so the codec selects the encoding mode by itself, but in many cases it can make a mistake...





News DownloadsDocumentationDemo

• Ideas, articles, programs Neiromaster 2003-2011