[libav-devel] rukhsana.af...@gmail.com has indicated you're a friend. Accept?

2013-12-10 Thread rukhsana . afroz
Hi,

rukhsana.af...@gmail.com wants to follow you.

** Is rukhsana.af...@gmail.com you friend? **
If Yes please follow the link below:
http://invites.fliporamailer.com/signup_e.html?fullname=Libav-devel&email=libav-devel@libav.org&invitername=Rukhsana&inviterid=23124967&userid=0&token=0&emailmasterid=0f02922d-cc2a-4e49-b9b9-f90513a7911b&from=rukhsana.af...@gmail.com&uie=8&src=txt_yes

If No please follow the link below:
http://invites.fliporamailer.com/signup_e_no.html?fullname=Libav-devel&email=libav-devel@libav.org&invitername=Rukhsana&inviterid=23124967&userid=0&token=0&emailmasterid=0f02922d-cc2a-4e49-b9b9-f90513a7911b&from=rukhsana.af...@gmail.com&uie=8&src=txt_no


Follow the link below to remove yourself from all such emails
http://invites.fliporamailer.com/uns.jsp?email=libav-devel@libav.org&iid=0f02922d-cc2a-4e49-b9b9-f90513a7911b&from=rukhsana.af...@gmail.com


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [FFmpeg-devel] JPEG2000 decoder

2011-06-03 Thread rukhsana afroz
Hi Michael,

On Wed, Jun 1, 2011 at 3:42 AM, rukhsana afroz wrote:

> Hi Michael,
>
>> maybe jaspers and ours advance the pointer at a slightly different
>> spot in the implementation
>>
>>
> As per the discussion on IRC chat, I checked where s->bit_index gets
> modified. I see, in our decoder that s->bit_index has been manually set to 8
> at the beginning of decoding packet. whereas, in jasper, I did not see this.
> Also, jasper always reads the entire byte to check present bit even for
> other files, like file1.jp2 etc. Whereas, our decoder does not do so. I need
> your suggestion on this as i do not find any clue in the doc for this. I am
> waiting for you on the IRC chat.
>
>
>
>
>
I have rebased the codebase against ffmpeg and also decode_packet function
works properly comparing with jasper. However, it gets segmentation fault
somewhere in decode_cblk function for adding new code. Tomorrow I will be in
chat to discuss this code. My new code rebased with ffmpeg is in:

https://github.com/rukhsana/ffmpeg_j2k

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] JPEG2000 decoder

2011-06-01 Thread rukhsana afroz
Hi Michael,

On Mon, May 30, 2011 at 6:36 AM, Michael Niedermayer wrote:

