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

Ivo ivop
Sat Apr 7 23:17:43 CEST 2007

On Saturday 07 April 2007 16:27, Michael Niedermayer wrote:
> On Sat, Apr 07, 2007 at 03:43:40PM +0200, Ivo wrote:
> > I see. I have thought about it and I think the shift/or "upgrading" to
> > 8/16-bits per component is better than multiply/division, even in this
> division is too slow, always mupltply by the reciprocal and shift
> > case, because it won't introduce rounding errors and can be downgraded
> > losslessly (simple shift).
> hmm

Do you disagree here and should I support all non-power-of-two maxvals 
exactly, despite the rounding errors they will introduce, or are you ok 
with treating non-power-of-two maxvals like they had a maxval of the 
nearest power of two above that? (which is what the current patch does)

> > +        ptr[j] = ptr[j]<<(8-s->bpp) | ptr[j]>>(s->bpp-(8-s->bpp));
> will fail if bpp<4 (negative shift)

Ah, yes, I overlooked that as I copied over the 16-bit variant, not thinking 
about the fact that in that case it will never happen (bpp always >8 in 
that case).
Fixed it.

> 16bit formats should be in native endian internally (for obvious reasons)

Fixed :)

Now it'll output gray16be for 16-bit input and gray16 (me) for 9-15 bit 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: maxval.patch
Type: text/x-diff
Size: 1829 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/8f0e9039/attachment.patch>

More information about the ffmpeg-devel mailing list