40 #define DEFAULT_SLICE_MB_WIDTH 8 54 static const int bitrate_table[6] = { 1000, 2100, 3500, 5400, 7000, 10000};
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
73 4, 5, 6, 7, 9, 11, 13, 15,
74 5, 5, 7, 8, 11, 13, 15, 17,
75 6, 7, 9, 11, 13, 15, 15, 17,
76 7, 7, 9, 11, 13, 15, 17, 19,
77 7, 9, 11, 13, 14, 16, 19, 23,
78 9, 11, 13, 14, 16, 19, 23, 29,
79 9, 11, 13, 15, 17, 21, 28, 35,
80 11, 13, 16, 17, 21, 28, 35, 41
82 4, 4, 5, 5, 6, 7, 7, 9,
83 4, 4, 5, 6, 7, 7, 9, 9,
84 5, 5, 6, 7, 7, 9, 9, 10,
85 5, 5, 6, 7, 7, 9, 9, 10,
86 5, 6, 7, 7, 8, 9, 10, 12,
87 6, 7, 7, 8, 9, 10, 12, 15,
88 6, 7, 7, 9, 10, 11, 14, 17,
89 7, 7, 9, 10, 11, 14, 17, 21
91 4, 4, 4, 4, 4, 4, 4, 4,
92 4, 4, 4, 4, 4, 4, 4, 4,
93 4, 4, 4, 4, 4, 4, 4, 4,
94 4, 4, 4, 4, 4, 4, 4, 5,
95 4, 4, 4, 4, 4, 4, 5, 5,
96 4, 4, 4, 4, 4, 5, 5, 6,
97 4, 4, 4, 4, 5, 5, 6, 7,
98 4, 4, 4, 4, 5, 6, 7, 7
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, 5,
104 4, 4, 4, 4, 4, 4, 5, 5,
105 4, 4, 4, 4, 4, 5, 5, 6,
106 4, 4, 4, 4, 5, 5, 6, 7,
107 4, 4, 4, 4, 5, 6, 7, 7
109 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 2, 2, 2, 2, 2, 3,
113 2, 2, 2, 2, 2, 2, 3, 3,
114 2, 2, 2, 2, 2, 3, 3, 3,
115 2, 2, 2, 2, 3, 3, 3, 4,
116 2, 2, 2, 2, 3, 3, 4, 4,
122 4, 7, 9, 11, 13, 14, 63, 63,
123 7, 7, 11, 12, 14, 63, 63, 63,
124 9, 11, 13, 14, 63, 63, 63, 63,
125 11, 11, 13, 14, 63, 63, 63, 63,
126 11, 13, 14, 63, 63, 63, 63, 63,
127 13, 14, 63, 63, 63, 63, 63, 63,
128 13, 63, 63, 63, 63, 63, 63, 63,
129 63, 63, 63, 63, 63, 63, 63, 63
131 4, 5, 6, 7, 9, 11, 13, 15,
132 5, 5, 7, 8, 11, 13, 15, 17,
133 6, 7, 9, 11, 13, 15, 15, 17,
134 7, 7, 9, 11, 13, 15, 17, 19,
135 7, 9, 11, 13, 14, 16, 19, 23,
136 9, 11, 13, 14, 16, 19, 23, 29,
137 9, 11, 13, 15, 17, 21, 28, 35,
138 11, 13, 16, 17, 21, 28, 35, 41
140 4, 4, 5, 5, 6, 7, 7, 9,
141 4, 4, 5, 6, 7, 7, 9, 9,
142 5, 5, 6, 7, 7, 9, 9, 10,
143 5, 5, 6, 7, 7, 9, 9, 10,
144 5, 6, 7, 7, 8, 9, 10, 12,
145 6, 7, 7, 8, 9, 10, 12, 15,
146 6, 7, 7, 9, 10, 11, 14, 17,
147 7, 7, 9, 10, 11, 14, 17, 21
149 4, 4, 4, 4, 4, 4, 4, 4,
150 4, 4, 4, 4, 4, 4, 4, 4,
151 4, 4, 4, 4, 4, 4, 4, 4,
152 4, 4, 4, 4, 4, 4, 4, 5,
153 4, 4, 4, 4, 4, 4, 5, 5,
154 4, 4, 4, 4, 4, 5, 5, 6,
155 4, 4, 4, 4, 5, 5, 6, 7,
156 4, 4, 4, 4, 5, 6, 7, 7
158 4, 4, 4, 4, 4, 4, 4, 4,
159 4, 4, 4, 4, 4, 4, 4, 4,
160 4, 4, 4, 4, 4, 4, 4, 4,
161 4, 4, 4, 4, 4, 4, 4, 5,
162 4, 4, 4, 4, 4, 4, 5, 5,
163 4, 4, 4, 4, 4, 5, 5, 6,
164 4, 4, 4, 4, 5, 5, 6, 7,
165 4, 4, 4, 4, 5, 6, 7, 7
167 4, 4, 4, 4, 4, 4, 4, 4,
168 4, 4, 4, 4, 4, 4, 4, 4,
169 4, 4, 4, 4, 4, 4, 4, 4,
170 4, 4, 4, 4, 4, 4, 4, 5,
171 4, 4, 4, 4, 4, 4, 5, 5,
172 4, 4, 4, 4, 4, 5, 5, 6,
173 4, 4, 4, 4, 5, 5, 6, 7,
174 4, 4, 4, 4, 5, 6, 7, 7
187 int qmat_luma[16][64];
188 int qmat_chroma[16][64];
200 unsigned int rice_order, exp_order, switch_bits, first_exp,
exp, zeros;
203 switch_bits = codebook & 3;
204 rice_order = codebook >> 5;
205 exp_order = (codebook >> 2) & 7;
207 first_exp = ((switch_bits + 1) << rice_order);
209 if (val >= first_exp) {
211 val += (1 << exp_order);
213 zeros = exp - exp_order + switch_bits + 1;
216 }
else if (rice_order) {
217 put_bits(pb, (val >> rice_order), 0);
226 #define QSCALE(qmat,ind,val) ((val) / ((qmat)[ind])) 227 #define TO_GOLOMB(val) (((val) * 2) ^ ((val) >> 31)) 228 #define DIFF_SIGN(val, sign) (((val) >> 31) ^ (sign)) 229 #define IS_NEGATIVE(val) ((((val) >> 31) ^ -1) + 1) 230 #define TO_GOLOMB2(val,sign) ((val)==0 ? 0 : ((val) << 1) + (sign)) 234 int sign = (val >> 31);
235 return (val ^ sign) - sign;
238 #define FIRST_DC_CB 0xB8 243 int blocks_per_slice,
int *qmat)
247 int new_dc,
delta, diff_sign, new_code;
249 prev_dc =
QSCALE(qmat, 0, in[0] - 16384);
253 code = 5; sign = 0; idx = 64;
254 for (i = 1; i < blocks_per_slice; i++, idx += 64) {
255 new_dc =
QSCALE(qmat, 0, in[idx] - 16384);
256 delta = new_dc - prev_dc;
269 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C };
271 0x28, 0x28, 0x28, 0x4C };
274 int16_t *
in,
int blocks_per_slice,
int *qmat,
const uint8_t ff_prores_scan[64])
280 for (i = 1; i < 64; i++) {
281 int indp = ff_prores_scan[
i];
282 for (j = 0; j < blocks_per_slice; j++) {
283 int val =
QSCALE(qmat, indp, in[(j << 6) + indp]);
308 for (i = 0; i < 8; i++) {
330 for (i = 0; i < mb_count; i++) {
331 fdct_get(fdsp, src, src_stride, block + (0 << 6));
332 fdct_get(fdsp, src + 16, src_stride, block + (1 << 6));
333 fdct_get(fdsp, src + 8 * src_stride, src_stride, block + (2 << 6));
334 fdct_get(fdsp, src + 16 + 8 * src_stride, src_stride, block + (3 << 6));
339 }
else if (chroma && is_422){
340 for (i = 0; i < mb_count; i++) {
341 fdct_get(fdsp, src, src_stride, block + (0 << 6));
342 fdct_get(fdsp, src + 8 * src_stride, src_stride, block + (1 << 6));
347 for (i = 0; i < mb_count; i++) {
348 fdct_get(fdsp, src, src_stride, block + (0 << 6));
349 fdct_get(fdsp, src + 8 * src_stride, src_stride, block + (1 << 6));
350 fdct_get(fdsp, src + 16, src_stride, block + (2 << 6));
351 fdct_get(fdsp, src + 16 + 8 * src_stride, src_stride, block + (3 << 6));
360 const uint8_t ff_prores_scan[64])
362 int blocks_per_slice;
365 blocks_per_slice = mb_count << (2 - sub_sample_chroma);
376 int16_t * blocks_y, int16_t * blocks_u, int16_t * blocks_v,
377 unsigned mb_count,
uint8_t *
buf,
unsigned data_size,
378 unsigned* y_data_size,
unsigned* u_data_size,
unsigned* v_data_size,
387 *u_data_size =
encode_slice_plane(blocks_u, mb_count, buf + *y_data_size, data_size - *y_data_size,
390 *v_data_size =
encode_slice_plane(blocks_v, mb_count, buf + *y_data_size + *u_data_size,
391 data_size - *y_data_size - *u_data_size,
395 return *y_data_size + *u_data_size + *v_data_size;
400 const int abits = 16;
402 const int dsize = 1 << dbits - 1;
403 int diff = cur - prev;
405 diff = av_mod_uintp2(diff, abits);
406 if (diff >= (1 << abits) - dsize)
408 if (diff < -dsize || diff > dsize || !diff) {
432 unsigned mb_count,
uint8_t *
buf,
unsigned data_size,
unsigned* a_data_size)
434 const int abits = 16;
435 const int mask = (1 << abits) - 1;
436 const int num_coeffs = mb_count * 256;
437 int prev =
mask, cur;
440 int16_t * blocks = (int16_t *)src_a;
457 }
while (idx < num_coeffs);
465 "Underestimated required buffer size.\n");
474 unsigned dst_width,
unsigned dst_height,
int is_alpha_plane,
475 int is_interlaced,
int is_top_field)
477 int box_width =
FFMIN(width - x, dst_width);
478 int i, j, src_stride, box_height;
479 uint16_t last_pix, *last_line;
481 if (!is_interlaced) {
482 src_stride = stride >> 1;
483 src += y * src_stride + x;
484 box_height =
FFMIN(height - y, dst_height);
487 src += y * src_stride + x;
488 box_height =
FFMIN(height/2 - y, dst_height);
493 for (i = 0; i < box_height; ++
i) {
494 for (j = 0; j < box_width; ++j) {
495 if (!is_alpha_plane) {
498 dst[j] = src[j] << 6;
501 if (!is_alpha_plane) {
502 last_pix = dst[j - 1];
504 last_pix = dst[j - 1] << 6;
506 for (; j < dst_width; j++)
511 last_line = dst - dst_width;
512 for (; i < dst_height; i++) {
513 for (j = 0; j < dst_width; ++j) {
514 dst[j] = last_line[j];
522 unsigned dst_width,
unsigned dst_height,
int is_interlaced,
int is_top_field)
524 subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 0, is_interlaced, is_top_field);
530 unsigned dst_width,
unsigned dst_height,
int is_interlaced,
int is_top_field)
532 subimage_with_fill_template(src, x, y, stride, width, height, dst, dst_width, dst_height, 1, is_interlaced, is_top_field);
536 int mb_y,
unsigned mb_count,
uint8_t *
buf,
unsigned data_size,
537 int unsafe,
int *qp,
int is_interlaced,
int is_top_field)
539 int luma_stride, chroma_stride, alpha_stride = 0;
542 int ret = 0, slice_size;
543 uint8_t *dest_y, *dest_u, *dest_v;
544 unsigned y_data_size = 0, u_data_size = 0, v_data_size = 0, a_data_size = 0;
547 int low_bytes = (tgt_bits - (tgt_bits >> 3)) >> 3;
548 int high_bytes = (tgt_bits + (tgt_bits >> 3)) >> 3;
560 if (!is_interlaced) {
561 dest_y = pic->
data[0] + (mb_y << 4) * luma_stride + (mb_x << 5);
562 dest_u = pic->
data[1] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->
is_422));
563 dest_v = pic->
data[2] + (mb_y << 4) * chroma_stride + (mb_x << (5 - ctx->
is_422));
565 dest_y = pic->
data[0] + (mb_y << 4) * luma_stride * 2 + (mb_x << 5);
566 dest_u = pic->
data[1] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 - ctx->
is_422));
567 dest_v = pic->
data[2] + (mb_y << 4) * chroma_stride * 2 + (mb_x << (5 - ctx->
is_422));
569 dest_y += luma_stride;
570 dest_u += chroma_stride;
571 dest_v += chroma_stride;
578 (uint16_t *) ctx->
fill_y, mb_count << 4, 16, is_interlaced, is_top_field);
581 (uint16_t *) ctx->
fill_u, mb_count << (4 - ctx->
is_422), 16, is_interlaced, is_top_field);
584 (uint16_t *) ctx->
fill_v, mb_count << (4 - ctx->
is_422), 16, is_interlaced, is_top_field);
592 mb_count, buf + hdr_size, data_size - hdr_size,
593 &y_data_size, &u_data_size, &v_data_size,
596 if (!is_interlaced) {
597 calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride, mb_count, 0, 0);
601 calc_plane_dct(fdsp, dest_y, blocks_y, luma_stride * 2, mb_count, 0, 0);
607 mb_count, buf + hdr_size, data_size - hdr_size,
608 &y_data_size, &u_data_size, &v_data_size,
615 mb_count, buf + hdr_size, data_size - hdr_size,
616 &y_data_size, &u_data_size, &v_data_size,
619 }
else if (slice_size < low_bytes && *qp
624 mb_count, buf + hdr_size, data_size - hdr_size,
625 &y_data_size, &u_data_size, &v_data_size,
631 buf[0] = hdr_size << 3;
641 (uint16_t *) ctx->
fill_a, mb_count << 4, 16, is_interlaced, is_top_field);
643 buf + hdr_size + slice_size,
644 data_size - hdr_size - slice_size, &a_data_size);
650 return hdr_size + y_data_size + u_data_size + v_data_size + a_data_size;
654 uint8_t *
buf,
const int buf_size,
const int picture_index,
const int is_top_field)
657 int mb_width = (avctx->
width + 15) >> 4;
658 int hdr_size, sl_size,
i;
659 int mb_y, sl_data_size, qp, mb_height, picture_height, unsafe_mb_height_limit;
660 int unsafe_bot, unsafe_right;
661 uint8_t *sl_data, *sl_data_sizes;
662 int slice_per_line = 0, rem = mb_width;
665 mb_height = (avctx->
height + 15) >> 4;
666 unsafe_mb_height_limit = mb_height;
669 picture_height = (avctx->
height + 1) / 2;
671 picture_height = avctx->
height / 2;
673 mb_height = (picture_height + 15) >> 4;
674 unsafe_mb_height_limit = mb_height;
678 slice_per_line += rem >>
i;
683 hdr_size = 8; sl_data_size = buf_size - hdr_size;
684 sl_data_sizes = buf + hdr_size;
685 sl_data = sl_data_sizes + (slice_per_line * mb_height * 2);
686 for (mb_y = 0; mb_y < mb_height; mb_y++) {
689 while (mb_x < mb_width) {
690 while (mb_width - mb_x < slice_mb_count)
691 slice_mb_count >>= 1;
693 unsafe_bot = (avctx->
height & 0xf) && (mb_y == unsafe_mb_height_limit - 1);
694 unsafe_right = (avctx->
width & 0xf) && (mb_x + slice_mb_count == mb_width);
696 sl_size =
encode_slice(avctx, pic, mb_x, mb_y, slice_mb_count,
697 sl_data, sl_data_size, unsafe_bot || unsafe_right, &qp, ctx->
is_interlaced, is_top_field);
702 bytestream_put_be16(&sl_data_sizes, sl_size);
704 sl_data_size -= sl_size;
705 mb_x += slice_mb_count;
709 buf[0] = hdr_size << 3;
710 AV_WB32(buf + 1, sl_data - buf);
711 AV_WB16(buf + 5, slice_per_line * mb_height);
714 return sl_data -
buf;
718 const AVFrame *pict,
int *got_packet)
721 int header_size = 148;
723 int compress_frame_size, pic_size, ret, is_top_field_first = 0;
732 compress_frame_size = 8 + header_size;
734 bytestream_put_be32(&buf, compress_frame_size);
737 bytestream_put_be16(&buf, header_size);
738 bytestream_put_be16(&buf, 0);
740 bytestream_put_be16(&buf, avctx->
width);
741 bytestream_put_be16(&buf, avctx->
height);
749 is_top_field_first = 1;
757 *buf++ = frame_flags;
779 pkt->
size - compress_frame_size, 0, is_top_field_first);
783 compress_frame_size += pic_size;
787 pkt->
size - compress_frame_size, 1, !is_top_field_first);
791 compress_frame_size += pic_size;
796 pkt->
size = compress_frame_size;
805 for (i = 0; i < 64; i++)
806 dst[i] = src[i] * scale;
823 if (avctx->
width & 0x1) {
825 "frame width needs to be multiple of 2\n");
829 if (avctx->
width > 65534 || avctx->
height > 65535) {
831 "The maximum dimensions are 65534x65535\n");
835 if (strlen(ctx->
vendor) != 4) {
844 "encoding with ProRes standard (apcn) profile\n");
848 "encoding with ProRes 4444 (ap4h) profile\n");
852 "encoding with ProRes 4444+ (ap4h) profile\n");
862 "unknown profile %d, use [0 - apco, 1 - apcs, 2 - apcn (default), 3 - apch, 4 - ap4h, 5 - ap4x]\n",
867 "encoding with ProRes 444/Xq (ap4h/ap4x) profile, need YUV444P10 input\n");
872 "encoding with ProRes Proxy/LT/422/422 HQ (apco, apcs, apcn, ap4h) profile, need YUV422P10 input\n");
906 for (i = 1; i <= 16; i++) {
923 #define OFFSET(x) offsetof(ProresContext, x) 924 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
const char const char void * val
static const AVClass prores_enc_class
This structure describes decoded (raw) audio or video data.
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 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)
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
static void put_sbits(PutBitContext *pb, int n, int32_t value)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define LIBAVUTIL_VERSION_INT
#define TO_GOLOMB2(val, sign)
static av_cold int init(AVCodecContext *avctx)
static const int valid_colorspace[5]
static const int qp_end_table[6]
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
const char * av_default_item_name(void *ptr)
Return the context name.
static void encode_ac_coeffs(PutBitContext *pb, int16_t *in, int blocks_per_slice, int *qmat, const uint8_t ff_prores_scan[64])
static av_cold int prores_encode_init(AVCodecContext *avctx)
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static const AVOption options[]
#define FF_PROFILE_PRORES_LT
SMPTE ST 431-2 (2011) / DCI P3.
static void calc_plane_dct(FDCTDSPContext *fdsp, uint8_t *src, int16_t *blocks, int src_stride, int mb_count, int chroma, int is_422)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
static const uint8_t QMAT_CHROMA[6][64]
#define FF_PROFILE_PRORES_XQ
#define AV_CODEC_CAP_INTRA_ONLY
Codec is intra only.
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)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, int blocks_per_slice, int *qmat)
const uint8_t * scantable
int interlaced_frame
The content of the picture is interlaced.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define AV_INPUT_BUFFER_MIN_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
const AVProfile ff_prores_profiles[]
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static const int qp_start_table[6]
static const uint8_t lev_to_cb[10]
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
static int put_bits_left(PutBitContext *s)
static const uint16_t mask[17]
static void put_alpha_run(PutBitContext *pb, int run)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_cold int prores_encode_close(AVCodecContext *avctx)
int flags
AV_CODEC_FLAG_*.
enum AVColorSpace colorspace
YUV colorspace type.
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_YUV444P10
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
int flags
A combination of AV_PKT_FLAG values.
static int put_bits_count(PutBitContext *s)
static const int valid_primaries[9]
static av_always_inline int get_level(int val)
static void scale_mat(const uint8_t *src, int *dst, int scale)
static void put_alpha_diff(PutBitContext *pb, int cur, int prev)
static const AVProfile profiles[]
int width
picture width / height.
#define FF_PROFILE_PRORES_STANDARD
#define FF_PROFILE_UNKNOWN
ITU-R BT2020 non-constant luminance system.
static const int valid_trc[4]
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define DEFAULT_SLICE_MB_WIDTH
void(* fdct)(int16_t *block)
#define AV_PIX_FMT_YUVA444P10
AVCodec ff_prores_encoder
#define FF_PROFILE_PRORES_4444
#define AV_LOG_INFO
Standard information.
const uint8_t ff_prores_interlaced_scan[64]
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
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 ff_prores_scan[64])
main external API structure.
static const uint8_t dc_codebook[7]
const uint8_t ff_prores_progressive_scan[64]
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
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-> in
Describe the class of an AVClass context structure.
const char * name
short name for the profile
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)
#define FF_PROFILE_PRORES_HQ
#define QSCALE(qmat, ind, val)
static const AVClass proresaw_enc_class
static void encode_codeword(PutBitContext *pb, int val, int codebook)
static enum AVPixelFormat pix_fmts[]
static void subimage_alpha_with_fill(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)
#define AV_PIX_FMT_YUV422P10
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void fdct_get(FDCTDSPContext *fdsp, uint8_t *pixels, int stride, int16_t *block)
AVCodec ff_prores_aw_encoder
static const uint8_t QMAT_LUMA[6][64]
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
#define LOCAL_ALIGNED(a, t, v,...)
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 void subimage_with_fill_template(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 av_always_inline int diff(const uint32_t a, const uint32_t b)
#define xf(width, name, var, range_min, range_max, subs,...)
int top_field_first
If the content is interlaced, is top field displayed first.
enum AVColorPrimaries color_primaries
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
#define FF_PROFILE_PRORES_PROXY
enum AVColorTransferCharacteristic color_trc
int ff_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.
#define DIFF_SIGN(val, sign)
static const uint8_t run_to_cb[16]
AVPixelFormat
Pixel format.
This structure stores compressed data.
static const int bitrate_table[6]
static void subimage_with_fill(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)