[Ffmpeg-devel] [PATCH/RFC] 1-7 and 9-15 bits per pixel PGM files
Sun Apr 8 11:44:12 CEST 2007
On Sunday 08 April 2007 00:39, Michael Niedermayer wrote:
> On Sun, Apr 08, 2007 at 12:33:54AM +0200, Ivo wrote:
> > On Saturday 07 April 2007 23:45, Michael Niedermayer wrote:
> > > On Sat, Apr 07, 2007 at 11:17:43PM +0200, Ivo wrote:
> > > > ptr[j] = ptr[j]<<(8-s->bpp) | ptr[j]>>s->bpp;
> > >
> > > ptr[j]>>s->bpp == 0
> > No, if the condition for which the code is run is true, s->bpp is
> > always smaller than eight. Perhaps I should use a less confusing
> > variable name,
> ptr[j] will contain s->bpp bits and you shift them away -> its 0
> or iam stupid (which is possible too)
Ah, yes. My single line is not the same of course as your two line
suggestion earlier. I'll change it to ptr[j]<<=8-s->bpp;
I thought about it a little more this time, and if I am not mistaken, this
won't be fully correct for bpp<4 either.
if bpp==3: 0x07 will become 0xfc instead of 0xff
if bpp==2: 0x03 will become 0xf0 instead of 0xff
if bpp==1: 0x01 will become 0xc0 instead of 0xff
bpp==1 would be stupid, but it is a valid pgm file.
How about the next patch?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2361 bytes
Desc: not available
More information about the ffmpeg-devel