38#define TRELLIS_WIDTH 16
39#define SCORE_LIMIT INT_MAX / 2
57 ptrdiff_t linesize,
int x,
int y,
int w,
int h,
58 int16_t *blocks, uint16_t *emu_buf,
59 int mbs_per_slice,
int blocks_per_mb,
int is_chroma)
62 const int mb_width = 4 * blocks_per_mb;
66 for (
i = 0;
i < mbs_per_slice;
i++,
src += mb_width) {
68 memset(blocks, 0, 64 * (mbs_per_slice -
i) * blocks_per_mb
72 if (x + mb_width <=
w && y + 16 <=
h) {
79 elinesize = 16 *
sizeof(*emu_buf);
81 bw =
FFMIN(
w - x, mb_width);
84 for (j = 0; j < bh; j++) {
85 memcpy(emu_buf + j * 16,
86 (
const uint8_t*)
src + j * linesize,
88 pix = emu_buf[j * 16 + bw - 1];
89 for (k = bw; k < mb_width; k++)
90 emu_buf[j * 16 + k] =
pix;
93 memcpy(emu_buf + j * 16,
94 emu_buf + (bh - 1) * 16,
95 mb_width *
sizeof(*emu_buf));
98 ctx->fdct(&
ctx->fdsp, esrc, elinesize, blocks);
100 if (blocks_per_mb > 2) {
101 ctx->fdct(&
ctx->fdsp, esrc + 8, elinesize, blocks);
104 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
106 if (blocks_per_mb > 2) {
107 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4 + 8, elinesize, blocks);
111 ctx->fdct(&
ctx->fdsp, esrc, elinesize, blocks);
113 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
115 if (blocks_per_mb > 2) {
116 ctx->fdct(&
ctx->fdsp, esrc + 8, elinesize, blocks);
118 ctx->fdct(&
ctx->fdsp, esrc + elinesize * 4 + 8, elinesize, blocks);
128 ptrdiff_t linesize,
int x,
int y,
int w,
int h,
129 uint16_t *blocks,
int mbs_per_slice,
int abits)
131 const int slice_width = 16 * mbs_per_slice;
132 int i, j, copy_w, copy_h;
134 copy_w =
FFMIN(
w - x, slice_width);
135 copy_h =
FFMIN(
h - y, 16);
136 for (
i = 0;
i < copy_h;
i++) {
137 memcpy(blocks,
src, copy_w *
sizeof(*
src));
139 for (j = 0; j < copy_w; j++)
142 for (j = 0; j < copy_w; j++)
143 blocks[j] = (blocks[j] << 6) | (blocks[j] >> 4);
144 for (j = copy_w; j < slice_width; j++)
145 blocks[j] = blocks[copy_w - 1];
146 blocks += slice_width;
147 src += linesize >> 1;
149 for (;
i < 16;
i++) {
150 memcpy(blocks, blocks - slice_width, slice_width *
sizeof(*blocks));
151 blocks += slice_width;
160 unsigned int rice_order, exp_order, switch_bits, switch_val;
168 switch_val = switch_bits << rice_order;
170 if (
val >= switch_val) {
171 val -= switch_val - (1 << exp_order);
174 put_bits(pb, exponent - exp_order + switch_bits, 0);
177 exponent =
val >> rice_order;
187#define GET_SIGN(x) ((x) >> 31)
188#define MAKE_CODE(x) (((x) * 2) ^ GET_SIGN(x))
191 int blocks_per_slice,
int scale)
196 prev_dc = (blocks[0] - 0x4000) /
scale;
201 for (
i = 1;
i < blocks_per_slice;
i++, blocks += 64) {
202 dc = (blocks[0] - 0x4000) /
scale;
203 delta = dc - prev_dc;
215 int blocks_per_slice,
216 const uint8_t *scan,
const int16_t *qmat)
222 int max_coeffs, abs_level;
223 max_coeffs = blocks_per_slice << 6;
225 for (
i = 1;
i < 64;
i++) {
226 for (idx = scan[
i]; idx < max_coeffs; idx += 64) {
227 level = blocks[idx] / qmat[scan[
i]];
235 prev_level =
FFMIN(abs_level, 9);
245 const uint16_t *
src, ptrdiff_t linesize,
246 int mbs_per_slice, int16_t *blocks,
250 int blocks_per_slice = mbs_per_slice * blocks_per_mb;
252 encode_dcs(pb, blocks, blocks_per_slice, qmat[0]);
253 encode_acs(pb, blocks, blocks_per_slice,
ctx->scantable, qmat);
258 const int dbits = (abits == 8) ? 4 : 7;
259 const int dsize = 1 << dbits - 1;
260 int diff = cur - prev;
263 if (
diff >= (1 << abits) - dsize)
290 int mbs_per_slice, uint16_t *blocks,
293 const int abits =
ctx->alpha_bits;
294 const int mask = (1 << abits) - 1;
295 const int num_coeffs = mbs_per_slice * 256;
296 int prev =
mask, cur;
313 }
while (idx < num_coeffs);
326 int num_cblocks, pwidth, line_add, picture_height;
330 uint16_t *qmat_chroma;
332 if (
ctx->pictures_per_frame == 1)
337 if ((y << 4) *
ctx->pictures_per_frame + line_add >= avctx->
height)
339 picture_height = (avctx->
height - line_add +
ctx->pictures_per_frame - 1) /
ctx->pictures_per_frame;
341 if (
ctx->force_quant) {
342 qmat =
ctx->quants[0];
343 qmat_chroma =
ctx->quants_chroma[0];
346 qmat_chroma =
ctx->quants_chroma[
quant];
348 qmat =
ctx->custom_q;
349 qmat_chroma =
ctx->custom_chroma_q;
350 for (
i = 0;
i < 64;
i++) {
352 qmat_chroma[
i] =
ctx->quant_chroma_mat[
i] *
quant;
356 for (
i = 0;
i <
ctx->num_planes;
i++) {
357 is_chroma = (
i == 1 ||
i == 2);
362 pwidth = avctx->
width;
367 pwidth = avctx->
width >> 1;
371 src = (
const uint16_t*)(pic->
data[
i] + yp * linesize +
376 pwidth, picture_height,
377 ctx->blocks[0],
ctx->emu_buf,
378 mbs_per_slice, num_cblocks, is_chroma);
381 mbs_per_slice,
ctx->blocks[0],
385 mbs_per_slice,
ctx->blocks[0],
386 num_cblocks, qmat_chroma);
390 pwidth, picture_height,
391 ctx->blocks[0], mbs_per_slice,
ctx->alpha_bits);
403 unsigned int rice_order, exp_order, switch_bits, switch_val;
411 switch_val = switch_bits << rice_order;
413 if (
val >= switch_val) {
414 val -= switch_val - (1 << exp_order);
417 return exponent * 2 - exp_order + switch_bits + 1;
419 return (
val >> rice_order) + rice_order + 1;
430 prev_dc = (blocks[0] - 0x4000) /
scale;
436 for (
i = 1;
i < blocks_per_slice;
i++, blocks += 64) {
437 dc = (blocks[0] - 0x4000) /
scale;
439 delta = dc - prev_dc;
453 const uint8_t *scan,
const int16_t *qmat)
459 int max_coeffs, abs_level;
462 max_coeffs = blocks_per_slice << 6;
465 for (
i = 1;
i < 64;
i++) {
466 for (idx = scan[
i]; idx < max_coeffs; idx += 64) {
467 level = blocks[idx] / qmat[scan[
i]];
475 prev_level =
FFMIN(abs_level, 9);
487 const uint16_t *
src, ptrdiff_t linesize,
492 int blocks_per_slice;
495 blocks_per_slice = mbs_per_slice * blocks_per_mb;
505 const int dbits = (abits == 8) ? 4 : 7;
506 const int dsize = 1 << dbits - 1;
507 int diff = cur - prev;
510 if (
diff >= (1 << abits) - dsize)
519 const uint16_t *
src, ptrdiff_t linesize,
520 int mbs_per_slice, int16_t *blocks)
522 const int abits =
ctx->alpha_bits;
523 const int mask = (1 << abits) - 1;
524 const int num_coeffs = mbs_per_slice * 256;
525 int prev =
mask, cur;
548 }
while (idx < num_coeffs);
561 int trellis_node,
int x,
int y,
int mbs_per_slice,
565 int i, q, pq, xp, yp;
569 const int min_quant =
ctx->profile_info->min_quant;
570 const int max_quant =
ctx->profile_info->max_quant;
572 int mbs, prev, cur, new_score;
576 uint16_t *qmat_chroma;
577 int linesize[4], line_add, picture_height;
580 if (
ctx->pictures_per_frame == 1)
585 if ((y << 4) *
ctx->pictures_per_frame + line_add >= avctx->
height)
587 picture_height = (avctx->
height - line_add +
ctx->pictures_per_frame - 1) /
ctx->pictures_per_frame;
588 mbs = x + mbs_per_slice;
590 for (
i = 0;
i <
ctx->num_planes;
i++) {
591 is_chroma[
i] = (
i == 1 ||
i == 2);
596 pwidth = avctx->
width;
601 pwidth = avctx->
width >> 1;
604 linesize[
i] =
ctx->pic->linesize[
i] *
ctx->pictures_per_frame;
605 src = (
const uint16_t *)(
ctx->pic->data[
i] + yp * linesize[
i] +
606 line_add *
ctx->pic->linesize[
i]) + xp;
610 pwidth, picture_height,
612 mbs_per_slice, num_cblocks[
i], is_chroma[
i]);
615 pwidth, picture_height,
616 td->
blocks[
i], mbs_per_slice,
ctx->alpha_bits);
620 for (q = min_quant; q < max_quant + 2; q++) {
627 mbs_per_slice, td->
blocks[3]);
629 for (q = min_quant; q <= max_quant; q++) {
637 for (
i = 1;
i <
ctx->num_planes - !!
ctx->alpha_bits;
i++) {
642 ctx->quants_chroma[q], td);
644 if (
bits > 65000 * 8)
647 slice_bits[q] =
bits;
648 slice_score[q] =
error;
650 if (slice_bits[max_quant] <=
ctx->bits_per_mb * mbs_per_slice) {
651 slice_bits[max_quant + 1] = slice_bits[max_quant];
652 slice_score[max_quant + 1] = slice_score[max_quant] + 1;
653 overquant = max_quant;
655 for (q = max_quant + 1; q < 128; q++) {
659 qmat =
ctx->quants[q];
660 qmat_chroma =
ctx->quants_chroma[q];
664 for (
i = 0;
i < 64;
i++) {
665 qmat[
i] =
ctx->quant_mat[
i] * q;
666 qmat_chroma[
i] =
ctx->quant_chroma_mat[
i] * q;
674 for (
i = 1;
i <
ctx->num_planes - !!
ctx->alpha_bits;
i++) {
685 slice_bits[max_quant + 1] =
bits;
686 slice_score[max_quant + 1] =
error;
689 td->
nodes[trellis_node + max_quant + 1].
quant = overquant;
691 bits_limit = mbs *
ctx->bits_per_mb;
692 for (pq = min_quant; pq < max_quant + 2; pq++) {
695 for (q = min_quant; q < max_quant + 2; q++) {
696 cur = trellis_node + q;
698 error = slice_score[q];
699 if (
bits > bits_limit)
717 pq = trellis_node + min_quant;
718 for (q = min_quant + 1; q < max_quant + 2; q++) {
721 pq = trellis_node + q;
729 int jobnr,
int threadnr)
733 int mbs_per_slice =
ctx->mbs_per_slice;
734 int x, y = jobnr,
mb, q = 0;
736 for (x =
mb = 0; x <
ctx->mb_width; x += mbs_per_slice,
mb++) {
737 while (
ctx->mb_width - x < mbs_per_slice)
744 for (x =
ctx->slices_width - 1; x >= 0; x--) {
753 const AVFrame *pic,
int *got_packet)
756 uint8_t *orig_buf, *buf, *slice_hdr, *slice_sizes, *
tmp;
757 uint8_t *picture_size_pos;
759 int x, y,
i,
mb, q = 0;
760 int sizes[4] = { 0 };
761 int slice_hdr_size = 2 *
ctx->num_planes;
764 int max_slice_size = (
ctx->frame_size_upper_bound - 200) / (
ctx->pictures_per_frame *
ctx->slices_per_picture + 1);
768 pkt_size =
ctx->frame_size_upper_bound;
773 orig_buf =
pkt->data;
777 bytestream_put_be32 (&orig_buf,
FRAME_ID);
783 bytestream_put_be16 (&buf,
ctx->chroma_factor !=
CFACTOR_Y422 ||
ctx->alpha_bits ? 1 : 0);
785 bytestream_put_be16 (&buf, avctx->
width);
786 bytestream_put_be16 (&buf, avctx->
height);
788 frame_flags =
ctx->chroma_factor << 6;
791 bytestream_put_byte (&buf, frame_flags);
793 bytestream_put_byte (&buf, 0);
795 bytestream_put_byte (&buf, pic->
color_trc);
797 bytestream_put_byte (&buf,
ctx->alpha_bits >> 3);
798 bytestream_put_byte (&buf, 0);
800 bytestream_put_byte (&buf, 0x03);
804 bytestream_put_byte (&buf, 0x00);
806 bytestream_put_be16 (&
tmp, buf - orig_buf);
808 for (
ctx->cur_picture_idx = 0;
809 ctx->cur_picture_idx <
ctx->pictures_per_frame;
810 ctx->cur_picture_idx++) {
812 picture_size_pos = buf + 1;
813 bytestream_put_byte (&buf, 0x40);
815 bytestream_put_be16 (&buf,
ctx->slices_per_picture);
816 bytestream_put_byte (&buf,
av_log2(
ctx->mbs_per_slice) << 4);
820 buf +=
ctx->slices_per_picture * 2;
823 if (!
ctx->force_quant) {
830 for (y = 0; y <
ctx->mb_height; y++) {
831 int mbs_per_slice =
ctx->mbs_per_slice;
832 for (x =
mb = 0; x <
ctx->mb_width; x += mbs_per_slice,
mb++) {
833 q =
ctx->force_quant ?
ctx->force_quant
834 :
ctx->slice_q[
mb + y *
ctx->slices_width];
836 while (
ctx->mb_width - x < mbs_per_slice)
839 bytestream_put_byte(&buf, slice_hdr_size << 3);
841 buf += slice_hdr_size - 1;
842 if (pkt_size <= buf - orig_buf + 2 * max_slice_size) {
843 uint8_t *start =
pkt->data;
846 int delta = 200 + (
ctx->pictures_per_frame *
847 ctx->slices_per_picture + 1) *
848 max_slice_size - pkt_size;
851 ctx->frame_size_upper_bound +=
delta;
855 "Packet too small: is %i,"
856 " needs %i (slice: %i). "
857 "Correct allocation",
858 pkt_size,
delta, max_slice_size);
867 orig_buf =
pkt->data + (orig_buf - start);
868 buf =
pkt->data + (buf - start);
869 picture_size_pos =
pkt->data + (picture_size_pos - start);
870 slice_sizes =
pkt->data + (slice_sizes - start);
871 slice_hdr =
pkt->data + (slice_hdr - start);
880 bytestream_put_byte(&slice_hdr, q);
881 slice_size = slice_hdr_size +
sizes[
ctx->num_planes - 1];
882 for (
i = 0;
i <
ctx->num_planes - 1;
i++) {
883 bytestream_put_be16(&slice_hdr,
sizes[
i]);
886 bytestream_put_be16(&slice_sizes, slice_size);
887 buf += slice_size - slice_hdr_size;
888 if (max_slice_size < slice_size)
889 max_slice_size = slice_size;
893 picture_size = buf - (picture_size_pos - 1);
894 bytestream_put_be32(&picture_size_pos, picture_size);
923 ptrdiff_t linesize, int16_t *
block)
926 const uint16_t *tsrc =
src;
928 for (y = 0; y < 8; y++) {
929 for (x = 0; x < 8; x++)
930 block[y * 8 + x] = tsrc[x];
931 tsrc += linesize >> 1;
939 int err = 0,
i, j, min_quant, max_quant;
948 if (!
ctx->force_quant) {
949 min_quant =
ctx->profile_info->min_quant;
950 max_quant =
ctx->profile_info->max_quant;
963 *
sizeof(*
ctx->tdata->nodes));
964 if (!
ctx->tdata[j].nodes)
966 for (
i = min_quant;
i < max_quant + 2;
i++) {
967 ctx->tdata[j].nodes[
i].prev_node = -1;
968 ctx->tdata[j].nodes[
i].bits = 0;
969 ctx->tdata[j].nodes[
i].score = 0;
977#define OFFSET(x) offsetof(ProresContext, x)
978#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
981 {
"mbs_per_slice",
"macroblocks per slice",
OFFSET(mbs_per_slice),
987 0, 0,
VE, .unit =
"profile" },
989 0, 0,
VE, .unit =
"profile" },
991 0, 0,
VE, .unit =
"profile" },
993 0, 0,
VE, .unit =
"profile" },
995 0, 0,
VE, .unit =
"profile" },
997 0, 0,
VE, .unit =
"profile" },
999 0, 0,
VE, .unit =
"profile" },
1000 {
"vendor",
"vendor ID",
OFFSET(vendor),
1002 {
"bits_per_mb",
"desired bits per macroblock",
OFFSET(bits_per_mb),
1007 0, 0,
VE, .unit =
"quant_mat" },
1009 0, 0,
VE, .unit =
"quant_mat" },
1011 0, 0,
VE, .unit =
"quant_mat" },
1013 0, 0,
VE, .unit =
"quant_mat" },
1015 0, 0,
VE, .unit =
"quant_mat" },
1017 0, 0,
VE, .unit =
"quant_mat" },
1019 { .i64 = 16 }, 0, 16,
VE },
1024 .class_name =
"ProRes encoder",
1031 .p.name =
"prores_ks",
static double val(void *priv, double ch)
const FFCodec ff_prores_ks_encoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
static av_cold int encode_init(AVCodecContext *avctx)
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(...)
#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 ...
static av_cold int encode_close(AVCodecContext *avctx)
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 bits[8]
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, AVPacket *pkt)
static const uint8_t frame_size[4]
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static const int sizes[][2]
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 uint16_t mask[17]
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P10
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_level_to_cb[10]
static int est_alpha_diff(int cur, int prev, int abits)
static int estimate_slice_plane(ProresContext *ctx, int *error, int plane, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int blocks_per_mb, const int16_t *qmat, ProresThreadData *td)
static const AVClass proresenc_class
static int estimate_alpha_plane(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks)
static int estimate_acs(int *error, int16_t *blocks, int blocks_per_slice, const uint8_t *scan, const int16_t *qmat)
static void encode_alpha_plane(ProresContext *ctx, PutBitContext *pb, int mbs_per_slice, uint16_t *blocks, int quant)
static av_cold int encode_init(AVCodecContext *avctx)
static av_cold int encode_close(AVCodecContext *avctx)
static void encode_acs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, const uint8_t *scan, const int16_t *qmat)
static void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
Write an unsigned rice/exp golomb codeword.
static void put_alpha_run(PutBitContext *pb, int run)
static int encode_slice(AVCodecContext *avctx, const AVFrame *pic, PutBitContext *pb, int sizes[4], int x, int y, int quant, int mbs_per_slice)
static void get_alpha_data(ProresContext *ctx, const uint16_t *src, ptrdiff_t linesize, int x, int y, int w, int h, uint16_t *blocks, int mbs_per_slice, int abits)
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
static int estimate_vlc(unsigned codebook, int val)
static int estimate_dcs(int *error, int16_t *blocks, int blocks_per_slice, int scale)
static int find_slice_quant(AVCodecContext *avctx, int trellis_node, int x, int y, int mbs_per_slice, ProresThreadData *td)
static void get_slice_data(ProresContext *ctx, const uint16_t *src, ptrdiff_t 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_alpha_diff(PutBitContext *pb, int cur, int prev, int abits)
static void prores_fdct(FDCTDSPContext *fdsp, const uint16_t *src, ptrdiff_t linesize, int16_t *block)
static void encode_slice_plane(ProresContext *ctx, PutBitContext *pb, const uint16_t *src, ptrdiff_t linesize, int mbs_per_slice, int16_t *blocks, int blocks_per_mb, const int16_t *qmat)
static void encode_dcs(PutBitContext *pb, int16_t *blocks, int blocks_per_slice, int scale)
static int find_quant_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
av_cold int ff_prores_kostya_encode_init(AVCodecContext *avctx, ProresContext *ctx, enum AVPixelFormat pix_fmt)
@ PRORES_PROFILE_STANDARD
#define MAX_MBS_PER_SLICE
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 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.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
int flags
AV_CODEC_FLAG_*.
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.
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)
int16_t blocks[MAX_PLANES][64 *4 *MAX_MBS_PER_SLICE]
int16_t custom_chroma_q[64]
struct TrellisNode * nodes
#define av_malloc_array(a, b)
#define avpriv_request_sample(...)
static void error(const char *err)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
static const uint8_t quant[64]