libavcodec/libvpxenc.c File Reference

VP8 encoder support via libvpx. More...

#include <vpx/vpx_encoder.h>
#include <vpx/vp8cx.h>
#include "avcodec.h"
#include "internal.h"
#include "libavutil/base64.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  FrameListData
 Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. More...
struct  VP8EncoderContext

Defines

#define VPX_DISABLE_CTRL_TYPECHECKS   1
#define VPX_CODEC_DISABLE_COMPAT   1
#define VP8F_ERROR_RESILIENT   0x00000001
 Enable measures appropriate for streaming over lossy links.
#define VP8F_AUTO_ALT_REF   0x00000002
 Enable automatic alternate reference frame generation.
#define OFFSET(x)   offsetof(VP8Context, x)
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Typedefs

typedef struct VP8EncoderContext VP8Context

Functions

static av_cold void log_encoder_error (AVCodecContext *avctx, const char *desc)
static av_cold void dump_enc_cfg (AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg)
static void coded_frame_add (void *list, struct FrameListData *cx_frame)
static av_cold void free_coded_frame (struct FrameListData *cx_frame)
static av_cold void free_frame_list (struct FrameListData *list)
static av_cold int codecctl_int (AVCodecContext *avctx, enum vp8e_enc_control_id id, int val)
static av_cold int vp8_free (AVCodecContext *avctx)
static av_cold int vp8_init (AVCodecContext *avctx)
static void cx_pktcpy (struct FrameListData *dst, const struct vpx_codec_cx_pkt *src)
static int storeframe (AVCodecContext *avctx, struct FrameListData *cx_frame, AVPacket *pkt, AVFrame *coded_frame)
 Store coded frame information in format suitable for return from encode2().
static int queue_frames (AVCodecContext *avctx, AVPacket *pkt_out, AVFrame *coded_frame)
 Queue multiple output frames from the encoder, returning the front-most.
static int vp8_encode (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)

Variables

static const char *const ctlidstr []
 String mappings for enum vp8e_enc_control_id.
static const AVOption options []
class {
      class_name = "libvpx encoder"
      item_name = av_default_item_name
      option = options
      version = LIBAVUTIL_VERSION_INT
}; 
static const AVCodecDefault defaults []
AVCodec ff_libvpx_encoder


Detailed Description

VP8 encoder support via libvpx.

Definition in file libvpxenc.c.


Define Documentation

#define OFFSET (  )     offsetof(VP8Context, x)

Definition at line 540 of file libvpxenc.c.

#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Definition at line 541 of file libvpxenc.c.

#define VP8F_AUTO_ALT_REF   0x00000002

Enable automatic alternate reference frame generation.

Definition at line 66 of file libvpxenc.c.

Referenced by vp8_init().

#define VP8F_ERROR_RESILIENT   0x00000001

Enable measures appropriate for streaming over lossy links.

Definition at line 65 of file libvpxenc.c.

Referenced by vp8_init().

#define VPX_CODEC_DISABLE_COMPAT   1

Definition at line 27 of file libvpxenc.c.

#define VPX_DISABLE_CTRL_TYPECHECKS   1

Definition at line 26 of file libvpxenc.c.


Typedef Documentation

typedef struct VP8EncoderContext VP8Context


Function Documentation

static av_cold int codecctl_int ( AVCodecContext avctx,
enum vp8e_enc_control_id  id,
int  val 
) [static]

Definition at line 193 of file libvpxenc.c.

Referenced by vp8_init().

static void coded_frame_add ( void *  list,
struct FrameListData cx_frame 
) [static]

Definition at line 166 of file libvpxenc.c.

Referenced by queue_frames().

static void cx_pktcpy ( struct FrameListData dst,
const struct vpx_codec_cx_pkt *  src 
) [inline, static]

Definition at line 372 of file libvpxenc.c.

Referenced by queue_frames().

static av_cold void dump_enc_cfg ( AVCodecContext avctx,
const struct vpx_codec_enc_cfg *  cfg 
) [static]

Definition at line 111 of file libvpxenc.c.

Referenced by vp8_init().

static av_cold void free_coded_frame ( struct FrameListData cx_frame  )  [static]

Definition at line 176 of file libvpxenc.c.

Referenced by free_frame_list(), and queue_frames().

static av_cold void free_frame_list ( struct FrameListData list  )  [static]

Definition at line 182 of file libvpxenc.c.

Referenced by vp8_free().

static av_cold void log_encoder_error ( AVCodecContext avctx,
const char *  desc 
) [static]

Definition at line 100 of file libvpxenc.c.

