FFmpeg  4.0
Functions
mjpegenc_common.c File Reference
#include <stdint.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "idctdsp.h"
#include "jpegtables.h"
#include "put_bits.h"
#include "mjpegenc.h"
#include "mjpegenc_common.h"
#include "mjpegenc_huffman.h"
#include "mjpeg.h"

Go to the source code of this file.

Functions

av_cold void ff_init_uni_ac_vlc (const uint8_t huff_size_ac[256], uint8_t *uni_ac_vlc_len)
 
static int put_huffman_table (PutBitContext *p, int table_class, int table_id, const uint8_t *bits_table, const uint8_t *value_table)
 
static void jpeg_table_header (AVCodecContext *avctx, PutBitContext *p, ScanTable *intra_scantable, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64], int hsample[3])
 
static void jpeg_put_comments (AVCodecContext *avctx, PutBitContext *p)
 
void ff_mjpeg_init_hvsample (AVCodecContext *avctx, int hsample[4], int vsample[4])
 
void ff_mjpeg_encode_picture_header (AVCodecContext *avctx, PutBitContext *pb, ScanTable *intra_scantable, int pred, uint16_t luma_intra_matrix[64], uint16_t chroma_intra_matrix[64])
 
void ff_mjpeg_encode_picture_frame (MpegEncContext *s)
 Encodes and outputs the entire frame in the JPEG format. More...
 
void ff_mjpeg_escape_FF (PutBitContext *pb, int start)
 
static void ff_mjpeg_build_optimal_huffman (MJpegContext *m)
 Builds all 4 optimal Huffman tables. More...
 
int ff_mjpeg_encode_stuffing (MpegEncContext *s)
 Writes the complete JPEG frame when optimal huffman tables are enabled, otherwise writes the stuffing. More...
 
void ff_mjpeg_encode_picture_trailer (PutBitContext *pb, int header_bits)
 
void ff_mjpeg_encode_dc (PutBitContext *pb, int val, uint8_t *huff_size, uint16_t *huff_code)
 

Function Documentation

◆ ff_init_uni_ac_vlc()

av_cold void ff_init_uni_ac_vlc ( const uint8_t  huff_size_ac[256],
uint8_t uni_ac_vlc_len 
)

Definition at line 39 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_init(), and ff_mjpeg_encode_stuffing().

◆ put_huffman_table()

static int put_huffman_table ( PutBitContext p,
int  table_class,
int  table_id,
const uint8_t bits_table,
const uint8_t value_table 
)
static

Definition at line 66 of file mjpegenc_common.c.

Referenced by jpeg_table_header().

◆ jpeg_table_header()

static void jpeg_table_header ( AVCodecContext avctx,
PutBitContext p,
ScanTable intra_scantable,
uint16_t  luma_intra_matrix[64],
uint16_t  chroma_intra_matrix[64],
int  hsample[3] 
)
static

Definition at line 86 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_picture_header().

◆ jpeg_put_comments()

static void jpeg_put_comments ( AVCodecContext avctx,
PutBitContext p 
)
static

Definition at line 165 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_picture_header().

◆ ff_mjpeg_init_hvsample()

void ff_mjpeg_init_hvsample ( AVCodecContext avctx,
int  hsample[4],
int  vsample[4] 
)

Definition at line 221 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_picture_header(), and ljpeg_encode_init().

◆ ff_mjpeg_encode_picture_header()

void ff_mjpeg_encode_picture_header ( AVCodecContext avctx,
PutBitContext pb,
ScanTable intra_scantable,
int  pred,
uint16_t  luma_intra_matrix[64],
uint16_t  chroma_intra_matrix[64] 
)

Definition at line 248 of file mjpegenc_common.c.

Referenced by encode_picture(), ff_mjpeg_encode_stuffing(), and ljpeg_encode_frame().

◆ ff_mjpeg_encode_picture_frame()

void ff_mjpeg_encode_picture_frame ( MpegEncContext s)

Encodes and outputs the entire frame in the JPEG format.

Parameters
sThe MpegEncContext.

Definition at line 367 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_stuffing().

◆ ff_mjpeg_escape_FF()

void ff_mjpeg_escape_FF ( PutBitContext pb,
int  start 
)

Definition at line 410 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_stuffing(), and ljpeg_encode_frame().

◆ ff_mjpeg_build_optimal_huffman()

static void ff_mjpeg_build_optimal_huffman ( MJpegContext m)
static

Builds all 4 optimal Huffman tables.

Uses the data stored in the JPEG buffer to compute the tables. Stores the Huffman tables in the bits_* and val_* arrays in the MJpegContext.

Parameters
mMJpegContext containing the JPEG buffer.

Definition at line 477 of file mjpegenc_common.c.

Referenced by ff_mjpeg_encode_stuffing().

◆ ff_mjpeg_encode_stuffing()

int ff_mjpeg_encode_stuffing ( MpegEncContext s)

Writes the complete JPEG frame when optimal huffman tables are enabled, otherwise writes the stuffing.

Header + values + stuffing.

Parameters
sThe MpegEncContext.
Returns
int Error code, 0 if successful.

Definition at line 539 of file mjpegenc_common.c.

Referenced by write_slice_end().

◆ ff_mjpeg_encode_picture_trailer()

void ff_mjpeg_encode_picture_trailer ( PutBitContext pb,
int  header_bits 
)

Definition at line 587 of file mjpegenc_common.c.

Referenced by ff_mpv_encode_picture(), and ljpeg_encode_frame().

◆ ff_mjpeg_encode_dc()

void ff_mjpeg_encode_dc ( PutBitContext pb,
int  val,
uint8_t huff_size,
uint16_t *  huff_code 
)

Definition at line 594 of file mjpegenc_common.c.

Referenced by encode_block(), ljpeg_encode_bgr(), and ljpeg_encode_yuv_mb().