37 #define CBPLO_VLC_BITS 6 38 #define CBPHI_VLC_BITS 6 39 #define BLKTYPE_VLC_BITS 9 40 #define BLOCK_VLC_BITS 12 68 { 0,-6 }, { 0x01, 6 }, { 0x02, 6 }, { 0x03, 6 }, { 0x00, 4 },
69 { 0x01, 3 }, { 0x02, 3 }, { 0x03, 3 }, { 0x00, 1 },
73 4, 5, 5, 4, 5, 4, 6, 4, 5, 6, 4, 4, 4, 4, 4, 2
77 3, 5, 4, 9, 3, 7, 2, 11, 2, 3, 5, 10, 4, 8, 6, 3
81 { 0,-8 }, { 0x34, 9 }, { 0,-9 }, { 0x14, 9 }, { 0,-9 },
82 { 0x23, 8 }, { 0x13, 8 }, { 0x32, 8 }, { 0x33, 7 }, { 0x22, 7 },
83 { 0x12, 7 }, { 0x21, 7 }, { 0x11, 7 }, { 0x04, 6 }, { 0x30, 6 },
84 { 0x03, 5 }, { 0x20, 4 }, { 0x10, 4 }, { 0x02, 3 }, { 0x01, 3 },
89 0, 0x4082, 0x4003, 0x000B, 0x000A, 0x4E01, 0x4D81, 0x4D01, 0x4C81,
90 0x0482, 0x0402, 0x0382, 0x0302, 0x0282, 0x0183, 0x0103, 0x0084, 0x000C,
91 0x0085, 0x0B81, 0x0C01, 0x4E81, 0x4F01, 0x4F81, 0x5001, 0x0086, 0x0104,
92 0x0203, 0x0283, 0x0303, 0x0502, 0x0C81, 0x0D01, 0x5081, 0x5101, 0x5181,
93 0x5201, 0x5281, 0x5301, 0x5381, 0x5401, 0x0000, 0x0009, 0x0008, 0x4C01,
94 0x4B81, 0x4B01, 0x4A81, 0x4A01, 0x4981, 0x4901, 0x4881, 0x4002, 0x0B01,
95 0x0A81, 0x0A01, 0x0981, 0x0901, 0x0881, 0x0801, 0x0781, 0x0202, 0x0182,
96 0x0007, 0x0006, 0x4801, 0x4781, 0x4701, 0x4681, 0x4601, 0x4581, 0x4501,
97 0x4481, 0x0701, 0x0681, 0x0102, 0x0083, 0x0005, 0x4401, 0x4381, 0x4301,
98 0x4281, 0x0601, 0x0581, 0x0501, 0x0004, 0x4201, 0x4181, 0x4101, 0x4081,
99 0x0481, 0x0401, 0x0381, 0x0301, 0x0082, 0x0003, 0x0281, 0x0201, 0x0181,
100 0x4001, 0x0001, 0x0081, 0x0101, 0x0002,
104 -9, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
105 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
106 12, 12, 12, 7, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
107 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
108 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
109 6, 5, 5, 5, 4, 2, 3, 4, 4,
125 return x ? value : 15 -
value;
133 int i, last,
len, factor2;
135 for (i = !flag; i < 64; i++) {
146 factor2 = value & 0x7F;
147 last = (value >> 14) & 1;
148 len = (value >> 7) & 0x3F;
155 s->
block[
block][scantable[
i]] = offset * (factor2 < 0 ? -1 : 1) + factor * factor2;
160 if (s->
hi == 2 && flag2 && block < 4) {
172 unsigned cbp,
int flag,
int offset,
unsigned flag2)
180 for (i = 0; i < 6; i++) {
188 s->
block[
i][scantable[0]] = x;
191 if (cbp & (1 << (5 - i))) {
221 for (y = 0; y < avctx->
height; y += 16) {
222 for (x = 0; x < avctx->
width; x += 16) {
230 ret =
decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag);
273 for (y = 0; y < avctx->
height; y += 16) {
274 for (x = 0; x < avctx->
width; x += 16) {
276 unsigned cbphi,
cbplo, flag2 = 0;
283 prev->
data[1] + (y >> 1) * prev->
linesize[1] + (x >> 1),
286 prev->
data[2] + (y >> 1) * prev->
linesize[2] + (x >> 1),
295 intra_block = value & 0x07;
296 reverse = intra_block == 3;
303 ret =
decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag2);
322 ret =
decode_blocks(avctx, gb, cbplo | (cbphi << 2), 1, offset, flag2);
330 prev->
data[1] + (y >> 1) * prev->
linesize[1] + (x >> 1),
333 prev->
data[2] + (y >> 1) * prev->
linesize[2] + (x >> 1),
365 if (avpkt->
size <= 32)
374 (uint32_t *)avpkt->
data,
375 (avpkt->
size + 3) >> 2);
383 width = avctx->
width;
386 scaled = avpkt->
data[8];
437 if (avctx->
width != width ||
438 avctx->
height != height) {
501 for (
int i = 0;
i < 64;
i++)
#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.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
#define avpriv_request_sample(...)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
static void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
static int get_sbits(GetBitContext *s, int n)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static const uint16_t block_symbols[]
static int get_cbphi(GetBitContext *gb, int x)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
GLsizei GLboolean const GLfloat * value
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static av_cold void imm4_init_static_data(void)
bitstream reader API header.
static uint32_t reverse(uint32_t num, int bits)
static void decode_flush(AVCodecContext *avctx)
static const uint16_t table[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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. ...
const char * name
Name of the codec implementation.
static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame, AVFrame *prev)
static av_cold int decode_close(AVCodecContext *avctx)
enum AVPictureType pict_type
Picture type of the frame.
static const uint8_t blktype[][2]
int width
picture width / height.
static const uint8_t cbplo[][2]
void(* idct_add)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
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
#define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap,symbols, symbols_wrap, symbols_size,offset, flags, static_size)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
ScanTable intra_scantable
uint8_t idct_permutation[64]
IDCT input permutation.
void(* idct_put)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
#define FF_ARRAY_ELEMS(a)
static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int block, int factor, int flag, int offset, int flag2)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size)
Libavcodec external API header.
static const uint8_t cbphi_codes[]
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.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static int decode_blocks(AVCodecContext *avctx, GetBitContext *gb, unsigned cbp, int flag, int offset, unsigned flag2)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void copy_block16(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const uint8_t cbphi_bits[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
static const uint8_t inter_cb[]
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
static int ff_thread_once(char *control, void(*routine)(void))
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
static const uint8_t block_bits[]
static const uint8_t intra_cb[]
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
This structure stores compressed data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
mode
Use these values in ebur128_init (or'ed).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)