Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Thu, Apr 28, 2011 at 11:20 PM, rukhsana afroz wrote: > > > On Wed, Apr 27, 2011 at 3:09 AM, rukhsana afroz > wrote: > > Just have pushed one clean repository. > > In this branch, I have splitted one single commit into a number of commits. :) -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 27, 2011 at 3:09 AM, rukhsana afroz wrote: Just have pushed one clean repository. -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 10:36 PM, rukhsana afroz wrote: > Here, I have attached my latest patch to have a final look for you. > > And Diego, I have fixed my git tree. I just have pushed one clean branch to > the github. > > Thnaks > > > pushed another clean git tree. > > -- > Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 2:55 AM, rukhsana afroz wrote: > I tested my decoder and jasper's one with a file which can be decoded > successfully by both. It seems, defining code blocks and its parameters with > how it should be decoded is completely implemnetation dependent. Like the > previous file, with this file also, I get different code blocks with > different parameters than the jasper one. Since the data files are too big, > I cannot attach here. However, if you want to see, I can send to you as well > when you come to online. > > Hi Ronald, Here, I have attached my latest patch to have a final look for you. And Diego, I have fixed my git tree. I just have pushed one clean branch to the github. Thnaks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia cblk_style.diff Description: Binary data ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 12:46 AM, rukhsana afroz wrote: > >>> >> Hi Ronald, >> >> I have attched two files for code block decode results (one is for jasper >> and one is for libav). I have only shown the entire code block at the >> beginning and at the end of clnpass function. With the comparison of jasper, >> it looks like, at the way earlier stage, where code block is defined and >> with how many passes (sigpass, refpass, clnpass) should a code block be gone >> is garbled. Because the parameters gone to the code block decode function is >> completely different than those of jasper. I will explain more the result >> files when you come to chat. I am investigating the problems, but the >> current decoder can decode correctly 9 files in the conformance site, thats >> why I thought, the problem might not be in earlier stage. After getting >> your feedback, I will move forward on this. >> >> >> >> > Hi Ronald, I tested my decoder and jasper's one with a file which can be decoded successfully by both. It seems, defining code blocks and its parameters with how it should be decoded is completely implemnetation dependent. Like the previous file, with this file also, I get different code blocks with different parameters than the jasper one. Since the data files are too big, I cannot attach here. However, if you want to see, I can send to you as well when you come to online. Thanks >-- >> > Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 2:15 AM, Diego Biurrun wrote: > > > > You can use pastebin.com, but I suggest you use IRC instead of this > mailing list first, I think it's the more suitable medium for the > kind of help you are looking for. > > Thanks Diego for your suggestion. I asked on IRC for help. I am waiting now for the moderator's reply. Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 12:46:46AM -0700, rukhsana afroz wrote: > > I sent two attachments with two files, however it got bounced because the > attachments were too big. I am not sure, at this stage, how to send the data > to you. Please let me know. You can use pastebin.com, but I suggest you use IRC instead of this mailing list first, I think it's the more suitable medium for the kind of help you are looking for. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sun, Apr 24, 2011 at 12:38 AM, rukhsana afroz wrote: > > > On Sat, Apr 23, 2011 at 5:24 PM, Ronald S. Bultje wrote: > >> Hi Rukhsana, >> >> On Sat, Apr 23, 2011 at 2:59 PM, rukhsana afroz >> Which bit planes are decoded correctly? And especially, how many out >> of how many? Are 99 out of 100 decoded correctly? Or 1 out of 10? >> Don't forget, the end-of-plane marker is 4 bits set to 1. For every 4 >> bits, the chance is pow(0.5, 4) that each bit is set, from a random >> perspective. Therefore, if 1 out of 10 is decoded correctly, your code >> is likely incorrect. However, if 99 out of 100 are correct, your code >> may well be correct but you're hitting some corner case that doesn't >> make it work. either way, you need to compare further to make sure >> that we're on the right track. >> >> How does it compare to the reference decoder? Are there blocks that >> are being decoded correctly now for files that previously decoded >> incorrectly? I've told you before, I need to see some data where >> you're attempting to decode an actual jpeg2k file using your decoder >> versus the reference decoder, then show me what values are being read >> in your decoder versus the reference decoder, so we can assess whether >> your decoder is doing the right thing. >> >> Hi Ronald, > > I have attched two files for code block decode results (one is for jasper > and one is for libav). I have only shown the entire code block at the > beginning and at the end of clnpass function. With the comparison of jasper, > it looks like, at the way earlier stage, where code block is defined and > with how many passes (sigpass, refpass, clnpass) should a code block be gone > is garbled. Because the parameters gone to the code block decode function is > completely different than those of jasper. I will explain more the result > files when you come to chat. I am investigating the problems, but the > current decoder can decode correctly 9 files in the conformance site, thats > why I thought, the problem might not be in earlier stage. After getting > your feedback, I will move forward on this. > > > Hi Ronald, I sent two attachments with two files, however it got bounced because the attachments were too big. I am not sure, at this stage, how to send the data to you. Please let me know. Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
Hi Rukhsana, On Sat, Apr 23, 2011 at 2:59 PM, rukhsana afroz wrote: > Here, I have attached a patch, code block style of which I have tested. Page > number in the spec is 115 (D.5) for this code block style. This codeblock > style checks whether the bitplane is decoded correctly in every cleanup > pass. I have found a file which has this code block style. In fact, some bit > plane is correctly decoded and some bit plane is not correctly decoded and > my code correctly checks this. Which bit planes are decoded correctly? And especially, how many out of how many? Are 99 out of 100 decoded correctly? Or 1 out of 10? Don't forget, the end-of-plane marker is 4 bits set to 1. For every 4 bits, the chance is pow(0.5, 4) that each bit is set, from a random perspective. Therefore, if 1 out of 10 is decoded correctly, your code is likely incorrect. However, if 99 out of 100 are correct, your code may well be correct but you're hitting some corner case that doesn't make it work. either way, you need to compare further to make sure that we're on the right track. > Also, I have checked the register values with > the reference codec jasper. I found in the middle somewhere, bit plane is > not decoded correctly. I am checking this too. However, as for my > qualification task, is it enough? Or do you want me to do something more? How does it compare to the reference decoder? Are there blocks that are being decoded correctly now for files that previously decoded incorrectly? I've told you before, I need to see some data where you're attempting to decode an actual jpeg2k file using your decoder versus the reference decoder, then show me what values are being read in your decoder versus the reference decoder, so we can assess whether your decoder is doing the right thing. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Sat, Apr 23, 2011 at 4:38 AM, rukhsana afroz wrote: > > Hi Ronald, > > I will get back to you soon over the chat soon. Please give me some more > hours. > > Thanks > > >> >> >> > Hi Ronald, Here, I have attached a patch, code block style of which I have tested. Page number in the spec is 115 (D.5) for this code block style. This codeblock style checks whether the bitplane is decoded correctly in every cleanup pass. I have found a file which has this code block style. In fact, some bit plane is correctly decoded and some bit plane is not correctly decoded and my code correctly checks this. Also, I have checked the register values with the reference codec jasper. I found in the middle somewhere, bit plane is not decoded correctly. I am checking this too. However, as for my qualification task, is it enough? Or do you want me to do something more? Please let me know. Thanks > >> -- >> > Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia seg_val_cblk_csty.diff Description: Binary data ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Fri, Apr 22, 2011 at 5:28 PM, rukhsana afroz wrote: > > > On Fri, Apr 22, 2011 at 5:20 PM, Ronald S. Bultje wrote: > >> >> You need to re-run configure. >> >> Hi Ronald, > > Thank you for your information. Yes, I did it and now working on the bug. > > > > Hi Ronald, I will get back to you soon over the chat soon. Please give me some more hours. Thanks > -- > Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Fri, Apr 22, 2011 at 5:20 PM, Ronald S. Bultje wrote: > > You need to re-run configure. > > Hi Ronald, Thank you for your information. Yes, I did it and now working on the bug. Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
Hi Rukhsana, On Fri, Apr 22, 2011 at 5:05 PM, rukhsana afroz wrote: > With current libav, while compiling the code I get the following error: > > CC libavdevice/alldevices.o > In file included from ./libavutil/internal.h:171, > from ./libavutil/common.h:328, > from ./libavutil/avutil.h:97, > from ./libavcodec/avcodec.h:31, > from ./libavformat/avformat.h:43, > from libavdevice/alldevices.c:22: > ./libavutil/libm.h:89:6: warning: "HAVE_TRUNC" is not defined > In file included from ./libavutil/internal.h:171, > from ./libavutil/common.h:328, > from ./libavutil/avutil.h:97, > from ./libavcodec/avcodec.h:31, > from ./libavformat/avformat.h:43, > from libavdevice/alldevices.c:22: > ./libavutil/libm.h:90: error: static declaration of ‘trunc’ follows > non-static declaration > libavdevice/alldevices.c: In function ‘avdevice_register_all’: > libavdevice/alldevices.c:45: error: ‘CONFIG_FBDEV_INDEV’ undeclared (first > use in this function) > libavdevice/alldevices.c:45: error: (Each undeclared identifier is reported > only once > libavdevice/alldevices.c:45: error: for each function it appears in.) > make: *** [libavdevice/alldevices.o] Error 1 > > > Could you please help me to get rid of this error? You need to re-run configure. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Fri, Apr 22, 2011 at 3:37 AM, rukhsana afroz wrote: > > > On Fri, Apr 22, 2011 at 2:53 AM, Diego Biurrun wrote: > >> On Thu, Apr 21, 2011 at 07:38:38PM -0700, rukhsana afroz wrote: >> >> >> Please break such long lines. >> >> > Thanks Diego for your reviews. I have attached new patch. Dear All, With current libav, while compiling the code I get the following error: CClibavdevice/alldevices.o In file included from ./libavutil/internal.h:171, from ./libavutil/common.h:328, from ./libavutil/avutil.h:97, from ./libavcodec/avcodec.h:31, from ./libavformat/avformat.h:43, from libavdevice/alldevices.c:22: ./libavutil/libm.h:89:6: warning: "HAVE_TRUNC" is not defined In file included from ./libavutil/internal.h:171, from ./libavutil/common.h:328, from ./libavutil/avutil.h:97, from ./libavcodec/avcodec.h:31, from ./libavformat/avformat.h:43, from libavdevice/alldevices.c:22: ./libavutil/libm.h:90: error: static declaration of ‘trunc’ follows non-static declaration libavdevice/alldevices.c: In function ‘avdevice_register_all’: libavdevice/alldevices.c:45: error: ‘CONFIG_FBDEV_INDEV’ undeclared (first use in this function) libavdevice/alldevices.c:45: error: (Each undeclared identifier is reported only once libavdevice/alldevices.c:45: error: for each function it appears in.) make: *** [libavdevice/alldevices.o] Error 1 Could you please help me to get rid of this error? Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Fri, Apr 22, 2011 at 2:53 AM, Diego Biurrun wrote: > On Thu, Apr 21, 2011 at 07:38:38PM -0700, rukhsana afroz wrote: > > > Please break such long lines. > > Thanks Diego for your reviews. I have attached new patch. -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia cblk_csty.diff Description: Binary data ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Thu, Apr 21, 2011 at 07:38:38PM -0700, rukhsana afroz wrote: > > I have attached new patch again. > > --- a/libavcodec/j2k.c > +++ b/libavcodec/j2k.c > @@ -105,18 +105,20 @@ static void tag_tree_zero(J2kTgtNode *t, int w, int h) > > -static int getnbctxno(int flag, int bandno) > +static int getnbctxno(int flag, int bandno, int vert_causal_ctx_csty_symbol) > { > int h, v, d; > > -h = ((flag & J2K_T1_SIG_E) ? 1:0)+ > + h = ((flag & J2K_T1_SIG_E) ? 1:0)+ This is a stray cosmetic change that should not be in your patch. > ((flag & J2K_T1_SIG_W) ? 1:0); > -v = ((flag & J2K_T1_SIG_N) ? 1:0)+ > -((flag & J2K_T1_SIG_S) ? 1:0); > +v = ((flag & J2K_T1_SIG_N) ? 1:0); > +if(!vert_causal_ctx_csty_symbol) 'if (', more below > --- a/libavcodec/j2kdec.c > +++ b/libavcodec/j2kdec.c > @@ -303,6 +303,8 @@ static int get_cod(J2kDecoderContext *s, J2kCodingStyle > *c, uint8_t *properties) > > + av_log(s->avctx, AV_LOG_DEBUG, "Inside get_cod\n"); These debug messages have no place in production code and should not be part of patches you submit. > @@ -592,7 +596,7 @@ static int decode_packets(J2kDecoderContext *s, J2kTile > *tile) > > /* TIER-1 routines */ > -static void decode_sigpass(J2kT1Context *t1, int width, int height, int > bpno, int bandno) > +static void decode_sigpass(J2kT1Context *t1, int width, int height, int > bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol) Please break this long line. > @@ -601,10 +605,13 @@ static void decode_sigpass(J2kT1Context *t1, int width, > int height, int bpno, in > && !(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ > -if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + > ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno))){ > +vert_causal_ctx_csty_symbol = > vert_causal_ctx_csty_symbol && (x == 3 && y == 3); > +if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + > ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_symbol))){ if (...) { > + if (bpass_csty_symbol) > + t1->data[y][x] = ff_mqc_decode(&t1->mqc, > t1->mqc.cx_states + ctxno) ? -mask : mask; > + else > + t1->data[y][x] = (ff_mqc_decode(&t1->mqc, > t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; Get rid of all the tabs. > @@ -697,14 +704,26 @@ static int decode_cblk(J2kDecoderContext *s, > J2kCodingStyle *codsty, J2kT1Contex > cblk->data[cblk->length] = 0xff; > cblk->data[cblk->length+1] = 0xff; > > +//av_log(s->avctx, AV_LOG_ERROR,"decode_cblk passno: %d, bpno: %d\n", > passno, bpno); Please don't add commented-out debugging cruft. > while(passno--){ > switch(pass_t){ > -case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); > +case 0: decode_sigpass(t1, width, height, bpno+1, bandpos, > bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol); Please break such long lines. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Thu, Apr 21, 2011 at 6:30 PM, rukhsana afroz wrote: > Thanks Nicolas for your comments. I will incorporate those in my code. > I have attached new patch again. -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c index f1337ed..59bbb0a 100644 --- a/libavcodec/j2k.c +++ b/libavcodec/j2k.c @@ -105,18 +105,20 @@ static void tag_tree_zero(J2kTgtNode *t, int w, int h) uint8_t ff_j2k_nbctxno_lut[256][4]; -static int getnbctxno(int flag, int bandno) +static int getnbctxno(int flag, int bandno, int vert_causal_ctx_csty_symbol) { int h, v, d; -h = ((flag & J2K_T1_SIG_E) ? 1:0)+ + h = ((flag & J2K_T1_SIG_E) ? 1:0)+ ((flag & J2K_T1_SIG_W) ? 1:0); -v = ((flag & J2K_T1_SIG_N) ? 1:0)+ -((flag & J2K_T1_SIG_S) ? 1:0); +v = ((flag & J2K_T1_SIG_N) ? 1:0); +if(!vert_causal_ctx_csty_symbol) +v = v + ((flag & J2K_T1_SIG_S) ? 1:0); d = ((flag & J2K_T1_SIG_NE) ? 1:0)+ -((flag & J2K_T1_SIG_NW) ? 1:0)+ -((flag & J2K_T1_SIG_SE) ? 1:0)+ -((flag & J2K_T1_SIG_SW) ? 1:0); +((flag & J2K_T1_SIG_NW) ? 1:0); +if(!vert_causal_ctx_csty_symbol) +d = d + ((flag & J2K_T1_SIG_SE) ? 1:0)+ +((flag & J2K_T1_SIG_SW) ? 1:0); if (bandno < 3){ if (bandno == 1) FFSWAP(int, h, v); diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 0f8864d..1a52a13 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -303,6 +303,8 @@ static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) J2kCodingStyle tmp; int compno; + av_log(s->avctx, AV_LOG_DEBUG, "Inside get_cod\n"); + if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); @@ -332,6 +334,8 @@ static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) { int compno; + av_log(s->avctx, AV_LOG_DEBUG, "Inside get_coc\n"); + if (s->buf_end - s->buf < 2) return AVERROR(EINVAL); @@ -592,7 +596,7 @@ static int decode_packets(J2kDecoderContext *s, J2kTile *tile) } /* TIER-1 routines */ -static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno) +static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; @@ -601,10 +605,13 @@ static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, in for (y = y0; y < height && y < y0+4; y++){ if ((t1->flags[y+1][x+1] & J2K_T1_SIG_NB) && !(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ -if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno))){ +vert_causal_ctx_csty_symbol = vert_causal_ctx_csty_symbol && (x == 3 && y == 3); +if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_symbol))){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); - -t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; + if (bpass_csty_symbol) +t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; + else + t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } @@ -685,7 +692,7 @@ static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, in static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { -int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; +int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); @@ -697,14 +704,26 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; +//av_log(s->avctx, AV_LOG_ERROR,"decode_cblk passno: %d, bpno: %d\n", passno, bpno); + +bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style; +vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style; + while(passno--){ switch(pass_t){ -case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); +case 0: decode_sigpass(t1, width, height, bpno+1, bandpos, bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol); break; -case 1: decode_refpas
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 20, 2011 at 2:23 AM, Nicolas George < nicolas.geo...@normalesup.org> wrote: > Le primidi 1er floréal, an CCXIX, rukhsana afroz a écrit : > > Here, I have attached the patch. > > This time it's not mangled. Getting it to have the correct MIME type would > have been a plus. You probably only had to name the file something.patch or > something.diff; try to think about it next time. > > > -h = ((flag & J2K_T1_SIG_E) ? 1:0)+ > > + h = ((flag & J2K_T1_SIG_E) ? 1:0)+ > > Indentation is weird. > > > +if(!vert_causal_ctx_csty_symbol) > > +d = d + ((flag & J2K_T1_SIG_SE) ? 1:0)+ > > + ((flag & J2K_T1_SIG_SW) ? 1:0); > > There is a tab here. Tabs can not be committed to the official repository. > There are tabs at other places as well. > > Also, the indent is weird: maybe align "((flag" with the same on the > previous line. > > > + av_log(s->avctx, AV_LOG_ERROR, "Inside get_cod\n"); > > + > > Debug message: if you want it to stay, it need to be at AV_LOG_DEBUG > (possibly use dlog?), and probably be more explicit. The same applies for > other places where debug is present. > > > + if (bpass_csty_symbol) > > + t1->data[y][x] = ff_mqc_decode(&t1->mqc, > t1->mqc.cx_states + ctxno) ? -mask : mask; > > + else > > + t1->data[y][x] = (ff_mqc_decode(&t1->mqc, > t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; > > Indentation is weird, probably because of the tabs. > > > + clnpass_cnt = clnpass_cnt + 1; > > break; > > Indentation is weird, but the faulty line is not yours. > > Sorry, these are only cosmetic remarks, but that is so much less work for > those who actually know what teh code does. > Thanks Nicolas for your comments. I will incorporate those in my code. -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 20, 2011 at 12:47 AM, Nicolas George < nicolas.geo...@normalesup.org> wrote: > The patch format is good, but unfortunaetly, the patch is still mangled. > For > example, the above quoted text should obviously be a single line, but your > mailer split it at 72 characters, as if it was text. > > If you can not disable text rewrapping in your mailer just for parts of the > text, then you probably need to save the patch in a separate file (git > format-patch does that for you) and attach that file: the mailer will not > rewrap attachments. > > > Here, I have attached the patch. > -- > Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia csty_diff Description: Binary data ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Tue, Apr 19, 2011 at 10:03 PM, rukhsana afroz wrote: > > > On Tue, Apr 19, 2011 at 9:09 PM, rukhsana afroz > wrote: > >> >> >> On Tue, Apr 19, 2011 at 2:59 PM, Nicolas George < >> nicolas.geo...@normalesup.org> wrote: >> >>> I suggest you produce your patch using the revision control tool (svn or >>> git), and attach it as a file to avoid its mangling. >>> >>> Hi Ronald and Nicolas, >> >> Thanks for your suggestion. Now I have used git diff for creating my >> patch. Also, I have modified the code for cblk_csty "Vertical stripe causal >> context formation" along with "Selective arithmetic coding bypass" code >> block style. Please, have a look at my patch: >> >> >> The pages 115-118 from the spec have illustrated these ideas. Other code >> block styles are already implicitly implemneted in the previous code. >> Please, let me know if you have any suggestions. >> >> > There was a mistake in the previous patch. Here, I have put the new patch. > > Sorry, there was again another mistake in the previous patch. Here is new patch: diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c index f1337ed..0f23b5b 100644 --- a/libavcodec/j2k.c +++ b/libavcodec/j2k.c @@ -105,18 +105,20 @@ static void tag_tree_zero(J2kTgtNode *t, int w, int h) uint8_t ff_j2k_nbctxno_lut[256][4]; -static int getnbctxno(int flag, int bandno) +static int getnbctxno(int flag, int bandno, int vert_causal_ctx_csty_symbol) { int h, v, d; -h = ((flag & J2K_T1_SIG_E) ? 1:0)+ + h = ((flag & J2K_T1_SIG_E) ? 1:0)+ ((flag & J2K_T1_SIG_W) ? 1:0); -v = ((flag & J2K_T1_SIG_N) ? 1:0)+ -((flag & J2K_T1_SIG_S) ? 1:0); +v = ((flag & J2K_T1_SIG_N) ? 1:0); +if(!vert_causal_ctx_csty_symbol) +v = v + ((flag & J2K_T1_SIG_S) ? 1:0); d = ((flag & J2K_T1_SIG_NE) ? 1:0)+ -((flag & J2K_T1_SIG_NW) ? 1:0)+ -((flag & J2K_T1_SIG_SE) ? 1:0)+ -((flag & J2K_T1_SIG_SW) ? 1:0); +((flag & J2K_T1_SIG_NW) ? 1:0); +if(!vert_causal_ctx_csty_symbol) +d = d + ((flag & J2K_T1_SIG_SE) ? 1:0)+ +((flag & J2K_T1_SIG_SW) ? 1:0); if (bandno < 3){ if (bandno == 1) FFSWAP(int, h, v); diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 0f8864d..750ba47 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -303,6 +303,8 @@ 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); @@ -332,6 +334,8 @@ static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) { int compno; +av_log(s->avctx, AV_LOG_ERROR, "Inside get_coc\n"); + if (s->buf_end - s->buf < 2) return AVERROR(EINVAL); @@ -592,7 +596,7 @@ static int decode_packets(J2kDecoderContext *s, J2kTile *tile) } /* TIER-1 routines */ -static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno) +static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; @@ -601,10 +605,13 @@ static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, in for (y = y0; y < height && y < y0+4; y++){ if ((t1->flags[y+1][x+1] & J2K_T1_SIG_NB) && !(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ -if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno))){ +vert_causal_ctx_csty_symbol = vert_causal_ctx_csty_symbol & (x == 3 && y == 3); +if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_symbol))){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); - -t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; +if (bpass_csty_symbol) +t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; +else +t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } @@ -685,7 +692,7 @@ static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, in static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { -int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; +int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Tue, Apr 19, 2011 at 9:09 PM, rukhsana afroz wrote: > > > On Tue, Apr 19, 2011 at 2:59 PM, Nicolas George < > nicolas.geo...@normalesup.org> wrote: > >> I suggest you produce your patch using the revision control tool (svn or >> git), and attach it as a file to avoid its mangling. >> >> Hi Ronald and Nicolas, > > Thanks for your suggestion. Now I have used git diff for creating my patch. > Also, I have modified the code for cblk_csty "Vertical stripe causal context > formation" along with "Selective arithmetic coding bypass" code block style. > Please, have a look at my patch: > > > The pages 115-118 from the spec have illustrated these ideas. Other code > block styles are already implicitly implemneted in the previous code. > Please, let me know if you have any suggestions. > > There was a mistake in the previous patch. Here, I have put the new patch. diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 0f8864d..750ba47 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -303,6 +303,8 @@ 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); @@ -332,6 +334,8 @@ static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) { int compno; +av_log(s->avctx, AV_LOG_ERROR, "Inside get_coc\n"); + if (s->buf_end - s->buf < 2) return AVERROR(EINVAL); @@ -592,7 +596,7 @@ static int decode_packets(J2kDecoderContext *s, J2kTile *tile) } /* TIER-1 routines */ -static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno) +static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; @@ -601,10 +605,13 @@ static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, in for (y = y0; y < height && y < y0+4; y++){ if ((t1->flags[y+1][x+1] & J2K_T1_SIG_NB) && !(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ -if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno))){ +vert_causal_ctx_csty_symbol = vert_causal_ctx_csty_symbol & (x == 3 && y == 3); +if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_symbol))){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); - -t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; +if (bpass_csty_symbol) +t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; +else +t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } @@ -685,7 +692,7 @@ static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, in static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { -int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; +int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); @@ -697,14 +704,26 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; +//av_log(s->avctx, AV_LOG_ERROR,"decode_cblk passno: %d, bpno: %d\n", passno, bpno); + +bpass_csty_symbols = J2K_CBLK_BYPASS & codsty->cblk_style; +vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style; + while(passno--){ switch(pass_t){ -case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); +case 0: decode_sigpass(t1, width, height, bpno+1, bandpos, bpass_csty_symbols & (clnpass_cnt > 4), vert_causal_ctx_csty_symbol); break; -case 1: decode_refpass(t1, width, height, bpno+1); +case 1: +if (clnpass_cnt > 4) +ff_mqc_initdec(&t1->mqc, cblk->data); +decode_refpass(t1, width, height, bpno+1); break; -case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos, +case 2: +if (clnpass_cnt > 4) +ff_mqc_initdec(&t1->mqc, cblk->data); +decode_clnpass(s, t1, width, height, bpno+1, bandpos, codsty->cblk_style & J2K_CBLK_SEGSYM);
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Tue, Apr 19, 2011 at 2:59 PM, Nicolas George < nicolas.geo...@normalesup.org> wrote: > I suggest you produce your patch using the revision control tool (svn or > git), and attach it as a file to avoid its mangling. > > Hi Ronald and Nicolas, Thanks for your suggestion. Now I have used git diff for creating my patch. Also, I have modified the code for cblk_csty "Vertical stripe causal context formation" along with "Selective arithmetic coding bypass" code block style. Please, have a look at my patch: diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 0f8864d..e000df0 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -303,6 +303,8 @@ 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); @@ -332,6 +334,8 @@ static int get_coc(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) { int compno; +av_log(s->avctx, AV_LOG_ERROR, "Inside get_coc\n"); + if (s->buf_end - s->buf < 2) return AVERROR(EINVAL); @@ -592,7 +596,7 @@ static int decode_packets(J2kDecoderContext *s, J2kTile *tile) } /* TIER-1 routines */ -static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno) +static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y; @@ -601,10 +605,12 @@ static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, in for (y = y0; y < height && y < y0+4; y++){ if ((t1->flags[y+1][x+1] & J2K_T1_SIG_NB) && !(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))){ -if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno))){ +if (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno, vert_causal_ctx_csty_symbol))){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); - -t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; +if (bpass_csty_symbol) +t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; +else +t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } @@ -685,7 +691,7 @@ static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, in static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { -int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; +int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); @@ -697,14 +703,26 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; +//av_log(s->avctx, AV_LOG_ERROR,"decode_cblk passno: %d, bpno: %d\n", passno, bpno); + +bpass_csty_symbols = J2K_CBLK_BYPASS & codsty->cblk_style; +vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style; + while(passno--){ switch(pass_t){ -case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); +case 0: decode_sigpass(t1, width, height, bpno+1, bandpos, bpass_csty_symbols & (clnpass_cnt > 4)); break; -case 1: decode_refpass(t1, width, height, bpno+1); +case 1: +if (clnpass_cnt > 4) +ff_mqc_initdec(&t1->mqc, cblk->data); +decode_refpass(t1, width, height, bpno+1); break; -case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos, +case 2: +if (clnpass_cnt > 4) +ff_mqc_initdec(&t1->mqc, cblk->data); +decode_clnpass(s, t1, width, height, bpno+1, bandpos, codsty->cblk_style & J2K_CBLK_SEGSYM); +clnpass_cnt = clnpass_cnt + 1; break; } @@ -899,6 +917,7 @@ static int decode_codestream(J2kDecoderContext *s) oldbuf = s->buf; if (marker == J2K_SOD){ +av_log(s->avctx, AV_LOG_ERROR, "Inside J2K_SOD\n"); J2kTile *tile = s->tile + s->curtileno; if (ret = init_tile(s, s->curtileno)) return ret; The pages 115-118 from the spec have illustrated these ideas. Other code block
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
Hi Rukhsana, On Tue, Apr 19, 2011 at 5:55 PM, rukhsana afroz wrote: > The following is the patch for selective arithmetic coding bypass cblk_csty: > > 595c595 > < static void decode_sigpass(J2kT1Context *t1, int width, int height, int > bpno, int bandno) > --- >> static void decode_sigpass(J2kT1Context *t1, int width, int height, int >> bpno, int bandno, int bpass_csty_symbol) Please provide a unified diff (diff -u) or, better yet, a git diff / git format-patch styled diff. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 13, 2011 at 1:46 PM, Michael Niedermayer wrote: > > i dont see a specific question in your mail, my suggestion is just to > implement the missing feature. > If you have specific questions ill try my best to help > Hi Michael, The following is the patch for selective arithmetic coding bypass cblk_csty: 595c595 < static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno) --- > static void decode_sigpass(J2kT1Context *t1, int width, int height, int bpno, int bandno, int bpass_csty_symbol) 606,607c606,609 < < t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; --- > if (bpass_csty_symbol) > t1->data[y][x] = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ? -mask : mask; > else > t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; 688c690 < int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; --- > int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0; 699a702,704 > bpass_csty_symbols = J2K_CBLK_BYPASS & codsty->cblk_style; > > 702c707 < case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); --- > case 0: decode_sigpass(t1, width, height, bpno+1, bandpos, bpass_csty_symbols & (clnpass_cnt > 4)); 704c709,712 < case 1: decode_refpass(t1, width, height, bpno+1); --- > case 1: > if (clnpass_cnt > 4) > ff_mqc_initdec(&t1->mqc, cblk->data); > decode_refpass(t1, width, height, bpno+1); 706c714,717 < case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos, --- > case 2: > if (clnpass_cnt > 4) > ff_mqc_initdec(&t1->mqc, cblk->data); > decode_clnpass(s, t1, width, height, bpno+1, bandpos, 707a719 > clnpass_cnt = clnpass_cnt + 1; Pages 115 -117 from the spec have illustrated this implementation. Please let me know if you have any suggestion. Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Fri, Apr 15, 2011 at 5:13 PM, rukhsana afroz wrote: > > > Hi Michael, > > I am in little bit problem of understanding the spec for implementing clean > pass operation on a particular code block with different cblk_style. Page > number of these implementations in spec is 112-119. Could you please have a > look at the spec to help me on this? I appreciate your help. Hi Michael, I still could not implement the part of code block decode for different cblk_style. However, I believe, I understand the spec now better than before. I have one question regarding cblk_style J2K_CBLK_SEGSYM. It has been implemneted in the code. The spec explanation about this is below: * D.5 Error resilience segmentation symbol * A segmentation symbol is a special symbol. Whether it is used is signalled in the COD or COC marker segments (AnnexA.6.1 and Annex A.6.2). The symbol is coded with the UNIFORM context of the arithmetic coder at the end of each bitplane.The correct decoding of this symbol confirms the correctness of the decoding of this bit-plane, which allows error detection. At the decoder, a segmentation symbol “1010” or “0xA” should be decoded at the end of each bit-plane. If the segmentation symbol is not decoded correctly, then bit errors occurred for this bit-plane. And the implemented code is below: static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); for (y = 0; y < height; y++) memset(t1->data[y], 0, width*sizeof(int)); ff_mqc_initdec(&t1->mqc, cblk->data); cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; while(passno--){ switch(pass_t){ case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); break; case 1: decode_refpass(t1, width, height, bpno+1); break; *case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos, codsty->cblk_style & J2K_CBLK_SEGSYM); break; *} pass_t++; if (pass_t == 3){ bpno--; pass_t = 0; } } return 0; } static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols) { int mask = 3 << (bpno - 1), y0, x, y, runlen, dec; for (y0 = 0; y0 < height; y0 += 4) { for (x = 0; x < width; x++){ if (y0 + 3 < height && !( (t1->flags[y0+1][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+2][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+3][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+4][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG{ if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL)) continue; runlen = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); dec = 1; } else{ runlen = 0; dec = 0; } for (y = y0 + runlen; y < y0 + 4 && y < height; y++){ if (!dec){ if (!(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))) dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno)); } if (dec){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } dec = 0; t1->flags[y+1][x+1] &= ~J2K_T1_VIS; } } } * if (seg_symbols) { int val; val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); if (val != 0xa) { av_log(s->avctx, AV_LOG_ERROR,"Segmentation symbol value incorrect\n"); } } *} Could you please let me know how the implemented code match with the spec. I have made the code bold for this code block style. I am wondering everytime why "val" is left shifted after decoding each co-efficient in the bit-plane. Please help me on this. I need to understand this first before implementing th
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 13, 2011 at 1:46 PM, Michael Niedermayer wrote: > > i dont see a specific question in your mail, my suggestion is just to > implement the missing feature. > If you have specific questions ill try my best to help > > and sorry for my slow reply > > Hi Michael, I am in little bit problem of understanding the spec for implementing clean pass operation on a particular code block with different cblk_style. Page number of these implementations in spec is 112-119. Could you please have a look at the spec to help me on this? I appreciate your help. Thanks Ruby -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 6, 2011 at 6:35 PM, rukhsana afroz wrote: > > > On Wed, Apr 6, 2011 at 9:24 AM, Michael Niedermayer wrote: > >> I suspect the If statement is there as the implementation only supports >> cblk_style==0 >> the others simply are not implemented >> >> Do you think you can implement them? >> >> Thanks Michael for your reply. I read the specification once. I believe, I > will be able to implement existing missing features of decoder. Later on, I > can work on encoder once I know the JPEG 2000 coding standard thoroughly. I > will submit my SoC application tonight, or tomorrow morning. > > Thanks > Ruby > > I have found what to do for particularly this missing feature. It looks like, parameters have been defined for all values of cblk_style in j2k.h file. // Codeblock coding styles #define J2K_CBLK_BYPASS0x01 // Selective arithmetic coding bypass #define J2K_CBLK_RESET 0x02 // Reset context probabilities #define J2K_CBLK_TERMALL 0x04 // Terminate after each coding pass #define J2K_CBLK_VSC 0x08 // Vertical stripe causal context formation #define J2K_CBLK_PREDTERM 0x10 // Predictable termination #define J2K_CBLK_SEGSYM0x20 // Segmentation symbols present Specification also says, these are the at most number of code block styles. These cblk_style is used while decoding the a particular code block (which is resided inside one band, one component-tile contains a number of bands, one tile is subdivided again into a number of component-tiles, entire codestream consists of a number of tiles). From the code, i see only the code block style J2K_CBLK_SEGSYM has been implemented. When code block style is zero, no action has been taken and it is default. Logic for this implementation is in the function decode_cblk and then from there main logic is in decode_clnpass function. static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk, int width, int height, int bandpos) { int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); for (y = 0; y < height; y++) memset(t1->data[y], 0, width*sizeof(int)); ff_mqc_initdec(&t1->mqc, cblk->data); cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; while(passno--){ switch(pass_t){ case 0: decode_sigpass(t1, width, height, bpno+1, bandpos); break; case 1: decode_refpass(t1, width, height, bpno+1); break; * case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos, codsty->cblk_style & J2K_CBLK_SEGSYM);* break; } pass_t++; if (pass_t == 3){ bpno--; pass_t = 0; } } return 0; } static void decode_clnpass(J2kDecoderContext *s, J2kT1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols) { int mask = 3 << (bpno - 1), y0, x, y, runlen, dec; for (y0 = 0; y0 < height; y0 += 4) { for (x = 0; x < width; x++){ if (y0 + 3 < height && !( (t1->flags[y0+1][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+2][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+3][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG)) || (t1->flags[y0+4][x+1] & (J2K_T1_SIG_NB | J2K_T1_VIS | J2K_T1_SIG{ if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL)) continue; runlen = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); dec = 1; } else{ runlen = 0; dec = 0; } for (y = y0 + runlen; y < y0 + 4 && y < height; y++){ if (!dec){ if (!(t1->flags[y+1][x+1] & (J2K_T1_SIG | J2K_T1_VIS))) dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_j2k_getnbctxno(t1->flags[y+1][x+1], bandno)); } if (dec){ int xorbit, ctxno = ff_j2k_getsgnctxno(t1->flags[y+1][x+1], &xorbit); t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_j2k_set_significant(t1, x, y, t1->data[y][x] < 0); } dec = 0; t1->flags[y+1][x+1] &= ~J2K_T1_VIS; } } } * if (seg_symbols) { int val; val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (v
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 6, 2011 at 9:24 AM, Michael Niedermayer wrote: > > I suspect the If statement is there as the implementation only supports > cblk_style==0 > the others simply are not implemented > > Do you think you can implement them? > > > Hi all, I have submitted my proposal on GSoC this year. And Michael, I believe, I shall be able to implement the missing features of the current decoder/encoder. Particularly for this missing feature, I will get back to you soon about the way I will implement this missing feature. Thanks Ruby -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Wed, Apr 6, 2011 at 9:24 AM, Michael Niedermayer wrote: > I suspect the If statement is there as the implementation only supports > cblk_style==0 > the others simply are not implemented > > Do you think you can implement them? > > Hi all, I have submitted my proposal on GSoC this year. And Michael, I believe, I shall be able to implement the missing features of the current decoder/encoder. Particularly for this missing feature, I will get back to you soon about the way I will implement this missing feature. Thanks Ruby -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)
On Tue, Apr 5, 2011 at 11:28 AM, Michael Niedermayer wrote: > > This results in > J2K_SIZ = 0xff51 > J2K_COD = 0xff52 > J2K_COC = 0xff53 > Thanks Michael, I understood that, it was my mistake. While processing 0xff52 (J2K_SOD) marker, the current decoder fails in the following code segment. /** 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; } /** 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; } In the get_cox function, the decoder shows the error "no extra cblk style supported". But, I am wondering, why this IF statement. The specification (page-45) says, there could be one byte in this position Code-block style 8 Table A-17 Style of the code-block coding passes (8 means size of this field in bits, Table A-17 is for the meaning of this parameter) I cannot print the entire table here. /* if (c->cblk_style != 0){ // cblk style av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n"); return -1; }*/ However, if I comment this IF block, I can get rid of this problem. However, I get errors while processing other subsequent markers [j2k @ 0xab98210] unsupported marker 0xA17D at pos 0x145 [j2k @ 0xab98210] unsupported marker 0xEFC8 at pos 0xbfa [j2k @ 0xab98210] Missing EOC [j2k @ 0xab98210] Segmentation symbol value incorrect These errors only occur while decoding the files in codestrem_profile0 folder, not other files in testfiles_jp2folder. I am also looking how these markers have been processed. Thanks -- Rukhsana Ruby Phd Student Department of Electrical & Computer Engineering The University of British Columbia ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel