[FFmpeg-devel] [Ffmpeg-devel] [PATCH] non working samples for bmp decoder
Michael Niedermayer
michaelni
Wed May 2 20:13:09 CEST 2007
Hi
On Wed, May 02, 2007 at 07:04:53PM +0200, Michel Bardiaux wrote:
> Compn wrote:
> >i am just looking for image files that are not supported yet.
> >here are some bmp files that cause trouble.
> >
> >http://samples.mplayerhq.hu/bmp-files/
> >
> >11Bbos20.bmp
> >[bmp @ 009C8BF0]depth 1 not supported
>
> Now readable with the attached patch.
>
> I would also like to support various variations (sic) of BMP in the
> encoder. What is the best example to follow about how to add options to
> a codec?
the existing -pix_fmt -coder ... should be enough or not?
[...]
> - n = (avctx->width * (depth / 8) + 3) & ~3;
> + n = (((avctx->width * depth) / 8) + 3) & ~3;
2 superflous ()
>
> if(n * avctx->height > dsize){
> av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
> @@ -185,6 +191,28 @@
> }
>
> switch(depth){
> + case 1:
> + // 2 palette entries as B,G,R,x in file
> + palette = (int*) p->data[1];
> + lbuf = buf0 + 14 + ihsize;
> + for(i = 0; i < 2; i++){
> + palette[i] = bytestream_get_byte(&lbuf); // B
> + palette[i] |= bytestream_get_byte(&lbuf)<<8; // G
> + palette[i] |= bytestream_get_byte(&lbuf)<<16; // R
> + lbuf++;
> + }
the palette code can be written more generically, that is for 1<<depth entries
bytestream_get_be24()
> + for(i = 0; i < avctx->height; i++) {
> + lbuf = buf;
> + for(j = 0; j < avctx->width; j++){
> + k=(j%8);
> + if((k=(j%8))==0)
> + b = bytestream_get_byte(&buf);
> + ptr[j] = !!(b&(1<<(7-k)));
> + }
get_bits1() could be used here (it is likely much faster and more readable)
> + buf = lbuf + n;
> + ptr += linesize;
> + }
> + break;
> case 24:
the indention of case missmatches
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- 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/20070502/cd7b6704/attachment.pgp>
More information about the ffmpeg-devel
mailing list