(click on the link to directly jump the filter)
DCTQIDCT
Discrete Cosinus Transform (DCT) based coding
and decoding with display of statistical information
Description:
This filter performs the folowing steps: color subsampling, blockwise
forward DCT, matrix based quantization, source coding, inverseDCT
(IDCT), color upsampling. There is done a compression and decompression
as in intraframe MPEG2 (IFrames).
I have written this filter for testing purpose. You can use different
quantization matrices and immediately see the effects on your video.
Also you can check if your other filters in the chain improves the
compressionratio for a fixed quality (quantizer stepsize). It creates
a compatible MPEG2 video sequence consisting of a single Iframe
which can be saved in a file. Also statistical data about the input
video is collected and a histogram can be created. This histogram
shoes the distribution for each coefficient of the dcttransformed
macroblocks, of the frames, which have been displayed.
Settings:
The
settings correspond to the variables/definitions in the international
standard ISO/IEC 138182 (MPEG2).
In the "intra_quantiser_matrix" the quantizer
stepsizes after the DCT are defined for each coefficient. For Iframes,
the dccoefficient in the upper left is fixed and cannot be changed
in this way. For the dccoeff. the variable "intra_dc_precision"
is responsible (only for Iframes). The matrix entries are saved
in the file "matrix.ini" in your virtualdub folder and
are reloaded on every start. So you don't have to retype then every
time when using this filter.
"quantizer scale" is used as a factor for all
quantizer coefficients, but not the dc coefficient. A value of 16
is neutral  in this case, the quatizer stepsize is exactly as defined
in the matrix. Lower values result in better quality and less compression
and vice versa. Because in MPEG2 there is a mapping of a 5 bit variable
in the bitstream called "quantizer_scale_code" to the
value "quantizer_scale", not all values in the range between
1 and 112 are allowed, so the nearest possible value is taken.
"intra_dc_precision" specifies the quantization
of the dc component (only for Iframes). Starting with a 8 bit source
(for each YUV color component) the DCT is performed, usally ending
with 11 bit values. After that a requantization to 8,9 or 10 bit
is applied.
In "chroma format" the subsampling of the color
is defined. 4:2:0 is half color resolution in both direction, horizontal
and vertical. 4:2:2 is half color resolution in the horizontal direction.
4:4:4 is full color resolution. Interpolation is done with respect
to the video type, progressive or interlaced.
The button "interlaced" specifies the way in which
the DCT/IDCT operations and the color subsampling is performed.
When enabled all operations are done on a field basis. In principle
first the fields are seperated, then subsampled, DCTtransformed,
quantized, IDCTtransformed and recombined to a frame. The color
subsampling is done with respect to the different vertical and temporal
position of pixelsamples.
With the option "display statistics" enabled,
statistical information about the variance of the DCTcoefficients
and the compression is displayed in the output window. Also the
number of frames which have been analyzed for the dcthistogram
are displayed.
When enabled "create m2vfile" every frame which
is actually displayed, is written out to harddisk in your VirtualDubfolder
and overwritten when viewing another frame. This file is a MPEG2
compatible videosequence consisting of one frame or two fields.
Maybe some MPEG2 decoder run into problems viewing this singleframesequence.
The option "save dcthistogram on OK" writes out
the histogram data of the lumaDCTcoefficients, which have been
collected since the filter have been applied to some video segment.
You can see the number of frames the histogram is based on, when
enabling "display statistics". When moving the VirtualDubslider
after playing some sequence, the data is reset. I recommend playing
some segment of your video by using the play button and then saving
the histogram. The created histogram file consists of 64 lines,
where one line consists of 256 spacesepareted numbers. The first
line corresponds to the dccoefficient, the second line to the second
coefficient (row 1, column 2), the third line to coefficient in
row 1 / column 3 and so on. The number of occurence is normalized
to 1000, that is, the sum of all values in one line should be 1000.
Because of rounding the sum is sometimes not exactly 1000. By dividing
the number by 10, you get the percentage of occurence for this DCTvalue.
Internally for the histogram we are performing the DCToperation
on 8 bit lumapixelframes which results in 11 bit (signed) DCTcoefficients,
i.e. in the range between 1024..1023. Because one line in the histogram
consists of 256 number only, we have cut this range to 128..127.
That means, the first value of a line is the number of occurence
(from 1000 events) that a DCTcoefficient is less than 128, the
second value is the number of occurence for a DCTcoefficient to
be 127 and so on. The first line (dccoefficient) is a special
case. Here we are considering 8 bit precision data and only positive
values (unsigned). So, the values in this line correponds to the
number of occurence of values in the range 0..256.
Download:
2d Comb
Removes line flickering. Intended to replace the standard
PALaveraging chroma comb filter
Description:
This filter is for removing color/luma fluctuations between adjacent
rows. It was intended to be a better chroma comb filter, which in
most capture cards is simply averaging the chroma signal of consecutive
lines and so is reducing the vertical color resolution. This filter
does the same job of removing color phase artefacts but with less
reducing the vertical resolution. I find it to be useful also for
removing luma fluctuations.
Settings:
The
setting "horizontal averaging" lets you specify
how many pixel are considered for the measuring of the phase offset
between adjacent lines. It does not do smoothing on the pixels,
it is only for determing the phase offset. Use higher values when
stribesartefacts are independent of the horizontal position, e.g.
there is a constant luma fluctuation. A value of one means, fluctuations
are measured between two pixels.
"threshold" is the maximal offset, which is corrected.
For heavy disturbances you have to increase this value in order
to compensate the fluctuations. If you only want to process color,
set the Ythreshold to zero. You get the standard chroma comb (as
in your TV or your capture device) with the following settings:
YUVprocessing on, Y/RGB: 1; 0, UV: 1; 512.
"YUVprocessing" means, the source is first transformed
to the YUVcolorspace, then filtering is applied and then it is
backconverted to RGBcolorspace. The conversion is done in higher
precision (12 bit per component), so for that there is no degradation.
In "testmode" you can display the differences
which are normally subracted by this filter.
Enable "interlaced" when your source is interlaced.
Then the filter operation is done on a field basis. I recommend
to use this option enabled also when you have progressive captured
video because most fluctuations are due to noise/interference in
your capture card and the signal you are receiving is always delivered
in fields. For that reason (and because there is no need for a frame
buffer) the chromacomb in your TV processes fields and not frames.
But of course try which option is better for your video.
Download:
General Rowfilter
A gerneral third order digital filter. Processes only in the
horizontal
Description:
This filter is a general third order digital filter which processes
only the rows and is apllied two times, from left to right and back.
Settings:
The
values you can modify are the digital filter coefficients. For example,
the following settings are used for a butterworth lowpass filter
with the cutoff frequency 0.5 (1.0 corresponding to half the sample
rate):
(a2,a3,a4) = (0, 0.3333, 0) and (b1,b2,b3,b4) = (0.1667,0.5000,0.5000,0.1667).
Download:
