FFmpeg
Macros | Functions
mjpegdec.c File Reference
#include "config_components.h"
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "codec_internal.h"
#include "copy_block.h"
#include "decode.h"
#include "exif.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "idctdsp.h"
#include "internal.h"
#include "jpegtables.h"
#include "mjpeg.h"
#include "mjpegdec.h"
#include "jpeglsdec.h"
#include "profiles.h"
#include "put_bits.h"

Go to the source code of this file.

Macros

#define REFINE_BIT(j)
 
#define ZERO_RUN
 

Functions

static void mjpeg_find_raw_scan_data (MJpegDecodeContext *s, const uint8_t **pbuf_ptr, size_t *pbuf_size)
 
static int init_default_huffman_tables (MJpegDecodeContext *s)
 
static void parse_avid (MJpegDecodeContext *s, uint8_t *buf, int len)
 
static void init_idct (AVCodecContext *avctx)
 
av_cold int ff_mjpeg_decode_init (AVCodecContext *avctx)
 
static int mjpeg_parse_len (MJpegDecodeContext *s, int *plen, const char *name)
 
int ff_mjpeg_decode_dqt (MJpegDecodeContext *s)
 
int ff_mjpeg_decode_dht (MJpegDecodeContext *s)
 
int ff_mjpeg_decode_sof (MJpegDecodeContext *s)
 
static int mjpeg_decode_dc (MJpegDecodeContext *s, int dc_index, int *val)
 
static int decode_block (MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, uint16_t *quant_matrix)
 
static int decode_dc_progressive (MJpegDecodeContext *s, int16_t *block, int component, int dc_index, uint16_t *quant_matrix, int Al)
 
static int decode_block_progressive (MJpegDecodeContext *s, int16_t *block, uint8_t *last_nnz, int ac_index, uint16_t *quant_matrix, int Ss, int Se, int Al, int *EOBRUN)
 
static int decode_block_refinement (MJpegDecodeContext *s, int16_t *block, uint8_t *last_nnz, int ac_index, uint16_t *quant_matrix, int Ss, int Se, int Al, int *EOBRUN)
 
static int ljpeg_decode_rgb_scan (MJpegDecodeContext *s)
 
static int ljpeg_decode_yuv_scan (MJpegDecodeContext *s)
 
static av_always_inline void mjpeg_copy_block (MJpegDecodeContext *s, uint8_t *dst, const uint8_t *src, int linesize, int lowres)
 
static void shift_output (MJpegDecodeContext *s, uint8_t *ptr, int linesize)
 
static int mjpeg_decode_scan (MJpegDecodeContext *s)
 
static int mjpeg_decode_scan_progressive_ac (MJpegDecodeContext *s)
 
static void mjpeg_idct_scan_progressive_ac (MJpegDecodeContext *s)
 
int ff_mjpeg_decode_sos (MJpegDecodeContext *s)
 
static int mjpeg_decode_dri (MJpegDecodeContext *s)
 
static int mjpeg_decode_app (MJpegDecodeContext *s, int start_code)
 
static int mjpeg_decode_com (MJpegDecodeContext *s)
 
int ff_mjpeg_find_marker (const uint8_t **pbuf_ptr, const uint8_t *buf_end)
 
int ff_mjpeg_unescape_sos (MJpegDecodeContext *s)
 
static void reset_icc_profile (MJpegDecodeContext *s)
 
int ff_mjpeg_decode_frame_from_buf (AVCodecContext *avctx, AVFrame *frame, int *got_frame, const AVPacket *avpkt, const uint8_t *buf, const int buf_size)
 
int ff_mjpeg_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
av_cold int ff_mjpeg_decode_end (AVCodecContext *avctx)
 
static av_cold void decode_flush (AVCodecContext *avctx)
 

Detailed Description

MJPEG decoder.

Definition in file mjpegdec.c.

Macro Definition Documentation

◆ REFINE_BIT

#define REFINE_BIT (   j)
Value:
{ \
UPDATE_CACHE(re, &s->gb); \
sign = block[j] >> 15; \
block[j] += SHOW_UBITS(re, &s->gb, 1) * \
((quant_matrix[i] ^ sign) - sign) << Al; \
LAST_SKIP_BITS(re, &s->gb, 1); \
}

Definition at line 989 of file mjpegdec.c.

◆ ZERO_RUN

#define ZERO_RUN
Value:
for (; ; i++) { \
if (i > last) { \
i += run; \
if (i > Se) { \
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); \
return -1; \
} \
break; \
} \
j = s->permutated_scantable[i]; \
if (block[j]) \
REFINE_BIT(j) \
else if (run-- == 0) \
break; \
}

Definition at line 997 of file mjpegdec.c.

Function Documentation

◆ mjpeg_find_raw_scan_data()

static void mjpeg_find_raw_scan_data ( MJpegDecodeContext s,
const uint8_t **  pbuf_ptr,
size_t *  pbuf_size 
)
static

Definition at line 2221 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

◆ init_default_huffman_tables()

static int init_default_huffman_tables ( MJpegDecodeContext s)
static

Definition at line 61 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_init().

◆ parse_avid()

static void parse_avid ( MJpegDecodeContext s,
uint8_t *  buf,
int  len 
)
static

Definition at line 104 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_init(), and mjpeg_decode_com().

◆ init_idct()

static void init_idct ( AVCodecContext avctx)
static

Definition at line 114 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_init(), and ff_mjpeg_decode_sof().

◆ ff_mjpeg_decode_init()

av_cold int ff_mjpeg_decode_init ( AVCodecContext avctx)

Definition at line 123 of file mjpegdec.c.

Referenced by mxpeg_decode_init().

