| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 817 人关注过本帖
标题:(求高手帮写下每句话的注释----急需!!)谢谢啦
只看楼主 加入收藏
张镜亦
Rank: 1
来 自:陕西咸阳
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-4-21
收藏
 问题点数:0 回复次数:0 
(求高手帮写下每句话的注释----急需!!)谢谢啦
function [Bin_DecSeq] = BinDec_(fname)   
%
% Written by Mustafa Sakalli
% msakalli@cipr.rpi.edu
% read BenEnc_ for header information.. R allocates 4 bits more for higher byte resolution
fid = fopen(fname,'r');   
if (fid== -1)
    txt = sprintf('Cannot open image file %s in the current directory.', fname);
    disp(txt);
    return;
end

txt = sprintf('Reading binary file, %s', fname);
[X L]= fread(fid, 'uint32');
fseek(fid, -(ftell(fid)-L*4), 1);
[X_ L_]= fread(fid, 'uint8');
fclose(fid);

SQ = bitand(X(1), 1); ifsq = SQ*12; SQ_ = ~SQ; R_ =0;

Bin_DecSeq = repmat(0, bitshift(L, 5)+ifsq+4+bitshift(L_, 3), 1);

Bin_DecSeq(1) = bitand(bitshift(X(1), -1), 4095); %sz
Bin_DecSeq(2) = bitand(bitshift(X(1), -ifsq-1), 4095); %sz
Bin_DecSeq(3) = bitand(bitshift(X(1), -13-ifsq), 15); %wlev
Bin_DecSeq(4) = bitand(bitshift(X(1), -17-ifsq), 7); %thr
if ~(Bin_DecSeq(4)),
    if (ifsq),
        Bin_DecSeq(4) = bitand(X(2), 15)+8;
        Bin_DecSeq(5:32) = bitget(X(2), [5:32]);
        R_= -28; j = 3;        
    else
        R_ =4; j =2;        
        Bin_DecSeq(4) = bitand(bitshift(X(1), -20), 15)+8;
        Bin_DecSeq(5:12) = bitget(X(1), [25:32]); %16-ifsq-R_, 21+R_+ifsq
    end;
else
   Bin_DecSeq(5:16-ifsq) = bitget(X(1), [21+ifsq:32]);
   j = 2;
end;
if (Bin_DecSeq(4)==15), Bin_DecSeq(4) =0; end; %Thr

a1_32 = 1:32; J = 16+[1:32]-(ifsq+R_);
for i = j:L,
    Bin_DecSeq(J) = bitget(X(i), a1_32);
    J = J+32;
end

l_ = J(1);
J = J(1:8);
for i = 1:L_,
    Bin_DecSeq(J) = bitget(X_(i), 1:8);
    l = max(J(Bin_DecSeq(J)>0));
    if l, l_ = l; end;
    J = J+8;
end
Bin_DecSeq(l_+1:end) = [];
return
搜索更多相关主题的帖子: 注释 fid fname txt 
2008-04-21 13:24
快速回复:(求高手帮写下每句话的注释----急需!!)谢谢啦
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038275 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved