Sign in

username or email:

password:



Not a member?
Forgot your password?

Search code



Search tips


See Also

Embedded SystemsFPGA

DSP Code Sharing > A-Law Compression - non uniform Quantization

A-Law Compression - non uniform Quantization

Language: Scilab

Processor: Not Relevant

Submitted by Senthilkumar R on Mar 24 2011

Licensed under a Creative Commons Attribution 3.0 Unported License

A-Law Compression - non uniform Quantization


 

This program is used to perform A-Law Compression

 
function [Cx,Xmax] =  Alaw(x,A)
  //Non-linear Quantization
  //A-law: A-law nonlinear quantization
  //x = input vector
  //Cx = A-law compressor output
  //Xmax = maximum of input vector x
  Xmax  = max(abs(x));
  for i = 1:length(x)
    if(x(i)/Xmax < = 1/A)
       Cx(i) = A*abs(x(i)/Xmax)./(1+log(A));
    elseif(x(i)/Xmax > 1/A)
      Cx(i) = (1+log(A*abs(x(i)/Xmax)))./(1+log(A));
    end
  end
  Cx = Cx/Xmax; //normalization of output vector
  Cx = Cx';
endfunction
 
Rate this code snippet:
0
Rating: 0 | Votes: 0
 
   
 
posted by Senthilkumar R



Comments


No comments yet for this code


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )