[Ffmpeg-devel] tiff encoder (qualification task for GSoC)

Kostya kostya.shishkov
Fri Mar 23 07:39:18 CET 2007


On Thu, Mar 22, 2007 at 09:28:32PM +0100, Michael Niedermayer wrote:
[...] 
> i think this encodes 1 0 0 1 to
> 0  1 -1  0  0  1
> while the following would be shorter
> 3  1  0  0  1
> 
> also this should rather use targa_encode_rle() (if needed with extending
> targa_encode_rle() to support any differences tiff requires)

It will be nice to have general RLE engine for all encoders, for example
there could be just one function ff_rle(uint8_t *src, int size, int *type)
which will return length of recognized serie and type (0=raw, 1=run)

Also run length should be >= 3 to be effective.

> > +    return 0;
> > +}
> > +
> > +#define TIFF_MAX_ENTRY 32
> > +
> > +static void add_entry(dir_entry **dir, dir_entry *end, int tag, int type, int count, int off, void *val){
> > +    if(*dir == end)
> > +        return;
> > +    (*dir)->tag = tag;
> > +    (*dir)->type = type;
> > +    (*dir)->count= count;
> > +    (*dir)->off = off;
> > +    (*dir)->val = val;
> > +    (*dir)++;
> > +}
> 
> why do you build the thing in memory first and then
> write it out instead of writing each entry immedeatly?

Usually they will be written after the image data so initial position is unknown.
Maybe it also has any relation to file_offset from another encoder?

[...]
> > +
> > +    if(avctx->frame_number == 0){
> > +        if(le){
> > +            tput_short(&ptr, 0x4949, le);
> > +        }else{
> > +            tput_short(&ptr, 0x4D4D, le);
> > +        }
> > +        tput_short(&ptr, 42, le);
> > +        offset = ptr;
> > +        tput_long(&ptr, 0x0 , le);
> > +    }
> 
> could you elaborate on the effect of the avctx->frame_number == 0 check?

TIFF file may contain some images in one file (like animated GIF).
I think whoever will add such support will also have to write such
multiimage TIFF demuxer. Personally I don't like this at all.
 
[...] 
> 
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB




More information about the ffmpeg-devel mailing list