66 uint8_t *
const scantable =
a->scantable.permutated;
67 const uint16_t *quant_matrix =
a->quant_matrix;
68 const int qscale =
a->qscale;
71 if (
a->version == 2) {
74 component = (n <= 3 ? 0 : n - 4 + 1);
76 a->last_dc[component] +=
diff;
77 block[0] =
a->last_dc[component] * (1 << 3);
90 }
else if (
level != 0) {
94 "ac-tex damaged at %d %d\n",
a->mb_x,
a->mb_y);
98 level = (
level * qscale * quant_matrix[j]) >> 3;
109 "ac-tex damaged at %d %d\n",
a->mb_x,
a->mb_y);
115 level = (
level * (unsigned)qscale * quant_matrix[j]) >> 3;
119 level = (
level * (unsigned)qscale * quant_matrix[j]) >> 3;
128 a->block_last_index[n] =
i;
135 static const int block_index[6] = { 5, 4, 0, 1, 2, 3 };
137 a->bdsp.clear_blocks(
block[0]);
139 for (
i = 0;
i < 6;
i++) {
141 block_index[
i])) < 0)
151 int16_t (*
block)[64] =
a->block;
158 a->idsp.idct_put(dest_y, linesize,
block[0]);
159 a->idsp.idct_put(dest_y + 8, linesize,
block[1]);
160 a->idsp.idct_put(dest_y + 8 * linesize, linesize,
block[2]);
161 a->idsp.idct_put(dest_y + 8 * linesize + 8, linesize,
block[3]);
170 void *
data,
int *got_frame,
175 int buf_size = avpkt->
size;
185 if (!
a->bitstream_buffer)
187 a->bbdsp.bswap16_buf((uint16_t *)
a->bitstream_buffer, (uint16_t *)buf, (buf_size + 1) / 2);
197 a->last_dc[0] =
a->last_dc[1] =
a->last_dc[2] = 128;
199 for (
a->mb_x = 0;
a->mb_x <
a->mb_width;
a->mb_x++) {
200 for (
a->mb_y = 0;
a->mb_y <
a->mb_height;
a->mb_y++) {
234 for (
i = 0;
i < 64;
i++) {
235 int j =
a->idsp.idct_permutation[
i];
248 a->bitstream_buffer_size = 0;
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int get_sbits(GetBitContext *s, int n)
#define CLOSE_READER(name, gb)
static int get_bits_left(GetBitContext *gb)
#define SHOW_UBITS(name, gb, num)
#define SHOW_SBITS(name, gb, num)
#define OPEN_READER(name, gb)
static void skip_bits(GetBitContext *s, int n)
#define SKIP_BITS(name, gb, num)
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
#define UPDATE_CACHE(name, gb)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define LAST_SKIP_BITS(name, gb, num)
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
@ AV_PICTURE_TYPE_I
Intra.
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const uint8_t ff_zigzag_direct[64]
static int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
static int decode_mb(MDECContext *a, int16_t block[6][64])
static av_cold int decode_init(AVCodecContext *avctx)
static void idct_put(MDECContext *a, AVFrame *frame, int mb_x, int mb_y)
static av_cold int decode_end(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
av_cold void ff_mpeg12_init_vlcs(void)
static int decode_dc(GetBitContext *gb, int component)
const uint16_t ff_mpeg1_default_intra_matrix[256]
@ AVCOL_RANGE_JPEG
Full range content.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
FF_ENABLE_DEPRECATION_WARNINGS int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
int coded_width
Bitstream width / height, may be different from width/height e.g.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int key_frame
1 -> keyframe, 0-> not
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
enum AVPictureType pict_type
Picture type of the frame.
This structure stores compressed data.
unsigned int bitstream_buffer_size
uint16_t quant_matrix[64]
uint8_t * bitstream_buffer
RL_VLC_ELEM * rl_vlc[32]
decoding only
static av_always_inline int diff(const uint32_t a, const uint32_t b)