[FFmpeg-devel] JPEG2000 decoder

rukhsana afroz rukhsana.afroz at gmail.com
Sun May 15 10:01:36 CEST 2011

On Sun, May 15, 2011 at 12:18 AM, rukhsana afroz
<rukhsana.afroz at gmail.com>wrote:

> Hi Michael,
> I am re-writing the function "decode_packet". Now, I am actually at the
> beginning of this function. I have confusion with the problems I have
> described here. When I process the COD marker, I found the coding style of
> this marker is 6. According to page 45 (Table A-13), if 2nd LSB of csty is
> 1, the packet header should have SOP marker and if 3rd LSB of csty is 1, the
> packet header should have EPH header. Since, these marker are not must, our
> decoder did not implemnet this. I have implemneted these marker while
> decoding packet header. But the problem i found with the file p1_01.j2k has
> also COC marker. According to the spec when COC marker comes, the parameters
> of COC marker will be replaced by COD marker parameters. I found in marker,
> csty value is 0. It means packet should not have SOP or EPH headers.
> However, I have checked jasper code, its csty value is 6 and it keeps COD
> marker's csty without replacing COC marker's csty. Therefore, SOP and EPH
> have been processed in their code. Please let me know, how you do think this
> problem. Should my logic be:
> if COC_csty is ZERO
>    s->codsty.csty = COD_csty;
> end
> Or, the current decoder does just replace like the following:
> s->codsty.csty = COC_csty
> I think, I will be able to better explain you stuffs in IRC chat.
Hi Michael,

For the first packet, without checking csty value from COD or COC marker, I
processed SOP marker (assuming there is a SOP marker). I found all of the
packet headers value can be correctly retrieved (comparing with jasper)
except the last one. The lines of code in the decode_packet function is

 if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)
                    return ret;

ret value by our decoder is 49 whereas for the jasper this is 41 (sum of
following numbers). In fact, our decoder gets this value assuming single
codeword segment. But according to jasper code, this is also actually
multiple codeword segment therefore the retrieved values from jasper are:

len = 12
len = 7
len = 6
len = 1
len = 2
len = 12
len = 1

Our decoder did not implemnet multiple codeword segment. Page number in the
spec for this feature is 79. Please have a look at this, and please let me
know if you have any suggestion.


Rukhsana Ruby
Phd Student
Department of Electrical & Computer Engineering
The University of British Columbia

More information about the ffmpeg-devel mailing list