[FFmpeg-soc] BFI Decoder

Michael Niedermayer michaelni at gmx.at
Thu Apr 17 00:49:25 CEST 2008


On Thu, Apr 17, 2008 at 03:51:28AM +0530, Sisir Koppaka wrote:
> On Thu, Apr 17, 2008 at 3:45 AM, Sisir Koppaka <sisir.koppaka at gmail.com>
> wrote:
> 
> > 1 : back chain
> >       if length is zero, read one more byte of the length AND two bytes of the offset
> >        else, read one byte of the offset
> >       copy (length) dwords from (output - offset) to the output
> >
> >       (note, that data may overlap, so don't use memmove() function here, just bare by-dword copying!)
> >
> >  case 1:                //Back Chain
> >             if (length == 0) {
> >                 length = bytestream_get_byte(&buf);
> >                 offset = bytestream_get_le16(&buf);
> >             } else {
> >                 offset = bytestream_get_byte(&buf);
> >             }
> >             dst_offset = dst - offset;
> >             length *= 4;        //Convert dwords to bytes.
> >             while(length--)
> >             {
> >                 *dst++ = *dst_offset++;
> >             }
> >             av_log(NULL,AV_LOG_INFO, "\n[DECODER] Back Chain.");
> >             break;
> >
> > Logically, it doesn't seem to be wrong to me....is it wrong?
> >
> > I did ./ffmpeg -i file.bfi images/%04d.png but still I only get a blue
> > frame, I think the first frame is not decoding...it still segfaults while
> > doing decoding a back chain from the av_logs...
> >
> This might be close to stupid or actually stupid, but I tried changing the
> bytestream_get_le16 to be16 just in case, but that didn't work and gave the
> same old blue.png....
> In a further act of desperation I tried writing dst_offset = dst + offset;
> because I'm not sure how the computer is actually addressing the memory
> (does next byte necessarily have an incremented address?)(my courses haven't
> got that far, if in case this is a well-known fact) this didn't work too...

You should check/ensure that the offset and length are within the allocated
buffer.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080417/108f2c4c/attachment.pgp>


More information about the FFmpeg-soc mailing list