image thumbnail
from Yet another arithmetic coding example by Samuel Cheng
A simple arithmetic coder that I used it in class.

r=compute_range(ranges,list)
function r=compute_range(ranges,list)

r=[0,1];
for id=1:length(list)
    l=r(2)-r(1);
    r(2)=r(1)+l*ranges(list(id),2);
    r(1)=r(1)+l*ranges(list(id),1);
end

Contact us