trials.f90: buffering is good for the planet

This commit is contained in:
tTh
2022-12-06 01:49:45 +01:00
parent 5b6df523fc
commit cc71a55ccb
5 changed files with 84 additions and 14 deletions

View File

@@ -8,8 +8,9 @@ module spitpgm
!-------------------------------------------------------------------
!-
! This subroutine try to scale the values to fit the 16 bit range
!
! This subroutine try to scale the values to fit the 16 bit range.
! XXX may be add a third parameter : the max value required ?
!-
subroutine spit_as_pgm_eq(pic, fname)
integer, intent(in), dimension (:,:) :: pic
@@ -19,7 +20,7 @@ subroutine spit_as_pgm_eq(pic, fname)
integer :: ix, iy
real :: fk, fpix
write(0, '(1X, A)') "> spit_as_pgm_eq to " // trim(fname)
! write(0, '(1X, A)') " spit_as_pgm_eq to " // trim(fname)
open(newunit=io, file=fname)
write (io, '(a2)') "P2"
@@ -34,7 +35,7 @@ subroutine spit_as_pgm_eq(pic, fname)
enddo
else
fk = float(foo) / 65535.01
write (0, *) " max pix value", foo, " fk ", fk
! write (0, *) " max pix value", foo, " fk ", fk
do iy = 1, ubound(pic, 2)
do ix = 1, ubound(pic, 1)
fpix = float(pic(ix, iy)) / fk
@@ -48,6 +49,7 @@ end subroutine
!-------------------------------------------------------------------
!-
! 16 bits - 65535 levels portable grey map file
! no data conversion except upper clippin.
!-
subroutine spit_as_pgm_16(pic, fname)
integer, intent(in), dimension (:,:) :: pic