> On Sun, May 29, 2011 at 05:49:05AM -0700, rukhsana afroz wrote:
> > Hi Michael,
> >
> > On Fri, May 27, 2011 at 7:10 AM, Michael Niedermayer  >wrote:
> >
> > > On Fri, May 27, 2011 at 04:28:29AM -0700, rukhsana afroz wrote:
> > > > Hi Michael,
> > > >
> > > > On Tue, May 24, 2011 at 1:10 AM, rukhsana afroz <
> > > rukhsana.af...@gmail.com>wrote:
> > > >
> > > > > Hi Michael,
> > > > >
> > > > > On Fri, May 20, 2011 at 10:49 PM, rukhsana afroz <
> > > rukhsana.af...@gmail.com
> > > > > > wrote:
> > > > >
> > > > >> Hi Michael,
> > > > >>
> > > > >>
> > > > >> On Thu, May 19, 2011 at 3:38 PM, rukhsana afroz <
> > > rukhsana.af...@gmail.com
> > > > >> > wrote:
> > > > >>
> > > > >>>
> > > > >>>
> > > > >>> On Thu, May 19, 2011 at 3:32 PM, rukhsana afroz <
> > > > >>> rukhsana.af...@gmail.com> wrote:
> > > > >>>
> > > > >>>> Hi Michael,
> > > > >>>>
> > > > >>>>
> > > > >>>> On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer <
> > > michae...@gmx.at>wrote:
> > > > >>>>
> > > > >>>>>
> > > > >>>>> We will have to implement multiple codeword segments.
> > > > >>>>>
> > > > >>>>> Also sofar, good work!
> > > > >>>>>
> > > > >>>>>
> > > > >>>> Sorry for the late reply. If I implement codeblock segment, its
> > > going to
> > > > >>>> affect from packet decoding process to the subsequent deoding
> > > process till
> > > > >>>> the last. Therefore, I have to be properly planned in order to
> > > accomplish
> > > > >>>> these changes. Here, I have put patch for incorporating multiple
> > > codeblock
> > > > >>>> segment. I had to create two more structures and modify J2KCblk
> > > sturucture
> > > > >>>> as well. This patch is just for the modification/creation on the
> > > structures.
> > > > >>>> I am also writing some miscellaneous function and I will post
> those
> > > in my
> > > > >>>> subsequent emails.
> > > > >>>>
> > > > >>>
> > > > >> I have modified the decode_packet function incorporating multiple
> > > codeword
> > > > >> segment. Here, I have attached the patch for the required changes.
> I
> > > have
> > > > >> taken the help from jasper code while writing this code, because
> only
> > > the
> > > > >> document is not sufficient to incorporate these changes. I have
> not
> > > tested
> > > > >> this code yet. Once, I test it, I also let you know. If you have
> any
> > > > >> suggestion on this patch, please let me know.
> > > > >>
> > > > >>
> > > > >>
> > > > >
> > > > > While doing arithmetic coding operation in decode_cblk function one
> > > > > term/variable is "bpno". Coding operation (decode_sigpass,
> > > decode_refpass,
> > > > > decode_clpass) uses this variable to determine the data of each
> > > codeblock in
> > > > > different contexts. This variable has been set in our decoder:
> > > > >
> > > > >
> > > > > bpno = cblk->nonzerobits - 1
> > > > >
> > > > > And, jasper has set this variable as follows:
> > > > >
> > > > > bpno = band->roishift + band->numbps - 1 - (cblk->numimsbs +
> > > (seg->passno +
> > > > > i - cblk->firstpassno + 2) / 3);
> > > > >
> > > > > band->roishift is the value got from processing the RGN marker and
> > > > > band->numbps is also the value got from some other marker. Our
> decoder
> > > has
> > > > > not processed this marker.  cblk->numimsbs is similar to our
> decoder's
> > > > > cblk->nonzerobits. Other part of thi

Re: [libav-devel] [FFmpeg-devel] JPEG2000 decoder

2011-05-27 Thread rukhsana afroz
On Fri, May 27, 2011 at 4:28 AM, rukhsana afroz wrote:

> Hi Michael,
>
>
> Here, I have attached two patches which cove all changes due to multiple
> codeblock segment. I have tested decode_packet function, but not decode_cblk
> yet.
>
>
> Thanks
>
> -
>

Also, I have removed linked list from the implementation.


-- 
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] JPEG2000 decoder

2011-05-27 Thread rukhsana afroz
Hi Michael,

On Tue, May 24, 2011 at 1:10 AM, rukhsana afroz wrote:

> Hi Michael,
>
> On Fri, May 20, 2011 at 10:49 PM, rukhsana afroz  > wrote:
>
>> Hi Michael,
>>
>>
>> On Thu, May 19, 2011 at 3:38 PM, rukhsana afroz > > wrote:
>>
>>>
>>>
>>> On Thu, May 19, 2011 at 3:32 PM, rukhsana afroz <
>>> rukhsana.af...@gmail.com> wrote:
>>>
>>>> Hi Michael,
>>>>
>>>>
>>>> On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer 
>>>> wrote:
>>>>
>>>>>
>>>>> We will have to implement multiple codeword segments.
>>>>>
>>>>> Also sofar, good work!
>>>>>
>>>>>
>>>> Sorry for the late reply. If I implement codeblock segment, its going to
>>>> affect from packet decoding process to the subsequent deoding process till
>>>> the last. Therefore, I have to be properly planned in order to accomplish
>>>> these changes. Here, I have put patch for incorporating multiple codeblock
>>>> segment. I had to create two more structures and modify J2KCblk sturucture
>>>> as well. This patch is just for the modification/creation on the 
>>>> structures.
>>>> I am also writing some miscellaneous function and I will post those in my
>>>> subsequent emails.
>>>>
>>>
>> I have modified the decode_packet function incorporating multiple codeword
>> segment. Here, I have attached the patch for the required changes. I have
>> taken the help from jasper code while writing this code, because only the
>> document is not sufficient to incorporate these changes. I have not tested
>> this code yet. Once, I test it, I also let you know. If you have any
>> suggestion on this patch, please let me know.
>>
>>
>>
>
> While doing arithmetic coding operation in decode_cblk function one
> term/variable is "bpno". Coding operation (decode_sigpass, decode_refpass,
> decode_clpass) uses this variable to determine the data of each codeblock in
> different contexts. This variable has been set in our decoder:
>
>
> bpno = cblk->nonzerobits - 1
>
> And, jasper has set this variable as follows:
>
> bpno = band->roishift + band->numbps - 1 - (cblk->numimsbs + (seg->passno +
> i - cblk->firstpassno + 2) / 3);
>
> band->roishift is the value got from processing the RGN marker and
> band->numbps is also the value got from some other marker. Our decoder has
> not processed this marker.  cblk->numimsbs is similar to our decoder's
> cblk->nonzerobits. Other part of this variable is segment specific and that
> makes sense. I need you suggestion on how to set this variable. I will
> explain more tomorrow on IRC chat.
>
>
>
Here, I have attached two patches which cove all changes due to multiple
codeblock segment. I have tested decode_packet function, but not decode_cblk
yet.

