Go to the documentation of this file.
66 const uint8_t *
const scantable =
a->permutated_scantable;
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;
154 uint8_t *dest_y =
frame->
data[0] + (mb_y * 16* linesize ) + mb_x * 16;
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]);
173 const uint8_t *buf = avpkt->
data;
174 int buf_size = avpkt->
size;
183 if (!
a->bitstream_buffer)
185 a->bbdsp.bswap16_buf((uint16_t *)
a->bitstream_buffer, (uint16_t *)buf, (buf_size + 1) / 2);
195 a->last_dc[0] =
a->last_dc[1] =
a->last_dc[2] = 128;
197 for (
a->mb_x = 0;
a->mb_x <
a->mb_width;
a->mb_x++) {
198 for (
a->mb_y = 0;
a->mb_y <
a->mb_height;
a->mb_y++) {
226 a->idsp.idct_permutation);
232 for (
i = 0;
i < 64;
i++) {
233 int j =
a->idsp.idct_permutation[
i];
246 a->bitstream_buffer_size = 0;
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
uint8_t permutated_scantable[64]
static int get_bits_count(const GetBitContext *s)
This structure describes decoded (raw) audio or video data.
@ AVCOL_RANGE_JPEG
Full range content.
#define UPDATE_CACHE(name, gb)
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in FFCodec caps_internal and use ff_thread_get_buffer() to allocate frames. Otherwise decode directly into the user-supplied frames. Call ff_thread_report_progress() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
static void skip_bits(GetBitContext *s, int n)
av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
uint16_t quant_matrix[64]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int decode_mb(MDECContext *a, int16_t block[6][64])
static av_cold int decode_init(AVCodecContext *avctx)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define CLOSE_READER(name, gb)
#define FF_CODEC_DECODE_CB(func)
av_cold void ff_blockdsp_init(BlockDSPContext *c)
#define SHOW_SBITS(name, gb, num)
unsigned int bitstream_buffer_size
static int get_sbits(GetBitContext *s, int n)
#define SKIP_BITS(name, gb, num)
#define CODEC_LONG_NAME(str)
static av_cold int decode_end(AVCodecContext *avctx)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AV_PICTURE_TYPE_I
Intra.
#define LAST_SKIP_BITS(name, gb, num)
RL_VLC_ELEM ff_mpeg1_rl_vlc[680]
enum AVPictureType pict_type
Picture type of the frame.
int(* init)(AVBSFContext *ctx)
#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 DECLARE_ALIGNED(n, t, v)
static void idct_put(MDECContext *a, AVFrame *frame, int mb_x, int mb_y)
const uint16_t ff_mpeg1_default_intra_matrix[256]
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
#define OPEN_READER(name, gb)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
const FFCodec ff_mdec_decoder
#define i(width, name, range_min, range_max)
av_cold void ff_mpeg12_init_vlcs(void)
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...
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
const uint8_t ff_zigzag_direct[64]
main external API structure.
#define SHOW_UBITS(name, gb, num)
int coded_width
Bitstream width / height, may be different from width/height e.g.
uint8_t * bitstream_buffer
This structure stores compressed data.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int decode_dc(GetBitContext *gb, int component)