⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jp1_get_cod.m

📁 用matlab实现的JPEG算法
💻 M
字号:
% ------------------------------------------
%  nom : 
%  [g_NL,xcb,ycb,g_wave]=jp1_get_COD(fid)
%
% ------------------------------------------

function [g_NL,xcb,ycb,g_wave]=jp1_get_COD(fid)

%marker_COD = hex2dec('FF52') ;

[Mext,count]=fread(fid,1,'uint16'); % COD

m_deb = ftell(fid) ;
[jmp,count] =fread(fid,1,'uint16'); % Lcod
jmp= double(jmp) ;


v_partition = 0 ;
v_partition = fread(fid,1,'int8'); % Scod PARITION +0 ou 1 entropie coder

% ---------- // SPcod  //-------------------------
g_NL = int16(fread(fid,1,'uint8'));		% Level decomp (8bits)
% ---------- // Progression style // -------------
% voir tableau A-15
% --- Layer progressive 					0000 0000
% --- Resolution_layer progessive		0000 0001
% --- Resolution-position progressive	0000 0010
% --- Position-component progressive	0000 0011
% --- Component-position progressive	0000 0100

style_prog = fread(fid,1,'uint8');	% Progression style (8bits)
nb_layers  = fread(fid,1,'uint16');	% number of layers  (16bits)

% ---------- // taille des blocs // -------------
% voir tableau A-16
%sprintf('debug pos before extract regualr xcb %d ',ftell(fid));
valeur = fread (fid,1,'uint8');	% xcb = 2^(valeur+2) (8bits)
xcb = 2^(valeur+2) ;
valeur = fread (fid,1,'uint8');	% ycb = 2^(valeur+2) (8bits)
ycb = 2^(valeur+2) ;
% ---------- // Code-blocks style // -------------
% voir tableau A-17
style_bloc = fread(fid,1,'uint8');	% Code-blocks context (8bits)
% --------------- // transform // -----------------
% voir tableau A-18
g_wave = int16(fread(fid,1,'uint8'));				% YTsiz (8bits)

% ----// taille des partitions de paquets // ------
% voir tableau A-19
if (v_partition~=0),
   for i=0:double(g_NL)
      Pack_size(i) = fread(fid,1,'uint8');		% Packet partition size (8bits)
   end
end

% point su la fin du segment pour le prochain ------


fseek(fid,m_deb+jmp,'bof');  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -