Go to the documentation of this file.
56 #define HUFFMAN_TABLE_SIZE 64 * 1024
57 #define HUF_TOKENS 256
58 #define PALETTE_COUNT 256
70 const unsigned char *
buf;
91 for(
i = 0;
i < num_hnodes;
i++) {
96 if(hnodes[
i].count < best) {
104 hnodes[best_node].
used = 1;
118 hnode *node, *hnodes;
122 hnodes =
s->huff_nodes[prev];
127 node = &hnodes[num_hnodes];
144 s->num_huff_nodes[prev] = num_hnodes - 1;
150 int i, j, histogram_index = 0;
151 unsigned char *histograms;
163 histograms = (
unsigned char *)
s->avctx->extradata;
164 for (
i = 0;
i < 256;
i++) {
166 s->huff_nodes[
i][j].count = histograms[histogram_index++];
179 int bit_pos, node_num, dat_pos;
181 prev = bit_pos = dat_pos = 0;
182 for (y = 0; y < (
frame->linesize[0] *
s->avctx->height);
183 y +=
frame->linesize[0]) {
184 for (x = y; x < y +
s->avctx->width; x++) {
185 node_num =
s->num_huff_nodes[prev];
186 hnodes =
s->huff_nodes[prev];
190 if(dat_pos >=
s->size) {
195 v =
s->buf[dat_pos++];
198 node_num = hnodes[node_num].
children[v & 0x01];
203 frame->data[0][x] = node_num;
212 void *
data,
int *got_frame,
215 const uint8_t *buf = avpkt->
data;
216 int buf_size = avpkt->
size;
241 {
"max_pixels",
"320*240" },
246 .
name =
"idcinvideo",
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
static const AVCodecDefault idcin_defaults[]
This structure describes decoded (raw) audio or video data.
static const AVCodecDefault defaults[]
const unsigned char * buf
hnode huff_nodes[256][HUF_TOKENS *2]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold void huff_build_tree(IdcinContext *s, int prev)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int huff_smallest_node(hnode *hnodes, int num_hnodes)
Find the lowest probability node in a Huffman table, and mark it as being assigned to a higher probab...
#define HUFFMAN_TABLE_SIZE
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define i(width, name, range_min, range_max)
static int idcin_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const AVCodec ff_idcin_decoder
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
static av_cold int idcin_decode_init(AVCodecContext *avctx)
This structure stores compressed data.
static int idcin_decode_vlcs(IdcinContext *s, AVFrame *frame)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so,...