[MPlayer-dev-eng] [PATCH] Switch libavutil macros instead of defining our own

Michael Niedermayer michaelni at gmx.at
Sat Feb 24 19:23:05 CET 2007


Hi

On Sat, Feb 24, 2007 at 06:35:10PM +0100, Reimar Döffinger wrote:
> Hello,
> attached patch replaces MIN, MAX, BE_32 and BE_16 in some places with
> the libavutil equivalent.
> Do you think this is okay despite it's size?

yes


> I assume it would also fix
> http://bugzilla.mplayerhq.hu/show_bug.cgi?id=767 along the way, though
> that is not really the main intention (and could be done by copying the
> definitions from rmff.c instead).

[...]
>  /**********************************************************************
> @@ -820,9 +818,9 @@
>  	r = tmp >> 16 & 0xff;
>  	g = tmp >> 8 & 0xff;
>  	b = tmp & 0xff;
> -	y = MIN(MAX((int)(0.1494 * r + 0.6061 * g + 0.2445 * b), 0), 0xff);
> -	u = MIN(MAX((int)(0.6066 * r - 0.4322 * g - 0.1744 * b) + 128, 0), 0xff);
> -	v = MIN(MAX((int)(-0.08435 * r - 0.3422 * g + 0.4266 * b) + 128, 0), 0xff);
> +	y = FFMIN(FFMAX((int)(0.1494 * r + 0.6061 * g + 0.2445 * b), 0), 0xff);
> +	u = FFMIN(FFMAX((int)(0.6066 * r - 0.4322 * g - 0.1744 * b) + 128, 0), 0xff);
> +	v = FFMIN(FFMAX((int)(-0.08435 * r - 0.3422 * g + 0.4266 * b) + 128, 0), 0xff);

clip_uint8() which should first get a av_ prefix

[...]
>  static void hexdump (const char *buf, int length) {
>  
>    int i;
> @@ -78,40 +73,40 @@
>  static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) {
>  
>    if (!fileheader) return;
> -  fileheader->object_id=BE_32(&fileheader->object_id);
> -  fileheader->size=BE_32(&fileheader->size);
> -  fileheader->object_version=BE_16(&fileheader->object_version);
> -  fileheader->file_version=BE_32(&fileheader->file_version);
> -  fileheader->num_headers=BE_32(&fileheader->num_headers);
> +  fileheader->object_id=AV_RB32(&fileheader->object_id);
> +  fileheader->size=AV_RB32(&fileheader->size);
> +  fileheader->object_version=AV_RB16(&fileheader->object_version);
> +  fileheader->file_version=AV_RB32(&fileheader->file_version);
> +  fileheader->num_headers=AV_RB32(&fileheader->num_headers);

as you already change it what about also vertically aligning it :)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070224/f36c7b52/attachment.pgp>


More information about the MPlayer-dev-eng mailing list