67 12, 12, 15, 19, 25, 34, 40, 48,
68 12, 12, 18, 22, 27, 44, 47, 46,
69 17, 18, 21, 26, 35, 46, 52, 47,
70 18, 20, 24, 28, 40, 61, 59, 51,
71 20, 24, 32, 43, 50, 72, 72, 63,
72 25, 31, 42, 48, 58, 72, 81, 75,
73 38, 46, 54, 61, 71, 84, 88, 85,
74 50, 61, 65, 68, 79, 78, 86, 91,
78 12, 16, 24, 47, 99, 99, 99, 99,
79 16, 21, 26, 66, 99, 99, 99, 99,
80 24, 26, 56, 99, 99, 99, 99, 99,
81 47, 66, 99, 99, 99, 99, 99, 99,
82 99, 99, 99, 99, 99, 99, 99, 99,
83 99, 99, 99, 99, 99, 99, 99, 99,
84 99, 99, 99, 99, 99, 99, 99, 99,
85 99, 99, 99, 99, 99, 99, 99, 99,
89 0, 1, 8, 9, 16, 2, 3, 10,
90 17, 24, 32, 25, 18, 11, 4, 5,
91 12, 19, 26, 33, 40, 48, 41, 34,
92 27, 20, 13, 6, 7, 14, 21, 28,
93 35, 42, 49, 56, 57, 50, 43, 36,
94 29, 22, 15, 23, 30, 37, 44, 51,
95 58, 59, 52, 45, 38, 31, 39, 46,
96 53, 60, 61, 54, 47, 55, 62, 63,
103 for (
int i = 0;
i < 64;
i++) {
111 const unsigned t0 =
blk[0 * step] +
blk[4 * step];
112 const unsigned t1 =
blk[0 * step] -
blk[4 * step];
113 const unsigned t2 =
blk[2 * step] +
blk[6 * step];
114 const unsigned t3 = ((int)((
blk[2 * step] -
blk[6 * step]) * 362U) >> 8) - t2;
115 const unsigned t4 = t0 + t2;
116 const unsigned t5 = t0 - t2;
117 const unsigned t6 = t1 + t3;
118 const unsigned t7 = t1 - t3;
119 const unsigned t8 =
blk[5 * step] +
blk[3 * step];
120 const unsigned t9 =
blk[5 * step] -
blk[3 * step];
121 const unsigned tA =
blk[1 * step] +
blk[7 * step];
122 const unsigned tB =
blk[1 * step] -
blk[7 * step];
123 const unsigned tC = t8 + tA;
124 const unsigned tD = (int)((tB + t9) * 473U) >> 8;
125 const unsigned tE = (((int)(t9 * -669U) >> 8) - tC) + tD;
126 const unsigned tF = ((int)((tA - t8) * 362U) >> 8) - tE;
127 const unsigned t10 = (((int)(tB * 277U) >> 8) - tD) + tF;
129 blk[0 * step] = t4 + tC;
130 blk[1 * step] = t6 + tE;
131 blk[2 * step] = t7 + tF;
132 blk[3 * step] = t5 - t10;
133 blk[4 * step] = t5 + t10;
134 blk[5 * step] = t7 - tF;
135 blk[6 * step] = t6 - tE;
136 blk[7 * step] = t4 - tC;
141 for (
int i = 0;
i < 8;
i++) {
161 for (
int i = 0;
i < 8;
i++) {
163 for (
int j = 0; j < 8; j++)
171 const uint8_t *
src,
int in_linesize,
int *
block)
173 for (
int i = 0;
i < 8;
i++) {
193 for (
int i = 0;
i < 8;
i++) {
195 for (
int j = 0; j < 8; j++)
205 const unsigned int t0 =
blk[0 * step];
206 const unsigned int t1 =
blk[1 * step];
207 const unsigned int t2 = (int)(t1 * 473U) >> 8;
208 const unsigned int t3 = t2 - t1;
209 const unsigned int t4 = ((int)(t1 * 362U) >> 8) - t3;
210 const unsigned int t5 = (((int)(t1 * 277U) >> 8) - t2) + t4;
212 blk[0 * step] = t1 + t0;
213 blk[1 * step] = t0 + t3;
214 blk[2 * step] = t4 + t0;
215 blk[3 * step] = t0 - t5;
216 blk[4 * step] = t5 + t0;
217 blk[5 * step] = t0 - t4;
218 blk[6 * step] = t0 - t3;
219 blk[7 * step] = t0 - t1;
224 for (
int i = 0;
i < 2;
i++) {
225 if ((
block[0x08 +
i]) == 0) {
238 for (
int i = 0;
i < 8;
i++) {
240 for (
int j = 0; j < 8; j++)
244 for (
int j = 0; j < 8; j++)
253 const uint8_t *
src,
int in_linesize,
256 for (
int i = 0;
i < 2;
i++) {
257 if ((
block[0x08 +
i]) == 0) {
270 for (
int i = 0;
i < 8;
i++) {
272 for (
int j = 0; j < 8; j++)
276 for (
int j = 0; j < 8; j++)
286 const uint8_t *
src,
int in_linesize,
289 for (
int i = 0;
i < 8;
i++) {
290 for (
int j = 0; j < 8; j++)
299 int *
block,
int *pfill,
300 uint8_t *
dst,
int linesize)
307 s->bdsp.fill_block_tab[1](
dst, 128, linesize, 8);
312 block[0] = ((int)((unsigned)pfill[0] * qtab[0]) >> 5) + 128;
313 s->bdsp.fill_block_tab[1](
dst,
block[0], linesize, 8);
319 block[0] = (unsigned)pfill[0] * qtab[0];
328 block[0] = (unsigned)pfill[0] * qtab[0];
329 for (
int i = 1;
i < 64;
i++)
340 int *
block,
int *pfill,
341 uint8_t *
dst,
int linesize,
342 const uint8_t *
src,
int in_linesize)
353 block[0] = (int)((
unsigned)pfill[0] * qtab[0]) >> 5;
360 block[0] = (unsigned)pfill[0] * qtab[0];
369 block[0] = (unsigned)pfill[0] * qtab[0];
370 for (
int i = 1;
i < 64;
i++)
381 memset(coeffs, 0, nb_codes *
sizeof(*coeffs));
383 for (
int i = 0;
i < nb_codes;) {
389 if (x < (1 <<
value) / 2) {
390 x = (1 << (
value - 1)) + (x & ((1 <<
value) - 1 >> 1));
392 x = -(1 << (
value - 1)) - (x & ((1 <<
value) - 1 >> 1));
419 linesize[0] =
frame->linesize[0];
420 linesize[1] =
frame->linesize[0];
421 linesize[2] =
frame->linesize[0];
422 linesize[3] =
frame->linesize[0];
423 linesize[4] =
frame->linesize[1];
424 linesize[5] =
frame->linesize[2];
426 for (
int y = 0; y < avctx->
height; y += 16) {
428 int pfill[3][1] = { {0} };
440 for (
int x = 0; x < avctx->
width; x += 16) {
441 dst[0] =
frame->data[0] + linesize[0] * y + x;
442 dst[1] =
frame->data[0] + linesize[0] * y + x + 8;
443 dst[2] =
frame->data[0] + linesize[0] * (y + 8) + x;
444 dst[3] =
frame->data[0] + linesize[0] * (y + 8) + x + 8;
445 dst[4] =
frame->data[1] + linesize[4] * (y >> 1) + (x >> 1);
446 dst[5] =
frame->data[2] + linesize[5] * (y >> 1) + (x >> 1);
448 for (
int b = 0;
b < 6;
b++) {
453 pfill[(
b >= 4) + (
b >= 5)],
454 dst[
b], linesize[
b]);
471 const int mask_size = ((avctx->
height >> 4) * (avctx->
width >> 4) * 2 + 7) / 8;
485 linesize[0] =
frame->linesize[0];
486 linesize[1] =
frame->linesize[0];
487 linesize[2] =
frame->linesize[0];
488 linesize[3] =
frame->linesize[0];
489 linesize[4] =
frame->linesize[1];
490 linesize[5] =
frame->linesize[2];
509 for (
int y = 0; y < avctx->
height; y += 16) {
511 int pfill[3][1] = { {0} };
532 for (
int x = 0; x < avctx->
width; x += 16) {
543 dst[0] =
frame->data[0] + linesize[0] * y + x;
544 dst[1] =
frame->data[0] + linesize[0] * y + x + 8;
545 dst[2] =
frame->data[0] + linesize[0] * (y + 8) + x;
546 dst[3] =
frame->data[0] + linesize[0] * (y + 8) + x + 8;
547 dst[4] =
frame->data[1] + linesize[4] * (y >> 1) + (x >> 1);
548 dst[5] =
frame->data[2] + linesize[5] * (y >> 1) + (x >> 1);
550 if ((
flags >> (cnt)) & 1) {
561 src[0] = prev->
data[0] + in_linesize[0] * py + px;
562 src[1] = prev->
data[0] + in_linesize[0] * py + px + 8;
563 src[2] = prev->
data[0] + in_linesize[0] * (py + 8) + px;
564 src[3] = prev->
data[0] + in_linesize[0] * (py + 8) + px + 8;
565 src[4] = prev->
data[1] + in_linesize[4] * (py >> 1) + (px >> 1);
566 src[5] = prev->
data[2] + in_linesize[5] * (py >> 1) + (px >> 1);
568 if ((
flags >> (cnt + 4)) & 1) {
569 for (
int b = 0;
b < 6;
b++)
572 for (
int b = 0;
b < 6;
b++) {
577 pfill[(
b >= 4) + (
b >= 5)],
579 src[
b], in_linesize[
b]);
585 for (
int b = 0;
b < 6;
b++) {
590 pfill[(
b >= 4) + (
b >= 5)],
591 dst[
b], linesize[
b]);
619 s->inter_quant =
s->intra_quant +
get_sbits(gb, 8);
628 if (
s->is_inter == 0) {
637 if (!
s->prev_frame->data[0]) {
657 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9,
701 s->mvectors_size = 0;
const uint16_t ff_aanscales[64]
AAN (Arai, Agui and Nakajima) (I)DCT tables.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static av_cold void decode_flush(AVCodecContext *avctx)
const FFCodec ff_mv30_decoder
static av_cold void close(AVCodecParserContext *s)
Libavcodec external API header.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define bytestream2_get_ne16
static const uint8_t cbp_tab[64][2]
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
bitstream reader API header.
static unsigned int get_bits_le(GetBitContext *s, int n)
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_sbits(GetBitContext *s, int n)
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
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...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int8_t mv[256][2]
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
av_cold void ff_blockdsp_init(BlockDSPContext *c)
static const int factor[16]
Macro definitions for various function/variable attributes.
static int ff_thread_once(char *control, void(*routine)(void))
static const uint16_t mask[17]
static av_const int sign_extend(int val, unsigned bits)
Memory handling functions.
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)
static av_cold void decode_flush(AVCodecContext *avctx)
static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame, AVFrame *prev)
static void get_qtable(int16_t *table, int quant, const uint8_t *quant_tab)
static void idct2_1d(int *blk, int step)
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static av_cold int decode_close(AVCodecContext *avctx)
static const uint8_t cbp_bits[]
static void idct_add(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int *block)
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold void init_static_data(void)
static void idct_put(uint8_t *dst, int stride, int *block)
static const uint8_t luma_tab[]
static const uint8_t zigzag[]
static int decode_intra_block(AVCodecContext *avctx, int mode, GetByteContext *gbyte, int16_t *qtab, int *block, int *pfill, uint8_t *dst, int linesize)
static void update_inter_block(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int block)
static int decode_coeffs(GetBitContext *gb, int16_t *coeffs, int nb_codes)
static void idct_1d(unsigned *blk, int step)
static void idct2_put(uint8_t *dst, int stride, int *block)
static void idct2_add(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int *block)
static int decode_inter_block(AVCodecContext *avctx, int mode, GetByteContext *gbyte, int16_t *qtab, int *block, int *pfill, uint8_t *dst, int linesize, const uint8_t *src, int in_linesize)
static const uint8_t chroma_tab[]
@ AVCOL_RANGE_JPEG
Full range content.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const uint16_t table[]
#define FF_ARRAY_ELEMS(a)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This structure stores compressed data.
unsigned int mvectors_size
int16_t interq_tab[2][64]
int16_t intraq_tab[2][64]
#define VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, lens, lens_wrap, syms, syms_wrap, syms_size, offset, flags)
static const uint8_t quant[64]