[Ffmpeg-devel] Which byte I/O API?

Michel Bardiaux mbardiaux
Tue Jan 23 10:20:55 CET 2007

Michael Niedermayer wrote:
> Hi
> On Mon, Jan 22, 2007 at 05:59:02PM +0100, Michel Bardiaux wrote:
>> I'm trying to ressucitate my BMP encoder. At the time it was criticized 
>> for using the put_bits API: understandable but the existing decoder used 
>>  get_bits...
>> So, the first order of business is to change the decoder to use a 
>> byte-oriented API. But which one? bytestream.h, or the recent 
>> intreadwrite.h?
> for reading/writing the header use whatever leads to the simplest / cleanest /
> most readable code (put_bits, bytestream.h, intreadwrite.h, ... whatever
> you like)
> for reading/writing the raw image use memcpy(), le2me_16() and uintXY_t
> read/write ISO C style (expect to see the patch rejected if this is
> inefficiently implemented like with bytestream.h or intreadwrite.h which
> are designed for unaligned data)
Crystal clear: in this case, the existing code (decoder) is a valid example.

Wilco, but for the record, I seriously disagree with that view:

(1) Changeing style (from using get/put_bits to manual) in the middle of 
the code damages readability

(2) Any inefficiency in the code moving the image data around, will be 
completely drowned by the I/O time.

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles

More information about the ffmpeg-devel mailing list