Libav
Data Structures | Macros | Functions | Variables
libx264.c File Reference
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.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 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, x264_nal_t *nals, int nnal)
 
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 const AVOption options []
 
class {
      class_name = "libx264"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const AVCodecDefault x264_defaults []
 
AVCodec ff_libx264_encoder
 

Macro Definition Documentation

#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);\
}
const char * name
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
#define AVERROR(e)
Definition: error.h:43
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
return

Definition at line 304 of file libx264.c.

Referenced by X264_init().

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

Definition at line 585 of file libx264.c.

Definition at line 586 of file libx264.c.

Function Documentation

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

Definition at line 82 of file libx264.c.

Referenced by X264_init().

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

Definition at line 98 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 131 of file libx264.c.

static av_cold int X264_close ( AVCodecContext avctx)
static

Definition at line 270 of file libx264.c.

static int convert_pix_fmt ( enum AVPixelFormat  pix_fmt)
static

Definition at line 285 of file libx264.c.

Referenced by X264_init().

static av_cold int X264_init ( AVCodecContext avctx)
static

Definition at line 310 of file libx264.c.

static av_cold void X264_init_static ( AVCodec codec)
static

Definition at line 575 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:70
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:92
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:69
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
Definition: pixfmt.h:77
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:65
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:193

Definition at line 553 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:242
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:240

Definition at line 562 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:265
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:245
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:243
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:244

Definition at line 567 of file libx264.c.

Referenced by X264_init_static().

const AVOption options[]
static

Definition at line 587 of file libx264.c.

class_name = "libx264"

Definition at line 642 of file libx264.c.

item_name = av_default_item_name

Definition at line 643 of file libx264.c.

option = options

Definition at line 644 of file libx264.c.

Definition at line 645 of file libx264.c.

const { ... }
const AVCodecDefault x264_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "-1" },
{ "g", "-1" },
{ "i_qfactor", "-1" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ "qdiff", "-1" },
{ "qblur", "-1" },
{ "qcomp", "-1" },
{ "refs", "-1" },
{ "sc_threshold", "-1" },
{ "trellis", "-1" },
{ "nr", "-1" },
{ "me_range", "-1" },
{ "me_method", "-1" },
{ "subq", "-1" },
{ "b_strategy", "-1" },
{ "keyint_min", "-1" },
{ "coder", "-1" },
{ "cmp", "-1" },
{ "threads", AV_STRINGIFY(X264_THREADS_AUTO) },
{ "thread_type", "0" },
{ "flags", "+cgop" },
{ "rc_init_occupancy","-1" },
{ NULL },
}
NULL
Definition: eval.c:55
#define AV_STRINGIFY(s)
Definition: macros.h:36

Definition at line 648 of file libx264.c.

AVCodec ff_libx264_encoder
Initial value:
= {
.name = "libx264",
.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.priv_data_size = sizeof(X264Context),
.encode2 = X264_frame,
.priv_class = &class,
.init_static_data = X264_init_static,
}
static av_cold int X264_init(AVCodecContext *avctx)
Definition: libx264.c:310
static const AVCodecDefault defaults[]
Definition: libspeexenc.c:345
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:713
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:150
#define CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
Definition: avcodec.h:767
static const AVCodecDefault x264_defaults[]
Definition: libx264.c:648
static av_cold int X264_close(AVCodecContext *avctx)
Definition: libx264.c:270
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:490
static av_cold void X264_init_static(AVCodec *codec)
Definition: libx264.c:575
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:499
static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: libx264.c:131

Definition at line 676 of file libx264.c.