29 block[i] = (c) * quant[i];
33 n = (-get_bits_count(gb)) & (a - 1); \
34 if (n) {skip_bits(gb, n);}
49 const uint32_t *
quant) {
65 memset(
block, 0, 64 *
sizeof(int16_t));
109 const uint8_t *buf,
int buf_size) {
111 int w =
c->w / 16,
h =
c->h / 16;
113 uint8_t *y1 =
f->data[0], *y2 =
f->data[0] + 8 *
f->linesize[0];
114 uint8_t *
u =
f->data[1], *v =
f->data[2];
119 for (y = 0; y <
h; y++) {
120 for (x = 0; x <
w; x++) {
121#define BLOCK(quant, dst, stride) do { \
122 int res = get_block(&gb, block, c->scan, quant); \
126 c->idsp.idct_put(dst, stride, block); \
128 int16_t *
block =
c->block;
129 BLOCK(
c->lquant, y1,
f->linesize[0]);
131 BLOCK(
c->lquant, y1,
f->linesize[0]);
133 BLOCK(
c->lquant, y2,
f->linesize[0]);
135 BLOCK(
c->lquant, y2,
f->linesize[0]);
137 BLOCK(
c->cquant,
u,
f->linesize[1]);
139 BLOCK(
c->cquant, v,
f->linesize[2]);
142 y1 += 2 * 8 * (
f->linesize[0] -
w);
143 y2 += 2 * 8 * (
f->linesize[0] -
w);
144 u += 8 * (
f->linesize[1] -
w);
145 v += 8 * (
f->linesize[2] -
w);
161 const uint32_t *lquant,
const uint32_t *cquant) {
163 for (
i = 0;
i < 64;
i++) {
164 int p =
c->idsp.idct_permutation[
i];
165 c->lquant[p] = lquant[
i];
166 c->cquant[p] = cquant[
i];
178 for (
i = 0;
i < 64;
i++) {
180 z = ((z << 3) | (z >> 3)) & 63;
183 c->scan[
i] =
c->idsp.idct_permutation[z];
#define i(width, name, range_min, range_max)
common internal and external API header
bitstream reader API header.
static int get_sbits(GetBitContext *s, int n)
static int get_bits_left(GetBitContext *gb)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define u(width, name, range_min, range_max)
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
Macro definitions for various function/variable attributes.
const uint8_t ff_zigzag_direct[64]
#define ALIGN(a)
aligns the bitstream to the given power of two
#define BLOCK(quant, dst, stride)
av_cold void ff_rtjpeg_init(RTJpegContext *c, struct AVCodecContext *avctx)
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
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
main external API structure.
This structure describes decoded (raw) audio or video data.
static const double coeff[2][5]
static const uint8_t quant[64]