Thanks

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

diff --git a/libavcodec/j2k.h b/libavcodec/j2k.h
index 76ef03a..a8e5221 100644
--- a/libavcodec/j2k.h
+++ b/libavcodec/j2k.h
@@ -100,12 +100,6 @@ enum J2kQuantsty{ ///< quantization style
 #define J2K_CSTY_SOP   0x02 // SOP marker present
 #define J2K_CSTY_EPH   0x04 // EPH marker present
 
-/* Tier-1 coding pass types. */
-#define	J2K_SIGPASS	0	/* significance */
-#define	J2K_REFPASS	1	/* refinement */
-#define	J2K_CLNPASS	2	/* cleanup */
-
-
 typedef struct {
 int data[J2K_MAX_CBLKW][J2K_MAX_CBLKH];
 int flags[J2K_MAX_CBLKW+2][J2K_MAX_CBLKH+2];
@@ -144,14 +138,6 @@ typedef struct {
 } J2kPass;
 
 typedef struct {
-unint16_t index;
-uint8_t npasses;
-uint8_t maxpasses;
-uint8_t firstpassno;
-uint8_t passno;
-} J2kCblkSeg;
-
-typedef struct {
 uint8_t npasses;
 uint8_t ninclpasses; ///< number coding of passes included in codestream
 uint8_t nonzerobits;
@@ -160,8 +146,7 @@ typedef struct {
 uint8_t lblock;
 uint8_t zero;
 uint8_t data[8192];
-J2kCblkSeg segs[50];
-  //J2kPass passes[100];
+J2kPass passes[100];
 } J2kCblk; ///< code block
 
 typedef struct {
diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c
index d729d45..b8d69df 100644
--- a/libavcodec/j2kdec.c
+++ b/libavcodec/j2kdec.c
@@ -322,9 +322,7 @@ static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)
 get_cox(s, &tmp);
 for (compno = 0; compno < s->ncomponents; compno++){
 if (!(properties[compno] & HAD_COC))
-	{
-	   memcpy(c + compno, &tmp, sizeof(J2kCodingStyle));
-}
+memcpy

Re: [libav-devel] [FFmpeg-devel] JPEG2000 decoder

2011-05-24 Thread rukhsana afroz
Hi Michael,

On Fri, May 20, 2011 at 10:49 PM, rukhsana afroz
wrote:

> Hi Michael,
>
>
> On Thu, May 19, 2011 at 3:38 PM, rukhsana afroz 
> wrote:
>
>>
>>
>> On Thu, May 19, 2011 at 3:32 PM, rukhsana afroz > > wrote:
>>
>>> Hi Michael,
>>>
>>>
>>> On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer 
>>> wrote:
>>>
>>>>
>>>> We will have to implement multiple codeword segments.
>>>>
>>>> Also sofar, good work!
>>>>
>>>>
>>> Sorry for the late reply. If I implement codeblock segment, its going to
>>> affect from packet decoding process to the subsequent deoding process till
>>> the last. Therefore, I have to be properly planned in order to accomplish
>>> these changes. Here, I have put patch for incorporating multiple codeblock
>>> segment. I had to create two more structures and modify J2KCblk sturucture
>>> as well. This patch is just for the modification/creation on the structures.
>>> I am also writing some miscellaneous function and I will post those in my
>>> subsequent emails.
>>>
>>
> I have modified the decode_packet function incorporating multiple codeword
> segment. Here, I have attached the patch for the required changes. I have
> taken the help from jasper code while writing this code, because only the
> document is not sufficient to incorporate these changes. I have not tested
> this code yet. Once, I test it, I also let you know. If you have any
> suggestion on this patch, please let me know.
>
>
>

While doing arithmetic coding operation in decode_cblk function one
term/variable is "bpno". Coding operation (decode_sigpass, decode_refpass,
decode_clpass) uses this variable to determine the data of each codeblock in
different contexts. This variable has been set in our decoder:


bpno = cblk->nonzerobits - 1

And, jasper has set this variable as follows:

bpno = band->roishift + band->numbps - 1 - (cblk->numimsbs + (seg->passno +
i - cblk->firstpassno + 2) / 3);

band->roishift is the value got from processing the RGN marker and
band->numbps is also the value got from some other marker. Our decoder has
not processed this marker.  cblk->numimsbs is similar to our decoder's
cblk->nonzerobits. Other part of this variable is segment specific and that
makes sense. I need you suggestion on how to set this variable. I will
explain more tomorrow on IRC chat.



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] JPEG2000 decoder

2011-05-20 Thread rukhsana afroz
Hi Michael,

On Thu, May 19, 2011 at 3:38 PM, rukhsana afroz wrote:

>
>
> On Thu, May 19, 2011 at 3:32 PM, rukhsana afroz 
> wrote:
>
>> Hi Michael,
>>
>>
>> On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer wrote:
>>
>>>
>>> We will have to implement multiple codeword segments.
>>>
>>> Also sofar, good work!
>>>
>>>
>> Sorry for the late reply. If I implement codeblock segment, its going to
>> affect from packet decoding process to the subsequent deoding process till
>> the last. Therefore, I have to be properly planned in order to accomplish
>> these changes. Here, I have put patch for incorporating multiple codeblock
>> segment. I had to create two more structures and modify J2KCblk sturucture
>> as well. This patch is just for the modification/creation on the structures.
>> I am also writing some miscellaneous function and I will post those in my
>> subsequent emails.
>>
>
I have modified the decode_packet function incorporating multiple codeword
segment. Here, I have attached the patch for the required changes. I have
taken the help from jasper code while writing this code, because only the
document is not sufficient to incorporate these changes. I have not tested
this code yet. Once, I test it, I also let you know. If you have any
suggestion on this patch, please let me know.

Thanks

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

--- libavcodec/j2k.h	2011-05-02 06:02:46.949613000 -0700
+++ ../jpeg2000/j2k.h	2011-05-20 22:08:52.401936000 -0700

@@ -100,6 +100,11 @@
 #define J2K_CSTY_SOP   0x02 // SOP marker present
 #define J2K_CSTY_EPH   0x04 // EPH marker present
 
+/* Tier-1 coding pass types. */
+#define	J2K_SIGPASS	0	/* significance */
+#define	J2K_REFPASS	1	/* refinement */
+#define	J2K_CLNPASS	2	/* cleanup */
+
 typedef struct {
 int data[J2K_MAX_CBLKW][J2K_MAX_CBLKH];
 int flags[J2K_MAX_CBLKW+2][J2K_MAX_CBLKH+2];
@@ -137,16 +142,62 @@
 int64_t disto;
 } J2kPass;
 
+
+
+typedef struct {
+	/* The next segment in the list. */
+	struct J2KCblkSeg *next;
+
+	/* The previous segment in the list. */
+	struct J2KCblkSeg *prev;
+
+	/* The starting pass number for this segment. */
+	uint8_t passno;
+
+	/* The number of passes in this segment. */
+	uint8_t numpasses;
+
+	/* The maximum number of passes in this segment. */
+	uint8_t maxpasses;
+
+	/* Data for this segment. */
+	uint8_t data[8192];
+
+	/* The number of bytes destined for this segment from the packet
+	  currently being decoded. */
+	uint8_t cnt;
+
+	/* A flag indicating if this segment has been terminated. */
+	uint8_t complete;
+
+	/* The layer number to which this segment belongs. */
+	/* If the segment spans multiple layers, then the largest layer number
+	  spanned by the segment is used. */
+	uint8_t lyrno;
+} J2KCblkSeg;
+
 typedef struct {
+	/* The first entry in the list. */
+	J2KCblkSeg *head;
+
+	/* The last entry in the list. */
+	J2KCblkSeg *tail;
+} J2KCblkSegList;
+
+typedef struct {
+/* A list of segments that still need to be decoded. */
+J2KCblkSegList segs;
+
+/* The first incomplete/partial segment. */
+J2KCblkSeg *curseg;
+
+/* The first pass number containing data for this code block. */
+uint8_t firstpassno;
 uint8_t npasses;
-uint8_t ninclpasses; ///< number coding of passes included in codestream
 uint8_t nonzerobits;
 uint16_t length;
 uint16_t lengthinc;
 uint8_t lblock;
-uint8_t zero;
-uint8_t data[8192];
-J2kPass passes[100];
 } J2kCblk; ///< code block
 
 typedef struct {

--- libavcodec/j2kdec.c	2011-05-20 21:00:31.358179000 -0700
+++ ../jpeg2000/j2kdec.c	2011-05-20 22:41:28.270844000 -0700

@@ -502,33 +490,83 @@
 return res;
 }
 
-static int decode_packet(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kResLevel *rlevel, int precno,
- int layno, uint8_t *expn, int numgbits)
+int getpasstype(int passno)
 {
-int bandno, cblkny, cblknx, cblkno, ret, marker, len;
+	int passtype;
+	switch (passno % 3) {
+	case 0:
+		passtype = J2K_CLNPASS;
+		break;
+	case 1:
+		passtype = J2K_SIGPASS;
+		break;
+	case 2:
+		passtype = J2K_REFPASS;
+		break;
+	default:
+		passtype = -1;
+		assert(0);
+		break;
+	}
+	return passtype;
+}
+
+int getsegpasscnt(int passno, int firstpassno, int numpasses, int bypass, int termall)
+{
+	int ret;
+	int passtype;
+
+	if (termall) {
+		ret = 1;
+	} else if (bypass) {
+		if (passno < firstpassno + 10) {
+			ret = 10 - (passno - firstpassno);
+		} else {
+			passtype = JPC_PASSTYPE(passno);
+			switch (passtype) {
+			case J2K_SIGPASS:
+ret = 2;
+break;
+			case J2K_REFPASS:
+ret = 1;
+break;
+			case J2K_CLNPASS:
+ret = 1;
+break;
+			default:
+ret = -1;
+assert(0);
+break;
+			}

Re: [libav-devel] [FFmpeg-devel] JPEG2000 decoder

2011-05-19 Thread rukhsana afroz
On Thu, May 19, 2011 at 3:32 PM, rukhsana afroz wrote:

> Hi Michael,
>
>
> On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer wrote:
>
>>
>> We will have to implement multiple codeword segments.
>>
>> Also sofar, good work!
>>
>>
> Sorry for the late reply. If I implement codeblock segment, its going to
> affect from packet decoding process to the subsequent deoding process till
> the last. Therefore, I have to be properly planned in order to accomplish
> these changes. Here, I have put patch for incorporating multiple codeblock
> segment. I had to create two more structures and modify J2KCblk sturucture
> as well. This patch is just for the modification/creation on the structures.
> I am also writing some miscellaneous function and I will post those in my
> subsequent emails.
>

Sorry, previous patch did not indicate the file name. Here, I have pasted it
again:

--- j2k.h2011-05-02 06:02:46.949613000 -0700
+++ /ubc/ece/home/vl/grads/rukhsana/gsoc11/jpeg2000/j2k.h2011-05-19
15:20:41.746429000 -0700

@@ -137,16 +137,62 @@
 int64_t disto;
 } J2kPass;

+
+
 typedef struct {
+/* The next segment in the list. */
+struct J2KCblkSeg *next;
+
+/* The previous segment in the list. */
+struct J2KCblkSeg *prev;
+
+/* The starting pass number for this segment. */
+uint8_t passno;
+
+/* The number of passes in this segment. */
+uint8_t numpasses;
+
+/* The maximum number of passes in this segment. */
+uint8_t maxpasses;
+
+/* Data for this segment. */
+uint8_t data[8192];
+
+/* The number of bytes destined for this segment from the packet
+  currently being decoded. */
+uint8_t cnt;
+
+/* A flag indicating if this segment has been terminated. */
+uint8_t complete;
+
+/* The layer number to which this segment belongs. */
+/* If the segment spans multiple layers, then the largest layer number
+  spanned by the segment is used. */
+uint8_t lyrno;
+} J2KCblkSeg;
+
+typedef struct {
+/* The first entry in the list. */
+J2KCblkSeg *head;
+
+/* The last entry in the list. */
+J2KCblkSeg *tail;
+} J2KCblkSegList;
+
+typedef struct {
+/* A list of segments that still need to be decoded. */
+J2KCblkSegList segs;
+
+/* The first incomplete/partial segment. */
+J2KCblkSeg *curseg;
+
+/* The first pass number containing data for this code block. */
+uint8_t firstpassno;
 uint8_t npasses;
-uint8_t ninclpasses; ///< number coding of passes included in
codestream
 uint8_t nonzerobits;
 uint16_t length;
 uint16_t lengthinc;
 uint8_t lblock;
-uint8_t zero;
-uint8_t data[8192];
-J2kPass passes[100];
 } J2kCblk; ///< code block

 typedef struct {


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] JPEG2000 decoder

2011-05-19 Thread rukhsana afroz
Hi Michael,

On Sun, May 15, 2011 at 5:00 PM, Michael Niedermayer wrote:

>
> We will have to implement multiple codeword segments.
>
> Also sofar, good work!
>
>
Sorry for the late reply. If I implement codeblock segment, its going to
affect from packet decoding process to the subsequent deoding process till
the last. Therefore, I have to be properly planned in order to accomplish
these changes. Here, I have put patch for incorporating multiple codeblock
segment. I had to create two more structures and modify J2KCblk sturucture
as well. This patch is just for the modification/creation on the structures.
I am also writing some miscellaneous function and I will post those in my
subsequent emails.

@@ -137,16 +137,62 @@
 int64_t disto;
 } J2kPass;

+
+
 typedef struct {
+/* The next segment in the list. */
+struct J2KCblkSeg *next;
+
+/* The previous segment in the list. */
+struct J2KCblkSeg *prev;
+
+/* The starting pass number for this segment. */
+uint8_t passno;
+
+/* The number of passes in this segment. */
+uint8_t numpasses;
+
+/* The maximum number of passes in this segment. */
+uint8_t maxpasses;
+
+/* Data for this segment. */
+uint8_t data[8192];
+
+/* The number of bytes destined for this segment from the packet
+  currently being decoded. */
+uint8_t cnt;
+
+/* A flag indicating if this segment has been terminated. */
+uint8_t complete;
+
+/* The layer number to which this segment belongs. */
+/* If the segment spans multiple layers, then the largest layer number
+  spanned by the segment is used. */
+uint8_t lyrno;
+} J2KCblkSeg;
+
+typedef struct {
+/* The first entry in the list. */
+J2KCblkSeg *head;
+
+/* The last entry in the list. */
+J2KCblkSeg *tail;
+} J2KCblkSegList;
+
+typedef struct {
+/* A list of segments that still need to be decoded. */
+J2KCblkSegList segs;
+
+/* The first incomplete/partial segment. */
+J2KCblkSeg *curseg;
+
+/* The first pass number containing data for this code block. */
+uint8_t firstpassno;
 uint8_t npasses;
-uint8_t ninclpasses; ///< number coding of passes included in
codestream
 uint8_t nonzerobits;
 uint16_t length;
 uint16_t lengthinc;
 uint8_t lblock;
-uint8_t zero;
-uint8_t data[8192];
-J2kPass passes[100];
 } J2kCblk; ///< code block

 typedef struct {



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


[libav-devel] [FFmpeg-devel] JPEG2000 decoder

2011-05-15 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: Sun, May 15, 2011 at 1:01 AM
Subject: Re: [FFmpeg-devel] JPEG2000 decoder
To: FFmpeg development discussions and patches 




On Sun, May 15, 2011 at 12:18 AM, rukhsana afroz
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
below:

 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.

Thanks
Ruby

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






-- 
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)

2011-04-29 Thread rukhsana afroz
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)

2011-04-28 Thread rukhsana afroz
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)

2011-04-27 Thread rukhsana afroz
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)

2011-04-24 Thread rukhsana afroz
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)

