[Ffmpeg-devel] [PATCH/RFC] 1-7 and 9-15 bits per pixel PGM files
Michael Niedermayer
michaelni
Sun Apr 8 23:28:52 CEST 2007
Hi
On Sun, Apr 08, 2007 at 07:42:54PM +0200, Ivo wrote:
> Hi,
>
> On Sunday 08 April 2007 18:27, Michael Niedermayer wrote:
> > On Sun, Apr 08, 2007 at 02:30:36PM +0200, Ivo wrote:
> > > On Sunday 08 April 2007 14:25, Ivo wrote:
> > > > Attached patch incorporates your suggestion.
> > >
> > > And without the superfluous {}'s
> >
> > why are the 16 and 8 bit cases done differently?
> > that is they use differnt rounding behavior ...
> > IMHO it should be consistent
>
> Yes, I agree. Here's another patch.
>
> --Ivo
> 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?
[...]
> + 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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070408/8c9c0fb0/attachment.pgp>
More information about the ffmpeg-devel
mailing list