35 #define CFACTOR_Y422 2 36 #define CFACTOR_Y444 3 38 #define MAX_MBS_PER_SLICE 8 40 #define MAX_PLANES 3 // should be increased to 4 when there's AV_PIX_FMT_YUV444AP10 59 4, 7, 9, 11, 13, 14, 15, 63,
60 7, 7, 11, 12, 14, 15, 63, 63,
61 9, 11, 13, 14, 15, 63, 63, 63,
62 11, 11, 13, 14, 63, 63, 63, 63,
63 11, 13, 14, 63, 63, 63, 63, 63,
64 13, 14, 63, 63, 63, 63, 63, 63,
65 13, 63, 63, 63, 63, 63, 63, 63,
66 63, 63, 63, 63, 63, 63, 63, 63,
69 4, 5, 6, 7, 9, 11, 13, 15,
70 5, 5, 7, 8, 11, 13, 15, 17,
71 6, 7, 9, 11, 13, 15, 15, 17,
72 7, 7, 9, 11, 13, 15, 17, 19,
73 7, 9, 11, 13, 14, 16, 19, 23,
74 9, 11, 13, 14, 16, 19, 23, 29,
75 9, 11, 13, 15, 17, 21, 28, 35,
76 11, 13, 16, 17, 21, 28, 35, 41,
79 4, 4, 5, 5, 6, 7, 7, 9,
80 4, 4, 5, 6, 7, 7, 9, 9,
81 5, 5, 6, 7, 7, 9, 9, 10,
82 5, 5, 6, 7, 7, 9, 9, 10,
83 5, 6, 7, 7, 8, 9, 10, 12,
84 6, 7, 7, 8, 9, 10, 12, 15,
85 6, 7, 7, 9, 10, 11, 14, 17,
86 7, 7, 9, 10, 11, 14, 17, 21,
89 4, 4, 4, 4, 4, 4, 4, 4,
90 4, 4, 4, 4, 4, 4, 4, 4,
91 4, 4, 4, 4, 4, 4, 4, 4,
92 4, 4, 4, 4, 4, 4, 4, 5,
93 4, 4, 4, 4, 4, 4, 5, 5,
94 4, 4, 4, 4, 4, 5, 5, 6,
95 4, 4, 4, 4, 5, 5, 6, 7,
96 4, 4, 4, 4, 5, 6, 7, 7,
99 4, 4, 4, 4, 4, 4, 4, 4,
100 4, 4, 4, 4, 4, 4, 4, 4,
101 4, 4, 4, 4, 4, 4, 4, 4,
102 4, 4, 4, 4, 4, 4, 4, 4,
103 4, 4, 4, 4, 4, 4, 4, 4,
104 4, 4, 4, 4, 4, 4, 4, 4,
105 4, 4, 4, 4, 4, 4, 4, 4,
106 4, 4, 4, 4, 4, 4, 4, 4,
110 #define NUM_MB_LIMITS 4 128 .tag =
MKTAG(
'a',
'p',
'c',
'o'),
131 .br_tab = { 300, 242, 220, 194 },
136 .tag =
MKTAG(
'a',
'p',
'c',
's'),
139 .br_tab = { 720, 560, 490, 440 },
143 .full_name =
"standard",
144 .tag =
MKTAG(
'a',
'p',
'c',
'n'),
147 .br_tab = { 1050, 808, 710, 632 },
151 .full_name =
"high quality",
152 .tag =
MKTAG(
'a',
'p',
'c',
'h'),
155 .br_tab = { 1566, 1216, 1070, 950 },
161 #define TRELLIS_WIDTH 16 162 #define SCORE_LIMIT INT_MAX / 2 171 #define MAX_STORED_Q 16 176 int16_t custom_q[64];
185 int16_t custom_q[64];
191 int mb_width, mb_height;
193 int num_chroma_blocks, chroma_factor;
195 int slices_per_picture;
196 int pictures_per_frame;
205 int frame_size_upper_bound;
216 int linesize,
int x,
int y,
int w,
int h,
217 int16_t *blocks, uint16_t *emu_buf,
218 int mbs_per_slice,
int blocks_per_mb,
int is_chroma)
220 const uint16_t *esrc;
221 const int mb_width = 4 * blocks_per_mb;
225 for (i = 0; i < mbs_per_slice; i++, src += mb_width) {
227 memset(blocks, 0, 64 * (mbs_per_slice - i) * blocks_per_mb
231 if (x + mb_width <= w && y + 16 <= h) {
233 elinesize = linesize;
238 elinesize = 16 *
sizeof(*emu_buf);
240 bw =
FFMIN(w - x, mb_width);
241 bh =
FFMIN(h - y, 16);
243 for (j = 0; j <
bh; j++) {
244 memcpy(emu_buf + j * 16,
245 (
const uint8_t*)src + j * linesize,
247 pix = emu_buf[j * 16 + bw - 1];
248 for (k = bw; k < mb_width; k++)
249 emu_buf[j * 16 + k] = pix;
252 memcpy(emu_buf + j * 16,
253 emu_buf + (bh - 1) * 16,
254 mb_width *
sizeof(*emu_buf));
257 ctx->
dsp.
fdct(esrc, elinesize, blocks);
259 if (blocks_per_mb > 2) {
260 ctx->
dsp.
fdct(esrc + 8, elinesize, blocks);
263 ctx->
dsp.
fdct(esrc + elinesize * 4, elinesize, blocks);
265 if (blocks_per_mb > 2) {
266 ctx->
dsp.
fdct(esrc + elinesize * 4 + 8, elinesize, blocks);
270 ctx->
dsp.
fdct(esrc, elinesize, blocks);
272 ctx->
dsp.
fdct(esrc + elinesize * 4, elinesize, blocks);
274 if (blocks_per_mb > 2) {
275 ctx->
dsp.
fdct(esrc + 8, elinesize, blocks);
277 ctx->
dsp.
fdct(esrc + elinesize * 4 + 8, elinesize, blocks);
291 unsigned int rice_order, exp_order, switch_bits, switch_val;
295 switch_bits = (codebook & 3) + 1;
296 rice_order = codebook >> 5;
297 exp_order = (codebook >> 2) & 7;
299 switch_val = switch_bits << rice_order;
301 if (val >= switch_val) {
302 val -= switch_val - (1 << exp_order);
305 put_bits(pb, exponent - exp_order + switch_bits, 0);
308 exponent = val >> rice_order;
318 #define GET_SIGN(x) ((x) >> 31) 319 #define MAKE_CODE(x) (((x) << 1) ^ GET_SIGN(x)) 322 int blocks_per_slice,
int scale)
325 int codebook = 3,
code,
dc, prev_dc,
delta, sign, new_sign;
327 prev_dc = (blocks[0] - 0x4000) / scale;
333 for (i = 1; i < blocks_per_slice; i++, blocks += 64) {
334 dc = (blocks[0] - 0x4000) / scale;
335 delta = dc - prev_dc;
337 delta = (delta ^ sign) - sign;
340 codebook = (
code + (
code & 1)) >> 1;
341 codebook =
FFMIN(codebook, 3);
348 int blocks_per_slice,
349 int plane_size_factor,
350 const uint8_t *scan,
const int16_t *qmat)
354 int max_coeffs, abs_level;
356 max_coeffs = blocks_per_slice << 6;
361 for (i = 1; i < 64; i++) {
362 for (idx = scan[i]; idx < max_coeffs; idx += 64) {
363 level = blocks[idx] / qmat[scan[
i]];
365 abs_level =
FFABS(level);
382 const uint16_t *
src,
int linesize,
383 int mbs_per_slice, int16_t *blocks,
384 int blocks_per_mb,
int plane_size_factor,
387 int blocks_per_slice, saved_pos;
390 blocks_per_slice = mbs_per_slice * blocks_per_mb;
392 encode_dcs(pb, blocks, blocks_per_slice, qmat[0]);
393 encode_acs(pb, blocks, blocks_per_slice, plane_size_factor,
409 int slice_width_factor =
av_log2(mbs_per_slice);
410 int num_cblocks, pwidth, linesize, line_add;
411 int plane_factor, is_chroma;
414 if (ctx->pictures_per_frame == 1)
419 if (ctx->force_quant) {
420 qmat = ctx->quants[0];
422 qmat = ctx->quants[
quant];
424 qmat = ctx->custom_q;
425 for (i = 0; i < 64; i++)
426 qmat[i] = ctx->quant_mat[i] * quant;
429 for (i = 0; i < ctx->num_planes; i++) {
430 is_chroma = (i == 1 || i == 2);
431 plane_factor = slice_width_factor + 2;
438 pwidth = avctx->
width;
443 pwidth = avctx->
width >> 1;
446 linesize = pic->
linesize[
i] * ctx->pictures_per_frame;
447 src = (
const uint16_t*)(pic->
data[i] + yp * linesize +
451 pwidth, avctx->
height / ctx->pictures_per_frame,
452 ctx->blocks[0], ctx->emu_buf,
453 mbs_per_slice, num_cblocks, is_chroma);
455 mbs_per_slice, ctx->blocks[0],
456 num_cblocks, plane_factor,
458 total_size += sizes[
i];
465 unsigned int rice_order, exp_order, switch_bits, switch_val;
469 switch_bits = (codebook & 3) + 1;
470 rice_order = codebook >> 5;
471 exp_order = (codebook >> 2) & 7;
473 switch_val = switch_bits << rice_order;
475 if (val >= switch_val) {
476 val -= switch_val - (1 << exp_order);
479 return exponent * 2 - exp_order + switch_bits + 1;
481 return (val >> rice_order) + rice_order + 1;
485 static int estimate_dcs(
int *error, int16_t *blocks,
int blocks_per_slice,
489 int codebook = 3,
code,
dc, prev_dc,
delta, sign, new_sign;
492 prev_dc = (blocks[0] - 0x4000) / scale;
499 for (i = 1; i < blocks_per_slice; i++, blocks += 64) {
500 dc = (blocks[0] - 0x4000) / scale;
502 delta = dc - prev_dc;
504 delta = (delta ^ sign) - sign;
507 codebook = (
code + (
code & 1)) >> 1;
508 codebook =
FFMIN(codebook, 3);
516 static int estimate_acs(
int *error, int16_t *blocks,
int blocks_per_slice,
517 int plane_size_factor,
518 const uint8_t *scan,
const int16_t *qmat)
522 int max_coeffs, abs_level;
525 max_coeffs = blocks_per_slice << 6;
530 for (i = 1; i < 64; i++) {
531 for (idx = scan[i]; idx < max_coeffs; idx += 64) {
532 level = blocks[idx] / qmat[scan[
i]];
533 *error +=
FFABS(blocks[idx]) % qmat[scan[
i]];
535 abs_level =
FFABS(level);
553 const uint16_t *
src,
int linesize,
555 int blocks_per_mb,
int plane_size_factor,
558 int blocks_per_slice;
561 blocks_per_slice = mbs_per_slice * blocks_per_mb;
563 bits =
estimate_dcs(error, td->blocks[plane], blocks_per_slice, qmat[0]);
564 bits +=
estimate_acs(error, td->blocks[plane], blocks_per_slice,
571 int trellis_node,
int x,
int y,
int mbs_per_slice,
575 int i, q, pq, xp, yp;
577 int slice_width_factor =
av_log2(mbs_per_slice);
580 const int min_quant = ctx->profile_info->min_quant;
581 const int max_quant = ctx->profile_info->max_quant;
582 int error,
bits, bits_limit;
583 int mbs, prev, cur, new_score;
587 int linesize[4], line_add;
589 if (ctx->pictures_per_frame == 1)
593 mbs = x + mbs_per_slice;
595 for (i = 0; i < ctx->num_planes; i++) {
596 is_chroma[
i] = (i == 1 || i == 2);
597 plane_factor[
i] = slice_width_factor + 2;
604 pwidth = avctx->
width;
609 pwidth = avctx->
width >> 1;
612 linesize[
i] = pic->
linesize[
i] * ctx->pictures_per_frame;
613 src = (
const uint16_t*)(pic->
data[i] + yp * linesize[i] +
617 pwidth, avctx->
height / ctx->pictures_per_frame,
618 td->blocks[i], td->emu_buf,
619 mbs_per_slice, num_cblocks[i], is_chroma[i]);
622 for (q = min_quant; q < max_quant + 2; q++) {
623 td->nodes[trellis_node + q].prev_node = -1;
624 td->nodes[trellis_node + q].quant = q;
628 for (q = min_quant; q <=
max_quant; q++) {
631 for (i = 0; i < ctx->num_planes; i++) {
635 num_cblocks[i], plane_factor[i],
638 if (bits > 65000 * 8) {
642 slice_bits[q] =
bits;
643 slice_score[q] = error;
645 if (slice_bits[max_quant] <= ctx->bits_per_mb * mbs_per_slice) {
646 slice_bits[max_quant + 1] = slice_bits[
max_quant];
647 slice_score[max_quant + 1] = slice_score[
max_quant] + 1;
650 for (q = max_quant + 1; q < 128; q++) {
654 qmat = ctx->quants[q];
657 for (i = 0; i < 64; i++)
658 qmat[i] = ctx->quant_mat[i] * q;
660 for (i = 0; i < ctx->num_planes; i++) {
664 num_cblocks[i], plane_factor[i],
667 if (bits <= ctx->bits_per_mb * mbs_per_slice)
671 slice_bits[max_quant + 1] =
bits;
672 slice_score[max_quant + 1] = error;
675 td->nodes[trellis_node + max_quant + 1].quant = overquant;
677 bits_limit = mbs * ctx->bits_per_mb;
678 for (pq = min_quant; pq < max_quant + 2; pq++) {
681 for (q = min_quant; q < max_quant + 2; q++) {
682 cur = trellis_node + q;
684 bits = td->nodes[prev].bits + slice_bits[q];
685 error = slice_score[q];
686 if (bits > bits_limit)
690 new_score = td->nodes[prev].score + error;
693 if (td->nodes[cur].prev_node == -1 ||
694 td->nodes[cur].score >= new_score) {
696 td->nodes[cur].bits =
bits;
697 td->nodes[cur].score = new_score;
698 td->nodes[cur].prev_node = prev;
703 error = td->nodes[trellis_node +
min_quant].score;
705 for (q = min_quant + 1; q < max_quant + 2; q++) {
706 if (td->nodes[trellis_node + q].score <= error) {
707 error = td->nodes[trellis_node + q].score;
708 pq = trellis_node + q;
716 int jobnr,
int threadnr)
720 int mbs_per_slice = ctx->mbs_per_slice;
721 int x,
y = jobnr,
mb, q = 0;
723 for (x = mb = 0; x < ctx->
mb_width; x += mbs_per_slice, mb++) {
724 while (ctx->
mb_width - x < mbs_per_slice)
731 for (x = ctx->slices_width - 1; x >= 0; x--) {
732 ctx->slice_q[x + y * ctx->slices_width] = td->nodes[q].quant;
733 q = td->nodes[q].prev_node;
740 const AVFrame *pic,
int *got_packet)
743 uint8_t *orig_buf, *
buf, *slice_hdr, *slice_sizes, *tmp;
746 int x,
y,
i,
mb, q = 0;
747 int sizes[4] = { 0 };
748 int slice_hdr_size = 2 + 2 * (ctx->num_planes - 1);
762 orig_buf = pkt->
data;
766 bytestream_put_be32 (&orig_buf,
FRAME_ID);
772 bytestream_put_be16 (&buf, 0);
774 bytestream_put_be16 (&buf, avctx->
width);
775 bytestream_put_be16 (&buf, avctx->
height);
780 bytestream_put_byte (&buf, frame_flags);
782 bytestream_put_byte (&buf, 0);
784 bytestream_put_byte (&buf, avctx->
color_trc);
785 bytestream_put_byte (&buf, avctx->
colorspace);
786 bytestream_put_byte (&buf, 0x40);
787 bytestream_put_byte (&buf, 0);
789 bytestream_put_byte (&buf, 0x03);
791 for (i = 0; i < 64; i++)
792 bytestream_put_byte(&buf, ctx->quant_mat[i]);
794 for (i = 0; i < 64; i++)
795 bytestream_put_byte(&buf, ctx->quant_mat[i]);
797 bytestream_put_byte (&buf, 0x00);
799 bytestream_put_be16 (&tmp, buf - orig_buf);
801 for (ctx->cur_picture_idx = 0;
802 ctx->cur_picture_idx < ctx->pictures_per_frame;
803 ctx->cur_picture_idx++) {
805 picture_size_pos = buf + 1;
806 bytestream_put_byte (&buf, 0x40);
808 bytestream_put_be16 (&buf, ctx->slices_per_picture);
809 bytestream_put_byte (&buf,
av_log2(ctx->mbs_per_slice) << 4);
813 buf += ctx->slices_per_picture * 2;
816 if (!ctx->force_quant) {
824 int mbs_per_slice = ctx->mbs_per_slice;
825 for (x = mb = 0; x < ctx->
mb_width; x += mbs_per_slice, mb++) {
826 q = ctx->force_quant ? ctx->force_quant
827 : ctx->slice_q[mb + y * ctx->slices_width];
829 while (ctx->
mb_width - x < mbs_per_slice)
832 bytestream_put_byte(&buf, slice_hdr_size << 3);
834 buf += slice_hdr_size - 1;
836 encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
838 bytestream_put_byte(&slice_hdr, q);
839 slice_size = slice_hdr_size + sizes[ctx->num_planes - 1];
840 for (i = 0; i < ctx->num_planes - 1; i++) {
841 bytestream_put_be16(&slice_hdr, sizes[i]);
842 slice_size += sizes[
i];
844 bytestream_put_be16(&slice_sizes, slice_size);
845 buf += slice_size - slice_hdr_size;
849 picture_size = buf - (picture_size_pos - 1);
850 bytestream_put_be32(&picture_size_pos, picture_size);
854 frame_size = buf - orig_buf;
855 bytestream_put_be32(&orig_buf, frame_size);
899 mps = ctx->mbs_per_slice;
900 if (mps & (mps - 1)) {
902 "there should be an integer power of two MBs per slice\n");
919 ctx->slices_width = ctx->
mb_width / mps;
920 ctx->slices_width += av_popcount(ctx->
mb_width - ctx->slices_width * mps);
921 ctx->slices_per_picture = ctx->
mb_height * ctx->slices_width;
922 ctx->pictures_per_frame = 1 + interlaced;
924 if (ctx->quant_sel == -1)
929 if (strlen(ctx->vendor) != 4) {
935 if (!ctx->force_quant) {
936 if (!ctx->bits_per_mb) {
939 ctx->pictures_per_frame)
941 ctx->bits_per_mb = ctx->profile_info->br_tab[
i];
942 }
else if (ctx->bits_per_mb < 128) {
947 min_quant = ctx->profile_info->min_quant;
948 max_quant = ctx->profile_info->max_quant;
950 for (j = 0; j < 64; j++)
951 ctx->quants[i][j] = ctx->quant_mat[j] * i;
954 ctx->slice_q =
av_malloc(ctx->slices_per_picture *
sizeof(*ctx->slice_q));
967 ctx->tdata[j].nodes =
av_malloc((ctx->slices_width + 1)
969 *
sizeof(*ctx->tdata->nodes));
970 if (!ctx->tdata[j].nodes) {
974 for (i = min_quant; i < max_quant + 2; i++) {
975 ctx->tdata[j].nodes[
i].prev_node = -1;
976 ctx->tdata[j].nodes[
i].bits = 0;
977 ctx->tdata[j].nodes[
i].score = 0;
983 if (ctx->force_quant > 64) {
988 for (j = 0; j < 64; j++) {
989 ctx->quants[0][j] = ctx->quant_mat[j] * ctx->force_quant;
990 ls +=
av_log2((1 << 11) / ctx->quants[0][j]) * 2 + 1;
993 ctx->bits_per_mb = ls * 8;
995 ctx->bits_per_mb += ls * 4;
996 if (ctx->num_planes == 4)
997 ctx->bits_per_mb += ls * 4;
1000 ctx->frame_size_upper_bound = ctx->pictures_per_frame *
1001 ctx->slices_per_picture *
1002 (2 + 2 * ctx->num_planes +
1003 (mps * ctx->bits_per_mb) / 8)
1006 avctx->
codec_tag = ctx->profile_info->tag;
1009 "profile %d, %d slices, interlacing: %s, %d bits per MB\n",
1010 ctx->profile, ctx->slices_per_picture * ctx->pictures_per_frame,
1011 interlaced ?
"yes" :
"no", ctx->bits_per_mb);
1013 ctx->frame_size_upper_bound);
1018 #define OFFSET(x) offsetof(ProresContext, x) 1019 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM 1022 {
"mbs_per_slice",
"macroblocks per slice",
OFFSET(mbs_per_slice),
1028 0, 0,
VE,
"profile" },
1030 0, 0,
VE,
"profile" },
1032 0, 0,
VE,
"profile" },
1034 0, 0,
VE,
"profile" },
1035 {
"vendor",
"vendor ID",
OFFSET(vendor),
1037 {
"bits_per_mb",
"desired bits per macroblock",
OFFSET(bits_per_mb),
1042 0, 0,
VE,
"quant_mat" },
1044 0, 0,
VE,
"quant_mat" },
1046 0, 0,
VE,
"quant_mat" },
1048 0, 0,
VE,
"quant_mat" },
1050 0, 0,
VE,
"quant_mat" },
1052 0, 0,
VE,
"quant_mat" },
1064 .
name =
"prores_ks",
static const AVClass proresenc_class
#define MAX_MBS_PER_SLICE
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static void get_slice_data(ProresContext *ctx, const uint16_t *src, int linesize, int x, int y, int w, int h, int16_t *blocks, uint16_t *emu_buf, int mbs_per_slice, int blocks_per_mb, int is_chroma)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static av_cold int encode_init(AVCodecContext *avctx)
const uint8_t ff_prores_ac_codebook[7]
AVFrame * coded_frame
the picture in the bitstream
static av_cold int init(AVCodecContext *avctx)
static int estimate_acs(int *error, int16_t *blocks, int blocks_per_slice, int plane_size_factor, const uint8_t *scan, const int16_t *qmat)
#define DECLARE_ALIGNED(n, t, v)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
unsigned mb_height
height of the current picture in mb
static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic, int trellis_node, int x, int y, int mbs_per_slice, ProresThreadData *td)
static const AVOption options[]
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static av_cold int encode_close(AVCodecContext *avctx)
void(* fdct)(int16_t *block)
output residual component w
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int estimate_vlc(unsigned codebook, int val)
static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, PutBitContext *pb, int sizes[4], int x, int y, int quant, int mbs_per_slice)
struct ProresThreadData ProresThreadData
const uint8_t ff_prores_run_to_cb_index[16]
Lookup tables for adaptive switching between codebooks according with previous run/level value...
const uint8_t ff_prores_lev_to_cb_index[10]
void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
static void encode_acs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, int plane_size_factor, const uint8_t *scan, const int16_t *qmat)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static const uint8_t frame_size[4]
unsigned mb_width
width of the current picture in mb
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static const int sizes[][2]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const struct prores_profile prores_profile_info[4]
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_YUV444P10
static void put_bits(J2kEncoderContext *s, int val, int n)
put n times val bit
static const int prores_mb_limits[NUM_MB_LIMITS]
int flags
A combination of AV_PKT_FLAG values.
static int put_bits_count(PutBitContext *s)
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
Write an unsigned rice/exp golomb codeword.
enum AVPictureType pict_type
Picture type of the frame.
#define FF_MIN_BUFFER_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
int width
picture width / height.
const uint8_t ff_prores_dc_codebook[4]
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static int estimate_slice_plane(ProresContext *ctx, int *error, int plane, const uint16_t *src, int linesize, int mbs_per_slice, int blocks_per_mb, int plane_size_factor, const int16_t *qmat, ProresThreadData *td)
#define CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
static void encode_dcs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, int scale)
FIXME Range Coding of cr are level
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
or the Software in violation of any applicable export control laws in any jurisdiction Except as provided by mandatorily applicable UPF has no obligation to provide you with source code to the Software In the event Software contains any source code
const uint8_t ff_prores_interlaced_scan[64]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static void close(AVCodecParserContext *s)
FIXME Range Coding of cr are mx and my are Motion Vector 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 Predicton block[y][x] dc[1]
const uint8_t ff_prores_progressive_scan[64]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Describe the class of an AVClass context structure.
synthesis window for stochastic i
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
int global_quality
Global quality for codecs which cannot change it per frame.
#define AV_PIX_FMT_YUV422P10
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int br_tab[NUM_MB_LIMITS]
#define CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
static const uint8_t prores_quant_matrices[][64]
common internal api header.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int find_quant_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
static int encode_slice_plane(ProresContext *ctx, PutBitContext *pb, const uint16_t *src, int linesize, int mbs_per_slice, int16_t *blocks, int blocks_per_mb, int plane_size_factor, const int16_t *qmat)
int top_field_first
If the content is interlaced, is top field displayed first.
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
int key_frame
1 -> keyframe, 0-> not
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
struct ProresContext ProresContext
AVCodec ff_prores_ks_encoder
#define MKTAG(a, b, c, d)
AVPixelFormat
Pixel format.
This structure stores compressed data.
static int estimate_dcs(int *error, int16_t *blocks, int blocks_per_slice, int scale)