UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer santiagordgz
Observer
5,717 Views
Registered: ‎11-01-2008

XAPP610 - DCT gives incorrect results

Jump to solution

Is there a problem with XAPP610?

 

When giving an input going from [0..63] the output is correct for the first column but incorrect for the other nonzero coefficients .

 

INPUT

 0  1  2  3  4  5  6  7
 8  9 10 11 12 13 14 15

16 17 18 19 20 21 22 23

24 25 26 27 28 29 30 31

32 33 34 35 36 37 38 39

40 41 42 43 44 45 46 47

48 49 50 51 52 53 54 55

56 57 58 59 60 61 62 63

OUTPUT in MatLab: int16(dct2(X))
 252 -18  0 -2  0 -1  0  0

-146   0  0  0  0  0  0  0

  0    0  0  0  0  0  0  0

 -15   0  0  0  0  0  0  0

  0    0  0  0  0  0  0  0

 -5    0  0  0  0  0  0  0

  0    0  0  0  0  0  0  0

 -1    0  0  0  0  0  0  0

 

OUTPUT in ISIM (viewed as signed Decimal):

 

 255 916  0 -333  0 216  0 -188

-146   0  0   0   0  0   0   0

  0    0  0   0   0  0   0   0

 -14   0  0   0   0  0   0   0

  0    0  0   0   0  0   0   0

 -5    0  0   0   0  0   0   0

  0    0  0   0   0  0   0   0

 -1    0  0   0   0  0   0   0

 

 

If somebody has a workaround or suggestions on how to interpret data correctly...any help is very much appreciated.

Message Edited by santiagordgz on 07-08-2009 11:57 AM
Message Edited by santiagordgz on 07-08-2009 12:53 PM
Tags (4)
0 Kudos
1 Solution

Accepted Solutions
Observer santiagordgz
Observer
6,212 Views
Registered: ‎11-01-2008

Re: XAPP610 - DCT gives incorrect results

Jump to solution

Fixed it!

 

I read and followed the code to understand why the 1D-DCT (z_out) was not even working and I found that the problem was that the sign

was lost when doing the ADD/SUB in pairs and storing it in add_sub*a vector.

So I fixed it by reducing in 1bit the size of the vector where the sum is stored and removing the constant "0" assigned at the MSB.

Now the sign is stored in bit8 of add_sub*a so the IF statements polling for the sign must be changed as well from add_sub*a(9) to add_sub*a(8).

 

  1. Changed add_sub*a  from std_logic_vector(9 downto 0) to std_logic_vector(8 downto 0)
  2. Change for every ocurrence:
      Seek from line 320, there are 4 ocurrences
        add_sub*a<= "0" & (xa*_reg + xa*_reg);      to        add_sub*a<= (xa*_reg + xa*_reg);
        add_sub*a<= "0" & (xa*_reg  - xa*_reg);      to        add_sub*a<= (xa*_reg - xa*_reg);

    3.  Change for every ocurrence:
           Seek from line 396, there are4 occurrences

             if(add_sub*a(9) = '0') then       to      if(add_sub2*(8) = '0') then

 

And that's it. That's a way to fix it.

 

 

Message Edited by santiagordgz on 07-09-2009 01:32 AM

View solution in original post

0 Kudos
2 Replies
Observer santiagordgz
Observer
6,213 Views
Registered: ‎11-01-2008

Re: XAPP610 - DCT gives incorrect results

Jump to solution

Fixed it!

 

I read and followed the code to understand why the 1D-DCT (z_out) was not even working and I found that the problem was that the sign

was lost when doing the ADD/SUB in pairs and storing it in add_sub*a vector.

So I fixed it by reducing in 1bit the size of the vector where the sum is stored and removing the constant "0" assigned at the MSB.

Now the sign is stored in bit8 of add_sub*a so the IF statements polling for the sign must be changed as well from add_sub*a(9) to add_sub*a(8).

 

  1. Changed add_sub*a  from std_logic_vector(9 downto 0) to std_logic_vector(8 downto 0)
  2. Change for every ocurrence:
      Seek from line 320, there are 4 ocurrences
        add_sub*a<= "0" & (xa*_reg + xa*_reg);      to        add_sub*a<= (xa*_reg + xa*_reg);
        add_sub*a<= "0" & (xa*_reg  - xa*_reg);      to        add_sub*a<= (xa*_reg - xa*_reg);

    3.  Change for every ocurrence:
           Seek from line 396, there are4 occurrences

             if(add_sub*a(9) = '0') then       to      if(add_sub2*(8) = '0') then

 

And that's it. That's a way to fix it.

 

 

Message Edited by santiagordgz on 07-09-2009 01:32 AM

View solution in original post

0 Kudos
Visitor dusan.susic
Visitor
3,871 Views
Registered: ‎02-13-2012

Re: XAPP610 - DCT gives incorrect results

Jump to solution

Do you still have this corrected code?

0 Kudos