26 #define AOM_DISABLE_CTRL_TYPECHECKS 1
27 #include <aom/aom_encoder.h>
28 #include <aom/aomcx.h>
60 typedef struct AOMEncoderContext {
63 struct aom_codec_ctx encoder;
64 struct aom_image rawimg;
65 struct aom_fixed_buf twopass_stats;
85 [AOME_SET_CPUUSED] =
"AOME_SET_CPUUSED",
86 [AOME_SET_CQ_LEVEL] =
"AOME_SET_CQ_LEVEL",
87 [AOME_SET_ENABLEAUTOALTREF] =
"AOME_SET_ENABLEAUTOALTREF",
88 [AOME_SET_STATIC_THRESHOLD] =
"AOME_SET_STATIC_THRESHOLD",
89 [AV1E_SET_COLOR_RANGE] =
"AV1E_SET_COLOR_RANGE",
90 [AV1E_SET_COLOR_PRIMARIES] =
"AV1E_SET_COLOR_PRIMARIES",
91 [AV1E_SET_MATRIX_COEFFICIENTS] =
"AV1E_SET_MATRIX_COEFFICIENTS",
92 [AV1E_SET_TRANSFER_CHARACTERISTICS] =
"AV1E_SET_TRANSFER_CHARACTERISTICS",
93 [AV1E_SET_SUPERBLOCK_SIZE] =
"AV1E_SET_SUPERBLOCK_SIZE",
94 [AV1E_SET_TILE_COLUMNS] =
"AV1E_SET_TILE_COLUMNS",
95 [AV1E_SET_TILE_ROWS] =
"AV1E_SET_TILE_ROWS",
102 const char *detail = aom_codec_error_detail(&ctx->
encoder);
110 const struct aom_codec_enc_cfg *cfg)
115 av_log(avctx, level,
"aom_codec_enc_cfg\n");
116 av_log(avctx, level,
"generic settings\n"
117 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
119 " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n",
120 width,
"g_usage:", cfg->g_usage,
121 width,
"g_threads:", cfg->g_threads,
122 width,
"g_profile:", cfg->g_profile,
123 width,
"g_w:", cfg->g_w,
124 width,
"g_h:", cfg->g_h,
125 width,
"g_bit_depth:", cfg->g_bit_depth,
126 width,
"g_input_bit_depth:", cfg->g_input_bit_depth,
127 width,
"g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den,
128 width,
"g_error_resilient:", cfg->g_error_resilient,
129 width,
"g_pass:", cfg->g_pass,
130 width,
"g_lag_in_frames:", cfg->g_lag_in_frames);
131 av_log(avctx, level,
"rate control settings\n"
133 width,
"rc_dropframe_thresh:", cfg->rc_dropframe_thresh,
134 width,
"rc_end_usage:", cfg->rc_end_usage,
135 width,
"rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz,
136 width,
"rc_target_bitrate:", cfg->rc_target_bitrate);
137 av_log(avctx, level,
"quantizer settings\n"
139 width,
"rc_min_quantizer:", cfg->rc_min_quantizer,
140 width,
"rc_max_quantizer:", cfg->rc_max_quantizer);
141 av_log(avctx, level,
"bitrate tolerance\n"
143 width,
"rc_undershoot_pct:", cfg->rc_undershoot_pct,
144 width,
"rc_overshoot_pct:", cfg->rc_overshoot_pct);
145 av_log(avctx, level,
"decoder buffer model\n"
146 " %*s%u\n %*s%u\n %*s%u\n",
147 width,
"rc_buf_sz:", cfg->rc_buf_sz,
148 width,
"rc_buf_initial_sz:", cfg->rc_buf_initial_sz,
149 width,
"rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz);
150 av_log(avctx, level,
"2 pass rate control settings\n"
151 " %*s%u\n %*s%u\n %*s%u\n",
152 width,
"rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct,
153 width,
"rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct,
154 width,
"rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct);
155 av_log(avctx, level,
"keyframing settings\n"
156 " %*s%d\n %*s%u\n %*s%u\n",
157 width,
"kf_mode:", cfg->kf_mode,
158 width,
"kf_min_dist:", cfg->kf_min_dist,
159 width,
"kf_max_dist:", cfg->kf_max_dist);
160 av_log(avctx, level,
"tile settings\n"
162 width,
"tile_width_count:", cfg->tile_width_count,
163 width,
"tile_height_count:", cfg->tile_height_count);
164 av_log(avctx, level,
"\n");
195 enum aome_enc_control_id
id,
int val)
205 res = aom_codec_control(&ctx->
encoder,
id, val);
206 if (res != AOM_CODEC_OK) {
207 snprintf(buf,
sizeof(buf),
"Failed to set %s codec control",
220 aom_codec_destroy(&ctx->
encoder);
229 struct aom_codec_enc_cfg *enccfg, aom_codec_flags_t *
flags,
230 aom_img_fmt_t *img_fmt)
233 enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
237 *img_fmt = AOM_IMG_FMT_I420;
241 *img_fmt = AOM_IMG_FMT_I422;
245 *img_fmt = AOM_IMG_FMT_I444;
249 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
250 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
254 *img_fmt = AOM_IMG_FMT_I42016;
255 *flags |= AOM_CODEC_USE_HIGHBITDEPTH;
261 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
262 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
265 *img_fmt = AOM_IMG_FMT_I42216;
266 *flags |= AOM_CODEC_USE_HIGHBITDEPTH;
272 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) {
273 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
277 *img_fmt = AOM_IMG_FMT_I44416;
278 *flags |= AOM_CODEC_USE_HIGHBITDEPTH;
291 enum aom_color_range aom_cr;
307 int sb_dim = (dim + sb_size - 1) / sb_size;
308 int tile_dim = (sb_dim + (1 << tiles_log2) - 1) >> tiles_log2;
310 return (sb_dim + tile_dim - 1) / tile_dim;
314 struct aom_codec_enc_cfg *enccfg)
317 int sb_128x128_possible, sb_size, sb_width, sb_height;
318 int uniform_rows, uniform_cols;
319 int uniform_64x64_possible, uniform_128x128_possible;
320 int tile_size, rounding, i;
332 "columns to fill width.\n", ctx->
tile_cols);
353 "large enough to fit specified tile arrangement.\n");
359 "not allow more than %dx%d tiles.\n",
365 "not allow tiles of width greater than %d.\n",
377 sb_128x128_possible =
391 "-> %dx%d tiles.\n", uniform_cols, uniform_rows);
392 uniform_64x64_possible = uniform_cols == ctx->
tile_cols &&
395 if (sb_128x128_possible) {
401 "-> %dx%d tiles.\n", uniform_cols, uniform_rows);
402 uniform_128x128_possible = uniform_cols == ctx->
tile_cols &&
406 uniform_128x128_possible = 0;
410 if (uniform_64x64_possible && uniform_128x128_possible) {
412 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
416 if (uniform_64x64_possible && !sb_128x128_possible) {
418 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
423 if (uniform_128x128_possible) {
425 "superblocks (tile_cols_log2 = %d, tile_rows_log2 = %d).\n",
432 if (sb_128x128_possible) {
440 "superblocks (tile_cols = %d, tile_rows = %d).\n",
443 enccfg->tile_width_count = ctx->
tile_cols;
444 enccfg->tile_height_count = ctx->
tile_rows;
446 sb_width = (avctx->
width + sb_size - 1) / sb_size;
447 sb_height = (avctx->
height + sb_size - 1) / sb_size;
452 enccfg->tile_widths[i] = tile_size +
454 i > ctx->
tile_cols - 1 - (rounding + 1) / 2);
460 enccfg->tile_heights[i] = tile_size +
462 i > ctx->
tile_rows - 1 - (rounding + 1) / 2);
469 const struct aom_codec_iface *iface)
472 struct aom_codec_enc_cfg enccfg = { 0 };
473 #ifdef AOM_FRAME_IS_INTRAONLY
474 aom_codec_flags_t
flags =
477 aom_codec_flags_t flags = 0;
481 aom_img_fmt_t img_fmt;
482 aom_codec_caps_t codec_caps = aom_codec_get_caps(iface);
487 if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != AOM_CODEC_OK) {
489 aom_codec_err_to_string(res));
493 if (
set_pix_fmt(avctx, codec_caps, &enccfg, &flags, &img_fmt))
504 enccfg.g_w = avctx->
width;
505 enccfg.g_h = avctx->
height;
514 enccfg.g_pass = AOM_RC_FIRST_PASS;
516 enccfg.g_pass = AOM_RC_LAST_PASS;
518 enccfg.g_pass = AOM_RC_ONE_PASS;
522 enccfg.rc_end_usage = AOM_CBR;
523 }
else if (ctx->
crf >= 0) {
524 enccfg.rc_end_usage = AOM_CQ;
526 enccfg.rc_end_usage = AOM_Q;
532 }
else if (enccfg.rc_end_usage != AOM_Q) {
533 if (enccfg.rc_end_usage == AOM_CQ) {
534 enccfg.rc_target_bitrate = 1000000;
536 avctx->
bit_rate = enccfg.rc_target_bitrate * 1000;
538 "Neither bitrate nor constrained quality specified, using default bitrate of %dkbit/sec\n",
539 enccfg.rc_target_bitrate);
543 if (avctx->
qmin >= 0)
544 enccfg.rc_min_quantizer = avctx->
qmin;
545 if (avctx->
qmax >= 0)
546 enccfg.rc_max_quantizer = avctx->
qmax;
548 if (enccfg.rc_end_usage == AOM_CQ || enccfg.rc_end_usage == AOM_Q) {
549 if (ctx->
crf < enccfg.rc_min_quantizer || ctx->
crf > enccfg.rc_max_quantizer) {
551 "CQ level %d must be between minimum and maximum quantizer value (%d-%d)\n",
552 ctx->
crf, enccfg.rc_min_quantizer, enccfg.rc_max_quantizer);
562 enccfg.rc_2pass_vbr_minsection_pct =
565 enccfg.rc_2pass_vbr_maxsection_pct =
572 enccfg.rc_buf_initial_sz =
574 enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6;
580 enccfg.kf_max_dist = avctx->
gop_size;
582 if (enccfg.g_pass == AOM_RC_FIRST_PASS)
583 enccfg.g_lag_in_frames = 0;
584 else if (enccfg.g_pass == AOM_RC_LAST_PASS) {
585 int decode_size, ret;
603 if (decode_size < 0) {
616 enccfg.g_profile = avctx->
profile;
626 res = aom_codec_enc_init(&ctx->
encoder, iface, &enccfg, flags);
627 if (res != AOM_CODEC_OK) {
657 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
658 ctx->
rawimg.bit_depth = enccfg.g_bit_depth;
670 "not found. This is a bug, please report it.\n");
686 if (enccfg.rc_end_usage == AOM_CBR ||
687 enccfg.g_pass != AOM_RC_ONE_PASS) {
699 const struct aom_codec_cx_pkt *
src)
701 dst->
pts = src->data.frame.pts;
702 dst->
duration = src->data.frame.duration;
703 dst->
flags = src->data.frame.flags;
704 dst->
sz = src->data.frame.sz;
705 dst->
buf = src->data.frame.buf;
706 #ifdef AOM_FRAME_IS_INTRAONLY
713 memcpy(dst->
sse, ctx->
sse,
sizeof(dst->
sse));
740 if (!!(cx_frame->
flags & AOM_FRAME_IS_KEY)) {
742 #ifdef AOM_FRAME_IS_INTRAONLY
744 }
else if (cx_frame->
flags & AOM_FRAME_IS_INTRAONLY) {
751 cx_frame->
have_sse ? 3 : 0, pict_type);
755 for (i = 0; i < 3; ++i) {
756 avctx->
error[i] += cx_frame->
sse[i + 1];
766 "failed to send input packet\n");
773 "failed to receive output packet\n");
791 const struct aom_codec_cx_pkt *
pkt;
792 const void *iter =
NULL;
807 while ((pkt = aom_codec_get_cx_data(&ctx->
encoder, &iter))) {
809 case AOM_CODEC_CX_FRAME_PKT:
826 "Frame queue element alloc failed\n");
832 if (!cx_frame->
buf) {
839 memcpy(cx_frame->
buf, pkt->data.frame.buf, pkt->data.frame.sz);
843 case AOM_CODEC_STATS_PKT:
849 pkt->data.twopass_stats.sz)) < 0) {
854 memcpy((
uint8_t *)stats->buf + stats->sz,
855 pkt->data.twopass_stats.buf, pkt->data.twopass_stats.sz);
856 stats->sz += pkt->data.twopass_stats.sz;
859 #ifdef AOM_FRAME_IS_INTRAONLY
860 case AOM_CODEC_PSNR_PKT:
863 ctx->
sse[0] = pkt->data.psnr.sse[0];
864 ctx->
sse[1] = pkt->data.psnr.sse[1];
865 ctx->
sse[2] = pkt->data.psnr.sse[2];
866 ctx->
sse[3] = pkt->data.psnr.sse[3];
871 case AOM_CODEC_CUSTOM_PKT:
884 struct aom_image *rawimg =
NULL;
885 int64_t timestamp = 0;
887 aom_enc_frame_flags_t
flags = 0;
891 rawimg->planes[AOM_PLANE_Y] = frame->
data[0];
892 rawimg->planes[AOM_PLANE_U] = frame->
data[1];
893 rawimg->planes[AOM_PLANE_V] = frame->
data[2];
894 rawimg->stride[AOM_PLANE_Y] = frame->
linesize[0];
895 rawimg->stride[AOM_PLANE_U] = frame->
linesize[1];
896 rawimg->stride[AOM_PLANE_V] = frame->
linesize[2];
897 timestamp = frame->
pts;
900 rawimg->range = AOM_CR_STUDIO_RANGE;
903 rawimg->range = AOM_CR_FULL_RANGE;
908 flags |= AOM_EFLAG_FORCE_KF;
911 res = aom_codec_encode(&ctx->
encoder, rawimg, timestamp,
913 if (res != AOM_CODEC_OK) {
932 *got_packet = !!coded_size;
958 aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx());
959 if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
967 return aom_init(avctx, aom_codec_av1_cx());
970 #define OFFSET(x) offsetof(AOMContext, x)
971 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
974 {
"auto-alt-ref",
"Enable use of alternate reference "
976 {
"lag-in-frames",
"Number of frames to look ahead at for "
978 {
"error-resilience",
"Error resilience configuration",
OFFSET(error_resilient),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
VE,
"er"},
979 {
"default",
"Improve resiliency against losses of whole frames", 0,
AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_DEFAULT}, 0, 0,
VE,
"er"},
981 {
"static-thresh",
"A change threshold on blocks below which they will be skipped by the encoder",
OFFSET(static_thresh),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX,
VE },
982 {
"drop-threshold",
"Frame drop threshold", offsetof(
AOMContext, drop_threshold),
AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX,
VE },
983 {
"noise-sensitivity",
"Noise sensitivity",
OFFSET(noise_sensitivity),
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4,
VE},
985 {
"tile-columns",
"Log2 of number of tile columns to use",
OFFSET(tile_cols_log2),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
986 {
"tile-rows",
"Log2 of number of tile rows to use",
OFFSET(tile_rows_log2),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
994 {
"keyint_min",
"-1" },
1006 .
name =
"libaom-av1",
1019 .wrapper_name =
"libaom",
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
uint64_t error[AV_NUM_DATA_POINTERS]
error
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
int max_bitrate
Maximum bitrate of the stream, in bits per second.
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
The bitstream filter state.
void * buf
compressed data buffer
const char * av_default_item_name(void *ptr)
Return the context name.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
size_t sz
length of compressed data
static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride)
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
#define AV_PIX_FMT_YUV420P12
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
static const AVOption options[]
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int min_bitrate
Minimum bitrate of the stream, in bits per second.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter.
static int choose_tiling(AVCodecContext *avctx, struct aom_codec_enc_cfg *enccfg)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
static av_cold void free_frame_list(struct FrameListData *list)
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
struct FrameListData * next
struct aom_fixed_buf twopass_stats
int64_t pts
time stamp to show frame (in timebase units)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AV_LOG_VERBOSE
Detailed information.
static av_cold int codecctl_int(AVCodecContext *avctx, enum aome_enc_control_id id, int val)
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
#define AV_PIX_FMT_YUV422P12
char * stats_out
pass1 encoding statistics output buffer
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static void cx_pktcpy(AOMContext *ctx, struct FrameListData *dst, const struct aom_codec_cx_pkt *src)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold void av1_init_static(AVCodec *codec)
int qmax
maximum quantizer
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
Round to nearest and halfway cases away from zero.
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
static av_always_inline av_const double round(double x)
#define AV_PIX_FMT_YUV444P10
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, AVPacket *pkt)
Store coded frame information in format suitable for return from encode2().
static void set_color_range(AVCodecContext *avctx)
int flags
A combination of AV_PKT_FLAG values.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int rc_buffer_size
decoder bitstream buffer size
static const AVClass class_aom
int64_t rc_min_rate
minimum bitrate
AVCodec ff_libaom_av1_encoder
struct FrameListData * coded_frame_list
static enum AVPixelFormat av1_pix_fmts_highbd[]
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
enum AVPictureType pict_type
Picture type of the frame.
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out)
Queue multiple output frames from the encoder, returning the front-most.
int width
picture width / height.
#define FF_PROFILE_UNKNOWN
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
static av_cold void free_coded_frame(struct FrameListData *cx_frame)
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static int count_uniform_tiling(int dim, int sb_size, int tiles_log2)
static void stats(AVPacket *const *in, int n_in, unsigned *_max, unsigned *_sum)
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
static const char *const ctlidstr[]
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
static void error(const char *err)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
the normal 2^n-1 "JPEG" YUV ranges
int have_sse
true if we have pending sse[]
static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps, struct aom_codec_enc_cfg *enccfg, aom_codec_flags_t *flags, aom_img_fmt_t *img_fmt)
This structure describes the bitrate properties of an encoded bitstream.
struct aom_codec_ctx encoder
#define AV_LOG_INFO
Standard information.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Libavcodec external API header.
aom_superblock_size_t superblock_size
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
const AVProfile ff_av1_profiles[]
main external API structure.
static enum AVPixelFormat av1_pix_fmts[]
int qmin
minimum quantizer
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static av_cold int av1_init(AVCodecContext *avctx)
#define AV_PIX_FMT_YUV420P10
static void coded_frame_add(void *list, struct FrameListData *cx_frame)
Describe the class of an AVClass context structure.
static const AVProfile profiles[]
#define FF_PROFILE_AV1_PROFESSIONAL
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
#define FF_PROFILE_AV1_MAIN
uint32_t flags
flags for this frame
offset must point to two consecutive integers
static av_cold void dump_enc_cfg(AVCodecContext *avctx, const struct aom_codec_enc_cfg *cfg)
float qcompress
amount of qscale change between easy & hard scenes (0.0-1.0)
int have_sse
true if we have pending sse[]
#define flags(name, subs,...)
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
the normal 219*2^(n-8) "MPEG" YUV ranges
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
common internal and external API header
static int aom_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
int avg_bitrate
Average bitrate of the stream, in bits per second.
unsigned long duration
duration to show frame (in timebase units)
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static const AVCodecDefault defaults[]
AVPixelFormat
Pixel format.
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static av_cold int aom_free(AVCodecContext *avctx)
#define FF_PROFILE_AV1_HIGH
int64_t rc_max_rate
maximum bitrate
int keyint_min
minimum GOP size