FFmpeg
Data Structures | Macros | Functions | Variables
vaapi_encode_mjpeg.c File Reference
#include <va/va.h>
#include <va/va_enc_jpeg.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "cbs.h"
#include "cbs_jpeg.h"
#include "internal.h"
#include "jpegtables.h"
#include "mjpeg.h"
#include "put_bits.h"
#include "vaapi_encode.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeMJPEGContext
 

Macros

#define OFFSET(x)   offsetof(VAAPIEncodeMJPEGContext, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 

Functions

static int vaapi_encode_mjpeg_write_image_header (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
 
static int vaapi_encode_mjpeg_write_extra_buffer (AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
 
static int vaapi_encode_mjpeg_init_picture_params (AVCodecContext *avctx, VAAPIEncodePicture *pic)
 
static int vaapi_encode_mjpeg_init_slice_params (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_mjpeg_configure (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mjpeg_init (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mjpeg_close (AVCodecContext *avctx)
 

Variables

static const unsigned char vaapi_encode_mjpeg_quant_luminance [64]
 
static const unsigned char vaapi_encode_mjpeg_quant_chrominance [64]
 
static const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles []
 
static const VAAPIEncodeType vaapi_encode_type_mjpeg
 
static const AVOption vaapi_encode_mjpeg_options []
 
static const AVCodecDefault vaapi_encode_mjpeg_defaults []
 
static const AVClass vaapi_encode_mjpeg_class
 
AVCodec ff_mjpeg_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 528 of file vaapi_encode_mjpeg.c.

◆ FLAGS

Definition at line 529 of file vaapi_encode_mjpeg.c.

Function Documentation

◆ vaapi_encode_mjpeg_write_image_header()

static int vaapi_encode_mjpeg_write_image_header ( AVCodecContext avctx,
VAAPIEncodePicture pic,
VAAPIEncodeSlice slice,
char *  data,
size_t *  data_len 
)
static

Definition at line 83 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_write_extra_buffer()

static int vaapi_encode_mjpeg_write_extra_buffer ( AVCodecContext avctx,
VAAPIEncodePicture pic,
int  index,
int type,
char *  data,
size_t *  data_len 
)
static

Definition at line 149 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_init_picture_params()

static int vaapi_encode_mjpeg_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 222 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_init_slice_params()

static int vaapi_encode_mjpeg_init_slice_params ( AVCodecContext avctx,
VAAPIEncodePicture pic,
VAAPIEncodeSlice slice 
)
static

Definition at line 414 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_configure()

static av_cold int vaapi_encode_mjpeg_configure ( AVCodecContext avctx)
static

Definition at line 437 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_init()

static av_cold int vaapi_encode_mjpeg_init ( AVCodecContext avctx)
static

Definition at line 502 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_close()

static av_cold int vaapi_encode_mjpeg_close ( AVCodecContext avctx)
static

Definition at line 518 of file vaapi_encode_mjpeg.c.

Variable Documentation

◆ vaapi_encode_mjpeg_quant_luminance

const unsigned char vaapi_encode_mjpeg_quant_luminance[64]
static
Initial value:
= {
16, 11, 12, 14, 12, 10, 16, 14,
13, 14, 18, 17, 16, 19, 24, 40,
26, 24, 22, 22, 24, 49, 35, 37,
29, 40, 58, 51, 61, 60, 57, 51,
56, 55, 64, 72, 92, 78, 64, 68,
87, 69, 55, 56, 80, 109, 81, 87,
95, 98, 103, 104, 103, 62, 77, 113,
121, 112, 100, 120, 92, 101, 103, 99,
}

Definition at line 40 of file vaapi_encode_mjpeg.c.

Referenced by vaapi_encode_mjpeg_init_picture_params().

◆ vaapi_encode_mjpeg_quant_chrominance

const unsigned char vaapi_encode_mjpeg_quant_chrominance[64]
static
Initial value:
= {
17, 18, 18, 24, 21, 24, 47, 26,
26, 47, 99, 66, 56, 66, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
}

Definition at line 50 of file vaapi_encode_mjpeg.c.

Referenced by vaapi_encode_mjpeg_init_picture_params().

◆ vaapi_encode_mjpeg_profiles

const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles[]
static
Initial value:
= {
8, 1, 0, 0, VAProfileJPEGBaseline },
8, 3, 1, 1, VAProfileJPEGBaseline },
8, 3, 1, 0, VAProfileJPEGBaseline },
8, 3, 0, 0, VAProfileJPEGBaseline },
}

Definition at line 468 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_type_mjpeg

const VAAPIEncodeType vaapi_encode_type_mjpeg
static
Initial value:
= {
.default_quality = 80,
.picture_params_size = sizeof(VAEncPictureParameterBufferJPEG),
.init_picture_params = &vaapi_encode_mjpeg_init_picture_params,
.slice_params_size = sizeof(VAEncSliceParameterBufferJPEG),
.init_slice_params = &vaapi_encode_mjpeg_init_slice_params,
.slice_header_type = VAEncPackedHeaderRawData,
.write_slice_header = &vaapi_encode_mjpeg_write_image_header,
.write_extra_buffer = &vaapi_encode_mjpeg_write_extra_buffer,
}

Definition at line 480 of file vaapi_encode_mjpeg.c.

Referenced by vaapi_encode_mjpeg_init().

◆ vaapi_encode_mjpeg_options

const AVOption vaapi_encode_mjpeg_options[]
static
Initial value:
= {
{ "jfif", "Include JFIF header",
{ .i64 = 0 }, 0, 1, FLAGS },
{ "huffman", "Include huffman tables",
{ .i64 = 1 }, 0, 1, FLAGS },
{ NULL },
}

Definition at line 530 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_defaults

const AVCodecDefault vaapi_encode_mjpeg_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL },
}

