|
FFmpeg
|
#include <string.h>#include <stdint.h>#include "libavutil/avassert.h"#include "libavutil/qsort.h"#include "mjpegenc_huffman.h"Go to the source code of this file.
Data Structures | |
| struct | PTable |
| Used to assign a occurrence count or "probability" to an input value. More... | |
| struct | PackageMergerList |
| Used to store intermediate lists in the package merge algorithm. More... | |
Functions | |
| static int | compare_by_prob (const void *a, const void *b) |
| Comparison function for two PTables by prob. More... | |
| static void | mjpegenc_huffman_compute_bits (PTable *prob_table, uint8_t counts[], int size, int max_length) |
| Computes the length of the Huffman encoding for each distinct input value. More... | |
| void | ff_mjpeg_encode_huffman_init (MJpegEncHuffmanContext *s) |
| void | ff_mjpeg_encode_huffman_close (MJpegEncHuffmanContext *s, uint8_t bits[17], uint8_t val[], int max_nval) |
| Produces a Huffman encoding with a given input. More... | |
|
static |
Comparison function for two PTables by prob.
Definition at line 53 of file mjpegenc_huffman.c.
Referenced by mjpegenc_huffman_compute_bits().
|
static |
Computes the length of the Huffman encoding for each distinct input value.
Uses package merge algorithm as follows:
All probabilities should be nonnegative integers.
| prob_table[in,out] | array of a PTable for each distinct input value, will be sorted according to ascending probability |
| counts[out] | the number of values of a given length |
| size | number of elements of the prob_table array |
| max_length | max length of a code |
Definition at line 81 of file mjpegenc_huffman.c.
Referenced by check_lengths(), ff_mjpeg_encode_huffman_close(), and main().
| void ff_mjpeg_encode_huffman_init | ( | MJpegEncHuffmanContext * | s | ) |
Definition at line 146 of file mjpegenc_huffman.c.
| void ff_mjpeg_encode_huffman_close | ( | MJpegEncHuffmanContext * | s, |
| uint8_t | bits[17], | ||
| uint8_t | val[], | ||
| int | max_nval | ||
| ) |
Produces a Huffman encoding with a given input.
| s | input to encode |
| bits | output array where the ith character represents how many input values have i length encoding |
| val | output array of input values sorted by their encoded length |
| max_nval | maximum number of distinct input values |
Definition at line 159 of file mjpegenc_huffman.c.
1.8.17