Go to the documentation of this file.
   33 static int read_cb(
void *opaque, 
void *buf, 
size_t *nb_elems)
 
   38     *nb_elems = 
FFMIN(*nb_elems, 
s->to_process);
 
   40     for (
unsigned i = 0; 
i < *nb_elems; 
i++)
 
   41         if (
b[
i] != 
s->read_idx + 
s->offset + 
i) {
 
   42             printf(
"Mismatch at idx %u offset %u i %u\n",
 
   43                    s->read_idx, 
s->offset, 
i);
 
   47     s->offset     += *nb_elems;
 
   48     s->to_process -= *nb_elems;
 
   53 static int write_cb(
void *opaque, 
void *buf, 
size_t *nb_elems)
 
   58     *nb_elems = 
FFMIN(*nb_elems, 
s->to_process);
 
   60     for (
unsigned i = 0; 
i < *nb_elems; 
i++)
 
   61         b[
i] = 
s->write_idx + 
i;
 
   63     s->write_idx  += *nb_elems;
 
   64     s->to_process -= *nb_elems;
 
   81     for (
i = 0; 
i < n; 
i++) {
 
   92         fprintf(stderr, 
"failed to allocate memory.\n");
 
   99     for(
i = 0; 
i < n; ++
i)
 
  117     for (
i = 0; 
i < n; 
i++) {
 
  133     for (
i = 0; 
i < n; 
i++) {
 
  152         for (
i = 0; 
i < 32; 
i++) {
 
  153             size_t       nb_elems = 16;
 
  154             unsigned   to_process = 
av_lfg_get(&lfg) % nb_elems;
 
  156             s.to_process = to_process;
 
  159             if (
ret < 0 || 
s.to_process || nb_elems != to_process) {
 
  160                 printf(
"FIFO write fail; seed %"PRIu32
"\n", 
seed);
 
  167                 nb_elems    -= 
s.offset;
 
  170                 to_process   = 
s.to_process;
 
  173                 if (
ret < 0 || 
s.to_process || nb_elems != to_process) {
 
  174                     printf(
"FIFO peek fail; seed %"PRIu32
"\n", 
seed);
 
  180             to_process   = nb_elems ? 
av_lfg_get(&lfg) % nb_elems : 0;
 
  181             s.to_process = to_process;
 
  185             if (
ret < 0 || 
s.to_process || to_process != nb_elems) {
 
  186                 printf(
"FIFO read fail; seed %"PRIu32
"\n", 
seed);
 
  189             s.read_idx += 
s.offset;
 
  
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
 
size_t av_fifo_can_read(const AVFifo *f)
 
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
 
int av_fifo_write_from_cb(AVFifo *f, AVFifoCB read_cb, void *opaque, size_t *nb_elems)
Write data from a user-provided callback into a FIFO.
 
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
 
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
 
size_t av_fifo_elem_size(const AVFifo *f)
 
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
 
size_t av_fifo_can_write(const AVFifo *f)
 
int av_fifo_peek_to_cb(AVFifo *f, AVFifoCB write_cb, void *opaque, size_t *nb_elems, size_t offset)
Feed data from a FIFO into a user-provided callback.
 
Context structure for the Lagged Fibonacci PRNG.
 
static int read_cb(void *opaque, void *buf, size_t *nb_elems)
 
int av_fifo_peek(AVFifo *f, void *buf, size_t nb_elems, size_t offset)
Read data from a FIFO without modifying FIFO state.
 
printf("static const uint8_t my_array[100] = {\n")
 
int av_fifo_read_to_cb(AVFifo *f, AVFifoCB write_cb, void *opaque, size_t *nb_elems)
Feed data from a FIFO into a user-provided callback.
 
#define i(width, name, range_min, range_max)
 
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
 
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
 
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
 
static int write_cb(void *opaque, void *buf, size_t *nb_elems)
 
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
 
int av_fifo_grow2(AVFifo *f, size_t inc)
Enlarge an AVFifo.