[FFmpeg-devel] [PATCH]Fix pnm encoding with bpc set

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Aug 25 06:41:58 CEST 2014

On 24.08.2014, at 14:02, Christophe Gisquet <christophe.gisquet at gmail.com> wrote:
> Hi,
> I think a first point must be cleared, seeing your reaction to my
> pnmdec comment. Here' are the opinions:
> - Mine: bits_per_raw_sample should indicate the dynamics of the signal
> when it is different from the colorspace bitdepth
> - ffmpeg's and yours (if I'm not mistaken): the signal bitdepth should
> always match the colorspace one, and bits_per_raw_sample should
> indicate the original bitdepth

The colorspace is supposed to be authoritative.
If it says 16 bit, then showing it as 16 bit must work properly.
The only intention of bits_per_raw_sample is to indicate that there is no point in storing some of the lower bits if you have the option.

> I believe rescaling in the decoder, like pnmdec does, is wrong. Like
> CMYK support, doing that is the job of a rescaler independent of the
> codec (yes that would be a speed hit). Otherwise, several "codecs"
> (dpx comes to mind) would have to implement it, up to getting it
> slightly wrong.

That can be solved by a common function if necessary, alternatively a 12 bit colorspace could be added, but the cost/benefit is questionable.

More information about the ffmpeg-devel mailing list