[FFmpeg-devel] [PATCH/RFC] set qscale_type for MPEG-4

Reimar Döffinger Reimar.Doeffinger
Wed Feb 3 21:12:12 CET 2010


On Wed, Feb 03, 2010 at 07:36:53PM +0100, Michael Niedermayer wrote:
> On Wed, Feb 03, 2010 at 07:12:46PM +0100, Reimar D?ffinger wrote:
> > On Wed, Feb 03, 2010 at 01:16:02AM +0100, Michael Niedermayer wrote:
> > > On Tue, Feb 02, 2010 at 11:54:26PM +0100, Reimar D?ffinger wrote:
> > > > Hello,
> > > > I have no idea if this actually makes sense, but MPlayer's -vf fspp seems to
> > > > look a lot better with it for me - no idea if MPEG-4 qscale is more similar
> > > > to MPEG-2 or MPEG-1.
> > > 
> > > mpeg4 has 2 quantizer types, one matches h263 one mpeg2 with a factor of 2
> > > difference in qscale
> > 
> > So in neither case the patch I made makes any sense?
> > Or is the H.263 one somewhat close to MPEG-2?
> 
> why dont you read the code?

I do and did, but it only gives me guesses. Even guessing requires
looking at code all over the place, and I sure don't intend to spend
days on this.

> get_qscale()
> mpeg1_decode_block_inter()

This reads to me like DC scaling (for standard matrices etc.) is in the
range from
2*3*8/32 = 1.5
to
62*3*8/32 = 46.5
With the first value being the quantizer that will be stored in qscale_table

> mpeg2_decode_block_non_intra()

Looks the same to me, so obviously I am missing something

> mpeg4_decode_block()

DC scaling 8 to 46 (corresponding to quantizers 1 to 31)

For VP56 it is DC scaling from 4*47 to 4*2 corresponding to
quantizers 0 to 63.

> > > mpeg1 and 2 depend on the used quant matrixes as well, thus make tripple sure
> > > your test files use the default matrixes and mpeg4 uses h263 style
> > 
> > The MPEG-4 used H.263 style, quantizer 15. And with fspp and spp the
> > picture looked far worse than without while with the patch it gave
> > a decent improvement (particularly any areas of large, identical colour).
> 
> also keep in mind that a encoder might behave different from what one
> expects that is it might create blockier output than another at the same
> quantizer.
> i guess to figure out what is wrong you could just encode your own
> video at constant quantizer and then test which constant with spp looks
> best.

That's basically what I did with VP6, except that I couldn't create my own videos
(but the quantizer was fairly constant anyway).
However I now tried with our MPEG-4 encoder and it seems to look fine.
My attempt to try H.263 failed because H.263 in AVI results only in
"[h263 @ 0x8a3b860]header damaged" when trying to play...



More information about the ffmpeg-devel mailing list