43#define DEFAULT_SLICE_MB_WIDTH 8
57static const int bitrate_table[] = { 1000, 2100, 3500, 5400, 7000, 10000};
68 4, 7, 9, 11, 13, 14, 15, 63,
69 7, 7, 11, 12, 14, 15, 63, 63,
70 9, 11, 13, 14, 15, 63, 63, 63,
71 11, 11, 13, 14, 63, 63, 63, 63,
72 11, 13, 14, 63, 63, 63, 63, 63,
73 13, 14, 63, 63, 63, 63, 63, 63,
74 13, 63, 63, 63, 63, 63, 63, 63,
75 63, 63, 63, 63, 63, 63, 63, 63
77 4, 5, 6, 7, 9, 11, 13, 15,
78 5, 5, 7, 8, 11, 13, 15, 17,
79 6, 7, 9, 11, 13, 15, 15, 17,
80 7, 7, 9, 11, 13, 15, 17, 19,
81 7, 9, 11, 13, 14, 16, 19, 23,
82 9, 11, 13, 14, 16, 19, 23, 29,
83 9, 11, 13, 15, 17, 21, 28, 35,
84 11, 13, 16, 17, 21, 28, 35, 41
86 4, 4, 5, 5, 6, 7, 7, 9,
87 4, 4, 5, 6, 7, 7, 9, 9,
88 5, 5, 6, 7, 7, 9, 9, 10,
89 5, 5, 6, 7, 7, 9, 9, 10,
90 5, 6, 7, 7, 8, 9, 10, 12,
91 6, 7, 7, 8, 9, 10, 12, 15,
92 6, 7, 7, 9, 10, 11, 14, 17,
93 7, 7, 9, 10, 11, 14, 17, 21
95 4, 4, 4, 4, 4, 4, 4, 4,
96 4, 4, 4, 4, 4, 4, 4, 4,
97 4, 4, 4, 4, 4, 4, 4, 4,
98 4, 4, 4, 4, 4, 4, 4, 5,
99 4, 4, 4, 4, 4, 4, 5, 5,
100 4, 4, 4, 4, 4, 5, 5, 6,
101 4, 4, 4, 4, 5, 5, 6, 7,
102 4, 4, 4, 4, 5, 6, 7, 7
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
113 2, 2, 2, 2, 2, 2, 2, 2,
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, 3,
117 2, 2, 2, 2, 2, 2, 3, 3,
118 2, 2, 2, 2, 2, 3, 3, 3,
119 2, 2, 2, 2, 3, 3, 3, 4,
120 2, 2, 2, 2, 3, 3, 4, 4,
126 4, 7, 9, 11, 13, 14, 63, 63,
127 7, 7, 11, 12, 14, 63, 63, 63,
128 9, 11, 13, 14, 63, 63, 63, 63,
129 11, 11, 13, 14, 63, 63, 63, 63,
130 11, 13, 14, 63, 63, 63, 63, 63,
131 13, 14, 63, 63, 63, 63, 63, 63,
132 13, 63, 63, 63, 63, 63, 63, 63,
133 63, 63, 63, 63, 63, 63, 63, 63
135 4, 5, 6, 7, 9, 11, 13, 15,
136 5, 5, 7, 8, 11, 13, 15, 17,
137 6, 7, 9, 11, 13, 15, 15, 17,
138 7, 7, 9, 11, 13, 15, 17, 19,
139 7, 9, 11, 13, 14, 16, 19, 23,
140 9, 11, 13, 14, 16, 19, 23, 29,
141 9, 11, 13, 15, 17, 21, 28, 35,
142 11, 13, 16, 17, 21, 28, 35, 41
144 4, 4, 5, 5, 6, 7, 7, 9,
145 4, 4, 5, 6, 7, 7, 9, 9,
146 5, 5, 6, 7, 7, 9, 9, 10,
147 5, 5, 6, 7, 7, 9, 9, 10,
148 5, 6, 7, 7, 8, 9, 10, 12,
149 6, 7, 7, 8, 9, 10, 12, 15,
150 6, 7, 7, 9, 10, 11, 14, 17,
151 7, 7, 9, 10, 11, 14, 17, 21
153 4, 4, 4, 4, 4, 4, 4, 4,
154 4, 4, 4, 4, 4, 4, 4, 4,
155 4, 4, 4, 4, 4, 4, 4, 4,
156 4, 4, 4, 4, 4, 4, 4, 5,
157 4, 4, 4, 4, 4, 4, 5, 5,
158 4, 4, 4, 4, 4, 5, 5, 6,
159 4, 4, 4, 4, 5, 5, 6, 7,
160 4, 4, 4, 4, 5, 6, 7, 7
162 4, 4, 4, 4, 4, 4, 4, 4,
163 4, 4, 4, 4, 4, 4, 4, 4,
164 4, 4, 4, 4, 4, 4, 4, 4,
165 4, 4, 4, 4, 4, 4, 4, 5,
166 4, 4, 4, 4, 4, 4, 5, 5,
167 4, 4, 4, 4, 4, 5, 5, 6,
168 4, 4, 4, 4, 5, 5, 6, 7,
169 4, 4, 4, 4, 5, 6, 7, 7
171 4, 4, 4, 4, 4, 4, 4, 4,
172 4, 4, 4, 4, 4, 4, 4, 4,
173 4, 4, 4, 4, 4, 4, 4, 4,
174 4, 4, 4, 4, 4, 4, 4, 5,
175 4, 4, 4, 4, 4, 4, 5, 5,
176 4, 4, 4, 4, 4, 5, 5, 6,
177 4, 4, 4, 4, 5, 5, 6, 7,
178 4, 4, 4, 4, 5, 6, 7, 7
212 const int *array_valid_values,
int default_value)
217 int ref_val = array_valid_values[
i];
218 if (ref_val == INT_MAX)
226 "%s %d are not supported. Set to default value : %d\n",
227 val_name,
val, default_value);
228 return default_value;
233 unsigned int rice_order, exp_order, switch_bits, switch_val;
241 switch_val = switch_bits << rice_order;
243 if (
val >= switch_val) {
244 val -= switch_val - (1 << exp_order);
247 put_bits(pb, exponent - exp_order + switch_bits, 0);
250 exponent =
val >> rice_order;
260#define GET_SIGN(x) ((x) >> 31)
261#define MAKE_CODE(x) (((x) * 2) ^ GET_SIGN(x))
264 int blocks_per_slice,
int scale)
269 prev_dc = (blocks[0] - 0x4000) /
scale;
274 for (
i = 1;
i < blocks_per_slice;
i++, blocks += 64) {
275 dc = (blocks[0] - 0x4000) /
scale;
276 delta = dc - prev_dc;
288 int blocks_per_slice,
289 int *qmat,
const uint8_t *scan)
295 int max_coeffs, abs_level;
297 max_coeffs = blocks_per_slice << 6;
299 for (
i = 1;
i < 64;
i++) {
300 for (idx = scan[
i]; idx < max_coeffs; idx += 64) {
301 level = blocks[idx] / qmat[scan[
i]];
309 prev_level =
FFMIN(abs_level, 9);
322 for (
i = 0;
i < 8;
i++) {
344 for (
i = 0;
i < mb_count;
i++) {
353 }
else if (
chroma && is_422){
354 for (
i = 0;
i < mb_count;
i++) {
361 for (
i = 0;
i < mb_count;
i++) {
373static int encode_slice_plane(int16_t *blocks,
int mb_count, uint8_t *buf,
unsigned buf_size,
int *qmat,
int sub_sample_chroma,
376 int blocks_per_slice;
379 blocks_per_slice = mb_count << (2 - sub_sample_chroma);
382 encode_dcs(&pb, blocks, blocks_per_slice, qmat[0]);
383 encode_acs(&pb, blocks, blocks_per_slice, qmat, scan);
390 int16_t * blocks_y, int16_t * blocks_u, int16_t * blocks_v,
391 unsigned mb_count, uint8_t *buf,
unsigned data_size,
392 unsigned* y_data_size,
unsigned* u_data_size,
unsigned* v_data_size,
398 buf, data_size,
ctx->qmat_luma[qp - 1], 0,
ctx->scantable);
400 *u_data_size =
encode_slice_plane(blocks_u, mb_count, buf + *y_data_size, data_size - *y_data_size,
401 ctx->qmat_chroma[qp - 1],
ctx->is_422,
ctx->scantable);
403 *v_data_size =
encode_slice_plane(blocks_v, mb_count, buf + *y_data_size + *u_data_size,
404 data_size - *y_data_size - *u_data_size,
405 ctx->qmat_chroma[qp - 1],
ctx->is_422,
ctx->scantable);
407 return *y_data_size + *u_data_size + *v_data_size;
412 const int abits = 16;
414 const int dsize = 1 << dbits - 1;
415 int diff = cur - prev;
418 if (
diff >= (1 << abits) - dsize)
444 unsigned mb_count, uint8_t *buf,
unsigned data_size,
unsigned* a_data_size)
446 const int abits = 16;
447 const int mask = (1 << abits) - 1;
448 const int num_coeffs = mb_count * 256;
449 int prev =
mask, cur;
452 int16_t * blocks = (int16_t *)src_a;
469 }
while (idx < num_coeffs);
476 "Underestimated required buffer size.\n");
485 unsigned dst_width,
unsigned dst_height,
int is_alpha_plane,
486 int is_interlaced,
int is_top_field)
489 int i, j, src_stride, box_height;
490 uint16_t last_pix, *last_line;
492 if (!is_interlaced) {
494 src += y * src_stride + x;
498 src += y * src_stride + x;
504 for (
i = 0;
i < box_height; ++
i) {
505 for (j = 0; j < box_width; ++j) {
506 if (!is_alpha_plane) {
512 if (!is_alpha_plane) {
513 last_pix =
dst[j - 1];
515 last_pix =
dst[j - 1] << 6;
517 for (; j < dst_width; j++)
522 last_line =
dst - dst_width;
523 for (;
i < dst_height;
i++) {
524 for (j = 0; j < dst_width; ++j) {
525 dst[j] = last_line[j];
533 unsigned dst_width,
unsigned dst_height,
int is_interlaced,
int is_top_field)
535 subimage_with_fill_template(
src, x, y,
stride,
width,
height,
dst, dst_width, dst_height, 0, is_interlaced, is_top_field);
541 unsigned dst_width,
unsigned dst_height,
int is_interlaced,
int is_top_field)
543 subimage_with_fill_template(
src, x, y,
stride,
width,
height,
dst, dst_width, dst_height, 1, is_interlaced, is_top_field);
547 int mb_y,
unsigned mb_count, uint8_t *buf,
unsigned data_size,
548 int unsafe,
int *qp,
int is_interlaced,
int is_top_field)
550 int luma_stride, chroma_stride, alpha_stride = 0;
552 int hdr_size = 6 + (
ctx->need_alpha * 2);
553 int ret = 0, slice_size;
554 const uint8_t *dest_y, *dest_u, *dest_v;
555 unsigned y_data_size = 0, u_data_size = 0, v_data_size = 0, a_data_size = 0;
558 int low_bytes = (tgt_bits - (tgt_bits >> 3)) >> 3;
559 int high_bytes = (tgt_bits + (tgt_bits >> 3)) >> 3;
571 if (!is_interlaced) {
572 dest_y = pic->
data[0] + (mb_y << 4) * luma_stride + (mb_x << 5);
573 dest_u = pic->
data[1] + (mb_y << 4) * chroma_stride + (mb_x << (5 -
ctx->is_422));
574 dest_v = pic->
data[2] + (mb_y << 4) * chroma_stride + (mb_x << (5 -
ctx->is_422));
576 dest_y = pic->
data[0] + (mb_y << 4) * luma_stride * 2 + (mb_x << 5);
577 dest_u = pic->
data[1] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 -
ctx->is_422));
578 dest_v = pic->
data[2] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 -
ctx->is_422));
580 dest_y += luma_stride;
581 dest_u += chroma_stride;
582 dest_v += chroma_stride;
589 (uint16_t *)
ctx->fill_y, mb_count << 4, 16, is_interlaced, is_top_field);
592 (uint16_t *)
ctx->fill_u, mb_count << (4 -
ctx->is_422), 16, is_interlaced, is_top_field);
595 (uint16_t *)
ctx->fill_v, mb_count << (4 -
ctx->is_422), 16, is_interlaced, is_top_field);
603 mb_count, buf + hdr_size, data_size - hdr_size,
604 &y_data_size, &u_data_size, &v_data_size,
607 if (!is_interlaced) {
608 calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride, mb_count, 0, 0);
612 calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride * 2, mb_count, 0, 0);
613 calc_plane_dct(fdsp, dest_u, blocks_u, chroma_stride * 2, mb_count, 1,
ctx->is_422);
614 calc_plane_dct(fdsp, dest_v, blocks_v, chroma_stride * 2, mb_count, 1,
ctx->is_422);
618 mb_count, buf + hdr_size, data_size - hdr_size,
619 &y_data_size, &u_data_size, &v_data_size,
626 mb_count, buf + hdr_size, data_size - hdr_size,
627 &y_data_size, &u_data_size, &v_data_size,
630 }
else if (slice_size < low_bytes && *qp
635 mb_count, buf + hdr_size, data_size - hdr_size,
636 &y_data_size, &u_data_size, &v_data_size,
642 buf[0] = hdr_size << 3;
647 if (
ctx->need_alpha) {
652 (uint16_t *)
ctx->fill_a, mb_count << 4, 16, is_interlaced, is_top_field);
654 buf + hdr_size + slice_size,
655 data_size - hdr_size - slice_size, &a_data_size);
661 return hdr_size + y_data_size + u_data_size + v_data_size + a_data_size;
665 uint8_t *buf,
const int buf_size,
const int picture_index,
const int is_top_field)
668 int mb_width = (avctx->
width + 15) >> 4;
669 int hdr_size, sl_size,
i;
670 int mb_y, sl_data_size, qp, mb_height, picture_height, unsafe_mb_height_limit;
671 int unsafe_bot, unsafe_right;
672 uint8_t *sl_data, *sl_data_sizes;
673 int slice_per_line = 0, rem = mb_width;
675 if (!
ctx->is_interlaced) {
676 mb_height = (avctx->
height + 15) >> 4;
677 unsafe_mb_height_limit = mb_height;
680 picture_height = (avctx->
height + 1) / 2;
682 picture_height = avctx->
height / 2;
684 mb_height = (picture_height + 15) >> 4;
685 unsafe_mb_height_limit = mb_height;
689 slice_per_line += rem >>
i;
694 hdr_size = 8; sl_data_size = buf_size - hdr_size;
695 sl_data_sizes = buf + hdr_size;
696 sl_data = sl_data_sizes + (slice_per_line * mb_height * 2);
697 for (mb_y = 0; mb_y < mb_height; mb_y++) {
700 while (mb_x < mb_width) {
701 while (mb_width - mb_x < slice_mb_count)
702 slice_mb_count >>= 1;
704 unsafe_bot = (avctx->
height & 0xf) && (mb_y == unsafe_mb_height_limit - 1);
705 unsafe_right = (avctx->
width & 0xf) && (mb_x + slice_mb_count == mb_width);
707 sl_size =
encode_slice(avctx, pic, mb_x, mb_y, slice_mb_count,
708 sl_data, sl_data_size, unsafe_bot || unsafe_right, &qp,
ctx->is_interlaced, is_top_field);
713 bytestream_put_be16(&sl_data_sizes, sl_size);
715 sl_data_size -= sl_size;
716 mb_x += slice_mb_count;
720 buf[0] = hdr_size << 3;
721 AV_WB32(buf + 1, sl_data - buf);
722 AV_WB16(buf + 5, slice_per_line * mb_height);
725 return sl_data - buf;
729 const AVFrame *pict,
int *got_packet)
732 int header_size = 148;
734 int compress_frame_size, pic_size, ret, is_top_field_first = 0;
743 compress_frame_size = 8 + header_size;
745 bytestream_put_be32(&buf, compress_frame_size);
746 bytestream_put_be32(&buf,
FRAME_ID);
748 bytestream_put_be16(&buf, header_size);
751 bytestream_put_be16(&buf, avctx->
width);
752 bytestream_put_be16(&buf, avctx->
height);
756 if (
ctx->is_interlaced) {
761 is_top_field_first = 1;
769 *buf++ = frame_flags;
778 *buf++ =
ctx->need_alpha ? 0x2 : 0;
786 pkt->size - compress_frame_size, 0, is_top_field_first);
790 compress_frame_size += pic_size;
792 if (
ctx->is_interlaced) {
794 pkt->size - compress_frame_size, 1, !is_top_field_first);
798 compress_frame_size += pic_size;
802 pkt->size = compress_frame_size;
811 for (
i = 0;
i < 64;
i++)
823 if (
ctx->is_interlaced) {
829 if (avctx->
width & 0x1) {
831 "frame width needs to be multiple of 2\n");
835 if (avctx->
width > 65534 || avctx->
height > 65535) {
837 "The maximum dimensions are 65534x65535\n");
841 if (strlen(
ctx->vendor) != 4) {
851 "encoding with ProRes standard (apcn) profile\n");
856 "encoding with ProRes 4444 (ap4h) profile\n");
861 "encoding with ProRes 4444+ (ap4h) profile\n");
871 "unknown profile %d, use [0 - apco, 1 - apcs, 2 - apcn (default), 3 - apch, 4 - ap4h, 5 - ap4x]\n",
876 "encoding with ProRes 444/Xq (ap4h/ap4x) profile, need YUV444P10 input\n");
881 "encoding with ProRes Proxy/LT/422/422 HQ (apco, apcs, apcn, ap4h) profile, need YUV422P10 input\n");
887 if ((avctx->
height & 0xf) || (avctx->
width & 0xf)) {
896 if ((avctx->
height & 0xf) || (avctx->
width & 0xf)) {
918 for (
i = 1;
i <= 16;
i++) {
935#define OFFSET(x) offsetof(ProresContext, x)
936#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
944 .class_name =
"ProRes encoder",
956 .p.name =
"prores_aw",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
const FFCodec ff_prores_aw_encoder
const FFCodec ff_prores_encoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Libavcodec external API header.
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define i(width, name, range_min, range_max)
static const unsigned codebook[256][2]
#define CODEC_PIXFMTS_ARRAY(array)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define AV_PROFILE_PRORES_STANDARD
#define AV_PROFILE_PRORES_4444
#define AV_PROFILE_PRORES_LT
#define AV_PROFILE_UNKNOWN
#define AV_PROFILE_PRORES_PROXY
#define AV_PROFILE_PRORES_XQ
#define AV_PROFILE_PRORES_HQ
int(* init)(AVBSFContext *ctx)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
#define FF_INPUT_BUFFER_MIN_SIZE
Used by some encoders as upper bound for the length of headers.
static const uint8_t frame_size[4]
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const AVProfile profiles[]
static enum AVPixelFormat pix_fmts[]
static const uint16_t mask[17]
Memory handling functions.
#define LOCAL_ALIGNED(a, t, v,...)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV422P10
AVPixelFormat
Pixel format.
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AVCOL_PRI_BT2020
ITU-R BT2020.
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
@ AVCOL_TRC_BT709
also ITU-R BT1361
#define AV_PIX_FMT_YUV444P10
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
const AVProfile ff_prores_profiles[]
const uint8_t ff_prores_dc_codebook[7]
const uint8_t ff_prores_run_to_cb[16]
const uint8_t ff_prores_progressive_scan[64]
const uint8_t ff_prores_level_to_cb[10]
const uint8_t ff_prores_interlaced_scan[64]
static const int valid_colorspace[]
static const uint8_t QMAT_LUMA[6][64]
static av_cold int prores_encode_init(AVCodecContext *avctx)
#define DEFAULT_SLICE_MB_WIDTH
static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
static int int_from_list_or_default(void *ctx, const char *val_name, int val, const int *array_valid_values, int default_value)
Check if a value is in the list.
static av_always_inline unsigned encode_slice_data(AVCodecContext *avctx, int16_t *blocks_y, int16_t *blocks_u, int16_t *blocks_v, unsigned mb_count, uint8_t *buf, unsigned data_size, unsigned *y_data_size, unsigned *u_data_size, unsigned *v_data_size, int qp)
static void get(const uint8_t *pixels, int stride, int16_t *block)
static int encode_slice_plane(int16_t *blocks, int mb_count, uint8_t *buf, unsigned buf_size, int *qmat, int sub_sample_chroma, const uint8_t *scan)
static const AVClass prores_enc_class
static const int bitrate_table[]
static void subimage_with_fill(const uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, unsigned dst_width, unsigned dst_height, int is_interlaced, int is_top_field)
static const int valid_trc[]
static const int valid_primaries[]
static void scale_mat(const uint8_t *src, int *dst, int scale)
static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
static void put_alpha_run(PutBitContext *pb, int run)
static av_cold int prores_encode_close(AVCodecContext *avctx)
static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, int mb_x, int mb_y, unsigned mb_count, uint8_t *buf, unsigned data_size, int unsafe, int *qp, int is_interlaced, int is_top_field)
static const int qp_start_table[]
static void subimage_alpha_with_fill(const uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, unsigned dst_width, unsigned dst_height, int is_interlaced, int is_top_field)
static int prores_encode_picture(AVCodecContext *avctx, const AVFrame *pic, uint8_t *buf, const int buf_size, const int picture_index, const int is_top_field)
static void subimage_with_fill_template(const uint16_t *src, unsigned x, unsigned y, unsigned stride, unsigned width, unsigned height, uint16_t *dst, unsigned dst_width, unsigned dst_height, int is_alpha_plane, int is_interlaced, int is_top_field)
static const uint8_t QMAT_CHROMA[6][64]
static void encode_acs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, int *qmat, const uint8_t *scan)
static void calc_plane_dct(FDCTDSPContext *fdsp, const uint8_t *src, int16_t *blocks, int src_stride, int mb_count, int chroma, int is_422)
static av_always_inline int encode_alpha_slice_data(AVCodecContext *avctx, int8_t *src_a, unsigned mb_count, uint8_t *buf, unsigned data_size, unsigned *a_data_size)
static const int qp_end_table[]
static void put_alpha_diff(PutBitContext *pb, int cur, int prev)
static void fdct_get(FDCTDSPContext *fdsp, const uint8_t *pixels, int stride, int16_t *block)
static void encode_dcs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, int scale)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int put_bits_left(PutBitContext *s)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static int put_bytes_output(const PutBitContext *s)
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int flags
AV_CODEC_FLAG_*.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
enum AVColorPrimaries color_primaries
enum AVColorSpace colorspace
YUV colorspace type.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum AVColorTransferCharacteristic color_trc
This structure stores compressed data.
void(* fdct)(int16_t *block)
const uint8_t * scantable
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)