[Ffmpeg-devel] [RFC] Fraps v2 support

Michael Niedermayer michaelni
Thu Nov 2 19:52:23 CET 2006


Hi

On Thu, Nov 02, 2006 at 08:24:46PM +0200, Kostya wrote:
> Please test if patch attached confirms to $subj. I have only a bit of one
> sample here.

[...]

> +    cur_node = 510; // for futher use in huffman decoding
> +    /* we have built Huffman table and are ready to decode plane */
> +    /* XXX this bitreader ignores every 32th bit so lavc bitreader cannot be used*/

hmm i can belive it ... are you sure that they ignore every 32th bit??
if its really true then id suggest that you use a temporary buffer and 
convert that 31/32bit block stream to a normal one, i guess that this 
with the get_vlc() code from lavc  is still faster ...


> +    bits = 0; bitbuf = 0;
> +    for(j = 0; j < h; j++){
> +        for(i = 0; i < w; i++){
> +            /* get one huffman code */
> +            curcode = cur_node;
> +            while(s->nodes[curcode].sym == HNODE) {
> +                /* get one bit */
> +                if(!bits){
> +                    if(size <= 0){
> +                        av_log(s->avctx, AV_LOG_ERROR, "Code went out of bounds\n");
> +                        return -1;
> +                    }
> +                    bitbuf = LE_32(src);
> +                    bits = 32;
> +                    src += 4;
> +                    size -= 4;
> +                }
> +                bits--;
> +                b = (bitbuf >> bits) & 1;
> +                if(!b)
> +                    curcode = s->nodes[curcode].n0;
> +                else
> +                    curcode = s->nodes[curcode].n1;
> +                assert(curcode >= 0 && curcode <= s->cur_node);
> +            }
> +            dst[i] = s->nodes[curcode].sym;
> +            /* we need to add 0x80 to the first line of the chroma planes */
> +            if(!j && Uoff) dst[i] += 0x80;
> +            /* lines are stored as deltas between previous line */
> +            if(j) dst[i] += dst[i - stride];

id suggest

if(j) ...
else if(Uoff) ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list