[FFmpeg-devel] GSoC project (JPEG 2000)

rukhsana afroz rukhsana.afroz at gmail.com
Tue Apr 5 04:35:12 CEST 2011


On Tue, Mar 29, 2011 at 4:56 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> For example decodimng the files from codestreams_profile0
> results in many
>  only LRCP progression supported
>  error during processing marker segment ff52
> and eventually a segfault
>
>
Hi Michael,

I tried the current decoder with the files in "codestreams_profile0"
folder. The root of these errors are that decoder cannot correctly retrieve
coding style information from the file. I have included here the
corresponding functions where the decoder fail:

/** get coding parameters for a particular tile or whole image*/
static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t
*properties)
{
    J2kCodingStyle tmp;
    int compno;

    av_log(s->avctx, AV_LOG_ERROR, "Inside get_cod\n");

    if (s->buf_end - s->buf < 5)
        return AVERROR(EINVAL);

    tmp.log2_prec_width  =
    tmp.log2_prec_height = 15;

    tmp.csty = bytestream_get_byte(&s->buf);

    if (bytestream_get_byte(&s->buf)){ // progression level
        av_log(s->avctx, AV_LOG_ERROR, "only LRCP progression supported\n");
        return -1;
    }

    tmp.nlayers = bytestream_get_be16(&s->buf);
        tmp.mct = bytestream_get_byte(&s->buf); // multiple component
transformation

    get_cox(s, &tmp);
    for (compno = 0; compno < s->ncomponents; compno++){
        if (!(properties[compno] & HAD_COC))
            memcpy(c + compno, &tmp, sizeof(J2kCodingStyle));
    }
    return 0;
}

/** get common part for COD and COC segments */
static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c)
{
    if (s->buf_end - s->buf < 5)
        return AVERROR(EINVAL);
          c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of
resolution levels - 1
     c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width
    c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height

    c->cblk_style = bytestream_get_byte(&s->buf);
    if (c->cblk_style != 0){ // cblk style
        av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n");
        return -1;
    }
    c->transform = bytestream_get_byte(&s->buf); // transformation
    if (c->csty & J2K_CSTY_PREC) {
        int i;
        for (i = 0; i < c->nreslevels; i++)
            bytestream_get_byte(&s->buf);
    }
    return 0;
}

Most of the files fail when the decoder retrieves the coding style of the
j2k file and gets the error "no extra cblk styles supported". The files in
"testfiles_jp2" do not fail in this IF block. Actually coding style is
retrieved at the beginning of decoding process, before entering to the
actual codestream. I looked for exact rfc of jpeg2000 coding standard in the
internet, however did not find anything useful. Could you please refer me
the standard rfc based on what this code has been developed?

I really work on this project (I found it is interesting) and I will submit
my SoC proposal on May 8th. Please help me on this so that I can work on
this effectively.

Thanks
Ruby



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


More information about the ffmpeg-devel mailing list