Referenced by codecctl_int(), vp8_encode(), and vp8_init().

static int queue_frames ( AVCodecContext avctx,
AVPacket pkt_out,
AVFrame coded_frame 
) [static]

Queue multiple output frames from the encoder, returning the front-most.

In cases where vpx_codec_get_cx_data() returns more than 1 frame append the frame queue. Return the head frame if available.

Returns:
Stored frame size

AVERROR(EINVAL) on output size error

AVERROR(ENOMEM) on coded frame queue data allocation error

Definition at line 418 of file libvpxenc.c.

Referenced by vp8_encode().

static int storeframe ( AVCodecContext avctx,
struct FrameListData cx_frame,
AVPacket pkt,
AVFrame coded_frame 
) [static]

Store coded frame information in format suitable for return from encode2().

Write information from cx_frame to pkt

Returns:
packet data size on success

a negative AVERROR on error

Definition at line 389 of file libvpxenc.c.

Referenced by queue_frames().

static int vp8_encode ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
) [static]

Definition at line 496 of file libvpxenc.c.

static av_cold int vp8_free ( AVCodecContext avctx  )  [static]

Definition at line 214 of file libvpxenc.c.

static av_cold int vp8_init ( AVCodecContext avctx  )  [static]

Definition at line 226 of file libvpxenc.c.


Variable Documentation

const { ... } [static]

class_name = "libvpx encoder"

Definition at line 580 of file libvpxenc.c.

const char* const ctlidstr[] [static]

Initial value:

 {
    [VP8E_UPD_ENTROPY]           = "VP8E_UPD_ENTROPY",
    [VP8E_UPD_REFERENCE]         = "VP8E_UPD_REFERENCE",
    [VP8E_USE_REFERENCE]         = "VP8E_USE_REFERENCE",
    [VP8E_SET_ROI_MAP]           = "VP8E_SET_ROI_MAP",
    [VP8E_SET_ACTIVEMAP]         = "VP8E_SET_ACTIVEMAP",
    [VP8E_SET_SCALEMODE]         = "VP8E_SET_SCALEMODE",
    [VP8E_SET_CPUUSED]           = "VP8E_SET_CPUUSED",
    [VP8E_SET_ENABLEAUTOALTREF]  = "VP8E_SET_ENABLEAUTOALTREF",
    [VP8E_SET_NOISE_SENSITIVITY] = "VP8E_SET_NOISE_SENSITIVITY",
    [VP8E_SET_SHARPNESS]         = "VP8E_SET_SHARPNESS",
    [VP8E_SET_STATIC_THRESHOLD]  = "VP8E_SET_STATIC_THRESHOLD",
    [VP8E_SET_TOKEN_PARTITIONS]  = "VP8E_SET_TOKEN_PARTITIONS",
    [VP8E_GET_LAST_QUANTIZER]    = "VP8E_GET_LAST_QUANTIZER",
    [VP8E_SET_ARNR_MAXFRAMES]    = "VP8E_SET_ARNR_MAXFRAMES",
    [VP8E_SET_ARNR_STRENGTH]     = "VP8E_SET_ARNR_STRENGTH",
    [VP8E_SET_ARNR_TYPE]         = "VP8E_SET_ARNR_TYPE",
    [VP8E_SET_CQ_LEVEL]          = "VP8E_SET_CQ_LEVEL",
}
String mappings for enum vp8e_enc_control_id.

Definition at line 80 of file libvpxenc.c.

Referenced by codecctl_int().

const AVCodecDefault defaults[] [static]

Initial value:

 {
    { "qmin",             "-1" },
    { "qmax",             "-1" },
    { "g",                "-1" },
    { "keyint_min",       "-1" },
    { NULL },
}

Definition at line 586 of file libvpxenc.c.

Initial value:

 {
    .name           = "libvpx",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_VP8,
    .priv_data_size = sizeof(VP8Context),
    .init           = vp8_init,
    .encode2        = vp8_encode,
    .close          = vp8_free,
    .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
    .pix_fmts       = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE },
    .long_name      = NULL_IF_CONFIG_SMALL("libvpx VP8"),
    .priv_class     = &class,
    .defaults       = defaults,
}

Definition at line 594 of file libvpxenc.c.

item_name = av_default_item_name

Definition at line 581 of file libvpxenc.c.

Definition at line 582 of file libvpxenc.c.

const AVOption options[] [static]

Definition at line 542 of file libvpxenc.c.

Definition at line 583 of file libvpxenc.c.


Generated on Fri Oct 26 02:47:57 2012 for FFmpeg by  doxygen 1.5.8