FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
mjpegdec.c File Reference

MJPEG decoder. More...

#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "copy_block.h"
#include "internal.h"
#include "mjpeg.h"
#include "mjpegdec.h"
#include "jpeglsdec.h"

Go to the source code of this file.

Macros

#define REFINE_BIT(j)
 
#define ZERO_RUN
 

Functions

static int build_vlc (VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes, int use_static, int is_ac)
 
static void build_basic_mjpeg_vlc (MJpegDecodeContext *s)
 
av_cold int ff_mjpeg_decode_init (AVCodecContext *avctx)
 
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)
 
static int decode_block (MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int ac_index, int16_t *quant_matrix)
 
static int decode_dc_progressive (MJpegDecodeContext *s, int16_t *block, int component, int dc_index, int16_t *quant_matrix, int Al)
 
static int decode_block_progressive (MJpegDecodeContext *s, int16_t *block, uint8_t *last_nnz, int ac_index, int16_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, int16_t *quant_matrix, int ss, int se, int Al, int *EOBRUN)
 
static void handle_rstn (MJpegDecodeContext *s, int nb_components)
 
static int ljpeg_decode_rgb_scan (MJpegDecodeContext *s, int nb_components, int predictor, int point_transform)
 
static int ljpeg_decode_yuv_scan (MJpegDecodeContext *s, int nb_components, int predictor, int point_transform)
 
static av_always_inline void mjpeg_copy_block (MJpegDecodeContext *s, uint8_t *dst, const uint8_t *src, int linesize, int lowres)
 
static int mjpeg_decode_scan (MJpegDecodeContext *s, int nb_components, int Ah, int Al, const uint8_t *mb_bitmask, const AVFrame *reference)
 
static int mjpeg_decode_scan_progressive_ac (MJpegDecodeContext *s, int ss, int se, int Ah, int Al)
 
int ff_mjpeg_decode_sos (MJpegDecodeContext *s, const uint8_t *mb_bitmask, const AVFrame *reference)
 
static int mjpeg_decode_dri (MJpegDecodeContext *s)
 
static int mjpeg_decode_app (MJpegDecodeContext *s)
 
static int mjpeg_decode_com (MJpegDecodeContext *s)
 
static int find_marker (const uint8_t **pbuf_ptr, const uint8_t *buf_end)
 
int ff_mjpeg_find_marker (MJpegDecodeContext *s, const uint8_t **buf_ptr, const uint8_t *buf_end, const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size)
 
int ff_mjpeg_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
av_cold int ff_mjpeg_decode_end (AVCodecContext *avctx)
 
static void decode_flush (AVCodecContext *avctx)
 

Detailed Description

MJPEG decoder.

Definition in file mjpegdec.c.

Macro Definition Documentation

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

Definition at line 646 of file mjpegdec.c.

Referenced by decode_block_refinement().

#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->scantable.permutated[i]; \
if (block[j]) \
REFINE_BIT(j) \
else if (run-- == 0) \
break; \
}

Definition at line 654 of file mjpegdec.c.

Referenced by decode_block_refinement().

Function Documentation

static int build_vlc ( VLC vlc,
const uint8_t bits_table,
const uint8_t val_table,
int  nb_codes,
int  use_static,
int  is_ac 
)
static

Definition at line 44 of file mjpegdec.c.

Referenced by build_basic_mjpeg_vlc(), and ff_mjpeg_decode_dht().

static void build_basic_mjpeg_vlc ( MJpegDecodeContext s)
static

Definition at line 67 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_init().

av_cold int ff_mjpeg_decode_init ( AVCodecContext avctx)

Definition at line 83 of file mjpegdec.c.

Referenced by init(), and mxpeg_decode_init().

int ff_mjpeg_decode_dqt ( MJpegDecodeContext s)

Definition at line 125 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame(), mjpegb_decode_frame(), and mxpeg_decode_frame().

int ff_mjpeg_decode_dht ( MJpegDecodeContext s)
int ff_mjpeg_decode_sof ( MJpegDecodeContext s)

Definition at line 212 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame(), mjpegb_decode_frame(), and mxpeg_decode_frame().

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

Definition at line 508 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

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

Definition at line 556 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

static int decode_block_progressive ( MJpegDecodeContext s,
int16_t *  block,
uint8_t last_nnz,
int  ac_index,
int16_t *  quant_matrix,
int  ss,
int  se,
int  Al,
int *  EOBRUN 
)
static

Definition at line 574 of file mjpegdec.c.

Referenced by mjpeg_decode_scan_progressive_ac().

static int decode_block_refinement ( MJpegDecodeContext s,
int16_t *  block,
uint8_t last_nnz,
int  ac_index,
int16_t *  quant_matrix,
int  ss,
int  se,
int  Al,
int *  EOBRUN 
)
static

Definition at line 672 of file mjpegdec.c.

Referenced by mjpeg_decode_scan_progressive_ac().

static void handle_rstn ( MJpegDecodeContext s,
int  nb_components 
)
static

Definition at line 737 of file mjpegdec.c.

Referenced by mjpeg_decode_scan(), and mjpeg_decode_scan_progressive_ac().

static int ljpeg_decode_rgb_scan ( MJpegDecodeContext s,
int  nb_components,
int  predictor,
int  point_transform 
)
static

Definition at line 767 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

static int ljpeg_decode_yuv_scan ( MJpegDecodeContext s,
int  nb_components,
int  predictor,
int  point_transform 
)
static

Definition at line 854 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

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 997 of file mjpegdec.c.

Referenced by mjpeg_decode_scan().

static int mjpeg_decode_scan ( MJpegDecodeContext s,
int  nb_components,
int  Ah,
int  Al,
const uint8_t mb_bitmask,
const AVFrame reference 
)
static

Definition at line 1013 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

static int mjpeg_decode_scan_progressive_ac ( MJpegDecodeContext s,
int  ss,
int  se,
int  Ah,
int  Al 
)
static

Definition at line 1124 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_sos().

int ff_mjpeg_decode_sos ( MJpegDecodeContext s,
const uint8_t mb_bitmask,
const AVFrame reference 
)

Definition at line 1182 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame(), mjpegb_decode_frame(), and mxpeg_decode_frame().

static int mjpeg_decode_dri ( MJpegDecodeContext s)
static

Definition at line 1339 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame().

static int mjpeg_decode_app ( MJpegDecodeContext s)
static

Definition at line 1351 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame().

static int mjpeg_decode_com ( MJpegDecodeContext s)
static

Definition at line 1487 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame().

static int find_marker ( const uint8_t **  pbuf_ptr,
const uint8_t buf_end 
)
static

Definition at line 1522 of file mjpegdec.c.

Referenced by ff_mjpeg_find_marker().

int ff_mjpeg_find_marker ( MJpegDecodeContext s,
const uint8_t **  buf_ptr,
const uint8_t buf_end,
const uint8_t **  unescaped_buf_ptr,
int *  unescaped_buf_size 
)

Definition at line 1546 of file mjpegdec.c.

Referenced by ff_mjpeg_decode_frame(), and mxpeg_decode_frame().

int ff_mjpeg_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)

Definition at line 1634 of file mjpegdec.c.

Referenced by decode_frame(), and sp5x_decode_frame().

av_cold int ff_mjpeg_decode_end ( AVCodecContext avctx)

Definition at line 1869 of file mjpegdec.c.

Referenced by end(), and mxpeg_decode_end().

static void decode_flush ( AVCodecContext avctx)
static

Definition at line 1893 of file mjpegdec.c.