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

Ivo ivop
Fri Apr 6 15:01:09 CEST 2007


Hi,

PGM files have a maxval value in their headers defining the maximum value a 
pixel can have. This can be anything from 1 to 65535. Currently pnm.c only 
supports 255 and 65535. The attached patch fixes this (not yet for PPM and 
PAM files which can also have any maxval from 1 to 65535 for the R, G and B 
components), but I am not sure if this is the way to go.

The patch upgrades anything below 255 to GRAY8 and anything from 256 to 
65535 to GRAY16BE while "decoding" the image file. I could also add 
fourteen new PIX_FMT_*'s and their conversion routines to and from GRAY8/16 
to libswscale and assume all reasonable maxval's will be powers of two, 
minus one. What do you think?

I will run into the same problem if I wanted to add Cineon support. .cin 
files can have up to 8 channels (as of version 4.5 the channels can only 
contain R, G or B components) and anything from 1 up to 255 bits per pixel, 
which can be different for each channel. Even the number of pixels per line 
and lines per image can be different for each channel and there are no 
further constraints (i.e. ch. 1-3 could be 1920x1080 12bits/component, and 
ch. 4-5 could be 640x360 7bits/component). How can we fit such things into 
the current PIX_FMT scheme?

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



More information about the ffmpeg-devel mailing list