38 #define CBP_VLC_BITS 9 65 12, 12, 15, 19, 25, 34, 40, 48,
66 12, 12, 18, 22, 27, 44, 47, 46,
67 17, 18, 21, 26, 35, 46, 52, 47,
68 18, 20, 24, 28, 40, 61, 59, 51,
69 20, 24, 32, 43, 50, 72, 72, 63,
70 25, 31, 42, 48, 58, 72, 81, 75,
71 38, 46, 54, 61, 71, 84, 88, 85,
72 50, 61, 65, 68, 79, 78, 86, 91,
76 12, 16, 24, 47, 99, 99, 99, 99,
77 16, 21, 26, 66, 99, 99, 99, 99,
78 24, 26, 56, 99, 99, 99, 99, 99,
79 47, 66, 99, 99, 99, 99, 99, 99,
80 99, 99, 99, 99, 99, 99, 99, 99,
81 99, 99, 99, 99, 99, 99, 99, 99,
82 99, 99, 99, 99, 99, 99, 99, 99,
83 99, 99, 99, 99, 99, 99, 99, 99,
87 0, 1, 8, 9, 16, 2, 3, 10,
88 17, 24, 32, 25, 18, 11, 4, 5,
89 12, 19, 26, 33, 40, 48, 41, 34,
90 27, 20, 13, 6, 7, 14, 21, 28,
91 35, 42, 49, 56, 57, 50, 43, 36,
92 29, 22, 15, 23, 30, 37, 44, 51,
93 58, 59, 52, 45, 38, 31, 39, 46,
94 53, 60, 61, 54, 47, 55, 62, 63,
99 int factor = quant < 50 ? 5000 /
FFMAX(quant, 1) : 200 -
FFMIN(quant, 100) * 2;
101 for (
int i = 0;
i < 64;
i++) {
102 table[
i] = av_clip((quant_tab[
i] * factor + 0x32) / 100, 1, 0x7fff);
109 const unsigned t0 = blk[0 *
step] + blk[4 *
step];
110 const unsigned t1 = blk[0 *
step] - blk[4 *
step];
111 const unsigned t2 = blk[2 *
step] + blk[6 *
step];
112 const unsigned t3 = ((
int)((blk[2 * step] - blk[6 * step]) * 362
U) >> 8) -
t2;
113 const unsigned t4 = t0 +
t2;
114 const unsigned t5 = t0 -
t2;
115 const unsigned t6 = t1 +
t3;
116 const unsigned t7 = t1 -
t3;
117 const unsigned t8 = blk[5 *
step] + blk[3 *
step];
118 const unsigned t9 = blk[5 *
step] - blk[3 *
step];
119 const unsigned tA = blk[1 *
step] + blk[7 *
step];
120 const unsigned tB = blk[1 *
step] - blk[7 *
step];
121 const unsigned tC = t8 + tA;
122 const unsigned tD = (
int)((tB + t9) * 473
U) >> 8;
123 const unsigned tE = (((
int)(t9 * -669
U) >> 8) - tC) + tD;
124 const unsigned tF = ((
int)((tA - t8) * 362
U) >> 8) - tE;
125 const unsigned t10 = (((
int)(tB * 277
U) >> 8) - tD) + tF;
127 blk[0 *
step] = t4 + tC;
128 blk[1 *
step] = t6 + tE;
129 blk[2 *
step] = t7 + tF;
132 blk[5 *
step] = t7 - tF;
133 blk[6 *
step] = t6 - tE;
134 blk[7 *
step] = t4 - tC;
139 for (
int i = 0;
i < 8;
i++) {
140 if ((block[0x08 +
i] |
146 block[0x38 +
i]) == 0) {
147 block[0x08 +
i] = block[
i];
148 block[0x10 +
i] = block[
i];
149 block[0x18 +
i] = block[
i];
150 block[0x20 +
i] = block[
i];
151 block[0x28 +
i] = block[
i];
152 block[0x30 +
i] = block[
i];
153 block[0x38 +
i] = block[
i];
159 for (
int i = 0;
i < 8;
i++) {
161 for (
int j = 0; j < 8; j++)
162 dst[j] = av_clip_uint8((block[j] >> 5) + 128);
171 for (
int i = 0;
i < 8;
i++) {
172 if ((block[0x08 +
i] |
178 block[0x38 +
i]) == 0) {
179 block[0x08 +
i] = block[
i];
180 block[0x10 +
i] = block[
i];
181 block[0x18 +
i] = block[
i];
182 block[0x20 +
i] = block[
i];
183 block[0x28 +
i] = block[
i];
184 block[0x30 +
i] = block[
i];
185 block[0x38 +
i] = block[
i];
191 for (
int i = 0;
i < 8;
i++) {
193 for (
int j = 0; j < 8; j++)
194 dst[j] = av_clip_uint8((block[j] >> 5) + src[j]);
203 const unsigned int t0 = blk[0 *
step];
204 const unsigned int t1 = blk[1 *
step];
205 const unsigned int t2 = (
int)(t1 * 473
U) >> 8;
206 const unsigned int t3 = t2 -
t1;
207 const unsigned int t4 = ((
int)(t1 * 362U) >> 8) - t3;
208 const unsigned int t5 = (((
int)(t1 * 277U) >> 8) - t2) +
t4;
222 for (
int i = 0;
i < 2;
i++) {
223 if ((block[0x08 +
i]) == 0) {
224 block[0x08 +
i] = block[
i];
225 block[0x10 +
i] = block[
i];
226 block[0x18 +
i] = block[
i];
227 block[0x20 +
i] = block[
i];
228 block[0x28 +
i] = block[
i];
229 block[0x30 +
i] = block[
i];
230 block[0x38 +
i] = block[
i];
236 for (
int i = 0;
i < 8;
i++) {
238 for (
int j = 0; j < 8; j++)
239 dst[j] = av_clip_uint8((block[0] >> 5) + 128);
242 for (
int j = 0; j < 8; j++)
243 dst[j] = av_clip_uint8((block[j] >> 5) + 128);
254 for (
int i = 0;
i < 2;
i++) {
255 if ((block[0x08 +
i]) == 0) {
256 block[0x08 +
i] = block[
i];
257 block[0x10 +
i] = block[
i];
258 block[0x18 +
i] = block[
i];
259 block[0x20 +
i] = block[
i];
260 block[0x28 +
i] = block[
i];
261 block[0x30 +
i] = block[
i];
262 block[0x38 +
i] = block[
i];
268 for (
int i = 0;
i < 8;
i++) {
270 for (
int j = 0; j < 8; j++)
271 dst[j] = av_clip_uint8((block[0] >> 5) + src[j]);
274 for (
int j = 0; j < 8; j++)
275 dst[j] = av_clip_uint8((block[j] >> 5) + src[j]);
287 for (
int i = 0;
i < 8;
i++) {
288 for (
int j = 0; j < 8; j++)
289 dst[j] = av_clip_uint8(block + src[j]);
297 int *
block,
int *pfill,
310 block[0] = ((
int)((
unsigned)pfill[0] * qtab[0]) >> 5) + 128;
314 memset(block, 0,
sizeof(*block) * 64);
317 block[0] = (unsigned)pfill[0] * qtab[0];
326 block[0] = (unsigned)pfill[0] * qtab[0];
327 for (
int i = 1;
i < 64;
i++)
338 int *
block,
int *pfill,
351 block[0] = (
int)((
unsigned)pfill[0] * qtab[0]) >> 5;
355 memset(block, 0,
sizeof(*block) * 64);
358 block[0] = (unsigned)pfill[0] * qtab[0];
362 idct2_add(dst, linesize, src, in_linesize, block);
367 block[0] = (unsigned)pfill[0] * qtab[0];
368 for (
int i = 1;
i < 64;
i++)
370 idct_add(dst, linesize, src, in_linesize, block);
379 memset(coeffs, 0, nb_codes *
sizeof(*coeffs));
381 for (
int i = 0;
i < nb_codes;) {
387 if (x < (1 << value) / 2) {
388 x = (1 << (value - 1)) + (x & ((1 <<
value) - 1 >> 1));
390 x = -(1 << (value - 1)) - (x & ((1 <<
value) - 1 >> 1));
396 i +=
get_bits(gb, 3 + flag * 3) + 1 + flag * 8;
424 for (
int y = 0; y < avctx->
height; y += 16) {
426 int pfill[3][1] = { {0} };
438 for (
int x = 0; x < avctx->
width; x += 16) {
439 dst[0] = frame->
data[0] + linesize[0] * y + x;
440 dst[1] = frame->
data[0] + linesize[0] * y + x + 8;
441 dst[2] = frame->
data[0] + linesize[0] * (y + 8) + x;
442 dst[3] = frame->
data[0] + linesize[0] * (y + 8) + x + 8;
443 dst[4] = frame->
data[1] + linesize[4] * (y >> 1) + (x >> 1);
444 dst[5] = frame->
data[2] + linesize[5] * (y >> 1) + (x >> 1);
446 for (
int b = 0;
b < 6;
b++) {
451 pfill[(
b >= 4) + (
b >= 5)],
452 dst[
b], linesize[b]);
469 const int mask_size = ((avctx->
height >> 4) * (avctx->
width >> 4) * 2 + 7) / 8;
507 for (
int y = 0; y < avctx->
height; y += 16) {
509 int pfill[3][1] = { {0} };
530 for (
int x = 0; x < avctx->
width; x += 16) {
541 dst[0] = frame->
data[0] + linesize[0] * y + x;
542 dst[1] = frame->
data[0] + linesize[0] * y + x + 8;
543 dst[2] = frame->
data[0] + linesize[0] * (y + 8) + x;
544 dst[3] = frame->
data[0] + linesize[0] * (y + 8) + x + 8;
545 dst[4] = frame->
data[1] + linesize[4] * (y >> 1) + (x >> 1);
546 dst[5] = frame->
data[2] + linesize[5] * (y >> 1) + (x >> 1);
548 if ((flags >> (cnt)) & 1) {
559 src[0] = prev->
data[0] + in_linesize[0] * py + px;
560 src[1] = prev->
data[0] + in_linesize[0] * py + px + 8;
561 src[2] = prev->
data[0] + in_linesize[0] * (py + 8) + px;
562 src[3] = prev->
data[0] + in_linesize[0] * (py + 8) + px + 8;
563 src[4] = prev->
data[1] + in_linesize[4] * (py >> 1) + (px >> 1);
564 src[5] = prev->
data[2] + in_linesize[5] * (py >> 1) + (px >> 1);
566 if ((flags >> (cnt + 4)) & 1) {
567 for (
int b = 0;
b < 6;
b++)
568 copy_block8(dst[
b], src[b], linesize[b], in_linesize[b], 8);
570 for (
int b = 0;
b < 6;
b++) {
575 pfill[(
b >= 4) + (
b >= 5)],
577 src[b], in_linesize[b]);
583 for (
int b = 0;
b < 6;
b++) {
588 pfill[(
b >= 4) + (
b >= 5)],
589 dst[
b], linesize[b]);
657 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9,
#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.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint8_t cbp_bits[]
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.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
static const uint8_t zigzag[]
enum AVColorRange color_range
MPEG vs JPEG YUV range.
av_cold void ff_blockdsp_init(BlockDSPContext *c, 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)
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 idct_add(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int *block)
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)
#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.
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.
static void idct_1d(unsigned *blk, int step)
int16_t interq_tab[2][64]
const uint16_t ff_aanscales[64]
bitstream reader API header.
static void idct2_add(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int *block)
static const uint16_t table[]
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define bytestream2_get_ne16
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void idct_put(uint8_t *dst, int stride, int *block)
const char * name
Name of the codec implementation.
int16_t intraq_tab[2][64]
static int decode_coeffs(GetBitContext *gb, int16_t *coeffs, int nb_codes)
static av_cold int decode_init(AVCodecContext *avctx)
static void get_qtable(int16_t *table, int quant, const uint8_t *quant_tab)
unsigned int mvectors_size
int width
picture width / height.
static av_cold void init_static_data(void)
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.
static const uint8_t chroma_tab[]
#define FF_ARRAY_ELEMS(a)
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 int8_t mv[256][2]
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.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int decode_intra_block(AVCodecContext *avctx, int mode, GetByteContext *gbyte, int16_t *qtab, int *block, int *pfill, uint8_t *dst, int linesize)
static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame, AVFrame *prev)
static const int factor[16]
static av_const int sign_extend(int val, unsigned bits)
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
#define flags(name, subs,...)
static unsigned int get_bits_le(GetBitContext *s, int n)
AAN (Arai, Agui and Nakajima) (I)DCT tables.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void decode_flush(AVCodecContext *avctx)
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void idct2_1d(int *blk, int step)
common internal api header.
static av_cold int decode_close(AVCodecContext *avctx)
static void update_inter_block(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int block)
static const uint8_t luma_tab[]
static void idct2_put(uint8_t *dst, int stride, int *block)
static int ff_thread_once(char *control, void(*routine)(void))
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)
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.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
op_fill_func fill_block_tab[2]