◆ mjpeg_parse_len()

static int mjpeg_parse_len ( MJpegDecodeContext s,
int *  plen,
const char *  name 
)
static

◆ ff_mjpeg_decode_dqt()

int ff_mjpeg_decode_dqt ( MJpegDecodeContext s)

◆ ff_mjpeg_decode_dht()

int ff_mjpeg_decode_dht ( MJpegDecodeContext s)

◆ ff_mjpeg_decode_sof()

int ff_mjpeg_decode_sof ( MJpegDecodeContext s)

◆ mjpeg_decode_dc()

static int mjpeg_decode_dc ( MJpegDecodeContext s,
int  dc_index,
int *  val 
)
inlinestatic

◆ decode_block()

static int decode_block ( MJpegDecodeContext s,
int16_t *  block,
int  component,
int  dc_index,
int  ac_index,
uint16_t *  quant_matrix 
)
static

Definition at line 851 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

◆ decode_dc_progressive()

static int decode_dc_progressive ( MJpegDecodeContext s,
int16_t *  block,
int  component,
int  dc_index,
uint16_t *  quant_matrix,
int  Al 
)
static

Definition at line 900 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

◆ decode_block_progressive()

static int decode_block_progressive ( MJpegDecodeContext s,
int16_t *  block,
uint8_t *  last_nnz,
int  ac_index,
uint16_t *  quant_matrix,
int  Ss,
int  Se,
int  Al,
int *  EOBRUN 
)
static

Definition at line 917 of file mjpegdec.c.

Referenced by mjpeg_decode_scan_progressive_ac().

◆ decode_block_refinement()

static int decode_block_refinement ( MJpegDecodeContext s,
int16_t *  block,
uint8_t *  last_nnz,
int  ac_index,
uint16_t *  quant_matrix,
int  Ss,
int  Se,
int  Al,
int *  EOBRUN 
)
static

Definition at line 1015 of file mjpegdec.c.

Referenced by mjpeg_decode_scan_progressive_ac().

◆ ljpeg_decode_rgb_scan()

static int ljpeg_decode_rgb_scan ( MJpegDecodeContext s)
static

Definition at line 1081 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

◆ ljpeg_decode_yuv_scan()

static int ljpeg_decode_yuv_scan ( MJpegDecodeContext s)
static

Definition at line 1251 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

◆ mjpeg_copy_block()

static av_always_inline void mjpeg_copy_block ( MJpegDecodeContext s,
uint8_t *  dst,
const uint8_t *  src,
int  linesize,
int  lowres 
)
static

Definition at line 1412 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

◆ shift_output()

static void shift_output ( MJpegDecodeContext s,
uint8_t *  ptr,
int  linesize 
)
static

Definition at line 1428 of file mjpegdec.c.

Referenced by mjpeg_decode_scan(), and mjpeg_idct_scan_progressive_ac().

◆ mjpeg_decode_scan()

static int mjpeg_decode_scan ( MJpegDecodeContext s)
static

Definition at line 1443 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

◆ mjpeg_decode_scan_progressive_ac()

static int mjpeg_decode_scan_progressive_ac ( MJpegDecodeContext s)
static

Definition at line 1600 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

◆ mjpeg_idct_scan_progressive_ac()

static void mjpeg_idct_scan_progressive_ac ( MJpegDecodeContext s)
static

Definition at line 1655 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame_from_buf().

◆ ff_mjpeg_decode_sos()

int ff_mjpeg_decode_sos ( MJpegDecodeContext s)

◆ mjpeg_decode_dri()

static int mjpeg_decode_dri ( MJpegDecodeContext s)
static

Definition at line 1835 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame_from_buf().

◆ mjpeg_decode_app()

static int mjpeg_decode_app ( MJpegDecodeContext s,
int  start_code 
)
static

Definition at line 1846 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame_from_buf().

◆ mjpeg_decode_com()

static int mjpeg_decode_com ( MJpegDecodeContext s)
static

Definition at line 2151 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame_from_buf().

◆ ff_mjpeg_find_marker()

int ff_mjpeg_find_marker ( const uint8_t **  pbuf_ptr,
const uint8_t *  buf_end 
)

Definition at line 2195 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame_from_buf(), and mxpeg_decode_frame().

◆ ff_mjpeg_unescape_sos()

int ff_mjpeg_unescape_sos ( MJpegDecodeContext s)

Definition at line 2251 of file mjpegdec.c.

Referenced by ff_mjpeg_handle_restart(), and mjpeg_decode_scan().

◆ reset_icc_profile()

static void reset_icc_profile ( MJpegDecodeContext s)
static

Definition at line 2380 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_end(), and ff_mjpeg_decode_frame_from_buf().

◆ ff_mjpeg_decode_frame_from_buf()

int ff_mjpeg_decode_frame_from_buf ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame,
const AVPacket avpkt,
const uint8_t *  buf,
const int  buf_size 
)

Definition at line 2394 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame(), and sp5x_decode_frame().

◆ ff_mjpeg_decode_frame()

int ff_mjpeg_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame,
AVPacket avpkt 
)

Definition at line 2899 of file mjpegdec.c.

◆ ff_mjpeg_decode_end()

av_cold int ff_mjpeg_decode_end ( AVCodecContext avctx)

Definition at line 2909 of file mjpegdec.c.

Referenced by mxpeg_decode_end().

◆ decode_flush()

static av_cold void decode_flush ( AVCodecContext avctx)
static

Definition at line 2946 of file mjpegdec.c.

AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
s
#define s(width, name)
Definition: cbs_vp9.c:198
run
uint8_t run
Definition: svq3.c:207
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
SHOW_UBITS
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:247
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207