38 #define SMKTREE_BITS 9 39 #define SMK_NODE 0x80000000 41 #define SMKTREE_DECODE_MAX_RECURSION FFMIN(32, 3 * SMKTREE_BITS) 42 #define SMKTREE_DECODE_BIG_MAX_RECURSION 500 48 #if (6 * SMKTREE_BITS + 1 + 3 + (2 + 3 * 16) + 64) <= 8 * AV_INPUT_BUFFER_PADDING_SIZE 49 #define UNCHECKED_BITSTREAM_READER 1 51 #define BITSTREAM_READER_LE 90 1, 2, 3, 4, 5, 6, 7, 8,
91 9, 10, 11, 12, 13, 14, 15, 16,
92 17, 18, 19, 20, 21, 22, 23, 24,
93 25, 26, 27, 28, 29, 30, 31, 32,
94 33, 34, 35, 36, 37, 38, 39, 40,
95 41, 42, 43, 44, 45, 46, 47, 48,
96 49, 50, 51, 52, 53, 54, 55, 56,
97 57, 58, 59, 128, 256, 512, 1024, 2048 };
162 val = i1 | (i2 << 8);
166 }
else if(val == ctx->
escapes[1]) {
169 }
else if(val == ctx->
escapes[2]) {
200 VLC vlc[2] = { { 0 } };
205 if(size >= UINT_MAX>>4){
210 for (
int i = 0;
i < 2;
i++) {
240 last[0] = last[1] = last[2] = -1;
248 ctx.
length = (size + 3) >> 2;
267 for (
int i = 0;
i < 2;
i++) {
276 int mmap_size, mclr_size, full_size, type_size,
ret;
347 recode[last[0]] = recode[last[1]] = recode[last[2]] = 0;
353 register int *
table = recode;
360 table += (*table) & (~SMK_NODE);
365 if(v != recode[last[0]]) {
366 recode[last[2]] = recode[last[1]];
367 recode[last[1]] = recode[last[0]];
381 int blocks,
blk, bw, bh;
386 if (avpkt->
size <= 769)
393 pal = (uint32_t*)smk->
pic->
data[1];
395 flags = bytestream2_get_byteu(&gb2);
403 for(i = 0; i < 256; i++)
404 *pal++ = 0xFFU << 24 | bytestream2_get_be24u(&gb2);
414 bw = avctx->
width >> 2;
418 while(blk < blocks) {
428 while(run-- && blk < blocks){
433 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
436 for(i = 0; i < 4; i++) {
437 if(map & 1) out[0] = hi;
else out[0] = lo;
438 if(map & 2) out[1] = hi;
else out[1] = lo;
439 if(map & 4) out[2] = hi;
else out[2] = lo;
440 if(map & 8) out[3] = hi;
else out[3] = lo;
455 while(run-- && blk < blocks){
456 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
459 for(i = 0; i < 4; i++) {
469 out[0] = out[1] = pix & 0xFF;
470 out[2] = out[3] = pix >> 8;
472 out[0] = out[1] = pix & 0xFF;
473 out[2] = out[3] = pix >> 8;
476 out[0] = out[1] = pix & 0xFF;
477 out[2] = out[3] = pix >> 8;
479 out[0] = out[1] = pix & 0xFF;
480 out[2] = out[3] = pix >> 8;
483 for(i = 0; i < 2; i++) {
500 while(run-- && blk < blocks)
505 while(run-- && blk < blocks){
507 out = smk->
pic->
data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
508 col = mode * 0x01010101
U;
509 for(i = 0; i < 4; i++) {
510 *((uint32_t*)out) = col;
589 int *got_frame_ptr,
AVPacket *avpkt)
593 int buf_size = avpkt->
size;
595 VLC vlc[4] = { { 0 } };
611 if (unp_size > (1
U<<24)) {
626 if (stereo ^ (avctx->
channels != 1)) {
637 if (unp_size % (avctx->
channels * (bits + 1))) {
639 "The buffer does not contain an integer number of samples\n");
644 samples = (int16_t *)frame->
data[0];
645 samples8 = frame->
data[0];
648 for(i = 0; i < (1 << (bits + stereo)); i++) {
669 for(i = stereo; i >= 0; i--)
671 for(i = 0; i <= stereo; i++)
672 *samples++ = pred[i];
673 for(; i < unp_size / 2; i++) {
674 unsigned idx = 2 * (i & stereo);
684 if (vlc[++idx].table)
689 pred[idx / 2] +=
val;
690 *samples++ = pred[idx / 2];
693 for(i = stereo; i >= 0; i--)
695 for(i = 0; i <= stereo; i++)
696 *samples8++ = pred[i];
697 for(; i < unp_size; i++) {
698 unsigned idx = i & stereo;
708 *samples8++ = pred[idx];
716 for(i = 0; i < 4; i++) {
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static const int block_runs[64]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AV_CH_LAYOUT_STEREO
static void error(const char *err)
static av_cold int decode_init(AVCodecContext *avctx)
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...
enum AVSampleFormat sample_fmt
audio sample format
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bits with AV_PIX_FMT_RGB32 palette
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static av_cold int smka_decode_init(AVCodecContext *avctx)
bitstream reader API header.
#define SMKTREE_DECODE_BIG_MAX_RECURSION
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static const uint16_t table[]
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVCodec ff_smacker_decoder
#define SMKTREE_DECODE_MAX_RECURSION
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available...
const char * name
Name of the codec implementation.
uint64_t channel_layout
Audio channel layout.
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Decode Smacker audio data.
audio channel layout utility functions
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
Context used for code reconstructing.
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 values
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_cold int decode_end(AVCodecContext *avctx)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int **recodes, int *last, int size)
Store large tree as FFmpeg's vlc codes.
static const float pred[4]
static int smacker_decode_bigtree(GetBitContext *gb, DBCtx *ctx, int length)
Decode header tree.
#define AV_LOG_INFO
Standard information.
Libavcodec external API header.
AVCodec ff_smackaud_decoder
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.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
int ff_init_vlc_from_lengths(VLC *vlc_arg, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
int palette_has_changed
Tell user application that palette has changed from previous frame.
const VDPAUPixFmtMap * map
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last)
int channels
number of audio channels
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 samples
#define av_malloc_array(a, b)
static int decode_header_trees(SmackVContext *smk)
static av_always_inline void last_reset(int *recode, int *last)
static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, int length)
Decode local frame tree.
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 AV_CH_LAYOUT_MONO
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static double val(void *priv, double ch)
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
mode
Use these values in ebur128_init (or'ed).
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define INIT_VLC_OUTPUT_LE