[MPlayer-dev-eng] [PATCH] H.264 encoding in mencoder
Loren Merritt
lorenm at u.washington.edu
Mon Aug 23 09:22:46 CEST 2004
Disclaimer: I'm not an expert, but I've read x264, and referred to the
H.264 spec.
On Mon, 23 Aug 2004 snacky at ikaruga.co.uk wrote:
> +.B fullintra
> +Use all available intraframe analyse methods (i4x4, psub8x8, psub16x16) (default: 4x4)
fullintra does nothing, because psub8x8 and psub16x16 are P-block types,
which can't be used in intra frames.
> I don't understand i_deblocking_filter_alphac0, i_deblocking_filter_beta,
The H.264 deblocking filter is run only on blocks with less than a certain
threshold of detail. (blocking artifacts are much more noticeable in smooth
gradients, while filtering detailed blocks would just blur the details.)
There are 3 parameters to the H.264 deblocking filter: alpha, beta, and
C0. They all depend on quantizer, but you can modify the values a bit.
(alpha and C0 are controlled jointly by i_deblocking_filter_alphac0.)
C0 limits the maximum change that the filter may cause in any one pixel
value.
Alpha affects the maximum allowed difference in luma value across the edge
being filtered. (Any edge exceeding the threshold is not filtered.)
Beta affects the maximum allowed gradient within the two adjacent blocks.
The units of i_deblocking_filter_alphac0 and i_deblocking_filter_beta are
in QP. So setting both to +6 will filter each block as if it had 6 higher
quant that it really did (approximately doubles thresholds and strength),
and -6 approximately halves thresholds and strength.
Summary: larger values are smoother, and ~0 looks best IMHO.
> or i_cabac_init_idc, so all of those could use better explanations as
> well. I realize the two parameters affect the loop filter, but I have
> no idea what's meant by alpha and beta.
CABAC predicts each bit based on a model of the relative probability of 1
vs 0. Different bits represent different things, so they have different
contexts. There are contexts for dct residuals, for motion vectors, for
QPs, etc. There are also separate sets of contexts for high vs low
complexity blocks. It switches between them based on the complexity of
the previous few blocks, but there's nothing to predict the first block in
each frame.
i_cabac_init_idc determines whether to encode the first block as low (0),
medium (1) or high (2) complexity. (The default is to let the encoder
choose, and it usually chooses 0.)
This happens in the entropy-coding stage; it directly affects only
bitrate, not distortion. So you can easily see the difference by encoding
at constant QP and looking at the resulting bitrate. (The difference I've
seen is only about 0,2% either way.)
Summary: auto (-1) is best.
--Loren Merritt
More information about the MPlayer-dev-eng
mailing list