Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

image normalization

Altera_Forum
Honored Contributor II
1,415 Views

Hi 

 

I am working on image image processing on cyclone II. 

if I have 8 bit data in YCbCr then  

Is it possible to normalize an image by: current pixel / 255  

 

If there is another option please suggest me, I am working on DSP Builder v6.0. 

 

Thank You
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
517 Views

/255 is rather hard work 

 

/256 is a lot easier as it is just a right bit shift by 8. In FPGA there is no need to do any bit shifting like this.
0 Kudos
Altera_Forum
Honored Contributor II
517 Views

 

--- Quote Start ---  

/255 is rather hard work 

 

/256 is a lot easier as it is just a right bit shift by 8. In FPGA there is no need to do any bit shifting like this. 

--- Quote End ---  

 

 

 

But at the same time I want data bus of the same width(before normalization and after normalization). 

Further, Is it possible to re-gain the same image on de-normalization? 

 

Thank You Tricky
0 Kudos
Altera_Forum
Honored Contributor II
517 Views

If all you are doing is /256 and want an 8 bit fractional, you actually do nothing at all. You just "pretend" you did a divide. In an FPGA there is no real bitshifting when dividing, you just append zeros depending on which way you shift. 

 

So if you had 152, and then divide by 256, then multiply by 1.5 (answer = 228), you just do this: 

 

input = 10011000 (152) 

 

1.5 = 1.1 

 

just append zeros to 1.5 (multiply by 256) 

= 110000000 

 

Do the multiply. 

 

You have 8 bits fractional and 8 bits integer. (because your source, 152 was all fractional bits) so you discard the 8 LSBs and you have your answer 

 

so you have: 

0 1 0 0 1 1 0 0 0 x 1 1 0 0 0 0 0 0 0 ------------------------------------- = 0 1 0 0 1 1 0 0 0 + 0 1 0 0 1 1 0 0 0 ------------------------------------- 0 1 1 1 0 0 1 0 0|0 0 0 0 0 0 0 0 --Integer Fraction 11100100 = 228
0 Kudos
Reply