NCEPLIBS-g2 4.0.0
All Data Structures Namespaces Files Functions Variables Pages
g2jpc.F90
Go to the documentation of this file.
1
6
34subroutine jpcpack(fld,width,height,idrstmpl,cpack,lcpack)
35
36 use, intrinsic :: iso_c_binding, only: c_size_t
37 implicit none
38
39 integer,intent(in) :: width,height
40 real,intent(in) :: fld(width*height)
41 character(len=1),intent(out) :: cpack(*)
42 integer,intent(inout) :: idrstmpl(*)
43 integer,intent(inout) :: lcpack
44 integer(c_size_t) :: width_c, height_c
45 integer :: ret
46
47 interface
48 function g2c_jpcpackd(fld, width, height, idrstmpl, cpack, lcpack) bind(c)
49 use, intrinsic :: iso_c_binding
50 real(kind=c_double), intent(in):: fld(*)
51 integer(c_size_t), value, intent(in) :: width, height
52 integer(c_int), intent(inout) :: idrstmpl(*)
53 character(kind=c_char), intent(out) :: cpack(*)
54 integer(c_int), intent(out) :: lcpack
55 integer(c_int) :: g2c_jpcpackd
56 end function g2c_jpcpackd
57 function g2c_jpcpackf(fld, width, height, idrstmpl, cpack, lcpack) bind(c)
58 use, intrinsic :: iso_c_binding
59 real(kind=c_float), intent(in):: fld(*)
60 integer(c_size_t), value, intent(in) :: width, height
61 integer(c_int), intent(inout) :: idrstmpl(*)
62 character(kind=c_char), intent(out) :: cpack(*)
63 integer(c_int), intent(out) :: lcpack
64 integer(c_int) :: g2c_jpcpackf
65 end function g2c_jpcpackf
66 end interface
67
68 width_c = width
69 height_c = height
70
71#if KIND==4
72 ret = g2c_jpcpackf(fld, width_c, height_c, idrstmpl, cpack, lcpack)
73#else
74 ret = g2c_jpcpackd(fld, width_c, height_c, idrstmpl, cpack, lcpack)
75#endif
76
77end subroutine
78
95subroutine jpcunpack(cpack,len,idrstmpl,ndpts,fld)
96
97 use, intrinsic :: iso_c_binding, only: c_size_t
98 implicit none
99
100 character(len=1),intent(in) :: cpack(len)
101 integer,intent(in) :: ndpts,len
102 integer,intent(in) :: idrstmpl(*)
103 real,intent(out) :: fld(ndpts)
104 integer(c_size_t) :: ndpts_c, len_c
105 integer :: ret
106
107 interface
108 function g2c_jpcunpackd(cpack, len, idrstmpl, ndpts, fld) bind(c)
109 use, intrinsic :: iso_c_binding
110 implicit none
111 integer(c_size_t), value, intent(in) :: len
112 integer(c_size_t), value, intent(in) :: ndpts
113 character(kind=c_char), intent(in) :: cpack(*)
114 integer(c_int), intent(in) :: idrstmpl(*)
115 real(kind=c_double), intent(out) :: fld(*)
116 integer(c_int) :: g2c_jpcunpackd
117 end function g2c_jpcunpackd
118 function g2c_jpcunpackf(cpack, len, idrstmpl, ndpts, fld) bind(c)
119 use, intrinsic :: iso_c_binding
120 implicit none
121 integer(c_size_t), value, intent(in) :: len
122 integer(c_size_t), value, intent(in) :: ndpts
123 character(kind=c_char), intent(in) :: cpack(*)
124 integer(c_int), intent(in) :: idrstmpl(*)
125 real(kind=c_float), intent(out) :: fld(*)
126 integer(c_int) :: g2c_jpcunpackf
127 end function g2c_jpcunpackf
128 end interface
129
130 len_c = len
131 ndpts_c = ndpts
132#if KIND==4
133 ret = g2c_jpcunpackf(cpack, len_c, idrstmpl, ndpts_c, fld)
134#else
135 ret = g2c_jpcunpackd(cpack, len_c, idrstmpl, ndpts_c, fld)
136#endif
137
138end subroutine jpcunpack
subroutine jpcunpack(cpack, len, idrstmpl, ndpts, fld)
Unpack a data field from a JPEG2000 code stream as defined in Data Representation Template 5....
Definition g2jpc.F90:96
subroutine jpcpack(fld, width, height, idrstmpl, cpack, lcpack)
Pack a data field into a JPEG2000 code stream as defined in Data Representation Template 5....
Definition g2jpc.F90:35