[FFmpeg-devel] [PATCH] MACE fixes

Michael Niedermayer michaelni
Sun Sep 7 04:53:52 CEST 2008


On Sun, Sep 07, 2008 at 01:16:29AM +0200, Vitor Sessak wrote:
> Hi,
>
> Next in my cleanup list is libavcodec/mace.c. As it is now, its output 
> differs from the binary decoder. Two patches:
>
> mace1.diff: Do not share context variables between channels and don't zero 
> them at decode_frame(). Before this patch, the decoded output could sound 
> different of the binary decoder.
>
> mace2.diff: Use the same weird S8 -> S16 conversion as quicktime. This 
> should not sound really different, but makes much easier to verify 
> conformity.
>
> After these two patches, MACE3 files decode bit identical to the binary 
> decoder and MACE6 files are pretty close.
>

> BTW, is it ok if I clean it up without asking and be flamed in -cvslogs?

iam ok with it though i am not really maintainer of it, but then noone else
is listed either in MAINTAINERS.

[...]

> Index: libavcodec/mace.c
> ===================================================================
> --- libavcodec/mace.c	(revision 15214)
> +++ libavcodec/mace.c	(working copy)
> @@ -235,72 +235,75 @@
>  };
>  
>  typedef struct MACEContext {
> -    short index, lev, factor, prev2, previous, level;
> +    short index[2], lev[2], factor[2], prev2[2], previous[2], level[2];
>      short *outPtr;
>  } MACEContext;

it may be cleaner to have 2 MACEContext or to put the vars of the first line
in their own struct and have 2 of it.

[...]


> --- libavcodec/mace.c.orig	2008-09-07 00:56:28.000000000 +0200
> +++ libavcodec/mace.c	2008-09-07 01:02:29.000000000 +0200
> @@ -234,6 +234,8 @@
>      { 0x3E22, 0x7FFF, 0x8000, 0xC1DD, 0, 0, 0, 0 },  { 0x40E7, 0x7FFF, 0x8000, 0xBF18, 0, 0, 0, 0 },
>  };
>  
> +#define QT_8S_2_16S(x) (((x) & 0xFF00) | (((x) >> 8) & 0xFF))
> +

are they also doing that with other 16bit data? ;)

(x>>8)*257
(no suggestion to change it to that, just an observation)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080907/ec65aabc/attachment.pgp>



More information about the ffmpeg-devel mailing list