text stringlengths 0 234 |
|---|
Ada.Text_IO.Put_Line( |
"row" & Integer'Image(y) & ": filter= " & |
Filter_method_0'Image(current_filter) |
); |
end if; |
-- |
-- !! find a way to have f99n0g04.png decoded correctly... |
-- seems a filter issue. |
-- |
case current_filter is |
when None => |
-- Recon(x) = Filt(x) |
u:= f; |
when Sub => |
-- Recon(x) = Filt(x) + Recon(a) |
if x > 0 then |
for i in f'Range loop |
u(u'First+j):= f(i) + mem_row_bytes(curr_row)((x-1)*bytes_to_unfilter+j); |
j:= j + 1; |
end loop; |
else |
u:= f; |
end if; |
when Up => |
-- Recon(x) = Filt(x) + Recon(b) |
if y > 0 then |
for i in f'Range loop |
u(u'First+j):= f(i) + mem_row_bytes(1-curr_row)(x*bytes_to_unfilter+j); |
j:= j + 1; |
end loop; |
else |
u:= f; |
end if; |
when Average => |
-- Recon(x) = Filt(x) + floor((Recon(a) + Recon(b)) / 2) |
for i in f'Range loop |
if x > 0 then |
a:= Integer(mem_row_bytes(curr_row)((x-1)*bytes_to_unfilter+j)); |
else |
a:= 0; |
end if; |
if y > 0 then |
b:= Integer(mem_row_bytes(1-curr_row)(x*bytes_to_unfilter+j)); |
else |
b:= 0; |
end if; |
u(u'First+j):= U8((Integer(f(i)) + (a+b)/2) mod 256); |
j:= j + 1; |
end loop; |
when Paeth => |
-- Recon(x) = Filt(x) + PaethPredictor(Recon(a), Recon(b), Recon(c)) |
for i in f'Range loop |
if x > 0 then |
a:= Integer(mem_row_bytes(curr_row)((x-1)*bytes_to_unfilter+j)); |
else |
a:= 0; |
end if; |
if y > 0 then |
b:= Integer(mem_row_bytes(1-curr_row)(x*bytes_to_unfilter+j)); |
else |
b:= 0; |
end if; |
if x > 0 and y > 0 then |
c:= Integer(mem_row_bytes(1-curr_row)((x-1)*bytes_to_unfilter+j)); |
else |
c:= 0; |
end if; |
p := a + b - c; |
pa:= abs(p - a); |
pb:= abs(p - b); |
pc:= abs(p - c); |
if pa <= pb and then pa <= pc then |
pr:= a; |
elsif pb <= pc then |
pr:= b; |
else |
pr:= c; |
end if; |
u(u'First+j):= f(i) + U8(pr); |
j:= j + 1; |
end loop; |
end case; |
j:= 0; |
for i in u'Range loop |
mem_row_bytes(curr_row)(x*bytes_to_unfilter+j):= u(i); |
j:= j + 1; |
end loop; |
-- if u'Length /= bytes_to_unfilter then |
-- raise Constraint_Error; |
-- end if; |
end Unfilter_bytes; |
filter_stat: array(Filter_method_0) of Natural:= (others => 0); |
---------------------------------------------- |
-- ** 8: Interlacing and pass extraction ** -- |
---------------------------------------------- |
-- http://www.w3.org/TR/PNG/#8Interlace |
-- Output bytes from decompression |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.