27 #define CACHED_BITSTREAM_READER !ARCH_X86_32 58 Node *nodes,
int node,
59 uint32_t pfx,
int pl,
int *
pos)
65 bits[*
pos] = (~pfx) & ((1ULL <<
FFMAX(pl, 1)) - 1);
67 xlat[*
pos] = s + (pl == 0);
87 int cur_node,
i, j,
pos = 0;
104 int first_node = cur_node;
105 int second_node = cur_node;
108 nodes[cur_node].
count = -1;
112 if (val && (val < nodes[first_node].count)) {
113 if (val >= nodes[second_node].count) {
114 first_node = new_node;
116 first_node = second_node;
117 second_node = new_node;
121 }
while (new_node != cur_node);
123 if (first_node == cur_node)
126 nd = nodes[second_node].
count;
127 st = nodes[first_node].
count;
128 nodes[second_node].
count = 0;
129 nodes[first_node].
count = 0;
130 if (nd >= UINT32_MAX - st) {
134 nodes[cur_node].
count = nd + st;
135 nodes[cur_node].
sym = -1;
136 nodes[cur_node].
n0 = cur_node;
137 nodes[cur_node].
l = first_node;
138 nodes[cur_node].
r = second_node;
144 get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
146 return ff_init_vlc_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
150 void *
data,
int *got_frame,
158 if (avpkt->
size <= 8)
164 if (size < 1 || size >= avpkt->
size)
170 if (type ==
MKTAG(
'L',
'Z',
'Y',
'V')) {
171 ret = inflateReset(&s->
zstream);
180 for (
int p = 0; p < 3; p++) {
181 for (
int y = 0; y < avctx->
height; y++) {
186 if (ret != Z_OK && ret != Z_STREAM_END) {
194 }
else if (type ==
MKTAG(
'H',
'U',
'F',
'Y')) {
196 int first_symbol, symbol;
207 symbol = first_symbol;
231 for (
int p = 0; p < 3; p++) {
237 for (
int y = 0; y < avctx->
height; y++) {
240 for (
int x = 0; x <
width; x++) {
255 for (
int p = 0; p < 3; p++) {
265 lefttop = left = dst[0];
266 for (
int y = 1; y < avctx->
height; y++) {
268 lefttop = left = dst[0];
291 zret = inflateInit(&s->
zstream);
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int(* add_left_pred)(uint8_t *dst, const uint8_t *src, ptrdiff_t w, int left)
This structure describes decoded (raw) audio or video data.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
int ff_init_vlc_sparse(VLC *vlc_arg, 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)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
void(* add_median_pred)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, ptrdiff_t w, int *left, int *left_top)
bitstream reader API header.
static av_cold int decode_close(AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
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)
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Libavcodec external API header.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static int build_vlc(AVCodecContext *avctx, VLC *vlc)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
void ff_llviddsp_init(LLVidDSPContext *c)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
#define MKTAG(a, b, c, d)
#define AVERROR_EXTERNAL
Generic error in an external library.
static double val(void *priv, double ch)
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int decode_init(AVCodecContext *avctx)