@@ -148,3 +148,76 @@ enc_aec(unsigned char *data, g2int ctemplen, g2int nbits, g2int flags,
148148
149149 return ret ;
150150}
151+
152+ /**
153+ * Decode an AEC code stream specified in the [CCSDS 121.0-B-3 Blue
154+ * Book](https://public.ccsds.org/Pubs/121x0b3.pdf).
155+ *
156+ * @param cpack Pointer to buffer that holds the input AEC code
157+ * stream.
158+ * @param len Length (in bytes) of the buffer that holds the input
159+ * AEC code stream.
160+ * @param nbits CCSDS bits per sample.
161+ * @param flags CCSDS compression options mask.
162+ * @param block_size CCSDS block size.
163+ * @param rsi CCSDS reference sample interval.
164+ * @param cfld Pointer to output buffer from the AEC decoder.
165+ * @param cfldlen length of output buffer.
166+ *
167+ * @return
168+ * - >0 Length of data from AEC decoder
169+ * - 0 Successful decode (AEC_OK)
170+ * - -1 AEC_CONF_ERROR
171+ * - -2 AEC_STREAM_ERROR
172+ * - -3 AEC_DATA_ERROR
173+ * - -4 AEC_MEM_ERROR
174+ * - -5 AEC_RSI_OFFSETS_ERROR
175+ *
176+ * @author Alyson Stahl @date 10/2025
177+ */
178+ int
179+ g2c_dec_aec (unsigned char * cpack , int len , int nbits , int flags ,
180+ int block_size , int rsi , unsigned char * cfld , int cfldlen )
181+ {
182+ g2int len8 = len , nbits8 = nbits , flags8 = flags ;
183+ g2int block_size8 = block_size , rsi8 = rsi , cfldlen8 = cfldlen ;
184+
185+ return dec_aec (cpack , len8 , nbits8 , flags8 , block_size8 , rsi8 ,
186+ cfld , cfldlen8 );
187+ }
188+
189+ /**
190+ * Encode data into an AEC code stream specified in the
191+ * [CCSDS 121.0-B-3 Blue Book](https://public.ccsds.org/Pubs/121x0b3.pdf).
192+ *
193+ * @param data Pointer to buffer that holds the input data.
194+ * @param ctemplen Length (in bytes) of the buffer that holds
195+ * the input data..
196+ * @param nbits CCSDS bits per sample.
197+ * @param flags CCSDS compression options mask.
198+ * @param block_size CCSDS block size.
199+ * @param rsi CCSDS reference sample interval.
200+ * @param aecbuf Pointer to buffer holding the AEC encoded stream.
201+ * @param aecbuflen Length of AEC code stream.
202+ *
203+ * @return
204+ * - >0 Exact length of AEC encoded data.
205+ * - 0 Successful decode (AEC_OK)
206+ * - -1 AEC_CONF_ERROR
207+ * - -2 AEC_STREAM_ERROR
208+ * - -3 AEC_DATA_ERROR
209+ * - -4 AEC_MEM_ERROR
210+ * - -5 AEC_RSI_OFFSETS_ERROR
211+ *
212+ * @author Alyson Stahl @date 10/2025
213+ */
214+ int
215+ g2c_enc_aec (unsigned char * data , int ctemplen , int nbits , int flags ,
216+ int block_size , int rsi , unsigned char * aecbuf , int * aecbuflen )
217+ {
218+ g2int ctemplen8 = ctemplen , nbits8 = nbits , flags8 = flags ;
219+ g2int block_size8 = block_size , rsi8 = rsi , aecbuflen8 = * aecbuflen ;
220+
221+ return enc_aec (data , ctemplen8 , nbits8 , flags8 , block_size8 , rsi8 ,
222+ aecbuf , & aecbuflen8 );
223+ }
0 commit comments