text stringlengths 0 234 |
|---|
Set_X_Y(2 + x*4, Y_range'Last - y*4); |
when 5 => |
Set_X_Y( x*2, Y_range'Last - 2 - y*4); |
when 6 => |
Set_X_Y(1 + x*2, Y_range'Last - y*2); |
when 7 => |
null; -- nothing to to, pixel are contiguous |
end case; |
end if; |
else |
x:= X_range'First; -- New row |
if y < y_max then |
y:= y + 1; |
curr_row:= 1-curr_row; -- swap row index for filtering |
if not interlaced then |
Feedback((y*100)/image.height); |
end if; |
elsif interlaced then -- last row has beed displayed |
while pass < 7 loop |
pass:= pass + 1; |
y:= 0; |
case pass is |
when 1 => |
null; |
when 2 => |
xm:= (image.width+3)/8 - 1; |
ym:= (image.height+7)/8 - 1; |
when 3 => |
xm:= (image.width+3)/4 - 1; |
ym:= (image.height+3)/8 - 1; |
when 4 => |
xm:= (image.width+1)/4 - 1; |
ym:= (image.height+3)/4 - 1; |
when 5 => |
xm:= (image.width+1)/2 - 1; |
ym:= (image.height+1)/4 - 1; |
when 6 => |
xm:= (image.width )/2 - 1; |
ym:= (image.height+1)/2 - 1; |
when 7 => |
xm:= image.width - 1; |
ym:= image.height/2 - 1; |
end case; |
if xm >=0 and xm <= X_range'Last and ym in Y_range then |
-- This pass is not empty (otherwise, we will continue |
-- to the next one, if any). |
x_max:= xm; |
y_max:= ym; |
exit; |
end if; |
end loop; |
end if; |
end if; |
end Inc_XY; |
uf: Byte_array(0..15); -- unfiltered bytes for a pixel |
w1, w2: U16; |
i: Integer; |
begin |
if some_trace then |
Ada.Text_IO.Put("[UO]"); |
end if; |
-- Depending on the row size, bpp, etc., we can have |
-- several rows, or less than one, being displayed |
-- with the present uncompressed data batch. |
-- |
i:= data'First; |
if i > data'Last then |
reject:= 0; |
return; -- data is empty, do nothing |
end if; |
-- |
-- Main loop over data |
-- |
loop |
if x = X_range'First then -- pseudo-column for filter method |
exit when i > data'Last; |
begin |
current_filter:= Filter_method_0'Val(data(i)); |
if some_trace then |
filter_stat(current_filter):= filter_stat(current_filter) + 1; |
end if; |
exception |
when Constraint_Error => |
Raise_Exception( |
error_in_image_data'Identity, |
"PNG: wrong filter code, row #" & |
Integer'Image(y) & " code:" & U8'Image(data(i)) |
); |
Function Definition: procedure Jump_IDAT is |
Function Body: dummy: U32; |
begin |
Big_endian(image.buffer, dummy); -- ending chunk's CRC |
-- New chunk begins here. |
loop |
Read(image, ch); |
exit when ch.kind /= IDAT or ch.length > 0; |
end loop; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.