MediaProcessors
|
#include "bitparser.h"
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <endian.h>
#include "log.h"
#include "stat_codes.h"
#include "check_utils.h"
Go to the source code of this file.
Functions | |
bitparser_ctx_t * | bitparser_open (void *buf, size_t buf_size) |
void | bitparser_close (bitparser_ctx_t **ref_bitparser_ctx) |
void | bitparser_flush (bitparser_ctx_t *bitparser_ctx, size_t n) |
WORD_T | bitparser_get (bitparser_ctx_t *bitparser_ctx, size_t n) |
WORD_T | bitparser_show (bitparser_ctx_t *bitparser_ctx, size_t n) |
void * | bitparser_copy_bytes (bitparser_ctx_t *bitparser_ctx, size_t cnt) |
void | bitparser_align_2byte (bitparser_ctx_t *bitparser_ctx) |
Definition in file bitparser.c.
#define IS_POW_OF_2 | ( | x | ) |
Definition at line 76 of file bitparser.c.
void bitparser_align_2byte | ( | bitparser_ctx_t * | bitparser_ctx | ) |
Align bit parser to the next byte boundary
bitparser_ctx | Pointer to bit-parser context structure. |
Definition at line 217 of file bitparser.c.
void bitparser_close | ( | bitparser_ctx_t ** | ref_bitparser_ctx | ) |
// FIXME!!
Definition at line 115 of file bitparser.c.
void* bitparser_copy_bytes | ( | bitparser_ctx_t * | bitparser_ctx, |
size_t | cnt | ||
) |
Copy 'cnt' bytes from bit-parser internal buffer to a dynamically (heap) allocated memory. Important: note that this function requires copy operation to be byte aligned; thus, this function copies the byte block corresponding to the current value of the internal bit-counter.
bitparser_ctx | Pointer to bit-parser context structure |
cnt | Number of bytes to copy |
Definition at line 186 of file bitparser.c.
void bitparser_flush | ( | bitparser_ctx_t * | bitparser_ctx, |
size_t | n | ||
) |
Flush next n bits out of buffer (Advance internal bit-counter by 'n' bits).
bitparser_ctx | Pointer to bit-parser context structure |
n | number of bits to flush. |
Definition at line 129 of file bitparser.c.
WORD_T bitparser_get | ( | bitparser_ctx_t * | bitparser_ctx, |
size_t | n | ||
) |
Get next n bits right aligned in an unsigned 32/64-bit word. Bits are "flushed" from internal buffer, incrementing internal bit counter.
bitparser_ctx | Pointer to bit-parser context structure |
n | Number of bits to get (internal bit counter is incremented by 'n') |
Definition at line 163 of file bitparser.c.
bitparser_ctx_t* bitparser_open | ( | void * | buf, |
size_t | buf_size | ||
) |
//FIXME!! Initializes the bit-parser context attributes, getting ready for parsing.
bitparser_ctx | Pointer to bit-parser context structure |
buf | Pointer to buffer to be parsed. |
buf_size | Parsing buffer size in bytes. Value MUST be a multiple of 8. |
Definition at line 82 of file bitparser.c.
WORD_T bitparser_show | ( | bitparser_ctx_t * | bitparser_ctx, |
size_t | n | ||
) |
Show next n bits right aligned in an unsigned 32/64-bit word. Internal buffer bit counter is not modified (namely, consecutive identical calls to this function will return the same value).
bitparser_ctx | Pointer to bit-parser context structure |
n | Number of bits to show |
Definition at line 175 of file bitparser.c.