#include "dsputil.h"
#include "bitstream.h"
#include "huffman.h"
-#include "mpegvideo.h"
#include "vp56.h"
#include "vp56data.h"
static void vp6_parse_coeff(vp56_context_t *s);
static void vp6_parse_coeff_huffman(vp56_context_t *s);
-static int vp6_parse_header(vp56_context_t *s, uint8_t *buf, int buf_size,
+static int vp6_parse_header(vp56_context_t *s, const uint8_t *buf, int buf_size,
int *golden_frame)
{
vp56_range_coder_t *c = &s->c;
model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
}
+/* nodes must ascend by count, but with descending symbol order */
static int vp6_huff_cmp(const void *va, const void *vb)
{
const Node *a = va, *b = vb;
- return a->count >= b->count;
+ return (a->count - b->count)*16 + (b->sym - a->sym);
}
static void vp6_build_huff_tree(vp56_context_t *s, uint8_t coeff_model[],
}
/* then build the huffman tree accodring to probabilities */
- ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, 1);
+ ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
+ FF_HUFFMAN_FLAG_HNODE_FIRST);
}
static void vp6_parse_coeff_models(vp56_context_t *s)
}
}
-static int vp6_decode_init(AVCodecContext *avctx)
+static av_cold int vp6_decode_init(AVCodecContext *avctx)
{
vp56_context_t *s = avctx->priv_data;
vp56_free,
vp56_decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
};
/* flash version, not flipped upside-down */
vp56_free,
vp56_decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
};
/* flash version, not flipped upside-down, with alpha channel */
vp56_free,
vp56_decode_frame,
CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
};