FFmpeg
Macros | Functions | Variables
mjpegenc.c File Reference
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "jpegtables.h"
#include "mjpegenc_common.h"
#include "mpegvideo.h"
#include "mjpeg.h"
#include "mjpegenc.h"
#include "profiles.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(MpegEncContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int alloc_huffman (MpegEncContext *s)
 
av_cold int ff_mjpeg_encode_init (MpegEncContext *s)
 
av_cold void ff_mjpeg_encode_close (MpegEncContext *s)
 
static void ff_mjpeg_encode_code (MJpegContext *s, uint8_t table_id, int code)
 Add code and table_id to the JPEG buffer. More...
 
static void ff_mjpeg_encode_coef (MJpegContext *s, uint8_t table_id, int val, int run)
 Add the coefficient's data to the JPEG buffer. More...
 
static void record_block (MpegEncContext *s, int16_t *block, int n)
 Add the block's data into the JPEG buffer. More...
 
static void encode_block (MpegEncContext *s, int16_t *block, int n)
 
void ff_mjpeg_encode_mb (MpegEncContext *s, int16_t block[12][64])
 

Variables

static const AVOption options []
 

Detailed Description

MJPEG encoder.

Definition in file mjpegenc.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 386 of file mjpegenc.c.

◆ VE

Definition at line 387 of file mjpegenc.c.

Function Documentation

◆ alloc_huffman()

static int alloc_huffman ( MpegEncContext s)
static

Definition at line 43 of file mjpegenc.c.

Referenced by ff_mjpeg_encode_init().

◆ ff_mjpeg_encode_init()

av_cold int ff_mjpeg_encode_init ( MpegEncContext s)

Definition at line 71 of file mjpegenc.c.

Referenced by ff_mpv_encode_init().

◆ ff_mjpeg_encode_close()

av_cold void ff_mjpeg_encode_close ( MpegEncContext s)

Definition at line 126 of file mjpegenc.c.

Referenced by ff_mpv_encode_end().

◆ ff_mjpeg_encode_code()

static void ff_mjpeg_encode_code ( MJpegContext s,
uint8_t  table_id,
int  code 
)
inlinestatic

Add code and table_id to the JPEG buffer.

Parameters
sThe MJpegContext which contains the JPEG buffer.
table_idWhich Huffman table the code belongs to.
codeThe encoded exponent of the coefficients and the run-bits.

Definition at line 139 of file mjpegenc.c.

Referenced by ff_mjpeg_encode_coef(), and record_block().

◆ ff_mjpeg_encode_coef()

static void ff_mjpeg_encode_coef ( MJpegContext s,
uint8_t  table_id,
int  val,
int  run 
)
static

Add the coefficient's data to the JPEG buffer.

Parameters
sThe MJpegContext which contains the JPEG buffer.
table_idWhich Huffman table the code belongs to.
valThe coefficient.
runThe run-bits.

Definition at line 154 of file mjpegenc.c.

Referenced by record_block().

◆ record_block()

static void record_block ( MpegEncContext s,
int16_t *  block,
int  n 
)
static

Add the block's data into the JPEG buffer.

Parameters
sThe MJpegEncContext that contains the JPEG buffer.
blockThe block.
nThe block's index or number.

Definition at line 182 of file mjpegenc.c.

Referenced by ff_mjpeg_encode_mb().

◆ encode_block()

static void encode_block ( MpegEncContext s,
int16_t *  block,
int  n 
)
static

Definition at line 225 of file mjpegenc.c.

Referenced by ff_mjpeg_encode_mb().

◆ ff_mjpeg_encode_mb()

void ff_mjpeg_encode_mb ( MpegEncContext s,
int16_t  block[12][64] 
)

Definition at line 283 of file mjpegenc.c.

Referenced by encode_mb_internal().

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "pred", "Prediction method", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 3, VE, "pred" },
{ "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
{ "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "pred" },
{ "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "pred" },
{ "huffman", "Huffman table strategy", OFFSET(huffman), AV_OPT_TYPE_INT, { .i64 = HUFFMAN_TABLE_OPTIMAL }, 0, NB_HUFFMAN_TABLE_OPTION - 1, VE, "huffman" },
{ "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = HUFFMAN_TABLE_DEFAULT }, INT_MIN, INT_MAX, VE, "huffman" },
{ "optimal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = HUFFMAN_TABLE_OPTIMAL }, INT_MIN, INT_MAX, VE, "huffman" },
{ NULL},
}

Definition at line 388 of file mjpegenc.c.

HUFFMAN_TABLE_OPTIMAL
@ HUFFMAN_TABLE_OPTIMAL
Compute and use optimal Huffman tables.
Definition: mjpegenc.h:97
NB_HUFFMAN_TABLE_OPTION
@ NB_HUFFMAN_TABLE_OPTION
Definition: mjpegenc.h:98
NULL
#define NULL
Definition: coverity.c:32
HUFFMAN_TABLE_DEFAULT
@ HUFFMAN_TABLE_DEFAULT
Use the default Huffman tables.
Definition: mjpegenc.h:96
OFFSET
#define OFFSET(x)
Definition: mjpegenc.c:386
VE
#define VE
Definition: mjpegenc.c:387
pred
static const float pred[4]
Definition: siprdata.h:259
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
FF_MPV_COMMON_OPTS
#define FF_MPV_COMMON_OPTS
Definition: mpegvideo.h:614
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232