[Ffmpeg-devel] Some possible libswscale cleanups?

Luca Abeni lucabe72
Thu Dec 21 16:05:53 CET 2006


Hi all,

as people might already have noticed, building libswscale in the ffmpeg
tree generates a lot of warnings. Some of them, such as
swscale.c: In function `yuv2packedXinC':
swscale.c:661: warning: pointer of type `void *' used in arithmetic
swscale.c:667: warning: pointer of type `void *' used in arithmetic
swscale.c:678: warning: pointer of type `void *' used in arithmetic
swscale.c:697: warning: pointer of type `void *' used in arithmetic
[...]
are due to the fact that the table_rV, table_gU, and table_bU fields in
SwsContext are "void *". I do not know if these warnings justify a
change from "void *" to "uint8_t *", but in case such change is ok the
attached remove_void_pointers_arithmetic.diff removes the warnings.

On one of my test machines I also see this:
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I"/tmp/ffmpeg" -I"/tmp/ffmpeg" -I"/tmp/ffmpeg"/libavutil -fomit-frame-pointer -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O3  -c -o swscale.o swscale.c
In file included from swscale.c:65:
/usr/include/malloc.h:118: warning: redundant redeclaration of `malloc' in same scope
/usr/include/stdlib.h:556: warning: previous declaration of `malloc'
/usr/include/malloc.h:122: warning: redundant redeclaration of `calloc' in same scope
/usr/include/stdlib.h:559: warning: previous declaration of `calloc'
In file included from /tmp/ffmpeg/libavutil/common.h:35,
                 from /tmp/ffmpeg/libavutil/avutil.h:44,
                 from swscale_internal.h:28,
                 from swscale.c:76:
[...]
I think "#include <malloc.h>" is not needed now (it was needed when
libswscale used memalign()), so the attached remove_useless_include.diff
removes it, eliminating the warning.

After applying the two attached patches, the only remaining warnings are
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I"/tmp/ffmpeg" -I"/tmp/ffmpeg" -I"/tmp/ffmpeg"/libavutil -fomit-frame-pointer -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O3  -c -o swscale.o swscale.c
swscale.c: In function `yuv2packedXinC':
swscale.c:780: warning: unused variable `g'
swscale.c:780: warning: unused variable `b'
swscale.c:780: warning: unused variable `r'
swscale.c:788: warning: unused variable `g'
swscale.c:788: warning: unused variable `b'
swscale.c:788: warning: unused variable `r'
(and I see no easy way to remove them).

I do not know if the two patches are ok, if there are better ways to
address these warnings, or if it is not worth removing these warnings.
Let me know, and I'll rework the patches as needed.


I also noticed that swscale.c contains some 
FFMIN(FFMAX(..., 0), 255);
Maybe it would be good to change them in clip_uint8()? If yes, let me
know and I'll provide a patch.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_useless_include.diff
Type: text/x-patch
Size: 403 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061221/1dd7a166/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_void_pointers_arithmetic.diff
Type: text/x-patch
Size: 2703 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061221/1dd7a166/attachment-0001.bin>



More information about the ffmpeg-devel mailing list