# [FFmpeg-devel] [PATCH] VC-1 MMX DSP functions

Michael Niedermayer michaelni
Fri Nov 16 12:25:22 CET 2007

```On Fri, Nov 16, 2007 at 11:12:05AM +0100, christophe.gisquet at free.fr wrote:
> Hi,
>
> (I hope the webmail I'm using wrong break anything)
>
> Selon Loren Merritt <lorenm at u.washington.edu>:
> > (a) Bias it. From your explanation, the possible values should be in
> > [-4080,36720] which is 16 bits of dynamic range, it's just not nicely
> > centered on 0.
>
> Very good idea. To be more precise however, the bias will depend on the pair of
> filters. Let's note A=[-1 9 9 -1] and B=[-4 18 53 -3]. The different cases are:
> - A/2^1 => output in [-255; 2295]
>   Convolved with A/2^6 afterwards, so bias should be -1024
> - A/2^3 => [-64; 574]
>   Convolved with B/2^6 afterwards, so bias should be -256
> - B/2^3 => [-223; 2263]
>   Convolved with A/2^6 afterwards, so bias should be -1024
> - B/2^5 => [-56; 566]
>   Convolved with B/2^6 afterwards, so bias should be -256
>
> I think it's possible to apply it on the first filtering, by modifying the
> rounder used to our need. I haven't thought yet much about un-biasing, but that
> will need to be done after scaling. Use of power of 2 bias superior to the scale
> factor should help reduce it to an addition, hopefully.

you can apply the bias after both filters, just before the >>7 and a filter
indepandant bias should be possible
after the >>7 you unbias it
the first can be merged with the rounder so its just 1 sub more
all that assumes that you remove all incorrect saturation arithmetic

[..]
--

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- 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/20071116/2edef2fa/attachment.pgp>

```