23#define CACHED_BITSTREAM_READER !ARCH_X86_32
55 Node *nodes,
int node,
56 uint32_t pfx,
int pl,
int *
pos)
64 xlat[*
pos] =
s + (pl == 0);
84 int cur_node,
i, j,
pos = 0;
88 for (
i = 0;
i <
s->nb_symbols;
i++) {
96 cur_node =
s->nb_symbols;
101 int first_node = cur_node;
102 int second_node = cur_node;
105 nodes[cur_node].
count = -1;
109 if (
val && (
val < nodes[first_node].count)) {
110 if (
val >= nodes[second_node].count) {
111 first_node = new_node;
113 first_node = second_node;
114 second_node = new_node;
118 }
while (new_node != cur_node);
120 if (first_node == cur_node)
123 nd = nodes[second_node].
count;
124 st = nodes[first_node].
count;
125 nodes[second_node].
count = 0;
126 nodes[first_node].
count = 0;
127 if (nd >= UINT32_MAX - st) {
131 nodes[cur_node].
count = nd + st;
132 nodes[cur_node].
sym = -1;
133 nodes[cur_node].
n0 = cur_node;
134 nodes[cur_node].
l = first_node;
135 nodes[cur_node].
r = second_node;
139 }
while (cur_node -
s->nb_symbols == j);
143 return ff_vlc_init_sparse(vlc, 12,
pos, lens, 2, 2,
bits, 4, 4, xlat, 1, 1, 0);
153 if (avpkt->
size <= 8)
163 z_stream *
const zstream = &
s->zstream.zstream;
164 ret = inflateReset(zstream);
173 zstream->next_in = avpkt->
data + 8;
174 zstream->avail_in = avpkt->
size - 8;
176 for (
int p = 0; p < 3; p++) {
177 for (
int y = 0; y < avctx->
height; y++) {
178 zstream->next_out =
frame->data[p] + (avctx->
height - y - 1) *
frame->linesize[p];
179 zstream->avail_out = avctx->
width >> (p > 0);
181 ret =
inflate(zstream, Z_SYNC_FLUSH);
182 if (ret != Z_OK && ret != Z_STREAM_END) {
186 if (zstream->avail_out > 0)
187 memset(zstream->next_out, 0, zstream->avail_out);
190 }
else if (
type ==
MKTAG(
'H',
'U',
'F',
'Y')) {
192 int first_symbol, symbol;
203 symbol = first_symbol;
204 for (
int i = 0;
i <
s->nb_symbols; symbol++) {
233 for (
int p = 0; p < 3; p++) {
239 for (
int y = 0; y < avctx->
height; y++) {
242 for (
int x = 0; x <
width; x++) {
243 int v =
get_vlc2(gb,
s->vlc.table,
s->vlc.bits, 3);
257 for (
int p = 0; p < 3; p++) {
268 for (
int y = 1; y < avctx->
height; y++) {
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
const FFCodec ff_mvha_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
#define prob(name, subs,...)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
static const uint8_t bits[8]
bitstream reader API header.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_bits_left(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
av_cold void ff_llviddsp_init(LLVidDSPContext *c)
#define MKTAG(a, b, c, d)
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
static int build_vlc(AVCodecContext *avctx, VLC *vlc)
static av_cold int decode_init(AVCodecContext *avctx)
static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, Node *nodes, int node, uint32_t pfx, int pl, int *pos)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
int ff_vlc_init_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
Build VLC decoding tables suitable for use with get_vlc2().
void ff_vlc_free(VLC *vlc)
void ff_inflate_end(FFZStream *zstream)
Wrapper around inflateEnd().
int ff_inflate_init(FFZStream *zstream, void *logctx)
Wrapper around inflateInit().