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

Ivo ivop
Mon Apr 9 10:30:16 CEST 2007


Hi,

On Sunday 08 April 2007 23:28, Michael Niedermayer wrote:
> On Sun, Apr 08, 2007 at 07:42:54PM +0200, Ivo wrote:
> > Index: libavcodec/pnm.c
> > ===================================================================
> > --- libavcodec/pnm.c	(revision 8648)
> > +++ libavcodec/pnm.c	(working copy)
> > @@ -26,6 +26,7 @@
> >      uint8_t *bytestream_start;
> >      uint8_t *bytestream_end;
> >      AVFrame picture;
> > +    uint16_t maxval;             ///< maximum value of a pixel
> >  } PNMContext;
>
> why not int?

No particular reason. Fixed.

> > +            for(j = 0; j < avctx->width; j++) {
> > +                val = AV_RB16(&ptr[j<<1]);
> > +                ((uint16_t *)ptr)[j] = (val * f + 16384)>>15;
>
> this has one fatal problem, mixing reads and writes of different size to
> the same area in memory is slow on some cpus (AV_RB16() can use bytewise
> reads) reading uint16_t style and using be2me_16() would avoid that

Fixed. I suppose it is always better to use the bytestream stuff like Reimar 
suggested earlier?

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



More information about the ffmpeg-devel mailing list