128 int8_t intra4x4_pred_mode_cache[5 * 8];
129 int8_t (*intra4x4_pred_mode);
143 int block_offset[2 * (16 * 3)];
147 #define FULLPEL_MODE 1 148 #define HALFPEL_MODE 2 149 #define THIRDPEL_MODE 3 150 #define PREDICT_MODE 4 162 0 + 0 * 4, 1 + 0 * 4, 2 + 0 * 4, 2 + 1 * 4,
163 2 + 2 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4,
164 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 1 + 2 * 4,
165 0 + 3 * 4, 1 + 3 * 4, 2 + 3 * 4, 3 + 3 * 4,
169 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64,
170 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64,
171 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64,
172 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64,
178 { 0, 2 }, { 1, 1 }, { 2, 0 },
179 { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
180 { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
181 { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
182 { 2, 4 }, { 3, 3 }, { 4, 2 },
188 { { 2, -1, -1, -1, -1 }, { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 },
189 { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 }, { 1, 2, -1, -1, -1 } },
190 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
191 { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
192 { { 2, 0, -1, -1, -1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
193 { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
194 { { 2, 0, -1, -1, -1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
195 { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
196 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
197 { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
198 { { 0, 2, -1, -1, -1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
199 { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
202 static const struct {
206 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
207 { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
208 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
209 { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
213 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
214 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
215 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
216 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
227 for (i = 0; i < 4; i++) {
228 const int z0 = 13 * (input[4 * i + 0] + input[4 * i + 2]);
229 const int z1 = 13 * (input[4 * i + 0] - input[4 * i + 2]);
230 const int z2 = 7 * input[4 * i + 1] - 17 * input[4 * i + 3];
231 const int z3 = 17 * input[4 * i + 1] + 7 * input[4 * i + 3];
233 temp[4 * i + 0] = z0 + z3;
234 temp[4 * i + 1] = z1 + z2;
235 temp[4 * i + 2] = z1 - z2;
236 temp[4 * i + 3] = z0 - z3;
239 for (i = 0; i < 4; i++) {
240 const int offset = x_offset[
i];
241 const int z0 = 13 * (temp[4 * 0 +
i] + temp[4 * 2 +
i]);
242 const int z1 = 13 * (temp[4 * 0 +
i] - temp[4 * 2 +
i]);
243 const int z2 = 7 * temp[4 * 1 +
i] - 17 * temp[4 * 3 +
i];
244 const int z3 = 17 * temp[4 * 1 +
i] + 7 * temp[4 * 3 +
i];
246 output[stride * 0 +
offset] = (
int)((z0 + z3) * qmul + 0x80000) >> 20;
247 output[stride * 2 +
offset] = (
int)((z1 + z2) * qmul + 0x80000) >> 20;
248 output[stride * 8 +
offset] = (
int)((z1 - z2) * qmul + 0x80000) >> 20;
249 output[stride * 10 +
offset] = (
int)((z0 - z3) * qmul + 0x80000) >> 20;
261 dc = 13 * 13 * (dc == 1 ? 1538
U* block[0]
262 : qmul * (block[0] >> 3) / 2);
266 for (i = 0; i < 4; i++) {
267 const int z0 = 13 * (block[0 + 4 *
i] + block[2 + 4 *
i]);
268 const int z1 = 13 * (block[0 + 4 *
i] - block[2 + 4 *
i]);
269 const int z2 = 7 * block[1 + 4 *
i] - 17 * block[3 + 4 *
i];
270 const int z3 = 17 * block[1 + 4 *
i] + 7 * block[3 + 4 *
i];
272 block[0 + 4 *
i] = z0 + z3;
273 block[1 + 4 *
i] = z1 + z2;
274 block[2 + 4 *
i] = z1 - z2;
275 block[3 + 4 *
i] = z0 - z3;
278 for (i = 0; i < 4; i++) {
279 const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
280 const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
281 const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
282 const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
283 const int rr = (dc + 0x80000
u);
285 dst[i + stride * 0] =
av_clip_uint8(dst[i + stride * 0] + ((
int)((z0 + z3) * qmul + rr) >> 20));
286 dst[i + stride * 1] =
av_clip_uint8(dst[i + stride * 1] + ((
int)((z1 + z2) * qmul + rr) >> 20));
287 dst[i + stride * 2] =
av_clip_uint8(dst[i + stride * 2] + ((
int)((z1 - z2) * qmul + rr) >> 20));
288 dst[i + stride * 3] =
av_clip_uint8(dst[i + stride * 3] + ((
int)((z0 - z3) * qmul + rr) >> 20));
291 memset(block, 0, 16 *
sizeof(int16_t));
297 static const uint8_t *
const scan_patterns[4] = {
303 const int intra = 3 * type >> 2;
306 for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
311 sign = (vlc & 1) ? 0 : -1;
318 }
else if (vlc < 4) {
323 level = (vlc + 9 >> 2) - run;
331 level = (vlc >> 3) + ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
334 level = (vlc >> 4) + ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
339 if ((index += run) >= limit)
342 block[scan[
index]] = (level ^ sign) - sign;
355 int i,
int list,
int part_width)
357 const int topright_ref = s->
ref_cache[
list][i - 8 + part_width];
376 int part_width,
int list,
377 int ref,
int *
const mx,
int *
const my)
379 const int index8 =
scan8[n];
385 int diagonal_ref, match_count;
396 match_count = (diagonal_ref ==
ref) + (top_ref == ref) + (left_ref ==
ref);
397 if (match_count > 1) {
400 }
else if (match_count == 1) {
401 if (left_ref == ref) {
404 }
else if (top_ref == ref) {
426 int mx,
int my,
int dxy,
427 int thirdpel,
int dir,
int avg)
432 int blocksize = 2 - (width >> 3);
439 if (mx < 0 || mx >= s->
h_edge_pos - width - 1 ||
448 src = pic->
f->
data[0] + mx + my * linesize;
453 width + 1, height + 1,
467 mx = mx + (mx < (int) x) >> 1;
468 my = my + (my < (int) y) >> 1;
470 height = height >> 1;
473 for (i = 1; i < 3; i++) {
474 dest = s->
cur_pic->
f->
data[
i] + (x >> 1) + (y >> 1) * uvlinesize;
475 src = pic->
f->
data[
i] + mx + my * uvlinesize;
479 uvlinesize, uvlinesize,
480 width + 1, height + 1,
502 int i, j, k, mx, my, dx, dy, x, y;
503 const int part_width = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
504 const int part_height = 16 >> ((unsigned)(size + 1) / 3);
505 const int extra_width = (mode ==
PREDICT_MODE) ? -16 * 6 : 0;
506 const int h_edge_pos = 6 * (s->
h_edge_pos - part_width) - extra_width;
507 const int v_edge_pos = 6 * (s->
v_edge_pos - part_height) - extra_width;
509 for (i = 0; i < 16; i += part_height)
510 for (j = 0; j < 16; j += part_width) {
511 const int b_xy = (4 * s->
mb_x + (j >> 2)) +
514 x = 16 * s->
mb_x + j;
515 y = 16 * s->
mb_y +
i;
516 k = (j >> 2 & 1) + (i >> 1 & 2) +
517 (j >> 1 & 4) + (i & 8);
539 mx =
av_clip(mx, extra_width - 6 * x, h_edge_pos - 6 * x);
540 my =
av_clip(my, extra_width - 6 * y, v_edge_pos - 6 * y);
549 if (dx != (int16_t)dx || dy != (int16_t)dy) {
558 mx = (mx + 1 >> 1) + dx;
559 my = (my + 1 >> 1) + dy;
560 fx = (unsigned)(mx + 0x30000) / 3 - 0x10000;
561 fy = (unsigned)(my + 0x30000) / 3 - 0x10000;
562 dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
565 fx, fy, dxy, 1, dir, avg);
569 mx = (unsigned)(mx + 1 + 0x30000) / 3 + dx - 0x10000;
570 my = (unsigned)(my + 1 + 0x30000) / 3 + dy - 0x10000;
571 dxy = (mx & 1) + 2 * (my & 1);
574 mx >> 1, my >> 1, dxy, 0, dir, avg);
578 mx = (unsigned)(mx + 3 + 0x60000) / 6 + dx - 0x10000;
579 my = (unsigned)(my + 3 + 0x60000) / 6 + dy - 0x10000;
582 mx, my, 0, 0, dir, avg);
591 if (part_height == 8 && i < 8) {
594 if (part_width == 8 && j < 8)
597 if (part_width == 8 && j < 8)
599 if (part_width == 4 || part_height == 4)
605 part_width >> 2, part_height >> 2, s->
b_stride,
613 int mb_type,
const int *block_offset,
618 for (i = 0; i < 16; i++)
620 uint8_t *
const ptr = dest_y + block_offset[
i];
629 const int *block_offset,
637 for (i = 0; i < 16; i++) {
638 uint8_t *
const ptr = dest_y + block_offset[
i];
646 if (!topright_avail) {
647 tr = ptr[3 - linesize] * 0x01010101
u;
650 topright = ptr + 4 - linesize;
668 const int mb_x = s->
mb_x;
669 const int mb_y = s->
mb_y;
670 const int mb_xy = s->
mb_xy;
672 uint8_t *dest_y, *dest_cb, *dest_cr;
673 int linesize, uvlinesize;
676 const int block_h = 16 >> 1;
681 dest_y = s->
cur_pic->
f->
data[0] + (mb_x + mb_y * linesize) * 16;
682 dest_cb = s->
cur_pic->
f->
data[1] + mb_x * 8 + mb_y * uvlinesize * block_h;
683 dest_cr = s->
cur_pic->
f->
data[2] + mb_x * 8 + mb_y * uvlinesize * block_h;
686 s->
vdsp.
prefetch(dest_cb + (s->
mb_x & 7) * uvlinesize + 64, dest_cr - dest_cb, 2);
698 uint8_t *dest[2] = { dest_cb, dest_cr };
703 for (j = 1; j < 3; j++) {
704 for (i = j * 16; i < j * 16 + 4; i++)
706 uint8_t *
const ptr = dest[j - 1] + block_offset[
i];
716 int i, j, k, m, dir,
mode;
720 const int mb_xy = s->
mb_xy;
747 }
else if (mb_type < 8) {
765 for (m = 0; m < 2; m++) {
767 for (i = 0; i < 4; i++)
771 for (i = 0; i < 4; i++)
777 4 * 2 *
sizeof(int16_t));
813 for (i = 0; i < 4; i++)
815 0, 4 * 2 *
sizeof(int16_t));
821 for (i = 0; i < 4; i++)
823 0, 4 * 2 *
sizeof(int16_t));
828 }
else if (mb_type == 8 || mb_type == 33) {
836 for (i = 0; i < 4; i++)
852 for (i = 0; i < 16; i += 2) {
857 "luma prediction:%"PRIu32
"\n", vlc);
865 left[2] =
svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
867 if (left[1] == -1 || left[2] == -1) {
873 for (i = 0; i < 4; i++)
878 i4x4[4] = i4x4_cache[7 + 8 * 3];
879 i4x4[5] = i4x4_cache[7 + 8 * 2];
880 i4x4[6] = i4x4_cache[7 + 8 * 1];
890 for (i = 0; i < 4; i++)
900 dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
913 for (i = 0; i < 4; i++)
915 0, 4 * 2 *
sizeof(int16_t));
917 for (i = 0; i < 4; i++)
919 0, 4 * 2 *
sizeof(int16_t));
953 "error while decoding intra luma dc\n");
962 for (i = 0; i < 4; i++)
963 if ((cbp & (1 << i))) {
964 for (j = 0; j < 4; j++) {
965 k = index ? (1 * (j & 1) + 2 * (i & 1) +
966 2 * (j & 2) + 4 * (i & 2))
972 "error while decoding block\n");
979 for (i = 1; i < 3; ++
i)
982 "error while decoding chroma dc block\n");
987 for (i = 1; i < 3; i++) {
988 for (j = 0; j < 4; j++) {
994 "error while decoding chroma ac block\n");
1016 const int mb_xy = s->
mb_xy;
1022 if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
1027 int slice_bits, slice_bytes, slice_length;
1028 int length = header >> 5 & 3;
1031 slice_bits = slice_length * 8;
1032 slice_bytes = slice_length + length - 1;
1065 if ((header & 0x9F) == 2) {
1092 -1, 4 *
sizeof(int8_t));
1094 -1, 8 *
sizeof(int8_t) * s->
mb_x);
1110 const int max_qp = 51;
1112 for (q = 0; q < max_qp + 1; q++) {
1115 for (x = 0; x < 16; x++)
1125 unsigned char *extradata;
1126 unsigned char *extradata_end;
1128 int marker_found = 0;
1160 extradata = (
unsigned char *)avctx->
extradata;
1164 if (!memcmp(extradata,
"SEQH", 4)) {
1175 int frame_size_code;
1176 int unk0, unk1, unk2, unk3, unk4;
1179 size =
AV_RB32(&extradata[4]);
1180 if (size > extradata_end - extradata - 8)
1185 frame_size_code =
get_bits(&gb, 3);
1186 switch (frame_size_code) {
1239 unk0, unk1, unk2, unk3, unk4);
1254 unsigned long buf_len = watermark_width *
1255 watermark_height * 4;
1259 if (watermark_height <= 0 ||
1260 (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
1268 watermark_width, watermark_height);
1270 "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
1271 u1, u2, u3, u4, offset);
1272 if (uncompress(buf, &buf_len, extradata + 8 + offset,
1273 size - offset) != Z_OK) {
1275 "could not uncompress watermark logo\n");
1287 "this svq3 file contains watermark which need zlib support compiled in\n");
1311 for (x = 0; x < s->
mb_width; x++) {
1325 for (i = 0; i < 2; i++) {
1337 const int b4_stride = s->
mb_width * 4 + 1;
1338 const int b4_array_size = b4_stride * s->
mb_height * 4;
1349 for (i = 0; i < 2; i++) {
1382 int buf_size = avpkt->
size;
1387 if (buf_size == 0) {
1422 for (i = 0; i < 16; i++) {
1426 for (i = 0; i < 16; i++) {
1463 "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
1499 for (m = 0; m < 2; m++) {
1501 for (i = 0; i < 4; i++) {
1503 for (j = -1; j < 4; j++)
1536 "error while decoding MB %d %d\n", s->
mb_x, s->
mb_y);
1540 if (mb_type != 0 || s->
cbp)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
discard all frames except keyframes
void(* h264_chroma_dc_dequant_idct)(int16_t *block, int qmul)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int svq3_decode_block(GetBitContext *gb, int16_t *block, int index, const int type)
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)
static av_always_inline void svq3_pred_motion(const SVQ3Context *s, int n, int part_width, int list, int ref, int *const mx, int *const my)
Get the predicted MV.
#define avpriv_request_sample(...)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, int chroma_format_idc)
Set the intra prediction function pointers.
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...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const uint8_t ff_h264_quant_rem6[QP_MAX_NUM+1]
void(* prefetch)(uint8_t *buf, ptrdiff_t stride, int h)
Prefetch memory into cache (if supported by hardware).
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
if it could not because there are no more frames
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Macro definitions for various function/variable attributes.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static int svq3_mc_dir(SVQ3Context *s, int size, int mode, int dir, int avg)
enum AVDiscard skip_frame
Skip decoding for selected frames.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
void(* emulated_edge_mc)(uint8_t *dst, const uint8_t *src, ptrdiff_t dst_linesize, ptrdiff_t src_linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Copy a rectangular area of samples to a temporary buffer and replicate the border samples...
#define MB_TYPE_INTRA16x16
const uint8_t ff_h264_dequant4_coeff_init[6][3]
static const uint8_t luma_dc_zigzag_scan[16]
The exact code depends on how similar the blocks are and how related they are to the block
static av_always_inline void hl_decode_mb_idct_luma(SVQ3Context *s, int mb_type, const int *block_offset, int linesize, uint8_t *dest_y)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
int block_offset[2 *(16 *3)]
#define FF_DEBUG_PICT_INFO
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
static const struct @134 svq3_dct_tables[2][16]
static av_always_inline int svq3_fetch_diagonal_mv(const SVQ3Context *s, const int16_t **C, int i, int list, int part_width)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
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.
#define u(width, name, range_min, range_max)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
const uint8_t ff_h264_chroma_dc_scan[4]
Context for storing H.264 prediction functions.
void(* pred8x8[4+3+4])(uint8_t *src, ptrdiff_t stride)
Public header for CRC hash function implementation.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static int get_bits_count(const GetBitContext *s)
const IMbInfo ff_h264_i_mb_type_info[26]
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
const uint8_t ff_h264_golomb_to_inter_cbp[48]
int ff_h264_check_intra4x4_pred_mode(int8_t *pred_mode_cache, void *logctx, int top_samples_available, int left_samples_available)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
static const uint8_t header[24]
enum AVPictureType slice_type
void(* pred4x4[9+3+3])(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
int prev_frame_num_offset
static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
int8_t * intra4x4_pred_mode
uint8_t * edge_emu_buffer
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
av_cold void ff_tpeldsp_init(TpelDSPContext *c)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const uint8_t ff_zigzag_scan[16+1]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
static int get_interleaved_se_golomb(GetBitContext *gb)
unsigned int left_samples_available
const char * name
Name of the codec implementation.
const uint8_t ff_h264_golomb_to_pict_type[5]
unsigned int topright_samples_available
Sorenson Vector Quantizer #1 (SVQ1) video codec.
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
useful rectangle filling function
tpel_mc_func avg_tpel_pixels_tab[11]
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
Context for storing H.264 DSP functions.
uint32_t dequant4_coeff[QP_MAX_NUM+1][16]
enum AVPictureType pict_type
Picture type of the frame.
int16_t(*[2] motion_val)[2]
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
int width
picture width / height.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static av_cold int svq3_decode_init(AVCodecContext *avctx)
tpel_mc_func put_tpel_pixels_tab[11]
Thirdpel motion compensation with rounding (a + b + 1) >> 1.
H.264 / AVC / MPEG-4 part10 codec.
static void fill_rectangle(int x, int y, int w, int h)
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static const int8_t mv[256][2]
#define AV_LOG_INFO
Standard information.
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.
const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM+1]
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff)*mv_scale Intra DC Prediction block[y][x] dc[1]
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 list
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
static const uint8_t scan8[16 *3+3]
void(* pred16x16[4+3+2])(uint8_t *src, ptrdiff_t stride)
static unsigned int get_bits1(GetBitContext *s)
const uint8_t ff_h264_golomb_to_intra4x4_cbp[48]
static void skip_bits1(GetBitContext *s)
enum AVPictureType pict_type
const uint8_t ff_h264_quant_div6[QP_MAX_NUM+1]
static void skip_bits(GetBitContext *s, int n)
static av_always_inline uint32_t pack16to32(unsigned a, unsigned b)
static void svq3_mc_dir_part(SVQ3Context *s, int x, int y, int width, int height, int mx, int my, int dxy, int thirdpel, int dir, int avg)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void init_dequant4_coeff_table(SVQ3Context *s)
static av_cold int svq3_decode_end(AVCodecContext *avctx)
int8_t ref_cache[2][5 *8]
static const uint8_t svq3_pred_0[25][2]
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
int16_t(*[2] motion_val_buf)[2]
static enum AVPixelFormat pix_fmts[]
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
static void free_picture(AVCodecContext *avctx, SVQ3Frame *pic)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
discard all non reference
GLint GLenum GLboolean GLsizei stride
static av_always_inline void hl_decode_mb_predict_luma(SVQ3Context *s, int mb_type, const int *block_offset, int linesize, uint8_t *dest_y)
uint8_t non_zero_count_cache[15 *8]
common internal api header.
static int get_buffer(AVCodecContext *avctx, SVQ3Frame *pic)
static int ref[MAX_W *MAX_W]
int ff_h264_check_intra_pred_mode(void *logctx, int top_samples_available, int left_samples_available, int mode, int is_chroma)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
int16_t mb_luma_dc[3][16 *2]
static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
static const uint32_t svq3_dequant_coeff[32]
unsigned int top_samples_available
static void hl_decode_mb(SVQ3Context *s)
static int svq3_decode_slice_header(AVCodecContext *avctx)
#define PART_NOT_AVAILABLE
int key_frame
1 -> keyframe, 0-> not
static const uint8_t svq3_scan[16]
int8_t intra4x4_pred_mode_cache[5 *8]
av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
static const int8_t svq3_pred_1[6][6][5]
static void svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc)
int frame_number
Frame counter, set by libavcodec.
static int skip_1stop_8data_bits(GetBitContext *gb)
#define FFSWAP(type, a, b)
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
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
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
AVPixelFormat
Pixel format.
This structure stores compressed data.
static int svq3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#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() or get_encode_buffer() for allocating buffers and supports custom allocators...
void * av_mallocz_array(size_t nmemb, size_t size)
int16_t mv_cache[2][5 *8][2]