134 int8_t intra4x4_pred_mode_cache[5 * 8];
135 int8_t (*intra4x4_pred_mode);
149 int block_offset[2 * (16 * 3)];
153 #define FULLPEL_MODE 1 154 #define HALFPEL_MODE 2 155 #define THIRDPEL_MODE 3 156 #define PREDICT_MODE 4 168 0 + 0 * 4, 1 + 0 * 4, 2 + 0 * 4, 2 + 1 * 4,
169 2 + 2 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4,
170 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 1 + 2 * 4,
171 0 + 3 * 4, 1 + 3 * 4, 2 + 3 * 4, 3 + 3 * 4,
175 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64,
176 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64,
177 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64,
178 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64,
184 { 0, 2 }, { 1, 1 }, { 2, 0 },
185 { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
186 { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
187 { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
188 { 2, 4 }, { 3, 3 }, { 4, 2 },
194 { { 2, -1, -1, -1, -1 }, { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 },
195 { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 }, { 1, 2, -1, -1, -1 } },
196 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
197 { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
198 { { 2, 0, -1, -1, -1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
199 { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
200 { { 2, 0, -1, -1, -1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
201 { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
202 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
203 { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
204 { { 0, 2, -1, -1, -1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
205 { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
208 static const struct {
212 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
213 { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
214 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
215 { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
219 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
220 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
221 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
222 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
235 for (i = 0; i < 4; i++) {
236 const int z0 = 13 * (input[4 * i + 0] + input[4 * i + 2]);
237 const int z1 = 13 * (input[4 * i + 0] - input[4 * i + 2]);
238 const int z2 = 7 * input[4 * i + 1] - 17 * input[4 * i + 3];
239 const int z3 = 17 * input[4 * i + 1] + 7 * input[4 * i + 3];
241 temp[4 * i + 0] = z0 + z3;
242 temp[4 * i + 1] = z1 + z2;
243 temp[4 * i + 2] = z1 - z2;
244 temp[4 * i + 3] = z0 - z3;
247 for (i = 0; i < 4; i++) {
248 const int offset = x_offset[
i];
249 const int z0 = 13 * (temp[4 * 0 +
i] + temp[4 * 2 +
i]);
250 const int z1 = 13 * (temp[4 * 0 +
i] - temp[4 * 2 +
i]);
251 const int z2 = 7 * temp[4 * 1 +
i] - 17 * temp[4 * 3 +
i];
252 const int z3 = 17 * temp[4 * 1 +
i] + 7 * temp[4 * 3 +
i];
254 output[stride * 0 +
offset] = (
int)((z0 + z3) * qmul + 0x80000) >> 20;
255 output[stride * 2 +
offset] = (
int)((z1 + z2) * qmul + 0x80000) >> 20;
256 output[stride * 8 +
offset] = (
int)((z1 - z2) * qmul + 0x80000) >> 20;
257 output[stride * 10 +
offset] = (
int)((z0 - z3) * qmul + 0x80000) >> 20;
269 dc = 13 * 13 * (dc == 1 ? 1538
U* block[0]
270 : qmul * (block[0] >> 3) / 2);
274 for (i = 0; i < 4; i++) {
275 const int z0 = 13 * (block[0 + 4 *
i] + block[2 + 4 *
i]);
276 const int z1 = 13 * (block[0 + 4 *
i] - block[2 + 4 *
i]);
277 const int z2 = 7 * block[1 + 4 *
i] - 17 * block[3 + 4 *
i];
278 const int z3 = 17 * block[1 + 4 *
i] + 7 * block[3 + 4 *
i];
280 block[0 + 4 *
i] = z0 + z3;
281 block[1 + 4 *
i] = z1 + z2;
282 block[2 + 4 *
i] = z1 - z2;
283 block[3 + 4 *
i] = z0 - z3;
286 for (i = 0; i < 4; i++) {
287 const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
288 const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
289 const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
290 const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
291 const int rr = (dc + 0x80000
u);
293 dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((
int)((z0 + z3) * qmul + rr) >> 20));
294 dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((
int)((z1 + z2) * qmul + rr) >> 20));
295 dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((
int)((z1 - z2) * qmul + rr) >> 20));
296 dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((
int)((z0 - z3) * qmul + rr) >> 20));
299 memset(block, 0, 16 *
sizeof(int16_t));
305 static const uint8_t *
const scan_patterns[4] = {
311 const int intra = 3 * type >> 2;
314 for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
319 sign = (vlc & 1) ? 0 : -1;
326 }
else if (vlc < 4) {
331 level = (vlc + 9 >> 2) - run;
339 level = (vlc >> 3) + ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
342 level = (vlc >> 4) + ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
347 if ((index += run) >= limit)
350 block[scan[
index]] = (level ^ sign) - sign;
363 int i,
int list,
int part_width)
365 const int topright_ref = s->
ref_cache[list][i - 8 + part_width];
368 *C = s->
mv_cache[list][i - 8 + part_width];
384 int part_width,
int list,
385 int ref,
int *
const mx,
int *
const my)
387 const int index8 =
scan8[n];
388 const int top_ref = s->
ref_cache[list][index8 - 8];
389 const int left_ref = s->
ref_cache[list][index8 - 1];
390 const int16_t *
const A = s->
mv_cache[list][index8 - 1];
391 const int16_t *
const B = s->
mv_cache[list][index8 - 8];
393 int diagonal_ref, match_count;
404 match_count = (diagonal_ref ==
ref) + (top_ref == ref) + (left_ref ==
ref);
405 if (match_count > 1) {
408 }
else if (match_count == 1) {
409 if (left_ref == ref) {
412 }
else if (top_ref == ref) {
434 int mx,
int my,
int dxy,
435 int thirdpel,
int dir,
int avg)
440 int blocksize = 2 - (width >> 3);
447 if (mx < 0 || mx >= s->
h_edge_pos - width - 1 ||
450 mx = av_clip(mx, -16, s->
h_edge_pos - width + 15);
451 my = av_clip(my, -16, s->
v_edge_pos - height + 15);
456 src = pic->
f->
data[0] + mx + my * linesize;
461 width + 1, height + 1,
475 mx = mx + (mx < (int) x) >> 1;
476 my = my + (my < (int) y) >> 1;
478 height = height >> 1;
481 for (i = 1; i < 3; i++) {
482 dest = s->
cur_pic->
f->
data[
i] + (x >> 1) + (y >> 1) * uvlinesize;
483 src = pic->
f->
data[
i] + mx + my * uvlinesize;
487 uvlinesize, uvlinesize,
488 width + 1, height + 1,
510 int i, j, k, mx, my, dx, dy, x, y;
511 const int part_width = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
512 const int part_height = 16 >> ((unsigned)(size + 1) / 3);
513 const int extra_width = (mode ==
PREDICT_MODE) ? -16 * 6 : 0;
514 const int h_edge_pos = 6 * (s->
h_edge_pos - part_width) - extra_width;
515 const int v_edge_pos = 6 * (s->
v_edge_pos - part_height) - extra_width;
517 for (i = 0; i < 16; i += part_height)
518 for (j = 0; j < 16; j += part_width) {
519 const int b_xy = (4 * s->
mb_x + (j >> 2)) +
522 x = 16 * s->
mb_x + j;
523 y = 16 * s->
mb_y +
i;
524 k = (j >> 2 & 1) + (i >> 1 & 2) +
525 (j >> 1 & 4) + (i & 8);
547 mx = av_clip(mx, extra_width - 6 * x, h_edge_pos - 6 * x);
548 my = av_clip(my, extra_width - 6 * y, v_edge_pos - 6 * y);
557 if (dx != (int16_t)dx || dy != (int16_t)dy) {
566 mx = (mx + 1 >> 1) + dx;
567 my = (my + 1 >> 1) + dy;
568 fx = (unsigned)(mx + 0x30000) / 3 - 0x10000;
569 fy = (unsigned)(my + 0x30000) / 3 - 0x10000;
570 dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
573 fx, fy, dxy, 1, dir, avg);
577 mx = (unsigned)(mx + 1 + 0x30000) / 3 + dx - 0x10000;
578 my = (unsigned)(my + 1 + 0x30000) / 3 + dy - 0x10000;
579 dxy = (mx & 1) + 2 * (my & 1);
582 mx >> 1, my >> 1, dxy, 0, dir, avg);
586 mx = (unsigned)(mx + 3 + 0x60000) / 6 + dx - 0x10000;
587 my = (unsigned)(my + 3 + 0x60000) / 6 + dy - 0x10000;
590 mx, my, 0, 0, dir, avg);
599 if (part_height == 8 && i < 8) {
602 if (part_width == 8 && j < 8)
605 if (part_width == 8 && j < 8)
607 if (part_width == 4 || part_height == 4)
613 part_width >> 2, part_height >> 2, s->
b_stride,
621 int mb_type,
const int *block_offset,
626 for (i = 0; i < 16; i++)
628 uint8_t *
const ptr = dest_y + block_offset[
i];
637 const int *block_offset,
645 for (i = 0; i < 16; i++) {
646 uint8_t *
const ptr = dest_y + block_offset[
i];
654 if (!topright_avail) {
655 tr = ptr[3 - linesize] * 0x01010101
u;
658 topright = ptr + 4 - linesize;
676 const int mb_x = s->
mb_x;
677 const int mb_y = s->
mb_y;
678 const int mb_xy = s->
mb_xy;
680 uint8_t *dest_y, *dest_cb, *dest_cr;
681 int linesize, uvlinesize;
684 const int block_h = 16 >> 1;
689 dest_y = s->
cur_pic->
f->
data[0] + (mb_x + mb_y * linesize) * 16;
690 dest_cb = s->
cur_pic->
f->
data[1] + mb_x * 8 + mb_y * uvlinesize * block_h;
691 dest_cr = s->
cur_pic->
f->
data[2] + mb_x * 8 + mb_y * uvlinesize * block_h;
694 s->
vdsp.
prefetch(dest_cb + (s->
mb_x & 7) * uvlinesize + 64, dest_cr - dest_cb, 2);
706 uint8_t *dest[2] = { dest_cb, dest_cr };
711 for (j = 1; j < 3; j++) {
712 for (i = j * 16; i < j * 16 + 4; i++)
714 uint8_t *
const ptr = dest[j - 1] + block_offset[
i];
724 int i, j, k, m, dir,
mode;
728 const int mb_xy = s->
mb_xy;
755 }
else if (mb_type < 8) {
773 for (m = 0; m < 2; m++) {
775 for (i = 0; i < 4; i++)
779 for (i = 0; i < 4; i++)
785 4 * 2 *
sizeof(int16_t));
821 for (i = 0; i < 4; i++)
823 0, 4 * 2 *
sizeof(int16_t));
829 for (i = 0; i < 4; i++)
831 0, 4 * 2 *
sizeof(int16_t));
836 }
else if (mb_type == 8 || mb_type == 33) {
844 for (i = 0; i < 4; i++)
860 for (i = 0; i < 16; i += 2) {
865 "luma prediction:%"PRIu32
"\n", vlc);
873 left[2] =
svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
875 if (left[1] == -1 || left[2] == -1) {
881 for (i = 0; i < 4; i++)
886 i4x4[4] = i4x4_cache[7 + 8 * 3];
887 i4x4[5] = i4x4_cache[7 + 8 * 2];
888 i4x4[6] = i4x4_cache[7 + 8 * 1];
898 for (i = 0; i < 4; i++)
908 dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
921 for (i = 0; i < 4; i++)
923 0, 4 * 2 *
sizeof(int16_t));
925 for (i = 0; i < 4; i++)
927 0, 4 * 2 *
sizeof(int16_t));
961 "error while decoding intra luma dc\n");
970 for (i = 0; i < 4; i++)
971 if ((cbp & (1 << i))) {
972 for (j = 0; j < 4; j++) {
973 k = index ? (1 * (j & 1) + 2 * (i & 1) +
974 2 * (j & 2) + 4 * (i & 2))
980 "error while decoding block\n");
987 for (i = 1; i < 3; ++
i)
990 "error while decoding chroma dc block\n");
995 for (i = 1; i < 3; i++) {
996 for (j = 0; j < 4; j++) {
1002 "error while decoding chroma ac block\n");
1024 const int mb_xy = s->
mb_xy;
1030 if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
1035 int slice_bits, slice_bytes, slice_length;
1036 int length = header >> 5 & 3;
1039 slice_bits = slice_length * 8;
1040 slice_bytes = slice_length + length - 1;
1073 if ((header & 0x9F) == 2) {
1100 -1, 4 *
sizeof(int8_t));
1102 -1, 8 *
sizeof(int8_t) * s->
mb_x);
1118 const int max_qp = 51;
1120 for (q = 0; q < max_qp + 1; q++) {
1123 for (x = 0; x < 16; x++)
1133 unsigned char *extradata;
1134 unsigned char *extradata_end;
1136 int marker_found = 0;
1168 extradata = (
unsigned char *)avctx->
extradata;
1172 if (!memcmp(extradata,
"SEQH", 4)) {
1183 int frame_size_code;
1184 int unk0, unk1, unk2, unk3, unk4;
1187 size =
AV_RB32(&extradata[4]);
1188 if (size > extradata_end - extradata - 8) {
1195 frame_size_code =
get_bits(&gb, 3);
1196 switch (frame_size_code) {
1249 unk0, unk1, unk2, unk3, unk4);
1266 unsigned long buf_len = watermark_width *
1267 watermark_height * 4;
1271 if (watermark_height <= 0 ||
1272 (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height) {
1283 watermark_width, watermark_height);
1285 "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
1286 u1, u2, u3, u4, offset);
1287 if (uncompress(buf, &buf_len, extradata + 8 + offset,
1288 size - offset) != Z_OK) {
1290 "could not uncompress watermark logo\n");
1303 "this svq3 file contains watermark which need zlib support compiled in\n");
1328 for (x = 0; x < s->
mb_width; x++) {
1345 for (i = 0; i < 2; i++) {
1359 const int b4_stride = s->
mb_width * 4 + 1;
1360 const int b4_array_size = b4_stride * s->
mb_height * 4;
1371 for (i = 0; i < 2; i++) {
1406 int buf_size = avpkt->
size;
1412 if (buf_size == 0) {
1429 memcpy(s->
buf, avpkt->
data, buf_size);
1457 for (i = 0; i < 16; i++) {
1461 for (i = 0; i < 16; i++) {
1498 "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
1534 for (m = 0; m < 2; m++) {
1536 for (i = 0; i < 4; i++) {
1538 for (j = -1; j < 4; j++)
1571 "error while decoding MB %d %d\n", s->
mb_x, s->
mb_y);
1575 if (mb_type != 0 || s->
cbp)
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)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video 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...
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.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Macro definitions for various function/variable attributes.
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]
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
static const struct @135 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)
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)
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.
AVBufferRef * ref_index_buf[2]
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 i(width, name, range_min, range_max)
#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)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
unsigned int left_samples_available
const char * name
Name of the codec implementation.
const uint8_t ff_h264_golomb_to_pict_type[5]
static const uint8_t offset[127][2]
unsigned int topright_samples_available
Sorenson Vector Quantizer #1 (SVQ1) video codec.
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
useful rectangle filling function
AVBufferRef * motion_val_buf[2]
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)
the normal 2^n-1 "JPEG" YUV ranges
#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.
main external API structure.
const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM+1]
uint8_t * data
The data buffer.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
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)
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
AVBufferRef * mb_type_buf
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 int svq3_decode_end(AVCodecContext *avctx)
int8_t ref_cache[2][5 *8]
static const uint8_t svq3_pred_0[25][2]
static enum AVPixelFormat pix_fmts[]
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
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.
A reference to a data buffer.
discard all non reference
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)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
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)
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() for allocating buffers and supports custom allocators.
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
int16_t mv_cache[2][5 *8][2]