2011-04-24 Thread rukhsana afroz
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)

2011-04-24 Thread rukhsana afroz
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)

2011-04-24 Thread rukhsana afroz
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)

2011-04-23 Thread rukhsana afroz
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)

2011-04-23 Thread rukhsana afroz
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)

2011-04-22 Thread rukhsana afroz
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)

2011-04-22 Thread rukhsana afroz
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)

2011-04-22 Thread rukhsana afroz
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)

2011-04-21 Thread rukhsana afroz
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;
+

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-21 Thread rukhsana afroz
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)

2011-04-20 Thread rukhsana afroz
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)

2011-04-19 Thread rukhsana afroz
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

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-19 Thread rukhsana afroz
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, bpn

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-19 Thread rukhsana afroz
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)

2011-04-19 Thread rukhsana afroz
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)

2011-04-17 Thread rukhsana afroz
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

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-15 Thread rukhsana afroz
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)

2011-04-11 Thread rukhsana afroz
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

Re: [libav-devel] [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-07 Thread rukhsana afroz
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)

2011-04-07 Thread rukhsana afroz
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)

2011-04-05 Thread rukhsana afroz
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


[libav-devel] Fwd: Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: 2011/4/5
Subject: Re: [libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)
To: Jindřich Makovička 


  2011/4/5 Jindřich Makovička 

