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/intreadwrite.h"
#include "avcodec.h"
#include "internal.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  X264Context
 

Macros

#define MB_SIZE   16
 
#define OPT_STR(opt, param)
 
#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 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

#define MB_SIZE   16

Definition at line 45 of file libx264.c.

Referenced by X264_frame().

#define OPT_STR (   opt,
  param 
)
Value:
do { \
if ((ret = x264_param_parse(&x4->params, opt, param)) < 0) { \
if(ret == X264_PARAM_BAD_NAME) \
"bad option '%s': '%s'\n", opt, param); \
"bad value for '%s': '%s'\n", opt, param); \
return -1; \
} \
} while (0)
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
if(ret)
int
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 it should return

Definition at line 492 of file libx264.c.

Referenced by X264_init().

#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);\
}
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
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 it should return
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
const char * name
Definition: opengl_enc.c:102

Definition at line 543 of file libx264.c.

Referenced by X264_init().

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

Definition at line 1027 of file libx264.c.

Definition at line 1028 of file libx264.c.

Function Documentation

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

Definition at line 104 of file libx264.c.

Referenced by X264_init().

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

Definition at line 120 of file libx264.c.

Referenced by X264_frame().

static int avfmt2_num_planes ( int  avfmt)
static

Definition at line 158 of file libx264.c.

Referenced by X264_frame().

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

Definition at line 180 of file libx264.c.

Referenced by X264_frame().

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

Definition at line 280 of file libx264.c.

static av_cold int X264_close ( AVCodecContext avctx)
static

Definition at line 476 of file libx264.c.

static int convert_pix_fmt ( enum AVPixelFormat  pix_fmt)
static

Definition at line 506 of file libx264.c.

Referenced by X264_init().

static av_cold int X264_init ( AVCodecContext avctx)
static

Definition at line 549 of file libx264.c.

static av_cold void X264_init_static ( AVCodec codec)
static

Definition at line 1013 of file libx264.c.

Variable Documentation

enum AVPixelFormat pix_fmts_8bit[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
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
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:201

Definition at line 956 of file libx264.c.

Referenced by X264_init_static().

enum AVPixelFormat pix_fmts_9bit[]
static
Initial value:
= {
}
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:386
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384

Definition at line 970 of file libx264.c.

Referenced by X264_init_static().

enum AVPixelFormat pix_fmts_10bit[]
static
Initial value:
= {
}
#define AV_PIX_FMT_NV20
Definition: pixfmt.h:434
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388

Definition at line 975 of file libx264.c.

Referenced by X264_init_static().

enum AVPixelFormat pix_fmts_all[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
#define AV_PIX_FMT_NV20
Definition: pixfmt.h:434
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
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:201

Definition at line 982 of file libx264.c.

Referenced by X264_init_static().

const AVOption options[]
static

Definition at line 1029 of file libx264.c.

const AVCodecDefault x264_defaults[]
static

Definition at line 1111 of file libx264.c.