[Ffmpeg-devel] Removing img_format dependency from swscale

Luca Abeni lucabe72
Tue Aug 29 15:17:37 CEST 2006

Hi all,

now that all the required pixel formats are defined in libavutil, I have
a preliminary version of a patch for removing img_format dependecies
from libswscale.
I still have to clean up the patch before proposing it for svn commit,
but it seems to be working fine.

Before going on, I have some questions:

1) since libswscale is now using ffmpeg's PIX_FMT_* instead of mplayer's
IMGFMT_*, swscale.c::sws_orderYUV() cannot use the pixel format to
decide if the pointers must be swapped or not.
I see two possible solutions:
	a) the caller of sws_scale() is now responsible for swapping 
	   the pointers when needed. So, sws_orderYUV() can be removed 
	   from swscale.c and all the places where sws_scale() is used 
	   must be modified
	b) I can introduce 2 new flags SWS_SWAP_SRC_PLANES and 
	   SWS_SWAP_DST_PLANES, to tell swscale how to sort the src[] 
	   and dst[] arrays of pointers. In this case, only the 
	   callers of sws_getContext() must be changed, and the callers 
	   of sws_scale() can stay unchanged
Which solution should be preferred: a) or b)? Or maybe there is a
different solution which is better?

2) The callers of sws_getContext() must be changed anyway, to introduce
a conversion from IMGFMT_* to PIX_FMT_*. I want to introduce a static
inline function performing such conversion, and I plan to put it in a
header file somewhere in mplayer's tree (this conversion function can be
useful in other places in mplayer, I think).
Any suggestion about a good name for such header file? Or maybe I can
use one of the existing headers? If noone has better ideas, I plan to
introduce an mplayer/fmt_conversion.h header.

3) What is IMGFMT_CLPL? swscale uses it only in
yuv2rgb_altivec.c::yuv2rgb_init_altivec(), but I do not know what this
format represents. I am tempted to say that any reference to it can be
removed from libswscale...

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list