---
name: "decenc_aec.c"
section: "3"
platform: "linux"
package: "libg2c-dev"
version: "2.1.0-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/decenc_aec.c"
---

# decenc\_aec.c(3)

Decode/encode an AEC code stream.

## NAME

decenc\_aec.c - Decode/encode an AEC code stream.

## SYNOPSIS

`#include 'grib2_int.h'`\
 `#include <libaec.h>`\
 `#include <stdint.h>`\
 `#include <stdio.h>`\

### Functions

int **dec\_aec** (unsigned char \*cpack, **g2int** len, **g2int** nbits, **g2int** flags, **g2int** block\_size, **g2int** rsi, unsigned char \*cfld, **g2int** cfldlen)\
 Decode an AEC code stream specified in the `CCSDS 121.0-B-3 Blue Book`.  int **enc\_aec** (unsigned char \*data, **g2int** ctemplen, **g2int** nbits, **g2int** flags, **g2int** block\_size, **g2int** rsi, unsigned char \*aecbuf, **g2int** \*aecbuflen)\
 Encode data into an AEC code stream specified in the `CCSDS 121.0-B-3 Blue Book`.

## Detailed Description

Decode/encode an AEC code stream.

**Author**

Eric Engle

**Date**

2023-10-16

Definition in file **decenc\_aec.c**.

## Function Documentation

### int dec\_aec (unsigned char \* cpack, g2int len, g2int nbits, g2int flags, g2int block\_size, g2int rsi, unsigned char \* cfld, g2int cfldlen)

Decode an AEC code stream specified in the `CCSDS 121.0-B-3 Blue Book`.

**Parameters**

*cpack* Pointer to buffer that holds the input AEC code stream. \
 *len* Length (in bytes) of the buffer that holds the input AEC code stream. \
 *nbits* CCSDS bits per sample. \
 *flags* CCSDS compression options mask. \
 *block\_size* CCSDS block size. \
 *rsi* CCSDS reference sample interval. \
 *cfld* Pointer to output buffer from the AEC decoder. \
 *cfldlen* length of output buffer.

**Returns**

- •

  \>0 Length of data from AEC decoder

- •

  0 Successful decode (AEC\_OK)

- •

  \-1 AEC\_CONF\_ERROR

- •

  \-2 AEC\_STREAM\_ERROR

- •

  \-3 AEC\_DATA\_ERROR

- •

  \-4 AEC\_MEM\_ERROR

- •

  \-5 AEC\_RSI\_OFFSETS\_ERROR

**Author**

Eric Engle

**Date**

2023-10-16

Definition at line **38** of file **decenc\_aec.c**.

References **LOG**.

Referenced by **aecunpack\_int()**.

### int enc\_aec (unsigned char \* data, g2int ctemplen, g2int nbits, g2int flags, g2int block\_size, g2int rsi, unsigned char \* aecbuf, g2int \* aecbuflen)

Encode data into an AEC code stream specified in the `CCSDS 121.0-B-3 Blue Book`.

**Parameters**

*data* Pointer to buffer that holds the input data. \
 *ctemplen* Length (in bytes) of the buffer that holds the input data.. \
 *nbits* CCSDS bits per sample. \
 *flags* CCSDS compression options mask. \
 *block\_size* CCSDS block size. \
 *rsi* CCSDS reference sample interval. \
 *aecbuf* Pointer to buffer holding the AEC encoded stream. \
 *aecbuflen* Length of AEC code stream.

**Returns**

- •

  \>0 Exact length of AEC encoded data.

- •

  0 Successful decode (AEC\_OK)

- •

  \-1 AEC\_CONF\_ERROR

- •

  \-2 AEC\_STREAM\_ERROR

- •

  \-3 AEC\_DATA\_ERROR

- •

  \-4 AEC\_MEM\_ERROR

- •

  \-5 AEC\_RSI\_OFFSETS\_ERROR

**Author**

Eric Engle

**Date**

2023-10-16

Definition at line **108** of file **decenc\_aec.c**.

References **LOG**.

Referenced by **aecpack\_int()**.

## Author

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
