FFmpeg
Loading...
Searching...
No Matches
rtjpeg.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "get_bits.h"
#include "rtjpeg.h"

Go to the source code of this file.

Macros

#define PUT_COEFF(c)
 
#define ALIGN(a)
 aligns the bitstream to the given power of two
 
#define BLOCK(quant, dst, stride)
 

Functions

static int get_block (GetBitContext *gb, int16_t *block, const uint8_t *scan, const uint32_t *quant)
 read one block from stream
 
int ff_rtjpeg_decode_frame_yuv420 (RTJpegContext *c, AVFrame *f, const uint8_t *buf, int buf_size)
 decode one rtjpeg YUV420 frame
 
void ff_rtjpeg_decode_init (RTJpegContext *c, int width, int height, const uint32_t *lquant, const uint32_t *cquant)
 initialize an RTJpegContext, may be called multiple times
 
av_cold void ff_rtjpeg_init (RTJpegContext *c, struct AVCodecContext *avctx)
 

Macro Definition Documentation

◆ PUT_COEFF

#define PUT_COEFF ( c)
Value:
i = scan[coeff--]; \
block[i] = (c) * quant[i];
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
static int16_t block[64]
Definition dct.c:125
static const double coeff[2][5]
static const uint8_t quant[64]
Definition vmixdec.c:71
static double c[64]

Definition at line 27 of file rtjpeg.c.

Referenced by get_block().

◆ ALIGN

#define ALIGN ( a)
Value:
n = (-get_bits_count(gb)) & (a - 1); \
if (n) {skip_bits(gb, n);}
static void skip_bits(GetBitContext *s, int n)
Definition get_bits.h:383
static int get_bits_count(const GetBitContext *s)
Definition get_bits.h:254
int a

aligns the bitstream to the given power of two

Definition at line 32 of file rtjpeg.c.

Referenced by get_block().

◆ BLOCK

#define BLOCK ( quant,
dst,
stride )
Value:
do { \
int res = get_block(&gb, block, c->scan, quant); \
if (res < 0) \
return res; \
if (res > 0) \
c->idsp.idct_put(dst, stride, block); \
} while (0)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static int get_block(GetBitContext *gb, int16_t *block, const uint8_t *scan, const uint32_t *quant)
read one block from stream
Definition rtjpeg.c:48
#define stride

Referenced by config_input(), ff_rtjpeg_decode_frame_yuv420(), filter(), and filter_1phase().

Function Documentation

◆ get_block()

static int get_block ( GetBitContext * gb,
int16_t * block,
const uint8_t * scan,
const uint32_t * quant )
inlinestatic

read one block from stream

Parameters
gbcontains stream data
blockwhere data is written to
scanarray containing the mapping stream address -> block position
quantquantization factors
Returns
0 means the block is not coded, < 0 means an error occurred.

Note: GetBitContext is used to make the code simpler, since all data is aligned this could be done faster in a different way, e.g. as it is done in MPlayer libmpcodecs/native/rtjpegn.c.

Definition at line 48 of file rtjpeg.c.

◆ ff_rtjpeg_decode_frame_yuv420()

int ff_rtjpeg_decode_frame_yuv420 ( RTJpegContext * c,
AVFrame * f,
const uint8_t * buf,
int buf_size )

decode one rtjpeg YUV420 frame

Parameters
ccontext, must be initialized via ff_rtjpeg_decode_init
fAVFrame to place decoded frame into. If parts of the frame are not coded they are left unchanged, so consider initializing it
bufbuffer containing input data
buf_sizelength of input data in bytes
Returns
number of bytes consumed from the input buffer

Definition at line 108 of file rtjpeg.c.

Referenced by decode_frame().

◆ ff_rtjpeg_decode_init()

void ff_rtjpeg_decode_init ( RTJpegContext * c,
int width,
int height,
const uint32_t * lquant,
const uint32_t * cquant )

initialize an RTJpegContext, may be called multiple times

Parameters
ccontext to initialize
widthwidth of image, will be rounded down to the nearest multiple of 16 for decoding
heightheight of image, will be rounded down to the nearest multiple of 16 for decoding
lquantluma quantization table to use
cquantchroma quantization table to use

Definition at line 160 of file rtjpeg.c.

Referenced by codec_reinit(), and decode_frame().

◆ ff_rtjpeg_init()

av_cold void ff_rtjpeg_init ( RTJpegContext * c,
struct AVCodecContext * avctx )

Definition at line 172 of file rtjpeg.c.

Referenced by decode_init().