Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Quantisation problem in image compression

Status
Not open for further replies.

dll_fpga

Full Member level 3
Joined
Mar 9, 2011
Messages
185
Helped
19
Reputation
38
Reaction score
21
Trophy points
1,298
Location
kerala,India
Activity points
2,416
hello,

I'm designing a multiplier module for image compression it should give
xxxx.xxxxx
xxxx.xxxxx
ie 4.5*4.5 =8.10(result)


where 8 and 10 are decimal and fractional part.....

1) how can i view decimal numbers having fractional part in modelsim?Modelsim is showing the number as a single unit.....but i need to see decimal and fractional parts seperate...like(eg 5.12)how can this be done?

2) now i need to quantise the result.........But how many bits can i discard ?Is there any rule?or should i use matlab?(If then how)?
 

Firstly what language are you using?

Secondly, quantisation is all up to the application and how many bits you can afford to lose. You need to play around with the algorithm and see what kind of accuracy loss is acceptable. It will change from application to application.
 

Firstly what language are you using?

Secondly, quantisation is all up to the application and how many bits you can afford to lose. You need to play around with the algorithm and see what kind of accuracy loss is acceptable. It will change from application to application.


I'm using DCT for image comression....using verilog HDL
but how can i decide on the number of bits?
is it by using matlab(if yes ...then how)

eg.
suppose i have a number like 112.521234 then i can afford to lose 234 ie (112.521 is acceptable)....... ie I need only 3 numbers after the decimal point.....

How can i find it and fix the number of bits to represent 3 bits after fraction?
Can you please give the details........
 

It is up to you to decide what kind of error is acceptable. If you're moving to fixed point then you are going to get rounding/truncation errors of 1 bit, and these can compound through an algorithm.

For fixed point, you devide how many integer bits you use, with each bit representing 2^n (where n is the poision). so for example, 3.75 can be represented with 2 integer bits and 2 fractional bits as 11.11 (2^1 + 2^0 + 2^-1 + 2^-2).

So, I would recommend you first write the algorithm in matlab and decide how much error is acceptable.
 

I s there a function in matlab to quantise the fixed point number to specified bits(nummerical plus fractional part)? so that i can see and check the error?
can you give the details......

---------- Post added at 22:06 ---------- Previous post was at 22:02 ----------

It is up to you to decide what kind of error is acceptable. If you're moving to fixed point then you are going to get rounding/truncation errors of 1 bit, and these can compound through an algorithm.

For fixed point, you devide how many integer bits you use, with each bit representing 2^n (where n is the poision). so for example, 3.75 can be represented with 2 integer bits and 2 fractional bits as 11.11 (2^1 + 2^0 + 2^-1 + 2^-2).

So, I would recommend you first write the algorithm in matlab and decide how much error is acceptable.


can you explain how you said that by discarding 3 bits after decimal ,i would loose 1 bit?
 

For matlab you will need the fixed point toolbox, which, AFAIK, is an extra purchase.

can you explain how you said that by discarding 3 bits after decimal ,i would loose 1 bit?

You have to remember that fixed point is binary, so base 2, not decimal. So if you had an output that was 16 bits with 8 bits integer and 8 bits fractional, results would be correct to +- 2^-8 ( +- 0.00390625 )
 

so you are saying that

in a number say
xxx.ab

if a is discarded i loose .5
and if b is dicarded i loose .25

in total loose .75...........
i'm i correct?
 

Yes. You'll get an error of +- 1.

And remember, that if the output of this feeds something else that has an error of +- 1, then the overall error will be +- 2, and so on.
 

so you are saying that

in a number say
xxx.ab

if a is discarded i loose .5
and if b is dicarded i loose .25

in total loose .75...........
i'm i correct?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top