FFmpeg
Loading...
Searching...
No Matches
jpeglsenc.c File Reference

JPEG-LS encoder. More...

#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "encode.h"
#include "get_bits.h"
#include "put_bits.h"
#include "put_golomb.h"
#include "mathops.h"
#include "mjpeg.h"
#include "jpegls.h"

Go to the source code of this file.

Data Structures

struct  JPEGLSContext
 

Macros

#define UNCHECKED_BITSTREAM_READER   1
 
#define OFFSET(x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void put_marker_byteu (PutByteContext *pb, enum JpegMarker code)
 
static void ls_encode_regular (JLSState *state, PutBitContext *pb, int Q, int err)
 Encode error from regular symbol.
 
static void ls_encode_runterm (JLSState *state, PutBitContext *pb, int RItype, int err, int limit_add)
 Encode error from run termination.
 
static void ls_encode_run (JLSState *state, PutBitContext *pb, int run, int comp, int trail)
 Encode run value as specified by JPEG-LS standard.
 
static void ls_encode_line (JLSState *state, PutBitContext *pb, void *tmp, const void *in, int last2, int w, int stride, int comp, int bits)
 Encode one line of image.
 
static void ls_store_lse (JLSState *state, PutByteContext *pb)
 
static int encode_picture_ls (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
 
static av_cold int encode_jpegls_init (AVCodecContext *avctx)
 
static av_cold int encode_jpegls_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass jpegls_class
 
const FFCodec ff_jpegls_encoder
 

Detailed Description

JPEG-LS encoder.

Definition in file jpeglsenc.c.

Macro Definition Documentation

◆ UNCHECKED_BITSTREAM_READER

#define UNCHECKED_BITSTREAM_READER   1

Definition at line 28 of file jpeglsenc.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 457 of file jpeglsenc.c.

◆ VE

Definition at line 458 of file jpeglsenc.c.

Function Documentation

◆ put_marker_byteu()

static void put_marker_byteu ( PutByteContext * pb,
enum JpegMarker code )
inlinestatic

Definition at line 52 of file jpeglsenc.c.

Referenced by encode_picture_ls(), and ls_store_lse().

◆ ls_encode_regular()

static void ls_encode_regular ( JLSState * state,
PutBitContext * pb,
int Q,
int err )
inlinestatic

Encode error from regular symbol.

Definition at line 61 of file jpeglsenc.c.

Referenced by ls_encode_line().

◆ ls_encode_runterm()

static void ls_encode_runterm ( JLSState * state,
PutBitContext * pb,
int RItype,
int err,
int limit_add )
inlinestatic

Encode error from run termination.

Definition at line 89 of file jpeglsenc.c.

Referenced by ls_encode_line().

◆ ls_encode_run()

static void ls_encode_run ( JLSState * state,
PutBitContext * pb,
int run,
int comp,
int trail )
inlinestatic

Encode run value as specified by JPEG-LS standard.

Definition at line 122 of file jpeglsenc.c.

Referenced by ls_encode_line().

◆ ls_encode_line()

static void ls_encode_line ( JLSState * state,
PutBitContext * pb,
void * tmp,
const void * in,
int last2,
int w,
int stride,
int comp,
int bits )
inlinestatic

Encode one line of image.

Definition at line 144 of file jpeglsenc.c.

Referenced by encode_picture_ls().

◆ ls_store_lse()

static void ls_store_lse ( JLSState * state,
PutByteContext * pb )
static

Definition at line 249 of file jpeglsenc.c.

Referenced by encode_picture_ls().

◆ encode_picture_ls()

static int encode_picture_ls ( AVCodecContext * avctx,
AVPacket * pkt,
const AVFrame * pict,
int * got_packet )
static

Definition at line 272 of file jpeglsenc.c.

◆ encode_jpegls_init()

static av_cold int encode_jpegls_init ( AVCodecContext * avctx)
static

Definition at line 422 of file jpeglsenc.c.

◆ encode_jpegls_close()

static av_cold int encode_jpegls_close ( AVCodecContext * avctx)
static

Definition at line 449 of file jpeglsenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "pred", "Prediction method", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE, .unit = "pred" },
{ "left", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ "plane", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, .unit = "pred" },
{ NULL},
}
#define VE
Definition amfenc_av1.c:30
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
static const float pred[4]
Definition siprdata.h:259

Definition at line 459 of file jpeglsenc.c.

◆ jpegls_class

const AVClass jpegls_class
static
Initial value:
= {
.class_name = "jpegls",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 468 of file jpeglsenc.c.

◆ ff_jpegls_encoder

const FFCodec ff_jpegls_encoder
Initial value:
= {
.p.name = "jpegls",
CODEC_LONG_NAME("JPEG-LS"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(JPEGLSContext),
.p.priv_class = &jpegls_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#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:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition codec.h:98
@ AV_CODEC_ID_JPEGLS
Definition codec_id.h:61
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int encode_jpegls_close(AVCodecContext *avctx)
Definition jpeglsenc.c:449
static const AVClass jpegls_class
Definition jpeglsenc.c:468
static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition jpeglsenc.c:272
static av_cold int encode_jpegls_init(AVCodecContext *avctx)
Definition jpeglsenc.c:422
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
#define AV_PIX_FMT_GRAY16
Definition pixfmt.h:528

Definition at line 475 of file jpeglsenc.c.