25 #define YLC_VLC_BITS 10 67 Node *nodes,
int node,
68 uint32_t pfx,
int pl,
int *
pos)
74 bits[*
pos] = (~pfx) & ((1ULL <<
FFMAX(pl, 1)) - 1);
76 xlat[*
pos] = s + (pl == 0);
95 int cur_node,
i, j,
pos = 0;
99 for (i = 0; i < 256; i++) {
112 int first_node = cur_node;
113 int second_node = cur_node;
116 nodes[cur_node].
count = -1;
120 if (val && (val < nodes[first_node].
count)) {
121 if (val >= nodes[second_node].count) {
122 first_node = new_node;
124 first_node = second_node;
125 second_node = new_node;
129 }
while (new_node != cur_node);
131 if (first_node == cur_node)
134 nd = nodes[second_node].
count;
135 st = nodes[first_node].
count;
136 nodes[second_node].
count = 0;
137 nodes[first_node].
count = 0;
138 if (nd >= UINT32_MAX - st) {
142 nodes[cur_node].
count = nd + st;
143 nodes[cur_node].
sym = -1;
144 nodes[cur_node].
n0 = cur_node;
145 nodes[cur_node].
l = first_node;
146 nodes[cur_node].
r = second_node;
150 }
while (cur_node - 256 == j);
152 get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
155 bits, 4, 4, xlat, 1, 1, 0);
159 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
160 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
161 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
162 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
163 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
164 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
165 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
166 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
167 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
168 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
169 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
170 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
176 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
177 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
178 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
179 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
180 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
181 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
182 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
183 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
184 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
185 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
186 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
191 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
192 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
195 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
196 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF,
197 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
198 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
201 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
202 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
203 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
204 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
207 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF,
208 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
209 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
212 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
213 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
214 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
215 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
218 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
223 0xFC, 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
224 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC,
225 0xFC, 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE,
226 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0xFC,
227 0xFC, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF,
228 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFD, 0xFD, 0xFD,
229 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
230 0x00, 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE,
231 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
232 0x01, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0xFE, 0xFE,
233 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
234 0x01, 0x01, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
235 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
236 0x02, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00,
237 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02,
238 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
239 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0xFF,
240 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
241 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF,
242 0xFF, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02,
243 0x02, 0x02, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0xFF,
244 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
245 0x02, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01,
246 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03,
247 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01,
248 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04,
249 0x04, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
250 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04,
255 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
256 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
257 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
258 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
259 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
260 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
261 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
262 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
263 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
264 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
265 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
266 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
267 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
268 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
269 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
270 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
271 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
272 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
273 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
274 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
275 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
276 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
277 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
278 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
279 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
280 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF,
281 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01,
282 0xFF, 0x00, 0x01, 0xFF, 0x00, 0x01, 0xFF, 0x00,
287 void *
data,
int *got_frame,
290 int TL[4] = { 128, 128, 128, 128 };
291 int L[4] = { 128, 128, 128, 128 };
295 int ret, x, y, toffset, boffset;
300 if (avpkt->
size <= 16)
308 if (toffset < 16 || toffset >= avpkt->
size)
312 if (toffset >= boffset || boffset >= avpkt->
size)
327 (boffset - toffset + 3) >> 2);
331 for (x = 0; x < 1024; x++) {
360 (avpkt->
size - boffset) >> 2);
365 for (y = 0; y < avctx->
height; y++) {
366 memset(dst, 0, avctx->
width * 2);
371 for (y = 0; y < avctx->
height; y++) {
372 for (x = 0; x < avctx->
width * 2 && y < avctx->
height;) {
380 }
else if (val < 0xE1) {
387 int incr = (val - 0xDF) * 4;
388 if (x + incr >= avctx->
width * 2) {
389 int iy = ((x + incr) / (avctx->
width * 2));
390 x = (x + incr) % (avctx->
width * 2);
404 if (y1 < 0 || y2 < 0 || u < 0 || v < 0)
408 dst[x + 2] = y1 + y2;
417 for (x = 0; x < avctx->
width * 2; x += 4) {
418 dst[x ] = dst[x ] + L[0];
419 dst[x + 2] = L[0] = dst[x + 2] + L[0];
420 L[1] = dst[x + 1] + L[1];
422 L[2] = dst[x + 3] + L[2];
427 for (y = 1; y < avctx->
height; y++) {
429 dst[x ] = dst[x ] + L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
430 dst[x + 2] = L[0] = dst[x + 2] + L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
431 TL[0] = dst[x + 2 - p->
linesize[0]];
432 L[1] = dst[x + 1] + L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
434 TL[1] = dst[x + 1 - p->
linesize[0]];
435 L[2] = dst[x + 3] + L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
437 TL[2] = dst[x + 3 - p->
linesize[0]];
438 for (x = 4; x < avctx->
width * 2; x += 4) {
439 dst[x ] = dst[x ] + L[0] + dst[x + 0 - p->
linesize[0]] - TL[0];
440 dst[x + 2] = L[0] = dst[x + 2] + L[0] + dst[x + 2 - p->
linesize[0]] - TL[0];
441 TL[0] = dst[x + 2 - p->
linesize[0]];
442 L[1] = dst[x + 1] + L[1] + dst[x + 1 - p->
linesize[0]] - TL[1];
444 TL[1] = dst[x + 1 - p->
linesize[0]];
445 L[2] = dst[x + 3] + L[2] + dst[x + 3 - p->
linesize[0]] - TL[2];
447 TL[2] = dst[x + 3 - p->
linesize[0]];
#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 void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static const uint8_t table_v[]
#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(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
Multithreading support functions.
#define u(width, name, range_min, range_max)
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)
#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.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in AVCodec caps_internal and use ff_thread_get_buffer() to allocate frames.The frames must then be freed with ff_thread_release_buffer().Otherwise decode directly into the user-supplied frames.Call ff_thread_report_progress() after some part of the current picture has decoded.A good place to put this is where draw_horiz_band() is called-add this if it isn't called anywhere
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)
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
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
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
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.
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.
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
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
#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)
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.