FFmpeg
Macros | Functions | Variables
cbs_jpeg.c File Reference
#include "libavutil/mem.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_jpeg.h"
#include "cbs_jpeg_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define u(width, name, range_min, range_max)   xu(width, name, range_min, range_max, 0, )
 
#define us(width, name, sub, range_min, range_max)   xu(width, name, range_min, range_max, 1, sub)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define FUNC(name)   cbs_jpeg_read_ ## name
 
#define xu(width, name, range_min, range_max, subs, ...)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define FUNC(name)   cbs_jpeg_write_ ## name
 
#define xu(width, name, range_min, range_max, subs, ...)
 
#define SEGMENT(marker, func)
 
#define SEGMENT(marker, func)
 

Functions

static int cbs_jpeg_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static int cbs_jpeg_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_jpeg_write_scan (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_write_segment (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_jpeg_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 

Variables

static const CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types []
 
const CodedBitstreamType ff_cbs_type_jpeg
 

Macro Definition Documentation

◆ HEADER

#define HEADER (   name)
Value:
do { \
ff_cbs_trace_header(ctx, name); \
} while (0)

Definition at line 25 of file cbs_jpeg.c.

◆ CHECK

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)

Definition at line 29 of file cbs_jpeg.c.

◆ SUBSCRIPTS

#define SUBSCRIPTS (   subs,
  ... 
)    (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)

Definition at line 35 of file cbs_jpeg.c.

◆ u

#define u (   width,
  name,
  range_min,
  range_max 
)    xu(width, name, range_min, range_max, 0, )

Definition at line 37 of file cbs_jpeg.c.

◆ us

#define us (   width,
  name,
  sub,
  range_min,
  range_max 
)    xu(width, name, range_min, range_max, 1, sub)

Definition at line 39 of file cbs_jpeg.c.

◆ READ

#define READ

Definition at line 43 of file cbs_jpeg.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 65 of file cbs_jpeg.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 66 of file cbs_jpeg.c.

◆ FUNC [1/2]

#define FUNC (   name)    cbs_jpeg_read_ ## name

Definition at line 67 of file cbs_jpeg.c.

◆ xu [1/2]

#define xu (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
current->name = value; \
} while (0)

Definition at line 69 of file cbs_jpeg.c.

◆ WRITE

#define WRITE

Definition at line 64 of file cbs_jpeg.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 65 of file cbs_jpeg.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 66 of file cbs_jpeg.c.

◆ FUNC [2/2]

#define FUNC (   name)    cbs_jpeg_write_ ## name

Definition at line 67 of file cbs_jpeg.c.

◆ xu [2/2]

#define xu (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = current->name; \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 69 of file cbs_jpeg.c.

◆ SEGMENT [1/2]

#define SEGMENT (   marker,
  func 
)
Value:
case JPEG_MARKER_ ## marker: \
{ \
err = cbs_jpeg_read_ ## func(ctx, &gbc, unit->content); \
if (err < 0) \
return err; \
} \
break

◆ SEGMENT [2/2]

#define SEGMENT (   marker,
  func 
)
Value:
case JPEG_MARKER_ ## marker: \
err = cbs_jpeg_write_ ## func(ctx, pbc, unit->content); \
break;

Function Documentation

◆ cbs_jpeg_split_fragment()

static int cbs_jpeg_split_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
int  header 
)
static

Definition at line 86 of file cbs_jpeg.c.

◆ cbs_jpeg_read_unit()

static int cbs_jpeg_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 221 of file cbs_jpeg.c.

◆ cbs_jpeg_write_scan()

static int cbs_jpeg_write_scan ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 287 of file cbs_jpeg.c.

Referenced by cbs_jpeg_write_unit().

◆ cbs_jpeg_write_segment()

static int cbs_jpeg_write_segment ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 313 of file cbs_jpeg.c.

Referenced by cbs_jpeg_write_unit().

◆ cbs_jpeg_write_unit()

static int cbs_jpeg_write_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 342 of file cbs_jpeg.c.

◆ cbs_jpeg_assemble_fragment()

static int cbs_jpeg_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 352 of file cbs_jpeg.c.

Variable Documentation

◆ cbs_jpeg_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types[]
static

◆ ff_cbs_type_jpeg

const CodedBitstreamType ff_cbs_type_jpeg
Initial value:
= {
.codec_id = AV_CODEC_ID_MJPEG,
.unit_types = cbs_jpeg_unit_types,
.split_fragment = &cbs_jpeg_split_fragment,
.read_unit = &cbs_jpeg_read_unit,
.write_unit = &cbs_jpeg_write_unit,
.assemble_fragment = &cbs_jpeg_assemble_fragment,
}

Definition at line 436 of file cbs_jpeg.c.

func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
JPEG_MARKER_COM
@ JPEG_MARKER_COM
Definition: cbs_jpeg.h:42
data
const char data[16]
Definition: mxf.c:149
CBS_UNIT_RANGE_POD
#define CBS_UNIT_RANGE_POD(range_start, range_end, structure)
Definition: cbs_internal.h:295
JPEG_MARKER_APPN
@ JPEG_MARKER_APPN
Definition: cbs_jpeg.h:40
ff_cbs_write_unsigned
int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:647
JPEG_MARKER_DQT
@ JPEG_MARKER_DQT
Definition: cbs_jpeg.h:38
CBS_UNIT_TYPE_INTERNAL_REF
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
Definition: cbs_internal.h:312
JPEGRawQuantisationTableSpecification
Definition: cbs_jpeg.h:93
cbs_jpeg_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types[]
Definition: cbs_jpeg.c:420
cbs_jpeg_assemble_fragment
static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_jpeg.c:352
ctx
AVFormatContext * ctx
Definition: movenc.c:49
JPEG_MARKER_SOF0
@ JPEG_MARKER_SOF0
Definition: cbs_jpeg.h:29
CBS_UNIT_RANGE_INTERNAL_REF
#define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field)
Definition: cbs_internal.h:315
cbs_jpeg_read_unit
static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_jpeg.c:221
JPEGRawHuffmanTableSpecification
Definition: cbs_jpeg.h:105
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_jpeg.c:35
CBS_UNIT_TYPE_POD
#define CBS_UNIT_TYPE_POD(type_, structure)
Definition: cbs_internal.h:288
JPEG_MARKER_SOF3
@ JPEG_MARKER_SOF3
Definition: cbs_jpeg.h:32
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
ff_cbs_read_unsigned
int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs.c:631
JPEGRawApplicationData
Definition: cbs_jpeg.h:110
cbs_jpeg_split_fragment
static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_jpeg.c:86
CBS_UNIT_TYPE_END_OF_LIST
#define CBS_UNIT_TYPE_END_OF_LIST
Definition: cbs_internal.h:335
JPEGRawScan
Definition: cbs_jpeg.h:80
cbs_jpeg_write_unit
static int cbs_jpeg_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_jpeg.c:342
JPEG_MARKER_SOS
@ JPEG_MARKER_SOS
Definition: cbs_jpeg.h:37
JPEG_MARKER_DHT
@ JPEG_MARKER_DHT
Definition: cbs_jpeg.h:34
JPEGRawFrameHeader
Definition: cbs_jpeg.h:53
JPEGRawComment
Definition: cbs_jpeg.h:116
width
#define width
Definition: dsp.h:85