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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Aug 27 20:13:07 CEST 2014

On 27.08.2014, at 16:41, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
>> Currently no relevant codecs use 12 bits, which is 
>> the reason why 9 and 10 bits exist as separate 
>> formats while 12 bits does not.
> Do you believe that x264 code would have to be 
> less efficient than it is now if the 9 and 10 
> bit colourspaces would be removed?

Yes. As an estimate shifting 2 reference and one output frame, at one SIMD instruction each per 4 pixels. The output shift might actually need more but I assume you might be able to do some clever tricks. Due to precision requirements I don't think it's possible to optimize the shifting for input side. Note that is the other reason why it matters less for above 10 bits: you have to do the idct etc. with 32 bits anyway, so you can skip the shift and just leaving the lowest bits 0.
Makes about 23 million clock cycles for one second of 1080p30 video, or a bit below about 1% extra CPU usage at realtime speeds.
Probably a bit optimistic.

> Am I correct that this is not the case for 
> the FFmpeg decoder?

No different for the decoder.

> I was under the impression that adding the colour 
> spaces was just a design mistake.

I don't think so, I think it is just a cost/benefit thing.

More information about the ffmpeg-devel mailing list