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 "codec_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_get_encoder_caps (AVCodecContext *avctx)
 
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 FFCodecDefault vaapi_encode_mjpeg_defaults []
 
static const AVClass vaapi_encode_mjpeg_class
 
const FFCodec ff_mjpeg_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 540 of file vaapi_encode_mjpeg.c.

◆ FLAGS

Definition at line 541 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_get_encoder_caps()

static av_cold int vaapi_encode_mjpeg_get_encoder_caps ( AVCodecContext avctx)
static

Definition at line 437 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_configure()

static av_cold int vaapi_encode_mjpeg_configure ( AVCodecContext avctx)
static

Definition at line 451 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_init()

static av_cold int vaapi_encode_mjpeg_init ( AVCodecContext avctx)
static

Definition at line 517 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_close()

static av_cold int vaapi_encode_mjpeg_close ( AVCodecContext avctx)
static

Definition at line 530 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 482 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 494 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 542 of file vaapi_encode_mjpeg.c.

◆ vaapi_encode_mjpeg_defaults

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

Definition at line 555 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 560 of file vaapi_encode_mjpeg.c.

◆ ff_mjpeg_vaapi_encoder

const FFCodec ff_mjpeg_vaapi_encoder
Initial value:

Definition at line 567 of file vaapi_encode_mjpeg.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
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: codec.h:145
vaapi_encode_mjpeg_options
static const AVOption vaapi_encode_mjpeg_options[]
Definition: vaapi_encode_mjpeg.c:542
vaapi_encode_mjpeg_defaults
static const FFCodecDefault vaapi_encode_mjpeg_defaults[]
Definition: vaapi_encode_mjpeg.c:555
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
vaapi_encode_mjpeg_get_encoder_caps
static av_cold int vaapi_encode_mjpeg_get_encoder_caps(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:437
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_mjpeg.c:540
vaapi_encode_mjpeg_close
static av_cold int vaapi_encode_mjpeg_close(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:530
FLAG_INTRA_ONLY
@ FLAG_INTRA_ONLY
Definition: vaapi_encode.h:406
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT
#define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT
Definition: defs.h:171
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1396
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
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
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:302
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
FLAG_CONSTANT_QUALITY_ONLY
@ FLAG_CONSTANT_QUALITY_ONLY
Definition: vaapi_encode.h:404
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
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
vaapi_encode_mjpeg_class
static const AVClass vaapi_encode_mjpeg_class
Definition: vaapi_encode_mjpeg.c:560
vaapi_encode_mjpeg_profiles
static const VAAPIEncodeProfile vaapi_encode_mjpeg_profiles[]
Definition: vaapi_encode_mjpeg.c:482
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:505
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:35
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:72
FLAGS
#define FLAGS
Definition: vaapi_encode_mjpeg.c:541
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
vaapi_encode_mjpeg_configure
static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:451
vaapi_encode_mjpeg_init
static av_cold int vaapi_encode_mjpeg_init(AVCodecContext *avctx)
Definition: vaapi_encode_mjpeg.c:517