35 #define CFACTOR_Y422 2
36 #define CFACTOR_Y444 3
38 #define MAX_MBS_PER_SLICE 8
64 4, 7, 9, 11, 13, 14, 15, 63,
65 7, 7, 11, 12, 14, 15, 63, 63,
66 9, 11, 13, 14, 15, 63, 63, 63,
67 11, 11, 13, 14, 63, 63, 63, 63,
68 11, 13, 14, 63, 63, 63, 63, 63,
69 13, 14, 63, 63, 63, 63, 63, 63,
70 13, 63, 63, 63, 63, 63, 63, 63,
71 63, 63, 63, 63, 63, 63, 63, 63,
74 4, 7, 9, 11, 13, 14, 63, 63,
75 7, 7, 11, 12, 14, 63, 63, 63,
76 9, 11, 13, 14, 63, 63, 63, 63,
77 11, 11, 13, 14, 63, 63, 63, 63,
78 11, 13, 14, 63, 63, 63, 63, 63,
79 13, 14, 63, 63, 63, 63, 63, 63,
80 13, 63, 63, 63, 63, 63, 63, 63,
81 63, 63, 63, 63, 63, 63, 63, 63
84 4, 5, 6, 7, 9, 11, 13, 15,
85 5, 5, 7, 8, 11, 13, 15, 17,
86 6, 7, 9, 11, 13, 15, 15, 17,
87 7, 7, 9, 11, 13, 15, 17, 19,
88 7, 9, 11, 13, 14, 16, 19, 23,
89 9, 11, 13, 14, 16, 19, 23, 29,
90 9, 11, 13, 15, 17, 21, 28, 35,
91 11, 13, 16, 17, 21, 28, 35, 41,
94 4, 4, 5, 5, 6, 7, 7, 9,
95 4, 4, 5, 6, 7, 7, 9, 9,
96 5, 5, 6, 7, 7, 9, 9, 10,
97 5, 5, 6, 7, 7, 9, 9, 10,
98 5, 6, 7, 7, 8, 9, 10, 12,
99 6, 7, 7, 8, 9, 10, 12, 15,
100 6, 7, 7, 9, 10, 11, 14, 17,
101 7, 7, 9, 10, 11, 14, 17, 21,
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,
107 4, 4, 4, 4, 4, 4, 4, 5,
108 4, 4, 4, 4, 4, 4, 5, 5,
109 4, 4, 4, 4, 4, 5, 5, 6,
110 4, 4, 4, 4, 5, 5, 6, 7,
111 4, 4, 4, 4, 5, 6, 7, 7,
114 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 2, 2, 3,
118 2, 2, 2, 2, 2, 2, 3, 3,
119 2, 2, 2, 2, 2, 3, 3, 3,
120 2, 2, 2, 2, 3, 3, 3, 4,
121 2, 2, 2, 2, 3, 3, 4, 4,
124 4, 4, 4, 4, 4, 4, 4, 4,
125 4, 4, 4, 4, 4, 4, 4, 4,
126 4, 4, 4, 4, 4, 4, 4, 4,
127 4, 4, 4, 4, 4, 4, 4, 4,
128 4, 4, 4, 4, 4, 4, 4, 4,
129 4, 4, 4, 4, 4, 4, 4, 4,
130 4, 4, 4, 4, 4, 4, 4, 4,
131 4, 4, 4, 4, 4, 4, 4, 4,
157 { 5, 5, 3, 3, 0, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 2 };
161 #define NUM_MB_LIMITS 4
180 .tag =
MKTAG(
'a',
'p',
'c',
'o'),
183 .br_tab = { 300, 242, 220, 194 },
189 .tag =
MKTAG(
'a',
'p',
'c',
's'),
192 .br_tab = { 720, 560, 490, 440 },
197 .full_name =
"standard",
198 .tag =
MKTAG(
'a',
'p',
'c',
'n'),
201 .br_tab = { 1050, 808, 710, 632 },
206 .full_name =
"high quality",
207 .tag =
MKTAG(
'a',
'p',
'c',
'h'),
210 .br_tab = { 1566, 1216, 1070, 950 },
216 .tag =
MKTAG(
'a',
'p',
'4',
'h'),
219 .br_tab = { 2350, 1828, 1600, 1425 },
224 .full_name =
"4444XQ",
225 .tag =
MKTAG(
'a',
'p',
'4',
'x'),
228 .br_tab = { 3525, 2742, 2400, 2137 },
234 #define TRELLIS_WIDTH 16
235 #define SCORE_LIMIT INT_MAX / 2
244 #define MAX_STORED_Q 16
267 ptrdiff_t linesize, int16_t *
block);
298 ptrdiff_t linesize,
int x,
int y,
int w,
int h,
299 int16_t *blocks, uint16_t *emu_buf,
300 int mbs_per_slice,
int blocks_per_mb,
int is_chroma)
302 const uint16_t *esrc;
303 const int mb_width = 4 * blocks_per_mb;
307 for (
i = 0;
i < mbs_per_slice;
i++,
src += mb_width) {
309 memset(blocks, 0, 64 * (mbs_per_slice -
i) * blocks_per_mb
313 if (x + mb_width <=
w && y + 16 <=
h) {
315 elinesize = linesize;
320 elinesize = 16 *
sizeof(*emu_buf);
322 bw =
FFMIN(
w - x, mb_width);
325 for (j = 0; j < bh; j++) {
326 memcpy(emu_buf + j * 16,
327 (
const uint8_t*)
src + j * linesize,
329 pix = emu_buf[j * 16 + bw - 1];
330 for (k = bw; k < mb_width; k++)
331 emu_buf[j * 16 + k] = pix;
334 memcpy(emu_buf + j * 16,
335 emu_buf + (bh - 1) * 16,
336 mb_width *
sizeof(*emu_buf));
339 ctx->fdct(&
ctx->fdsp, esrc, elinesize, blocks);
341 if (blocks_per_mb > 2) {
342 ctx->fdct(&
ctx->fdsp, esrc + 8, elinesize, blocks);
345 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
347 if (blocks_per_mb > 2) {
348 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4 + 8, elinesize, blocks);
352 ctx->fdct(&
ctx->fdsp, esrc, elinesize, blocks);
354 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
356 if (blocks_per_mb > 2) {
357 ctx->fdct(&
ctx->fdsp, esrc + 8, elinesize, blocks);
359 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4 + 8, elinesize, blocks);
369 ptrdiff_t linesize,
int x,
int y,
int w,
int h,
370 int16_t *blocks,
int mbs_per_slice,
int abits)
372 const int slice_width = 16 * mbs_per_slice;
373 int i, j, copy_w, copy_h;
375 copy_w =
FFMIN(
w - x, slice_width);
376 copy_h =
FFMIN(
h - y, 16);
377 for (
i = 0;
i < copy_h;
i++) {
378 memcpy(blocks,
src, copy_w *
sizeof(*
src));
380 for (j = 0; j < copy_w; j++)
383 for (j = 0; j < copy_w; j++)
384 blocks[j] = (blocks[j] << 6) | (blocks[j] >> 4);
385 for (j = copy_w; j < slice_width; j++)
386 blocks[j] = blocks[copy_w - 1];
387 blocks += slice_width;
388 src += linesize >> 1;
390 for (;
i < 16;
i++) {
391 memcpy(blocks, blocks - slice_width, slice_width *
sizeof(*blocks));
392 blocks += slice_width;
401 unsigned int rice_order, exp_order, switch_bits, switch_val;
409 switch_val = switch_bits << rice_order;
411 if (
val >= switch_val) {
412 val -= switch_val - (1 << exp_order);
415 put_bits(pb, exponent - exp_order + switch_bits, 0);
418 exponent =
val >> rice_order;
428 #define GET_SIGN(x) ((x) >> 31)
429 #define MAKE_CODE(x) ((((x)) * 2) ^ GET_SIGN(x))
432 int blocks_per_slice,
int scale)
437 prev_dc = (blocks[0] - 0x4000) /
scale;
443 for (
i = 1;
i < blocks_per_slice;
i++, blocks += 64) {
444 dc = (blocks[0] - 0x4000) /
scale;
458 int blocks_per_slice,
459 int plane_size_factor,
460 const uint8_t *scan,
const int16_t *qmat)
464 int max_coeffs, abs_level;
466 max_coeffs = blocks_per_slice << 6;
471 for (
i = 1;
i < 64;
i++) {
472 for (idx = scan[
i]; idx < max_coeffs; idx += 64) {
473 level = blocks[idx] / qmat[scan[
i]];
492 const uint16_t *
src, ptrdiff_t linesize,
493 int mbs_per_slice, int16_t *blocks,
494 int blocks_per_mb,
int plane_size_factor,
497 int blocks_per_slice = mbs_per_slice * blocks_per_mb;
499 encode_dcs(pb, blocks, blocks_per_slice, qmat[0]);
500 encode_acs(pb, blocks, blocks_per_slice, plane_size_factor,
501 ctx->scantable, qmat);
506 const int dbits = (abits == 8) ? 4 : 7;
507 const int dsize = 1 << dbits - 1;
508 int diff = cur - prev;
511 if (
diff >= (1 << abits) - dsize)
513 if (diff < -dsize || diff > dsize || !
diff) {
538 int mbs_per_slice, uint16_t *blocks,
541 const int abits =
ctx->alpha_bits;
542 const int mask = (1 << abits) - 1;
543 const int num_coeffs = mbs_per_slice * 256;
544 int prev =
mask, cur;
561 }
while (idx < num_coeffs);
575 int slice_width_factor =
av_log2(mbs_per_slice);
576 int num_cblocks, pwidth, line_add;
578 int plane_factor, is_chroma;
580 uint16_t *qmat_chroma;
582 if (
ctx->pictures_per_frame == 1)
587 if (
ctx->force_quant) {
588 qmat =
ctx->quants[0];
589 qmat_chroma =
ctx->quants_chroma[0];
592 qmat_chroma =
ctx->quants_chroma[
quant];
594 qmat =
ctx->custom_q;
595 qmat_chroma =
ctx->custom_chroma_q;
596 for (
i = 0;
i < 64;
i++) {
598 qmat_chroma[
i] =
ctx->quant_chroma_mat[
i] *
quant;
602 for (
i = 0;
i <
ctx->num_planes;
i++) {
603 is_chroma = (
i == 1 ||
i == 2);
604 plane_factor = slice_width_factor + 2;
606 plane_factor +=
ctx->chroma_factor - 3;
611 pwidth = avctx->
width;
616 pwidth = avctx->
width >> 1;
620 src = (
const uint16_t*)(pic->
data[
i] + yp * linesize +
625 pwidth, avctx->
height /
ctx->pictures_per_frame,
626 ctx->blocks[0],
ctx->emu_buf,
627 mbs_per_slice, num_cblocks, is_chroma);
630 mbs_per_slice,
ctx->blocks[0],
631 num_cblocks, plane_factor, qmat);
634 mbs_per_slice,
ctx->blocks[0],
635 num_cblocks, plane_factor, qmat_chroma);
639 pwidth, avctx->
height /
ctx->pictures_per_frame,
640 ctx->blocks[0], mbs_per_slice,
ctx->alpha_bits);
652 unsigned int rice_order, exp_order, switch_bits, switch_val;
660 switch_val = switch_bits << rice_order;
662 if (
val >= switch_val) {
663 val -= switch_val - (1 << exp_order);
666 return exponent * 2 - exp_order + switch_bits + 1;
668 return (
val >> rice_order) + rice_order + 1;
679 prev_dc = (blocks[0] - 0x4000) /
scale;
686 for (
i = 1;
i < blocks_per_slice;
i++, blocks += 64) {
687 dc = (blocks[0] - 0x4000) /
scale;
704 int plane_size_factor,
705 const uint8_t *scan,
const int16_t *qmat)
709 int max_coeffs, abs_level;
712 max_coeffs = blocks_per_slice << 6;
717 for (
i = 1;
i < 64;
i++) {
718 for (idx = scan[
i]; idx < max_coeffs; idx += 64) {
719 level = blocks[idx] / qmat[scan[
i]];
740 const uint16_t *
src, ptrdiff_t linesize,
742 int blocks_per_mb,
int plane_size_factor,
745 int blocks_per_slice;
748 blocks_per_slice = mbs_per_slice * blocks_per_mb;
752 plane_size_factor,
ctx->scantable, qmat);
759 const int dbits = (abits == 8) ? 4 : 7;
760 const int dsize = 1 << dbits - 1;
761 int diff = cur - prev;
764 if (
diff >= (1 << abits) - dsize)
766 if (diff < -dsize || diff > dsize || !
diff)
773 const uint16_t *
src, ptrdiff_t linesize,
774 int mbs_per_slice, int16_t *blocks)
776 const int abits =
ctx->alpha_bits;
777 const int mask = (1 << abits) - 1;
778 const int num_coeffs = mbs_per_slice * 256;
779 int prev =
mask, cur;
802 }
while (idx < num_coeffs);
815 int trellis_node,
int x,
int y,
int mbs_per_slice,
819 int i, q, pq, xp, yp;
821 int slice_width_factor =
av_log2(mbs_per_slice);
827 int mbs, prev, cur, new_score;
831 uint16_t *qmat_chroma;
832 int linesize[4], line_add;
835 if (
ctx->pictures_per_frame == 1)
839 mbs = x + mbs_per_slice;
841 for (
i = 0;
i <
ctx->num_planes;
i++) {
842 is_chroma[
i] = (
i == 1 ||
i == 2);
843 plane_factor[
i] = slice_width_factor + 2;
845 plane_factor[
i] +=
ctx->chroma_factor - 3;
850 pwidth = avctx->
width;
855 pwidth = avctx->
width >> 1;
858 linesize[
i] =
ctx->pic->linesize[
i] *
ctx->pictures_per_frame;
859 src = (
const uint16_t *)(
ctx->pic->data[
i] + yp * linesize[
i] +
860 line_add *
ctx->pic->linesize[
i]) + xp;
864 pwidth, avctx->
height /
ctx->pictures_per_frame,
865 td->blocks[
i],
td->emu_buf,
866 mbs_per_slice, num_cblocks[
i], is_chroma[
i]);
869 pwidth, avctx->
height /
ctx->pictures_per_frame,
870 td->blocks[
i], mbs_per_slice,
ctx->alpha_bits);
875 td->nodes[trellis_node + q].prev_node = -1;
876 td->nodes[trellis_node + q].quant = q;
881 mbs_per_slice,
td->blocks[3]);
889 num_cblocks[0], plane_factor[0],
891 for (
i = 1;
i <
ctx->num_planes - !!
ctx->alpha_bits;
i++) {
895 num_cblocks[
i], plane_factor[
i],
896 ctx->quants_chroma[q],
td);
898 if (
bits > 65000 * 8)
901 slice_bits[q] =
bits;
902 slice_score[q] =
error;
904 if (slice_bits[
max_quant] <=
ctx->bits_per_mb * mbs_per_slice) {
913 qmat =
ctx->quants[q];
914 qmat_chroma =
ctx->quants_chroma[q];
917 qmat_chroma =
td->custom_chroma_q;
918 for (
i = 0;
i < 64;
i++) {
919 qmat[
i] =
ctx->quant_mat[
i] * q;
920 qmat_chroma[
i] =
ctx->quant_chroma_mat[
i] * q;
926 num_cblocks[0], plane_factor[0],
928 for (
i = 1;
i <
ctx->num_planes - !!
ctx->alpha_bits;
i++) {
932 num_cblocks[
i], plane_factor[
i],
935 if (bits <= ctx->bits_per_mb * mbs_per_slice)
943 td->nodes[trellis_node +
max_quant + 1].quant = overquant;
945 bits_limit = mbs *
ctx->bits_per_mb;
950 cur = trellis_node + q;
952 bits =
td->nodes[prev].bits + slice_bits[q];
953 error = slice_score[q];
954 if (
bits > bits_limit)
958 new_score =
td->nodes[prev].score +
error;
961 if (
td->nodes[cur].prev_node == -1 ||
962 td->nodes[cur].score >= new_score) {
964 td->nodes[cur].bits =
bits;
965 td->nodes[cur].score = new_score;
966 td->nodes[cur].prev_node = prev;
974 if (
td->nodes[trellis_node + q].score <=
error) {
975 error =
td->nodes[trellis_node + q].score;
976 pq = trellis_node + q;
984 int jobnr,
int threadnr)
988 int mbs_per_slice =
ctx->mbs_per_slice;
989 int x, y = jobnr,
mb, q = 0;
991 for (x =
mb = 0; x <
ctx->mb_width; x += mbs_per_slice,
mb++) {
992 while (
ctx->mb_width - x < mbs_per_slice)
999 for (x =
ctx->slices_width - 1; x >= 0; x--) {
1000 ctx->slice_q[x + y *
ctx->slices_width] =
td->nodes[q].quant;
1001 q =
td->nodes[q].prev_node;
1008 const AVFrame *pic,
int *got_packet)
1011 uint8_t *orig_buf, *buf, *slice_hdr, *slice_sizes, *
tmp;
1012 uint8_t *picture_size_pos;
1014 int x, y,
i,
mb, q = 0;
1015 int sizes[4] = { 0 };
1016 int slice_hdr_size = 2 + 2 * (
ctx->num_planes - 1);
1019 int max_slice_size = (
ctx->frame_size_upper_bound - 200) / (
ctx->pictures_per_frame *
ctx->slices_per_picture + 1);
1020 uint8_t frame_flags;
1023 pkt_size =
ctx->frame_size_upper_bound;
1032 bytestream_put_be32 (&orig_buf,
FRAME_ID);
1038 bytestream_put_be16 (&buf, 0);
1040 bytestream_put_be16 (&buf, avctx->
width);
1041 bytestream_put_be16 (&buf, avctx->
height);
1043 frame_flags =
ctx->chroma_factor << 6;
1046 bytestream_put_byte (&buf, frame_flags);
1048 bytestream_put_byte (&buf, 0);
1050 bytestream_put_byte (&buf, pic->
color_trc);
1052 bytestream_put_byte (&buf, 0x40 | (
ctx->alpha_bits >> 3));
1053 bytestream_put_byte (&buf, 0);
1055 bytestream_put_byte (&buf, 0x03);
1057 for (
i = 0;
i < 64;
i++)
1058 bytestream_put_byte(&buf,
ctx->quant_mat[
i]);
1060 for (
i = 0;
i < 64;
i++)
1061 bytestream_put_byte(&buf,
ctx->quant_mat[
i]);
1063 bytestream_put_byte (&buf, 0x00);
1065 bytestream_put_be16 (&
tmp, buf - orig_buf);
1067 for (
ctx->cur_picture_idx = 0;
1068 ctx->cur_picture_idx <
ctx->pictures_per_frame;
1069 ctx->cur_picture_idx++) {
1071 picture_size_pos = buf + 1;
1072 bytestream_put_byte (&buf, 0x40);
1074 bytestream_put_be16 (&buf,
ctx->slices_per_picture);
1075 bytestream_put_byte (&buf,
av_log2(
ctx->mbs_per_slice) << 4);
1079 buf +=
ctx->slices_per_picture * 2;
1082 if (!
ctx->force_quant) {
1089 for (y = 0; y <
ctx->mb_height; y++) {
1090 int mbs_per_slice =
ctx->mbs_per_slice;
1091 for (x =
mb = 0; x <
ctx->mb_width; x += mbs_per_slice,
mb++) {
1092 q =
ctx->force_quant ?
ctx->force_quant
1093 :
ctx->slice_q[
mb + y *
ctx->slices_width];
1095 while (
ctx->mb_width - x < mbs_per_slice)
1096 mbs_per_slice >>= 1;
1098 bytestream_put_byte(&buf, slice_hdr_size << 3);
1100 buf += slice_hdr_size - 1;
1101 if (pkt_size <= buf - orig_buf + 2 * max_slice_size) {
1105 int delta = 200 + (
ctx->pictures_per_frame *
1106 ctx->slices_per_picture + 1) *
1107 max_slice_size - pkt_size;
1110 ctx->frame_size_upper_bound +=
delta;
1114 "Packet too small: is %i,"
1115 " needs %i (slice: %i). "
1116 "Correct allocation",
1117 pkt_size,
delta, max_slice_size);
1127 orig_buf =
pkt->
data + (orig_buf - start);
1128 buf =
pkt->
data + (buf - start);
1129 picture_size_pos =
pkt->
data + (picture_size_pos - start);
1130 slice_sizes =
pkt->
data + (slice_sizes - start);
1131 slice_hdr =
pkt->
data + (slice_hdr - start);
1140 bytestream_put_byte(&slice_hdr, q);
1141 slice_size = slice_hdr_size +
sizes[
ctx->num_planes - 1];
1142 for (
i = 0;
i <
ctx->num_planes - 1;
i++) {
1143 bytestream_put_be16(&slice_hdr,
sizes[
i]);
1146 bytestream_put_be16(&slice_sizes, slice_size);
1147 buf += slice_size - slice_hdr_size;
1148 if (max_slice_size < slice_size)
1149 max_slice_size = slice_size;
1153 picture_size = buf - (picture_size_pos - 1);
1154 bytestream_put_be32(&picture_size_pos, picture_size);
1183 ptrdiff_t linesize, int16_t *
block)
1186 const uint16_t *tsrc =
src;
1188 for (y = 0; y < 8; y++) {
1189 for (x = 0; x < 8; x++)
1190 block[y * 8 + x] = tsrc[x];
1191 tsrc += linesize >> 1;
1211 mps =
ctx->mbs_per_slice;
1212 if (mps & (mps - 1)) {
1214 "there should be an integer power of two MBs per slice\n");
1220 !(
desc->log2_chroma_w +
desc->log2_chroma_h))
1224 ?
"4:4:4:4 profile because of the used input colorspace"
1225 :
"HQ profile to keep best quality");
1232 "encode alpha. Override with -profile if needed.\n");
1233 ctx->alpha_bits = 0;
1235 if (
ctx->alpha_bits & 7) {
1241 ctx->alpha_bits = 0;
1248 ctx->num_planes = 3 + !!
ctx->alpha_bits;
1257 ctx->slices_width =
ctx->mb_width / mps;
1259 ctx->slices_per_picture =
ctx->mb_height *
ctx->slices_width;
1262 if (
ctx->quant_sel == -1) {
1270 if (strlen(
ctx->vendor) != 4) {
1276 if (!
ctx->force_quant) {
1277 if (!
ctx->bits_per_mb) {
1280 ctx->pictures_per_frame)
1282 ctx->bits_per_mb =
ctx->profile_info->br_tab[
i];
1283 if (
ctx->alpha_bits)
1284 ctx->bits_per_mb *= 20;
1285 }
else if (
ctx->bits_per_mb < 128) {
1293 for (j = 0; j < 64; j++) {
1294 ctx->quants[
i][j] =
ctx->quant_mat[j] *
i;
1295 ctx->quants_chroma[
i][j] =
ctx->quant_chroma_mat[j] *
i;
1310 *
sizeof(*
ctx->tdata->nodes));
1311 if (!
ctx->tdata[j].nodes)
1314 ctx->tdata[j].nodes[
i].prev_node = -1;
1315 ctx->tdata[j].nodes[
i].bits = 0;
1316 ctx->tdata[j].nodes[
i].score = 0;
1323 if (
ctx->force_quant > 64) {
1328 for (j = 0; j < 64; j++) {
1329 ctx->quants[0][j] =
ctx->quant_mat[j] *
ctx->force_quant;
1330 ctx->quants_chroma[0][j] =
ctx->quant_chroma_mat[j] *
ctx->force_quant;
1331 ls +=
av_log2((1 << 11) /
ctx->quants[0][j]) * 2 + 1;
1332 ls_chroma +=
av_log2((1 << 11) /
ctx->quants_chroma[0][j]) * 2 + 1;
1335 ctx->bits_per_mb = ls * 4 + ls_chroma * 4;
1337 ctx->bits_per_mb += ls_chroma * 4;
1340 ctx->frame_size_upper_bound = (
ctx->pictures_per_frame *
1341 ctx->slices_per_picture + 1) *
1342 (2 + 2 *
ctx->num_planes +
1343 (mps *
ctx->bits_per_mb) / 8)
1346 if (
ctx->alpha_bits) {
1348 ctx->frame_size_upper_bound += (
ctx->pictures_per_frame *
1349 ctx->slices_per_picture + 1) *
1350 (
ctx->mbs_per_slice * 256 *
1351 (1 +
ctx->alpha_bits + 1) + 7 >> 3);
1358 "profile %d, %d slices, interlacing: %s, %d bits per MB\n",
1359 ctx->profile,
ctx->slices_per_picture *
ctx->pictures_per_frame,
1362 ctx->frame_size_upper_bound);
1367 #define OFFSET(x) offsetof(ProresContext, x)
1368 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1371 {
"mbs_per_slice",
"macroblocks per slice",
OFFSET(mbs_per_slice),
1377 0, 0,
VE,
"profile" },
1379 0, 0,
VE,
"profile" },
1381 0, 0,
VE,
"profile" },
1383 0, 0,
VE,
"profile" },
1385 0, 0,
VE,
"profile" },
1387 0, 0,
VE,
"profile" },
1389 0, 0,
VE,
"profile" },
1390 {
"vendor",
"vendor ID",
OFFSET(vendor),
1392 {
"bits_per_mb",
"desired bits per macroblock",
OFFSET(bits_per_mb),
1397 0, 0,
VE,
"quant_mat" },
1399 0, 0,
VE,
"quant_mat" },
1401 0, 0,
VE,
"quant_mat" },
1403 0, 0,
VE,
"quant_mat" },
1405 0, 0,
VE,
"quant_mat" },
1407 0, 0,
VE,
"quant_mat" },
1409 { .i64 = 16 }, 0, 16,
VE },
1421 .
p.
name =
"prores_ks",