[FFmpeg-devel] JPEG2000 decoder

Michael Niedermayer michaelni at gmx.at
Mon May 2 01:42:25 CEST 2011


Hi ruby

On Sun, May 01, 2011 at 09:12:56AM -0700, rukhsana afroz wrote:
> 2011/5/1 rukhsana afroz <rukhsana.afroz at gmail.com>
> 
> > Hi Michael,
> >
> > Here I have attached four patches, one is for our decoder and three for
> > jasper decoder and all these are for the purpose of debugging. I hope,
> > seeing the content of the file, you will get where to apply the patch in
> > jasper code. My latest code is in:
> >
> > https://github.com/rukhsana/j2k/tree/r6
> >
> > Please apply the patch for our decoder in this code.
> >
> > Thanks
> >
> >
> By the way, Michael, I am using the jasper version "jasper-1.900.1" . I
> believe, its the latest version found in their website.

Thanks for the patches.

The problem i see with testfiles_jp2/file1.jp2
is that the buf array in jasper contains signed values
while our decoder uses unsigend uint8_t

thus the values -2,-1,0,1,2 are 0xFE,0xFF,0,1,2 on our side, both
have the same binary representation though namely
11111110, 11111111, 00000000, 00000001, 00000010

but their type that the compiler uses to interpret them differs.

Now C extends things to int when passing the arguments to printf()
this does not change their values, they are still 
-2,-1,0,1,2 and 0xFE,0xFF,0,1,2
but their representation now changes due to sign extension used for
signed values, thus they become
for jasper: 11111111111111111111111111111110, 11111111111111111111111111111111, 00000000000000000000000000000000, ...
for us    : 00000000000000000000000011111110, 00000000000000000000000011111111, 00000000000000000000000000000000, ...

and in the last step "%x" is for unsigned values and prints them as
0xFFFFFFFE, 0xFFFFFFFF,0x0, 0x1
and
0xFE, 0xFF,0x0, 0x1

Which looks different

also stdout & stderr from jasper can get intermixed in somewhat
random ways


The following in our decoder produces identical outpiut for the values
if the other lines are ignored
for(x = 0; x < cblk->length; x++)
    av_log(s->avctx, AV_LOG_INFO, "0X%02x ", (int8_t)cblk->data[x]);


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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110502/a73df635/attachment.asc>


More information about the ffmpeg-devel mailing list