[Ffmpeg-devel] [PATCH/RFC] 1-7 and 9-15 bits per pixel PGM files

Ivo ivop
Sun Apr 8 14:25:56 CEST 2007


Hi,

On Sunday 08 April 2007 13:08, Michael Niedermayer wrote:
> On Sun, Apr 08, 2007 at 11:44:12AM +0200, Ivo wrote:
> > How about the next patch?
>
> ugly, why are you trying so hard to avoid doing a multiplication?

I don't know :)

> with your incorrect conversation factor and rounding thats equivalent to:
> 7->8 (* 10000001 >> 6)
> 6->8 (* 01000001 >> 4)
> 5->8 (* 00100001 >> 2)
> 4->8 (* 00010001 >> 0)
> 3->8 (* 01001001 >> 1)
> 2->8 (* 01010101 >> 0)
> 1->8 (* 11111111 >> 0)
>
> correcter would be something like
> int w= (1<<bpp)-1;
> int factor= (255*128 + w/2) / w;
> new_pix= (old_pix * factor + 64)>>7;

Attached patch incorporates your suggestion.

--Ivo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maxval.patch
Type: text/x-diff
Size: 1879 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070408/880505f0/attachment.patch>



More information about the ffmpeg-devel mailing list