Go to the documentation of this file.
22 #include "config_components.h"
53 #if FF_API_REORDERED_OPAQUE
54 int64_t reordered_opaque;
130 static const int level_map[] = {
137 if (level < 0 || level > X264_LOG_DEBUG)
146 memset(o, 0,
sizeof(*o));
150 const x264_nal_t *nals,
int nnal)
160 for (
int i = 0;
i < nnal;
i++) {
161 size += nals[
i].i_payload;
165 #if INT_MAX > INT64_MAX / INT_MAX - 1
166 if ((int64_t)
size < 0)
187 memcpy(p, nals[0].p_payload,
size);
224 x264_encoder_reconfig(x4->
enc, &x4->
params);
226 if (x4->
params.vui.i_sar_height*
ctx->sample_aspect_ratio.num !=
ctx->sample_aspect_ratio.den * x4->
params.vui.i_sar_width) {
227 x4->
params.vui.i_sar_height =
ctx->sample_aspect_ratio.den;
228 x4->
params.vui.i_sar_width =
ctx->sample_aspect_ratio.num;
229 x264_encoder_reconfig(x4->
enc, &x4->
params);
232 if (x4->
params.rc.i_vbv_buffer_size !=
ctx->rc_buffer_size / 1000 ||
233 x4->
params.rc.i_vbv_max_bitrate !=
ctx->rc_max_rate / 1000) {
234 x4->
params.rc.i_vbv_buffer_size =
ctx->rc_buffer_size / 1000;
235 x4->
params.rc.i_vbv_max_bitrate =
ctx->rc_max_rate / 1000;
236 x264_encoder_reconfig(x4->
enc, &x4->
params);
239 if (x4->
params.rc.i_rc_method == X264_RC_ABR &&
242 x264_encoder_reconfig(x4->
enc, &x4->
params);
246 x4->
params.rc.i_rc_method == X264_RC_CRF &&
247 x4->
params.rc.f_rf_constant != x4->
crf) {
249 x264_encoder_reconfig(x4->
enc, &x4->
params);
252 if (x4->
params.rc.i_rc_method == X264_RC_CQP &&
254 x4->
params.rc.i_qp_constant != x4->
cqp) {
256 x264_encoder_reconfig(x4->
enc, &x4->
params);
262 x264_encoder_reconfig(x4->
enc, &x4->
params);
271 switch (stereo->
type) {
290 #if X264_BUILD >= 145
303 "Ignoring unsupported inverted stereo value %d\n", fpa_type);
307 if (fpa_type != x4->
params.i_frame_packing) {
308 x4->
params.i_frame_packing = fpa_type;
309 x264_encoder_reconfig(x4->
enc, &x4->
params);
317 x264_picture_t *pic = &x4->
pic;
319 for (
int i = 0;
i < pic->extra_sei.num_payloads;
i++)
320 av_free(pic->extra_sei.payloads[
i].payload);
323 pic->extra_sei.num_payloads = 0;
361 if (x4->
params.rc.i_aq_mode == X264_AQ_NONE) {
367 }
else if (
frame->interlaced_frame) {
377 if (!roi_size ||
size % roi_size != 0) {
381 nb_rois =
size / roi_size;
383 qoffsets =
av_calloc(mbx * mby,
sizeof(*qoffsets));
389 for (
int i = nb_rois - 1;
i >= 0;
i--) {
390 int startx, endx, starty, endy;
406 qoffset =
av_clipf(qoffset * qp_range, -qp_range, +qp_range);
408 for (
int y = starty; y < endy; y++) {
409 for (
int x = startx; x < endx; x++) {
410 qoffsets[x + y*mbx] = qoffset;
415 pic->prop.quant_offsets = qoffsets;
416 pic->prop.quant_offsets_free =
av_free;
422 x264_picture_t **ppic)
426 x264_picture_t *pic = &x4->
pic;
427 x264_sei_t *
sei = &pic->extra_sei;
428 unsigned int sei_data_size = 0;
429 int64_t wallclock = 0;
437 x264_picture_init(pic);
438 pic->img.i_csp = x4->
params.i_csp;
439 #if X264_BUILD >= 153
445 pic->img.i_csp |= X264_CSP_HIGH_DEPTH;
448 for (
int i = 0;
i < pic->img.i_plane;
i++) {
449 pic->img.plane[
i] =
frame->data[
i];
450 pic->img.i_stride[
i] =
frame->linesize[
i];
453 pic->i_pts =
frame->pts;
464 #if FF_API_REORDERED_OPAQUE
466 opaque->reordered_opaque =
frame->reordered_opaque;
474 pic->opaque = opaque;
479 switch (
frame->pict_type) {
481 pic->i_type = x4->
forced_idr > 0 ? X264_TYPE_IDR : X264_TYPE_KEYFRAME;
484 pic->i_type = X264_TYPE_P;
487 pic->i_type = X264_TYPE_B;
490 pic->i_type = X264_TYPE_AUTO;
504 pic->extra_sei.payloads =
av_mallocz(
sizeof(pic->extra_sei.payloads[0]));
505 if (pic->extra_sei.payloads ==
NULL) {
510 pic->extra_sei.sei_free =
av_free;
512 pic->extra_sei.payloads[0].payload_size = sei_size;
513 pic->extra_sei.payloads[0].payload = sei_data;
514 pic->extra_sei.num_payloads = 1;
515 pic->extra_sei.payloads[0].payload_type = 4;
527 for (
int j = 0; j <
frame->nb_side_data; j++) {
530 x264_sei_payload_t *sei_payload;
540 sei_payload = &
sei->payloads[
sei->num_payloads];
542 if (!sei_payload->payload) {
546 sei_payload->payload_size = side_data->
size;
567 x264_picture_t pic_out = {0}, *pic_in;
569 int64_t wallclock = 0;
577 if (x264_encoder_encode(x4->
enc, &nal, &nnal, pic_in, &pic_out) < 0)
588 "Unhandled reconstructed frame colorspace: %d\n",
595 for (
int i = 0;
i < pic_out.img.i_plane;
i++) {
610 }
while (!
ret && !
frame && x264_encoder_delayed_frames(x4->
enc));
618 out_opaque = pic_out.opaque;
621 #if FF_API_REORDERED_OPAQUE
623 ctx->reordered_opaque = out_opaque->reordered_opaque;
639 "this is a bug, please report it.\n");
640 #if FF_API_REORDERED_OPAQUE
642 ctx->reordered_opaque = 0;
647 switch (pic_out.i_type) {
685 #if X264_BUILD >= 161
686 x264_param_cleanup(&x4->
params);
690 x264_encoder_close(x4->
enc);
702 if ((
ret = x264_param_parse(&x4->
params, opt, param)) < 0) {
703 if (
ret == X264_PARAM_BAD_NAME) {
705 "bad option '%s': '%s'\n", opt, param);
707 #if X264_BUILD >= 161
708 }
else if (
ret == X264_PARAM_ALLOC_FAILED) {
710 "out of memory parsing option '%s': '%s'\n", opt, param);
715 "bad value for '%s': '%s'\n", opt, param);
738 return X264_CSP_BGRA;
758 #define PARSE_X264_OPT(name, var)\
759 if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\
760 av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
761 return AVERROR(EINVAL);\
774 #if CONFIG_LIBX262_ENCODER
777 x264_param_default_mpeg2(&x4->
params);
780 x264_param_default(&x4->
params);
789 for (
i = 0; x264_preset_names[
i];
i++)
793 for (
i = 0; x264_tune_names[
i];
i++)
799 if (avctx->
level > 0)
803 x4->
params.p_log_private = avctx;
804 x4->
params.i_log_level = X264_LOG_DEBUG;
806 #if X264_BUILD >= 153
814 av_log(avctx,
AV_LOG_ERROR,
"bit_rate and rc_max_rate > %d000 not supported by libx264\n", INT_MAX);
818 x4->
params.rc.i_rc_method = X264_RC_ABR;
824 x4->
params.rc.b_stat_read = 1;
827 x4->
params.rc.i_rc_method = X264_RC_CRF;
829 }
else if (x4->
cqp >= 0) {
830 x4->
params.rc.i_rc_method = X264_RC_CQP;
840 x4->
params.rc.f_vbv_buffer_init =
862 if (avctx->
qmin >= 0)
864 if (avctx->
qmax >= 0)
868 if (avctx->
qblur >= 0)
872 if (avctx->
refs >= 0)
874 else if (x4->
params.i_level_idc > 0) {
877 int scale = X264_BUILD < 129 ? 384 : 1;
879 for (
i = 0;
i<x264_levels[
i].level_idc;
i++)
922 x4->
params.b_vfr_input = 0;
925 #if X264_BUILD >= 142
929 "x264 too old for AVC Intra, at least version 142 needed\n");
935 "x264 too old for AVC Intra 300/480, at least version 164 needed\n");
939 x4->
params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY;
943 if (x4->
b_bias != INT_MIN)
964 x264_param_apply_fastfirstpass(&x4->
params);
1005 if (x264_param_apply_profile(&x4->
params, x4->
profile) < 0) {
1009 for (
i = 0; x264_profile_names[
i];
i++)
1018 x4->
params.vui.i_sar_width = sw;
1019 x4->
params.vui.i_sar_height = sh;
1047 x4->
params.vui.b_fullrange = 1;
1059 x4->
params.b_repeat_headers = 0;
1062 x4->
params.b_full_recon = 1;
1067 char param[4096]={0},
val[4096]={0};
1068 if(sscanf(p,
"%4095[^:=]=%4095[^:]", param,
val) == 1){
1084 #if X264_BUILD >= 142
1087 x4->
params.b_repeat_headers = 1;
1095 "Error parsing option '%s = %s'.\n",
1097 #if X264_BUILD >= 161
1098 if (
ret == X264_PARAM_ALLOC_FAILED)
1107 x4->
params.i_bframe_pyramid ? 2 : 1 : 0;
1113 x4->
enc = x264_encoder_open(&x4->
params);
1122 s = x264_encoder_headers(x4->
enc, &nal, &nnal);
1127 for (
i = 0;
i < nnal;
i++) {
1129 if (nal[
i].i_type == NAL_SEI) {
1135 memcpy(x4->
sei, nal[
i].p_payload, nal[
i].i_payload);
1138 memcpy(p, nal[
i].p_payload, nal[
i].i_payload);
1139 p += nal[
i].i_payload;
1173 #ifdef X264_CSP_NV21
1199 #ifdef X264_CSP_NV21
1206 #ifdef X264_CSP_I400
1212 #if CONFIG_LIBX264RGB_ENCODER
1221 #if X264_BUILD < 153
1224 if (x264_bit_depth == 8)
1226 else if (x264_bit_depth == 9)
1228 else if (x264_bit_depth == 10)
1233 #define OFFSET(x) offsetof(X264Context, x)
1234 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1239 {
"fastfirstpass",
"Use fast settings when encoding first pass",
OFFSET(fastfirstpass),
AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1,
VE},
1245 {
"crf",
"Select the quality for constant quality mode",
OFFSET(crf),
AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX,
VE },
1246 {
"crf_max",
"In CRF mode, prevents VBV from lowering quality beyond this point.",
OFFSET(crf_max),
AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX,
VE },
1247 {
"qp",
"Constant quantization parameter rate control method",
OFFSET(cqp),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE },
1250 {
"variance",
"Variance AQ (complexity mask)", 0,
AV_OPT_TYPE_CONST, {.i64 = X264_AQ_VARIANCE}, INT_MIN, INT_MAX,
VE,
"aq_mode" },
1251 {
"autovariance",
"Auto-variance AQ", 0,
AV_OPT_TYPE_CONST, {.i64 = X264_AQ_AUTOVARIANCE}, INT_MIN, INT_MAX,
VE,
"aq_mode" },
1252 #if X264_BUILD >= 144
1253 {
"autovariance-biased",
"Auto-variance AQ with bias to dark scenes", 0,
AV_OPT_TYPE_CONST, {.i64 = X264_AQ_AUTOVARIANCE_BIASED}, INT_MIN, INT_MAX,
VE,
"aq_mode" },
1255 {
"aq-strength",
"AQ strength. Reduces blocking and blurring in flat and textured areas.",
OFFSET(aq_strength),
AV_OPT_TYPE_FLOAT, {.dbl = -1}, -1, FLT_MAX,
VE},
1257 {
"psy-rd",
"Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.",
OFFSET(psy_rd),
AV_OPT_TYPE_STRING, {0 }, 0, 0,
VE},
1258 {
"rc-lookahead",
"Number of frames to look ahead for frametype and ratecontrol",
OFFSET(rc_lookahead),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE },
1260 {
"weightp",
"Weighted prediction analysis method.",
OFFSET(weightp),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE,
"weightp" },
1265 {
"intra-refresh",
"Use Periodic Intra Refresh instead of IDR frames.",
OFFSET(intra_refresh),
AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1,
VE },
1266 {
"bluray-compat",
"Bluray compatibility workarounds.",
OFFSET(bluray_compat) ,
AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1,
VE },
1267 {
"b-bias",
"Influences how often B-frames are used",
OFFSET(b_bias),
AV_OPT_TYPE_INT, { .i64 = INT_MIN}, INT_MIN, INT_MAX,
VE },
1268 {
"b-pyramid",
"Keep some B-frames as references.",
OFFSET(b_pyramid),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE,
"b_pyramid" },
1270 {
"strict",
"Strictly hierarchical pyramid", 0,
AV_OPT_TYPE_CONST, {.i64 = X264_B_PYRAMID_STRICT}, INT_MIN, INT_MAX,
VE,
"b_pyramid" },
1271 {
"normal",
"Non-strict (not Blu-ray compatible)", 0,
AV_OPT_TYPE_CONST, {.i64 = X264_B_PYRAMID_NORMAL}, INT_MIN, INT_MAX,
VE,
"b_pyramid" },
1272 {
"mixed-refs",
"One reference per partition, as opposed to one reference per macroblock",
OFFSET(mixed_refs),
AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1,
VE },
1278 {
"cplxblur",
"Reduce fluctuations in QP (before curve compression)",
OFFSET(cplxblur),
AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX,
VE},
1279 {
"partitions",
"A comma-separated list of partitions to consider. "
1280 "Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all",
OFFSET(partitions),
AV_OPT_TYPE_STRING, { 0 }, 0, 0,
VE},
1281 {
"direct-pred",
"Direct MV prediction mode",
OFFSET(direct_pred),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE,
"direct-pred" },
1286 {
"slice-max-size",
"Limit the size of each slice in bytes",
OFFSET(slice_max_size),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX,
VE },
1288 {
"nal-hrd",
"Signal HRD information (requires vbv-bufsize; "
1293 {
"avcintra-class",
"AVC-Intra class 50/100/200/300/480",
OFFSET(avcintra_class),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 480 ,
VE},
1294 {
"me_method",
"Set motion estimation method",
OFFSET(motion_est),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA,
VE,
"motion-est"},
1295 {
"motion-est",
"Set motion estimation method",
OFFSET(motion_est),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA,
VE,
"motion-est"},
1301 {
"forced-idr",
"If forcing keyframes, force them as IDR frames.",
OFFSET(forced_idr),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, -1, 1,
VE },
1308 {
"b_strategy",
"Strategy to choose between I/P/B-frames",
OFFSET(b_frame_strategy),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2,
VE },
1309 {
"chromaoffset",
"QP difference between chroma and luma",
OFFSET(chroma_offset),
AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX,
VE },
1310 {
"sc_threshold",
"Scene change threshold",
OFFSET(scenechange_threshold),
AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX,
VE },
1311 {
"noise_reduction",
"Noise reduction",
OFFSET(noise_reduction),
AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX,
VE },
1312 {
"udu_sei",
"Use user data unregistered SEI if available",
OFFSET(udu_sei),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1,
VE },
1313 {
"x264-params",
"Override the x264 configuration using a :-separated list of key=value parameters",
OFFSET(x264_params),
AV_OPT_TYPE_DICT, { 0 }, 0, 0,
VE },
1322 {
"i_qfactor",
"-1" },
1323 {
"b_qfactor",
"-1" },
1331 {
"trellis",
"-1" },
1332 {
"me_range",
"-1" },
1334 {
"keyint_min",
"-1" },
1337 {
"thread_type",
"0" },
1338 {
"flags",
"+cgop" },
1339 {
"rc_init_occupancy",
"-1" },
1343 #if CONFIG_LIBX264_ENCODER
1344 static const AVClass x264_class = {
1351 #if X264_BUILD >= 153
1354 FFCodec ff_libx264_encoder = {
1355 .
p.
name =
"libx264",
1363 .p.priv_class = &x264_class,
1364 .p.wrapper_name =
"libx264",
1370 #if X264_BUILD < 153
1376 #if X264_BUILD < 158
1383 #if CONFIG_LIBX264RGB_ENCODER
1384 static const AVClass rgbclass = {
1392 .
p.
name =
"libx264rgb",
1393 CODEC_LONG_NAME(
"libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB"),
1399 .p.pix_fmts = pix_fmts_8bit_rgb,
1400 .p.priv_class = &rgbclass,
1401 .p.wrapper_name =
"libx264",
1408 #if X264_BUILD < 158
1415 #if CONFIG_LIBX262_ENCODER
1416 static const AVClass X262_class = {
1424 .
p.
name =
"libx262",
1432 .p.priv_class = &X262_class,
1433 .p.wrapper_name =
"libx264",
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
Send the specified message to the log if the level is less than or equal to the current av_log_level.
#define FF_ENABLE_DEPRECATION_WARNINGS
int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, void **data, size_t *sei_size)
Check AVFrame for A53 side data and allocate and fill SEI message with A53 info.
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int keyint_min
minimum GOP size
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVColorSpace colorspace
YUV colorspace type.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
static void stats(AVPacket *const *in, int n_in, unsigned *_max, unsigned *_sum)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
#define FF_PROFILE_H264_BASELINE
#define AV_CODEC_CAP_ENCODER_RECON_FRAME
The encoder is able to output reconstructed frame data, i.e.
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
static void X264_log(void *p, int level, const char *fmt, va_list args)
This structure describes decoded (raw) audio or video data.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
@ AVCOL_RANGE_JPEG
Full range content.
const FFCodec ff_libx264rgb_encoder
int depth
Number of bits in the component.
#define AV_PIX_FMT_YUV420P10
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
int qmax
maximum quantizer
int me_subpel_quality
subpel ME quality
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int roi_warned
If the encoder does not support ROI then warn the first time we encounter a frame with ROI side data.
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
static av_cold int X264_init(AVCodecContext *avctx)
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
static av_cold void X264_init_static(FFCodec *codec)
#define AV_CODEC_FLAG_COPY_OPAQUE
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
AVCodec p
The public AVCodec.
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
int refs
number of reference frames
int flags
AV_CODEC_FLAG_*.
#define FF_PROFILE_H264_HIGH
static double val(void *priv, double ch)
static av_always_inline float scale(float x, float s)
#define FF_CODEC_ENCODE_CB(func)
#define AV_CODEC_FLAG_LOOP_FILTER
loop filter.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
#define AV_PIX_FMT_YUV444P10
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static enum AVPixelFormat pix_fmts_10bit[]
Structure describing a single Region Of Interest.
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
int has_b_frames
Size of the frame reordering buffer in the decoder.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
int global_quality
Global quality for codecs which cannot change it per frame.
#define AV_CEIL_RSHIFT(a, b)
int flags
Flags modifying the (de)muxer behaviour.
static enum AVPixelFormat pix_fmt
#define AV_CODEC_EXPORT_DATA_PRFT
Export encoder Producer Reference Time through packet side data.
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
static enum AVPixelFormat pix_fmts_all[]
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
int thread_type
Which multithreading methods to use.
#define AV_PIX_FMT_YUV420P9
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int64_t rc_max_rate
maximum bitrate
void * opaque
for some private data of the user
This structure describes the bitrate properties of an encoded bitstream.
#define CODEC_LONG_NAME(str)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static int setup_roi(AVCodecContext *ctx, x264_picture_t *pic, int bit_depth, const AVFrame *frame, const uint8_t *data, size_t size)
int flags
Additional information about the frame packing.
#define AV_PIX_FMT_GRAY10
int rc_buffer_size
decoder bitstream buffer size
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
static enum AVPixelFormat pix_fmts_9bit[]
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
float qblur
amount of qscale smoothing over time (0.0-1.0)
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
int64_t bit_rate
the average bitrate
uint32_t self_size
Must be set to the size of this data structure (that is, sizeof(AVRegionOfInterest)).
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
int me_cmp
motion estimation comparison function
#define AV_PIX_FMT_YUV422P10
int trellis
trellis RD quantization
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static int FUNC() sei(CodedBitstreamContext *ctx, RWContext *rw, H264RawSEI *current)
@ AVCOL_RANGE_UNSPECIFIED
@ AV_FRAME_DATA_SEI_UNREGISTERED
User data unregistered metadata associated with a video frame.
static void dct8x8(int16_t *coef, int bit_depth)
AVDictionary * x264_params
#define PARSE_X264_OPT(name, var)
float qcompress
amount of qscale change between easy & hard scenes (0.0-1.0)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int FUNC() aud(CodedBitstreamContext *ctx, RWContext *rw, H264RawAUD *current)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
static enum AVPixelFormat pix_fmts_8bit[]
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
@ AV_STEREO3D_CHECKERBOARD
Views are packed in a checkerboard-like structure per pixel.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
static av_cold int X264_close(AVCodecContext *avctx)
#define FF_PROFILE_H264_HIGH_422
static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, const x264_nal_t *nals, int nnal)
int me_range
maximum motion estimation search range in subpel units If 0 then no limit.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
@ AVCHROMA_LOC_UNSPECIFIED
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
static void opaque_uninit(X264Opaque *o)
#define AVERROR_EXTERNAL
Generic error in an external library.
int flags
A combination of AV_PKT_FLAG values.
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
#define AV_LOG_INFO
Standard information.
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
AVBufferRef * frame_opaque_ref
#define AV_CODEC_FLAG_RECON_FRAME
Request the encoder to output reconstructed frames, i.e. frames that would be produced by decoding th...
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int top
Distance in pixels from the top edge of the frame to the top and bottom edges and from the left edge ...
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
static const FFCodecDefault x264_defaults[]
@ AV_FRAME_DATA_STEREO3D
Stereoscopic 3d metadata.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
static enum AVPixelFormat csp_to_pixfmt(int csp)
static const AVOption options[]
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void * av_calloc(size_t nmemb, size_t size)
#define AV_PIX_FMT_YUV444P9
#define AV_CODEC_FLAG_CLOSED_GOP
X264Opaque * reordered_opaque
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
@ AV_STEREO3D_COLUMNS
Views are packed per column.
enum AVStereo3DType type
How views are packed within the video.
const FFCodec ff_libx262_encoder
#define FF_PROFILE_H264_HIGH_444
int next_reordered_opaque
AVFrame * recon_frame
When the AV_CODEC_FLAG_RECON_FRAME flag is used.
int scenechange_threshold
#define AV_INPUT_BUFFER_PADDING_SIZE
int max_qdiff
maximum quantizer difference between frames
main external API structure.
static void reconfig_encoder(AVCodecContext *ctx, const AVFrame *frame)
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
@ SEI_TYPE_USER_DATA_UNREGISTERED
int qmin
minimum quantizer
enum AVFrameSideDataType type
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#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 FF_PROFILE_H264_MAIN
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int64_t av_gettime(void)
Get the current time in microseconds.
#define FF_DISABLE_DEPRECATION_WARNINGS
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
A reference to a data buffer.
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
static int setup_frame(AVCodecContext *ctx, const AVFrame *frame, x264_picture_t **ppic)
Structure to hold side data for an AVFrame.
static int parse_opts(AVCodecContext *avctx, const char *opt, const char *param)
int slices
Number of slices.
This structure stores compressed data.
static int avfmt2_num_planes(int avfmt)
#define FF_PROFILE_H264_HIGH_10
int width
picture width / height.
@ AV_FRAME_DATA_REGIONS_OF_INTEREST
Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is ...
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
AVRational qoffset
Quantisation offset.
void * priv_data
Format private data.
static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
static void free_picture(AVCodecContext *ctx)
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.