[Ffmpeg-devel] more libswscale questions....

Steven Johnson mplayer
Thu Nov 16 11:51:26 CET 2006


Hi,

The more i muck with libswscale, the more questions I have.

Q1,
When I was messing with imgresample, it seemed quite straight forward.
If there was a way to convert from Format X to Y, through W, it just
worked, It wasn't necessary to have a Format X to Y converter for every
permutation.  For example:

If I want to convert YCrCb 422 to PAL8, it goes YCrCb 422 -> RGB32 ->
PAL8.  All that is required is that YCrCb 422 can be converted to RGB32
and RGB32 can be converted to PAL8. (This may not be the exact set of
steps, but it is the idea I got from the code when I was playing with it).

But it seems if I want to convert from X to Y using libswscale, then
there needs to be a converter for every possible permutation.  Is that
correct?

Because by my count there are 37 pixel formats, and having converters
for each to each is 37 * 37 = 1369 convert functions.  That can't be
right, can it?  What formats does one need to support/implement
conversions to/from in order to cover all of the cases?  And relating
back to my PAL8 src format code I posted earlier, did I cover all of the
places where PAL8 to Format X needs to be done, or have I missed
something.  For example, I haven't added a PIX_FMT_PAL8 to PIX_FMT_GRAY8
converter.  If i try to go from PIX_FMT_PAL8 to PIX_FMT_GRAY8, will it
just crash, or will it go through some intermediary format?

Q2,
When it comes to scaling, how does the image end up in the format the
scaling code uses, and how does it go from there to the dest format.  I
tried tracking the code, but I can;t work out the path.

Eg, I want to go from RGB24 to BGR32 and scale the image from 1024x768
down to 320x200.  How does libswscale convert from RGB24 -> YV12 ->
Scaled YV12 -> BGR32?  It seems for the src I need to add the format to
hcscale an hyscale? Is that correct?  But it seems the dest is always
YV12?  That can't be correct, so I am missing something, obviously.  In
my example here, where is the scaled YV12 converted to BGR32 in imgresample?

Q3,
I am wondering if the lack of horizontal and vertical resolution in YV12
is the culprit for the blockiness I am experiencing?  Is there a HQ
setting for libswscale, so the U and V channels have full resolution, to
maintain image quality equivalent to imgresample?

Thanks for any help.

Steven J






More information about the ffmpeg-devel mailing list