> On Tue, Apr 5, 2011 at 09:14, rukhsana afroz 
> wrote:
> > Thanks Compn. I got the partial of this document, not the full one. It
> > seems, in the document, for J2K_SOD the marker is 0xff52,  for J2K_COC
> > marker is 0xff53, and  for J2K_TLM marker is 0xff55. However in the code,
> > marker 0xff55 has been assigned to all J2L_TLM, J2K_SOD and J2K_COC.
>
> I am not sure if you understand the enum syntax.
>
> enum J2kMarkers{
>J2K_SOC = 0xff4f, ///< start of codestream
>J2K_SIZ = 0xff51, ///< image and tile size
>J2K_COD,  ///< coding style default
>J2K_COC,  ///< coding style component
>J2K_TLM = 0xff55, ///< packed packet headers, tile-part header
>
> means the COD, COC and TLM are set according to the specification.
>
> --
> Jindrich Makovicka
>


Thank you Jindrich. I made mistake. Thanks for the help.

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






-- 
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


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: Mon, Apr 4, 2011 at 8:41 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: FFmpeg development discussions and patches 


 On Mon, Apr 4, 2011 at 8:08 PM, compn  wrote:

> On Mon, 4 Apr 2011 19:35:12 -0700, rukhsana afroz wrote:
> >On Tue, Mar 29, 2011 at 4:56 PM, Michael Niedermayer  >wrote:
> >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?
>
> did you see this document already?
> http://www.jpeg.org/public/fcd15444-1.pdf
>
> (linked to from http://wiki.multimedia.cx/index.php?title=JPEG_2000 )
>

Thanks Compn. I got the partial of this document, not the full one. It
seems, in the document, for J2K_SOD the marker is 0xff52,  for J2K_COC
marker is 0xff53, and  for J2K_TLM marker is 0xff55. However in the code,
marker 0xff55 has been assigned to all J2L_TLM, J2K_SOD and J2K_COC.

switch(marker){
case J2K_SIZ:
ret = get_siz(s); break;
case J2K_COC:
ret = get_coc(s, codsty, properties); break;
case J2K_COD:
ret = get_cod(s, codsty, properties); break;
case J2K_QCC:
ret = get_qcc(s, len, qntsty, properties); break;
case J2K_QCD:
ret = get_qcd(s, len, qntsty, properties); break;
case J2K_SOT:
if (!(ret = get_sot(s))){
codsty = s->tile[s->curtileno].codsty;
qntsty = s->tile[s->curtileno].qntsty;
properties = s->tile[s->curtileno].properties;
}
break;
case J2K_COM:
// the comment is ignored
s->buf += len - 2; break;
default:
av_log(s->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at
pos 0x%x\n", marker, s->buf - s->buf_start - 4);
s->buf += len - 2; break;
}

I believe, these portion of code need to be corrected. All markers (J2L_SOD,
J2K_COC, J2L_TLM) need to be distinguished separately and their
corresponding functions need to be implemented. I am trying myself to solve
these bugs at this stage with less code.

Thanks

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






-- 
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


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: compn 
Date: Mon, Apr 4, 2011 at 8:08 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: ffmpeg-de...@ffmpeg.org


On Mon, 4 Apr 2011 19:35:12 -0700, rukhsana afroz wrote:
>On Tue, Mar 29, 2011 at 4:56 PM, Michael Niedermayer wrote:
>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?

did you see this document already?
http://www.jpeg.org/public/fcd15444-1.pdf

(linked to from http://wiki.multimedia.cx/index.php?title=JPEG_2000 )

-compn
 ___
ffmpeg-devel mailing list
ffmpeg-de...@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



-- 
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


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: Mon, Apr 4, 2011 at 7:51 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: FFmpeg development discussions and patches 




 On Tue, Mar 29, 2011 at 4:56 PM, Michael Niedermayer 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
>
> or try testfiles_jp2/file9.jp2
>
> I thought i remember other errors too, but couldnt find them now
>

Hi Michael,

In the current code, J2K_COD and J2K_COC have the same marker 0xff55.
J2K_COD means default coding parameters which is common for all components,
J2K_COC is component specific coding parameters. Should they have same
marker? I need the exact specification to get those bugs solved.

enum J2kMarkers{
J2K_SOC = 0xff4f, ///< start of codestream
J2K_SIZ = 0xff51, ///< image and tile size
J2K_COD,  ///< coding style default
J2K_COC,  ///< coding style component
J2K_TLM = 0xff55, ///< packed packet headers, tile-part header
J2K_PLM = 0xff57, ///< tile-part lengths
J2K_PLT,  ///< packet length, main header
J2K_QCD = 0xff5c, ///< quantization default
J2K_QCC,  ///< quantization component
J2K_RGN,  ///< region of interest
J2K_POC,  ///< progression order change
J2K_PPM,  ///< packet length, tile-part header
J2K_PPT,  ///< packed packet headers, main header
J2K_CRG = 0xff63, ///< component registration
J2K_COM,  ///< comment
J2K_SOT = 0xff90, ///< start of tile-part
J2K_SOP,  ///< start of packet
J2K_EPH,  ///< end of packet header
J2K_SOD,  ///< start of data
J2K_EOC = 0xffd9, ///< end of codestream
};

Please help me on this.



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






-- 
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


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: Mon, Apr 4, 2011 at 7:35 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: FFmpeg development discussions and patches 


 On Tue, Mar 29, 2011 at 4:56 PM, Michael Niedermayer 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






-- 
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


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: Michael Niedermayer 
Date: Tue, Mar 29, 2011 at 4:56 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: FFmpeg development discussions and patches 


On Sun, Mar 27, 2011 at 05:45:54PM -0700, rukhsana afroz wrote:
> Hi Michael,
>
> I was able to compile ffmpeg project with j2k files. Also, I was able to
> decode some j2k files with current decoder. My code is in the repository
> "g...@github.com:rukhsana/j2k.git" and the j2k files i decoded with the
> current decoder are taken from the url

If you want to work on ffmpeg for SOC then you must rebase your
changes against the official ffmpeg tree,
git://git.videolan.org/ffmpeg


> http://www.crc.ricoh.com/~gormish/jpeg2000conformance/. As a qualification
> task, you asked me before to fix some bugs in the j2kdecoder. Could you
> please tell me what exact bugs you guess in the current decoder?  With
which
> exact input file (.j2k), will i be able to catch that bug? I am trying
> myself with some more files and also investigating the decoder's code.
>
> However, if you could give me some sort of directions where to go, that
> would be great for me. I truly appreciate all of your helps.

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

or try testfiles_jp2/file9.jp2

I thought i remember other errors too, but couldnt find them now


[...]

--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk2SccgACgkQYR7HhwQLD6tFhQCeJfObUdZAsoTBZ7TJAHxuZ676
BOUAn2EhvhotJxTphi9ucBeqqXwgZw5F
=65FV
-END PGP SIGNATURE-

___
ffmpeg-devel mailing list
ffmpeg-de...@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel




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



signature.asc
Description: PGP signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] Fwd: [FFmpeg-devel] GSoC project (JPEG 2000)

2011-04-05 Thread rukhsana afroz
-- Forwarded message --
From: rukhsana afroz 
Date: Sun, Mar 27, 2011 at 5:45 PM
Subject: Re: [FFmpeg-devel] GSoC project (JPEG 2000)
To: FFmpeg development discussions and patches 


Hi Michael,

I was able to compile ffmpeg project with j2k files. Also, I was able to
decode some j2k files with current decoder. My code is in the repository
"g...@github.com:rukhsana/j2k.git" and the j2k files i decoded with the
current decoder are taken from the url
http://www.crc.ricoh.com/~gormish/jpeg2000conformance/. As a qualification
task, you asked me before to fix some bugs in the j2kdecoder. Could you
please tell me what exact bugs you guess in the current decoder?  With which
exact input file (.j2k), will i be able to catch that bug? I am trying
myself with some more files and also investigating the decoder's code.

However, if you could give me some sort of directions where to go, that
would be great for me. I truly appreciate all of your helps.

Thanks
Ruby




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






-- 
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