FFmpeg
Data Structures | Macros | Functions | Variables
libx264.c File Reference
#include "libavutil/eval.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.h"
#include "libavutil/time.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
#include "packet_internal.h"
#include "atsc_a53.h"
#include <x264.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  X264Opaque
 
struct  X264Context
 

Macros

#define MB_SIZE   16
 
#define PARSE_X264_OPT(name, var)
 
#define OFFSET(x)   offsetof(X264Context, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void X264_log (void *p, int level, const char *fmt, va_list args)
 
static int encode_nals (AVCodecContext *ctx, AVPacket *pkt, const x264_nal_t *nals, int nnal)
 
static int avfmt2_num_planes (int avfmt)
 
static void reconfig_encoder (AVCodecContext *ctx, const AVFrame *frame)
 
static int X264_frame (AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int X264_close (AVCodecContext *avctx)
 
static int parse_opts (AVCodecContext *avctx, const char *opt, const char *param)
 
static int convert_pix_fmt (enum AVPixelFormat pix_fmt)
 
static av_cold int X264_init (AVCodecContext *avctx)
 
static av_cold void X264_init_static (AVCodec *codec)
 

Variables

static enum AVPixelFormat pix_fmts_8bit []
 
static enum AVPixelFormat pix_fmts_9bit []
 
static enum AVPixelFormat pix_fmts_10bit []
 
static enum AVPixelFormat pix_fmts_all []
 
static const AVOption options []
 
static const AVCodecDefault x264_defaults []
 

Macro Definition Documentation

◆ MB_SIZE

#define MB_SIZE   16

Definition at line 48 of file libx264.c.

◆ PARSE_X264_OPT

#define PARSE_X264_OPT (   name,
  var 
)
Value:
if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\
av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
return AVERROR(EINVAL);\
}

Definition at line 578 of file libx264.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(X264Context, x)

Definition at line 1024 of file libx264.c.

◆ VE

Definition at line 1025 of file libx264.c.

Function Documentation

◆ X264_log()

static void X264_log ( void *  p,
int  level,
const char *  fmt,
va_list  args 
)
static

Definition at line 118 of file libx264.c.

Referenced by X264_init().

◆ encode_nals()

static int encode_nals ( AVCodecContext ctx,
AVPacket pkt,
const x264_nal_t *  nals,
int  nnal 
)
static

Definition at line 134 of file libx264.c.

Referenced by X264_frame().

◆ avfmt2_num_planes()

static int avfmt2_num_planes ( int  avfmt)
static

Definition at line 172 of file libx264.c.

Referenced by X264_frame().

◆ reconfig_encoder()

static void reconfig_encoder ( AVCodecContext ctx,
const AVFrame frame 
)
static

Definition at line 194 of file libx264.c.

Referenced by X264_frame().

◆ X264_frame()

static int X264_frame ( AVCodecContext ctx,
AVPacket pkt,
const AVFrame frame,
int got_packet 
)
static

Definition at line 294 of file libx264.c.

◆ X264_close()

static av_cold int X264_close ( AVCodecContext avctx)
static

Definition at line 496 of file libx264.c.

◆ parse_opts()

static int parse_opts ( AVCodecContext avctx,
const char *  opt,
const char *  param 
)
static

Definition at line 515 of file libx264.c.

Referenced by X264_init().

◆ convert_pix_fmt()

static int convert_pix_fmt ( enum AVPixelFormat  pix_fmt)
static

Definition at line 541 of file libx264.c.

Referenced by X264_init().

◆ X264_init()

static av_cold int X264_init ( AVCodecContext avctx)
static

Definition at line 584 of file libx264.c.

◆ X264_init_static()

static av_cold void X264_init_static ( AVCodec codec)
static

Definition at line 1013 of file libx264.c.

Variable Documentation

◆ pix_fmts_8bit

enum AVPixelFormat pix_fmts_8bit[]
static

◆ pix_fmts_9bit

enum AVPixelFormat pix_fmts_9bit[]
static
Initial value:

Definition at line 969 of file libx264.c.

Referenced by X264_init_static().

◆ pix_fmts_10bit

enum AVPixelFormat pix_fmts_10bit[]
static

◆ pix_fmts_all

enum AVPixelFormat pix_fmts_all[]
static

◆ options

const AVOption options[]
static

Definition at line 1026 of file libx264.c.

◆ x264_defaults

const AVCodecDefault x264_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "-1" },
{ "flags2", "0" },
{ "g", "-1" },
{ "i_qfactor", "-1" },
{ "b_qfactor", "-1" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ "qdiff", "-1" },
{ "qblur", "-1" },
{ "qcomp", "-1" },
{ "refs", "-1" },
{ "trellis", "-1" },
{ "me_range", "-1" },
{ "subq", "-1" },
{ "keyint_min", "-1" },
{ "cmp", "-1" },
{ "threads", AV_STRINGIFY(X264_THREADS_AUTO) },
{ "thread_type", "0" },
{ "flags", "+cgop" },
{ "rc_init_occupancy","-1" },
{ NULL },
}

Definition at line 1108 of file libx264.c.

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AVERROR
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
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:389
AV_PIX_FMT_NV20
#define AV_PIX_FMT_NV20
Definition: pixfmt.h:436
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:392
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:181
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:386
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:390
AV_PIX_FMT_NV16
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:191
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:36
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:388
AV_PIX_FMT_NV12
@ 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...
Definition: pixfmt.h:89
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70