64 Node *nodes,
int node,
65 uint32_t pfx,
int pl,
int *pos)
71 bits[*pos] = (~pfx) & ((1 <<
FFMAX(pl, 1)) - 1);
72 lens[*pos] =
FFMAX(pl, 1);
73 xlat[*pos] = s + (pl == 0);
92 int cur_node, i, j, pos = 0;
96 for (i = 0; i < 256; i++) {
97 nodes[i].
count = table[i];
109 int first_node = cur_node;
110 int second_node = cur_node;
113 nodes[cur_node].
count = -1;
117 if (val && (val < nodes[first_node].
count)) {
118 if (val >= nodes[second_node].count) {
119 first_node = new_node;
121 first_node = second_node;
122 second_node = new_node;
126 }
while (new_node != cur_node);
128 if (first_node == cur_node)
131 nd = nodes[second_node].
count;
132 st = nodes[first_node].
count;
133 nodes[second_node].
count = 0;
134 nodes[first_node].
count = 0;
135 nodes[cur_node].
count = nd + st;
136 nodes[cur_node].
sym = -1;
137 nodes[cur_node].
n0 = cur_node;
138 nodes[cur_node].
l = first_node;
139 nodes[cur_node].
r = second_node;
143 }
while (cur_node - 256 == j);
145 get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
147 return ff_init_vlc_sparse(vlc, 10, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
151 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
152 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
153 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
154 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
155 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
156 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
157 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
158 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
159 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
160 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
161 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
162 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
168 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
169 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
170 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
171 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
172 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
173 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
174 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
175 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
176 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
177 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
178 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
183 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
184 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
187 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
188 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF,
189 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
190 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
192 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
193 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
194 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
195 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
196 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
199 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF,
200 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
201 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
204 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
205 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
206 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
207 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
210 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
215 0xFC, 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
216 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC,
217 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE,
218 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0xFC,
219 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF,
220 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFD, 0xFD, 0xFD,
221 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
222 0x00, 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE,
223 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
224 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
225 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
226 0x01, 0x01, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
227 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
228 0x02, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00,
229 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
230 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
231 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0xFF,
232 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
233 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF,
234 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
235 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0xFF,
236 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
237 0x02, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01,
238 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03,
239 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01,
240 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04,
241 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
242 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04,
247 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
248 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
249 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
250 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
251 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
252 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
253 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
254 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
255 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
256 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
257 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
258 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
259 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
260 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
261 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
262 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
263 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
264 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
265 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
266 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
267 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
268 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
269 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
270 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
271 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
272 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
273 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
274 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
279 void *
data,
int *got_frame,
282 int TL[4] = { 128, 128, 128, 128 };
283 int L[4] = { 128, 128, 128, 128 };
286 int ret, x, y, toffset, boffset;
291 if (avpkt->
size <= 16)
299 if (toffset < 16 || toffset >= avpkt->
size)
303 if (toffset >= boffset || boffset >= avpkt->
size)
318 (boffset - toffset + 3) >> 2);
322 for (x = 0; x < 1024; x++) {
351 (avpkt->
size - boffset) >> 2);
356 for (y = 0; y < avctx->
height; y++) {
357 memset(dst, 0, avctx->
width * 2);
362 for (y = 0; y < avctx->
height; y++) {
363 for (x = 0; x < avctx->
width * 2 && y < avctx->
height;) {
371 }
else if (val < 0xE1) {
378 int incr = (val - 0xDF) * 4;
379 if (x + incr >= avctx->
width * 2) {
380 int iy = ((x + incr) / (avctx->
width * 2));
381 x = (x + incr) % (avctx->
width * 2);
395 if (y1 < 0 || y2 < 0 || u < 0 || v < 0)
399 dst[x + 2] = y1 + y2;
408 for (x = 0; x < avctx->
width * 2; x += 4) {
409 dst[x ] = dst[x ] + L[0];
410 dst[x + 2] = L[0] = dst[x + 2] + L[0];
411 L[1] = dst[x + 1] + L[1];
413 L[2] = dst[x + 3] + L[2];
418 for (y = 1; y < avctx->
height; y++) {
420 dst[x ] = dst[x ] + L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
421 dst[x + 2] = L[0] = dst[x + 2] + L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
422 TL[0] = dst[x + 2 - p->
linesize[0]];
423 L[1] = dst[x + 1] + L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
425 TL[1] = dst[x + 1 - p->
linesize[0]];
426 L[2] = dst[x + 3] + L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
428 TL[2] = dst[x + 3 - p->
linesize[0]];
429 for (x = 4; x < avctx->
width * 2; x += 4) {
430 dst[x ] = dst[x ] + L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
431 dst[x + 2] = L[0] = dst[x + 2] + L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
432 TL[0] = dst[x + 2 - p->
linesize[0]];
433 L[1] = dst[x + 1] + L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
435 TL[1] = dst[x + 1 - p->
linesize[0]];
436 L[2] = dst[x + 3] + L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
438 TL[2] = dst[x + 3 - p->
linesize[0]];
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static av_cold int decode_init(AVCodecContext *avctx)
ptrdiff_t const GLvoid * data
static const uint8_t table_y1[]
memory handling functions
static const uint8_t table_y2[]
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 const uint8_t table_u[]
static const uint8_t table_v[]
static av_cold int decode_end(AVCodecContext *avctx)
bitstream reader API header.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static int get_bits_left(GetBitContext *gb)
static const struct endianess table[]
#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.
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)
common internal API header
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.
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.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static unsigned int get_bits1(GetBitContext *s)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
common internal api header.
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
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.