text stringlengths 0 234 |
|---|
if some_trace then |
Put_Line( |
" Restart #" & U16'Image(nextrst) & |
" Code " & U16'Image(w) & |
" after" & Natural'Image(image.JPEG_stuff.restart_interval) & |
" macro blocks" |
); |
end if; |
if w not in 16#FFD0# .. 16#FFD7# or (w and 7) /= nextrst then |
Raise_Exception( |
error_in_image_data'Identity, |
"JPEG: expected RST (restart) marker Nb " & U16'Image(nextrst) |
); |
end if; |
nextrst:= (nextrst + 1) and 7; |
rstcount:= image.JPEG_stuff.restart_interval; |
-- Block-to-block predictor variables are reset. |
for c in Component loop |
info_B(c).dcpred:= 0; |
end loop; |
end if; |
end if; |
end loop macro_blocks_loop; |
Function Definition: procedure Dispose is new |
Function Body: Ada.Unchecked_Deallocation( HufT_table, p_HufT_table ); |
procedure Dispose is new |
Ada.Unchecked_Deallocation( Table_list, p_Table_list ); |
current: p_Table_list; |
tcount : Natural:= 0; -- just a stat. Idea: replace table_list with an array |
tot_length: Natural:= 0; |
begin |
if full_trace then |
Ada.Text_IO.Put("[HufT_Free... "); |
end if; |
while tl /= null loop |
if full_trace then |
tcount:= tcount+1; |
tot_length:= tot_length + tl.table'Length; |
end if; |
Dispose( tl.table ); -- destroy the Huffman table |
current:= tl; |
tl := tl.next; |
Dispose( current ); -- destroy the current node |
end loop; |
if full_trace then |
Ada.Text_IO.Put_Line( |
Integer'Image(tcount)& " tables, of" & |
Integer'Image(tot_length)& " tot. length]" |
); |
end if; |
end HufT_free; |
-- Build huffman table from code lengths given by array b |
procedure HufT_build ( b : Length_array; |
s : Integer; |
d, e : Length_array; |
tl : out p_Table_list; |
m : in out Integer; |
huft_incomplete : out Boolean) |
is |
b_max : constant:= 16; |
b_maxp1: constant:= b_max + 1; |
-- bit length count table |
count : array( 0 .. b_maxp1 ) of Integer:= (others=> 0); |
f : Integer; -- i repeats in table every f entries |
g : Integer; -- max. code length |
i, -- counter, current code |
j : Integer; -- counter |
kcc : Integer; -- number of bits in current code |
c_idx, v_idx: Natural; -- array indices |
current_table_ptr : p_HufT_table:= null; |
current_node_ptr : p_Table_list:= null; -- curr. node for the curr. table |
new_node_ptr : p_Table_list; -- new node for the new table |
new_entry: HufT; -- table entry for structure assignment |
u : array( 0..b_max ) of p_HufT_table; -- table stack |
n_max : constant:= 288; |
-- values in order of bit length |
v : array( 0..n_max ) of Integer:= (others=> 0); |
el_v, el_v_m_s: Integer; |
w : Natural:= 0; -- bits before this table |
offset, code_stack : array( 0..b_maxp1 ) of Integer; |
table_level : Integer:= -1; |
bits : array( Integer'(-1)..b_maxp1 ) of Integer; |
-- ^bits(table_level) = # bits in table of level table_level |
y : Integer; -- number of dummy codes added |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.