資源簡介
matlab 算術編碼的實現(編解碼)
有編解碼的舉例。內容詳細。由國外的 Karl Skretting編寫

代碼片段和文件信息
function?varargout?=?Arith06(xC)
%?Arith06?????Arithmetic?encoder?or?decoder?
%?Vectors?of?integers?are?arithmetic?encoded?
%?these?vectors?are?collected?in?a?cell?array?xC.
%?If?first?argument?is?a?cell?array?the?function?do?encoding
%?else?decoding?is?done.
%
%?[y?Res]?=?Arith06(xC);????????????????????%?encoding
%?y?=?Arith06(xC);???????????????????????????%?encoding
%?xC?=?Arith06(y);???????????????????????????%?decoding
%?------------------------------------------------------------------
%?Arguments:
%??y????????a?column?vector?of?non-negative?integers?(bytes)?representing?
%???????????the?code?0?<=?y(i)?<=?255.?
%??Res??????a?matrix?that?sum?up?the?results?size?is?(NumOfX+1)x4
%???????????one?line?for?each?of?the?input?sequences?the?columns?are
%???????????Res(:1)?-?number?of?elements?in?the?sequence
%???????????Res(:2)?-?unused?(=0)?
%???????????Res(:3)?-?bits?needed?to?code?the?sequence
%???????????Res(:4)?-?bit?rate?for?the?sequence?Res(:3)/Res(:1)
%???????????Then?the?last?line?is?total?(which?include?bits?needed?to?store?NumOfX)
%??xC???????a?cell?array?of?column?vectors?of?integers?representing?the
%???????????symbol?sequences.?(should?not?be?to?large?integers)
%???????????If?only?one?sequence?is?to?be?coded?we?must?make?the?cell?array
%???????????like:?xC=cell(21);?xC{1}=x;?%?where?x?is?the?sequence
%?------------------------------------------------------------------
%?Note:?this?routine?is?extremely?slow?since?it?is?all?Matlab?code
%?This?function?do?recursive?encoding?like?Huff06.
%?An?alternative?(a?perhaps?better)?aritmethic?coder?is?Arith07
%?which?is?a?more?“pure“?arithmetic?coder
%?SOME?NOTES?ON?THE?FUNCTION
%?The?descrition?of?the?encoding?algorithm?is?in?
%?chapter?5?of?“The?Data?Compression?Book“?by?Mark?Nelson.?
%?The?actual?coding?algorithm?is?practical?identical?it?is?a?translation
%?from?C?code?to?MatLab?code?but?some?differences?have?been?made.
%?The?system?model?T?keep?record?of?the?symbols?that?have?been?encoded.?
%?based?on?this?table?the?probabiltity?of?each?symbol?is?estimated.?Probability?
%?for?symbol?m?is:?(T(m+1)-T(m+2))/T(1)
%?The?symbols?are?01...M?and?Escape?(M+1)?Escape?is?used?to?indicate?an?
%?unused?symbol?which?is?then?coded?by?another?table?the?Tu?table.
%?POSSIBLE?IMPROVEMENTS
%?-?better?decision?wether?to?split?a?sequence?or?not?
%?-?for?long?sequences?update?frequency?table?T=floor(T*a)??(ex:?0.2?%???and?do?this?for?every?La?samples?(ex:?100?%???We?must?not?set?any?non-zero?probabilities?to?zero?during?this?adaption!!
%?-?Display?some?information?(so?users?know?something?is?happening)
%----------------------------------------------------------------------
%?Copyright?(c)?1999-2001.??Karl?Skretting.??All?rights?reserved.
%?Hogskolen?in?Stavanger?(Stavanger?University)?Signal?Processing?Group
%?Mail:??karl.skretting@tn.his.no???Homepage:??http://www.ux.his.no/~karlsk/
%?
%?HISTORY:
%?Ver.?1.0??1
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????I.A....?????19115??2012-09-22?10:43??matlab?算術編碼及解碼的實現\Arith06.m
????I.A....?????30008??2012-09-22?10:43??matlab?算術編碼及解碼的實現\Arith07.m
?????目錄??????????0??2012-09-22?10:45??matlab?算術編碼及解碼的實現
-----------?---------??----------?-----??----
????????????????49123????????????????????3
評論
共有 條評論