Definition at line 543 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_class

const AVClass vaapi_encode_mjpeg_class
static
Initial value:
= {
.class_name = "mjpeg_vaapi",
.item_name = av_default_item_name,
}

Definition at line 548 of file vaapi_encode_mjpeg.c.

◆ ff_mjpeg_vaapi_encoder

AVCodec ff_mjpeg_vaapi_encoder
Initial value:
= {
.name = "mjpeg_vaapi",
.long_name = NULL_IF_CONFIG_SMALL("MJPEG (VAAPI)"),
.priv_data_size = sizeof(VAAPIEncodeMJPEGContext),
.receive_packet = &ff_vaapi_encode_receive_packet,
.priv_class = &vaapi_encode_mjpeg_class,
.capabilities = AV_CODEC_CAP_HARDWARE |
.pix_fmts = (const enum AVPixelFormat[]) {
},
.wrapper_name = "vaapi",
}

Definition at line 555 of file vaapi_encode_mjpeg.c.

AV_CODEC_CAP_INTRA_ONLY
#define AV_CODEC_CAP_INTRA_ONLY
Codec is intra only.
Definition: avcodec.h:1067
FLAG_CONSTANT_QUALITY_ONLY
@ FLAG_CONSTANT_QUALITY_ONLY
Definition: vaapi_encode.h:316
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
vaapi_encode_mjpeg_write_extra_buffer
static int vaapi_encode_mjpeg_write_extra_buffer(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
Definition: vaapi_encode_mjpeg.c:149
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: avcodec.h:1078
vaapi_encode_mjpeg_options
static const AVOption vaapi_encode_mjpeg_options[]
Definition: vaapi_encode_mjpeg.c:530
vaapi_encode_mjpeg_defaults
static const AVCodecDefault vaapi_encode_mjpeg_defaults[]
Definition: vaapi_encode_mjpeg.c:543
FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT
#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT
Definition: avcodec.h:2995
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_mjpeg.c:528
defaults
static const AVCodecDefault defaults[]
Definition: amfenc_h264.c:361
vaapi_encode_mjpeg_close
static av_cold int vaapi_encode_mjpeg_close(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:518
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2899
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1020
ff_vaapi_encode_send_frame
int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Definition: vaapi_encode.c:954
vaapi_encode_mjpeg_init_slice_params
static int vaapi_encode_mjpeg_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode_mjpeg.c:414
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
VAAPIEncodeMJPEGContext
Definition: vaapi_encode_mjpeg.c:61
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
vaapi_encode_mjpeg_write_image_header
static int vaapi_encode_mjpeg_write_image_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
Definition: vaapi_encode_mjpeg.c:83
vaapi_encode_mjpeg_class
static const AVClass vaapi_encode_mjpeg_class
Definition: vaapi_encode_mjpeg.c:548
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
vaapi_encode_mjpeg_profiles
static const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles[]
Definition: vaapi_encode_mjpeg.c:468
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:408
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Definition: pixfmt.h:122
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: avcodec.h:225
vaapi_encode_mjpeg_init_picture_params
static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode_mjpeg.c:222
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
FLAGS
#define FLAGS
Definition: vaapi_encode_mjpeg.c:529
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
vaapi_encode_mjpeg_configure
static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:437
FLAG_INTRA_ONLY
@ FLAG_INTRA_ONLY
Definition: vaapi_encode.h:318
vaapi_encode_mjpeg_init
static av_cold int vaapi_encode_mjpeg_init(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:502