47 #define MBINCR_VLC_BITS 9
48 #define MB_PAT_VLC_BITS 9
49 #define MB_PTYPE_VLC_BITS 6
50 #define MB_BTYPE_VLC_BITS 6
57 int code, sign, val, shift;
71 val = (val - 1) << shift;
83 #define check_scantable_index(ctx, x) \
86 av_log(ctx->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", \
87 ctx->mb_x, ctx->mb_y); \
88 return AVERROR_INVALIDDATA; \
99 const int qscale = s->
qscale;
102 component = (n <= 3 ? 0 : n - 4 + 1);
109 block[0] = dc * quant_matrix[0];
121 }
else if (level != 0) {
125 level = (level * qscale * quant_matrix[j]) >> 4;
126 level = (level - 1) | 1;
136 }
else if (level == 0) {
144 level = (level * qscale * quant_matrix[j]) >> 4;
145 level = (level - 1) | 1;
148 level = (level * qscale * quant_matrix[j]) >> 4;
149 level = (level - 1) | 1;
172 const int qscale = s->
qscale;
180 level = (3 * qscale * quant_matrix[0]) >> 5;
181 level = (level - 1) | 1;
197 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
198 level = (level - 1) | 1;
208 }
else if (level == 0) {
215 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
216 level = (level - 1) | 1;
219 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
220 level = (level - 1) | 1;
246 const int qscale = s->
qscale;
254 level = (3 * qscale) >> 1;
255 level = (level - 1) | 1;
273 level = ((level * 2 + 1) * qscale) >> 1;
274 level = (level - 1) | 1;
284 }
else if (level == 0) {
292 level = ((level * 2 + 1) * qscale) >> 1;
293 level = (level - 1) | 1;
296 level = ((level * 2 + 1) * qscale) >> 1;
297 level = (level - 1) | 1;
320 const uint16_t *quant_matrix;
321 const int qscale = s->
qscale;
337 level= (3 * qscale * quant_matrix[0]) >> 5;
356 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
369 level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
372 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
386 block[63] ^= (mismatch & 1);
398 const int qscale = s->
qscale;
405 level = (3 * qscale) >> 1;
423 level = ((level * 2 + 1) * qscale) >> 1;
436 level = ((-level * 2 + 1) * qscale) >> 1;
439 level = ((level * 2 + 1) * qscale) >> 1;
462 const uint16_t *quant_matrix;
463 const int qscale = s->
qscale;
472 component = (n & 1) + 1;
482 mismatch = block[0] ^ 1;
498 }
else if (level != 0) {
502 level = (level * qscale * quant_matrix[j]) >> 4;
514 level = (-level * qscale * quant_matrix[j]) >> 4;
517 level = (level * qscale * quant_matrix[j]) >> 4;
526 block[63] ^= mismatch & 1;
538 const uint16_t *quant_matrix;
539 const int qscale = s->
qscale;
547 component = (n & 1) + 1;
571 }
else if (level != 0) {
575 level = (level * qscale * quant_matrix[j]) >> 4;
587 level = (-level * qscale * quant_matrix[j]) >> 4;
590 level = (level * qscale * quant_matrix[j]) >> 4;
605 #define INIT_2D_VLC_RL(rl, static_size)\
607 static RL_VLC_ELEM rl_vlc_table[static_size];\
608 INIT_VLC_STATIC(&rl.vlc, TEX_VLC_BITS, rl.n + 2,\
609 &rl.table_vlc[0][1], 4, 2,\
610 &rl.table_vlc[0][0], 4, 2, static_size);\
612 rl.rl_vlc[0] = rl_vlc_table;\
613 init_2d_vlc_rl(&rl);\
635 }
else if (code == rl->
n+1) {
749 int i, j, k, cbp, val, mb_type, motion_type;
773 if ((s->
mv[0][0][0] | s->
mv[0][0][1] | s->
mv[1][0][0] | s->
mv[1][0][1]) == 0)
852 for (i = 0; i < 6; i++) {
856 for (i = 0; i < mb_block_count; i++) {
862 for (i = 0; i < 6; i++) {
907 s->
mv_dir = (mb_type >> 13) & 3;
909 switch (motion_type) {
914 for (i = 0; i < 2; i++) {
923 s->
mv[i][0][0] <<= 1;
924 s->
mv[i][0][1] <<= 1;
931 for (i = 0; i < 2; i++) {
934 for (j = 0; j < 2; j++) {
936 for (k = 0; k < 2; k++) {
940 s->
mv[i][j][k] = val;
951 for (i = 0; i < 2; i++) {
953 for (j = 0; j < 2; j++) {
958 s->
mv[i][j][0] = val;
962 s->
last_mv[i][j][1] = val << 1;
963 s->
mv[i][j][1] = val;
970 for (i = 0; i < 2; i++) {
973 for (k = 0; k < 2; k++) {
978 s->
mv[i][0][k] = val;
986 for (i = 0; i < 2; i++) {
988 int dmx, dmy, mx, my, m;
997 s->
last_mv[i][0][1] >> my_shift);
1001 s->
last_mv[i][0][1] = my << my_shift;
1002 s->
last_mv[i][1][1] = my << my_shift;
1004 s->
mv[i][0][0] = mx;
1005 s->
mv[i][0][1] = my;
1006 s->
mv[i][1][0] = mx;
1007 s->
mv[i][1][1] = my;
1016 s->
mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
1017 s->
mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1;
1019 s->
mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
1020 s->
mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
1024 s->
mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
1025 s->
mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy;
1045 if (mb_block_count > 6) {
1046 cbp <<= mb_block_count - 6;
1065 for (i = 0; i < 6; i++) {
1074 cbp <<= 12-mb_block_count;
1076 for (i = 0; i < mb_block_count; i++) {
1077 if (cbp & (1 << 11)) {
1088 for (i = 0; i < 6; i++) {
1097 for (i = 0; i < 6; i++) {
1109 for (i = 0; i < 12; i++)
1127 for (i = 0; i < 64; i++)
1156 if (avctx == avctx_from || !ctx_from->mpeg_enc_ctx_allocated || !
s1->context_initialized)
1160 if (err)
return err;
1174 uint16_t temp_matrix[64];
1177 memcpy(temp_matrix, matrix, 64 *
sizeof(uint16_t));
1179 for (i = 0; i < 64; i++) {
1180 matrix[new_perm[i]] = temp_matrix[old_perm[i]];
1294 s->avctx->sample_aspect_ratio =
1310 memcpy(old_permutation, s->dsp.idct_permutation, 64 *
sizeof(
uint8_t));
1320 s1->mpeg_enc_ctx_allocated = 1;
1326 const uint8_t *buf,
int buf_size)
1330 int ref, f_code, vbv_delay;
1370 int horiz_size_ext, vert_size_ext;
1380 s->
width |= (horiz_size_ext << 12);
1381 s->
height |= (vert_size_ext << 12);
1383 s->
bit_rate += (bit_rate_ext << 18) * 400;
1406 int color_description, w, h;
1410 if (color_description) {
1446 for (i = 0; i < nofco; i++) {
1464 for (i = 0; i < 64; i++) {
1471 if (intra && i == 0 && v != 8) {
1611 for (i = 0; i < 4; i++) {
1633 #define DECODE_SLICE_ERROR -1
1634 #define DECODE_SLICE_OK 0
1643 const uint8_t **buf,
int buf_size)
1651 assert(mb_y < s->mb_height);
1699 const uint8_t *buf_end, *buf_start = *buf - 4;
1700 int start_code = -1;
1702 if (buf_end < *buf + buf_size)
1718 av_log(s->
avctx,
AV_LOG_DEBUG,
"qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
1739 int motion_x, motion_y, dir, i;
1741 for (i = 0; i < 2; i++) {
1742 for (dir = 0; dir < 2; dir++) {
1744 motion_x = motion_y = 0;
1746 motion_x = s->
mv[dir][0][0];
1747 motion_y = s->
mv[dir][0][1];
1749 motion_x = s->
mv[dir][i][0];
1750 motion_y = s->
mv[dir][i][1];
1773 const int mb_size = 16;
1779 s->
mb_y += 1 << field_pic;
1811 }
else if (code == 35) {
1833 for (i = 0; i < 12; i++)
1842 s->
mv[0][0][0] = s->
mv[0][0][1] = 0;
1872 uint32_t start_code;
1877 av_dlog(c,
"ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
1897 if (mb_y < 0 || mb_y >= s->
end_mb_y)
1953 const uint8_t *buf,
int buf_size)
1964 if (width <= 0 || height <= 0)
1988 for (i = 0; i < 64; i++) {
1998 for (i = 0; i < 64; i++) {
2060 for (i = 0; i < 64; i++) {
2085 const uint8_t *p,
int buf_size)
2087 const uint8_t *buf_end = p + buf_size;
2090 if (buf_end - p >= 5 &&
2091 p[0] ==
'D' && p[1] ==
'T' && p[2] ==
'G' && p[3] ==
'1') {
2099 if (buf_end - p < 1)
2107 const uint8_t *buf,
int buf_size)
2112 int time_code_hours, time_code_minutes;
2113 int time_code_seconds, time_code_pictures;
2134 time_code_hours, time_code_minutes, time_code_seconds,
2135 time_code_pictures, s1->
closed_gop, broken_link);
2158 for (i = 0; i < buf_size; i++) {
2164 if ((buf[i] & 3) == 3)
2203 const uint8_t *buf,
int buf_size)
2208 const uint8_t *buf_end = buf + buf_size;
2209 int ret, input_size;
2214 uint32_t start_code = -1;
2216 if (start_code > 0x1ff) {
2238 input_size = buf_end - buf_ptr;
2241 av_log(avctx,
AV_LOG_DEBUG,
"%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
2245 switch (start_code) {
2247 if (last_code == 0) {
2291 if (last_code == 0) {
2323 if (last_code == 0) {
2400 if (threshold <= mb_y) {
2436 void *
data,
int *got_output,
2440 int buf_size = avpkt->
size;
2444 av_dlog(avctx,
"fill_buffer\n");
2476 return decode_chunks(avctx, picture, got_output, buf, buf_size);
2513 .
name =
"mpeg1video",
2529 .
name =
"mpeg2video",
2544 #if CONFIG_MPEG_XVMC_DECODER
2552 av_dlog(avctx,
"mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
2562 AVCodec ff_mpeg_xvmc_decoder = {
2563 .
name =
"mpegvideo_xvmc",
2567 .
init = mpeg_mc_decode_init,
2578 #if CONFIG_MPEG_VDPAU_DECODER
2579 AVCodec ff_mpeg_vdpau_decoder = {
2580 .
name =
"mpegvideo_vdpau",
2594 #if CONFIG_MPEG1_VDPAU_DECODER
2595 AVCodec ff_mpeg1_vdpau_decoder = {
2596 .
name =
"mpeg1video_vdpau",
const uint16_t ff_mpeg1_default_non_intra_matrix[64]
#define PICT_BOTTOM_FIELD
static int get_qscale(MpegEncContext *s)
enum AVPixelFormat ff_hwaccel_pixfmt_list_420[]
static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
const struct AVCodec * codec
discard all frames except keyframes
void ff_init_block_index(MpegEncContext *s)
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
#define SLICE_MAX_START_CODE
const uint8_t ff_zigzag_direct[64]
AVCodec ff_mpeg2video_decoder
This structure describes decoded (raw) audio or video data.
static int mpeg_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from)
AVPanScan * pan_scan
Pan scan.
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
#define MV_TYPE_FIELD
2 vectors, one per field
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
int last_mv[2][2][2]
last MV, used for MV prediction in MPEG1 & B-frame MPEG4
int coded_width
Bitstream width / height, may be different from width/height.
av_cold int ff_MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
int sync
Did we reach a sync point like a GOP/SEQ/KEYFrame?
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
av_cold void ff_mpeg12_init_vlcs(void)
MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
void ff_MPV_report_decode_progress(MpegEncContext *s)
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
uint16_t chroma_intra_matrix[64]
static const AVProfile mpeg2_video_profiles[]
#define MB_BTYPE_VLC_BITS
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
uint16_t chroma_inter_matrix[64]
enum AVColorRange color_range
MPEG vs JPEG YUV range.
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
int repeat_pict
When decoding, this signals how much the picture must be delayed.
void ff_xvmc_field_end(MpegEncContext *s)
Complete frame/field rendering by passing any remaining blocks.
const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
#define CODEC_CAP_HWACCEL_VDPAU
void ff_init_rl(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
void ff_mpeg1_clean_buffers(MpegEncContext *s)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
static const uint8_t non_linear_qscale[32]
const uint16_t ff_mpeg12_vlc_dc_lum_code[12]
const int8_t * table_level
static int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n)
#define SLICE_MIN_START_CODE
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
Find and store the surfaces that are used as reference frames.
static int get_sbits(GetBitContext *s, int n)
int encoding
true if we are encoding (vs decoding)
#define USES_LIST(a, list)
does this mb use listX, note does not work if subMBs
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define CODEC_FLAG_TRUNCATED
enum AVDiscard skip_frame
#define INIT_2D_VLC_RL(rl, static_size)
struct AVHWAccel * hwaccel
Hardware accelerator in use.
const uint8_t ff_alternate_vertical_scan[64]
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
DCTELEM(*[12] pblocks)[64]
#define FF_PROFILE_MPEG2_SIMPLE
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
enum OutputFormat out_format
output format
const float ff_mpeg1_aspect[16]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Picture current_picture
copy of the current picture structure.
static int get_dmv(MpegEncContext *s)
void ff_xvmc_init_block(MpegEncContext *s)
Initialize the block field of the MpegEncContext pointer passed as parameter after making sure that t...
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static int get_bits_count(const GetBitContext *s)
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
Fill individual block pointers, so there are no gaps in the data_block array in case not all blocks i...
MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstr...
uint8_t idct_permutation[64]
idct input permutation.
int flags2
AVCodecContext.flags2.
#define DECODE_SLICE_ERROR
int mb_height
number of MBs horizontally & vertically
static void mpeg_decode_gop(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
void ff_MPV_frame_end(MpegEncContext *s)
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
static av_cold int mpeg_decode_init(AVCodecContext *avctx)
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static int init(AVCodecParserContext *s)
#define FF_PROFILE_MPEG2_SS
void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove)
Fetch timestamps for a specific byte within the current access unit.
static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
const uint16_t ff_mpeg1_default_intra_matrix[64]
static int get_bits_left(GetBitContext *gb)
#define FF_PROFILE_RESERVED
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
int slice_context_count
number of used thread_contexts
#define UPDATE_CACHE(name, gb)
static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, int *got_output, const uint8_t *buf, int buf_size)
int has_b_frames
Size of the frame reordering buffer in the decoder.
int last_dc[3]
last DC values for MPEG1
Multithreading support functions.
static int slice_decode_thread(AVCodecContext *c, void *arg)
int mb_skipped
MUST BE SET only during DECODING.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
#define FF_PROFILE_MPEG2_SNR_SCALABLE
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
int active_thread_type
Which multithreading methods are in use by the codec.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
#define FF_DEBUG_PICT_INFO
int capabilities
Codec capabilities.
#define MB_TYPE_INTERLACED
static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], int intra)
#define CODEC_CAP_TRUNCATED
const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]
#define CODEC_FLAG_LOW_DELAY
XVideo Motion Acceleration via common packet passing.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int width
width and height in 1/16 pel
int low_delay
no reordering needed / has no b-frames
static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
static int mpeg2_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n)
VLC vlc
decoding only deprecated FIXME remove
#define CLOSE_READER(name, gb)
static int decode_dc(GetBitContext *gb, int component)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void ff_mpeg_flush(AVCodecContext *avctx)
#define SKIP_BITS(name, gb, num)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int resync_mb_x
x position of last resync marker
int rc_buffer_size
decoder bitstream buffer size
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define FF_PROFILE_MPEG2_HIGH
int dtg_active_format
DTG active format information (additional aspect ratio information only used in DVB MPEG-2 transport ...
the normal 219*2^(n-8) "MPEG" YUV ranges
void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
int n
number of entries of table_vlc minus 1
int bit_rate
the average bitrate
static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt)
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define FF_PROFILE_MPEG2_MAIN
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for b-frame encodin...
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]
Picture * current_picture_ptr
pointer to the current picture
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
static int mpeg_decode_end(AVCodecContext *avctx)
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define check_scantable_index(ctx, x)
void ff_er_frame_end(MpegEncContext *s)
static void flush(AVCodecContext *avctx)
#define SLICE_FLAG_CODED_ORDER
#define LAST_SKIP_BITS(name, gb, num)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
#define CONFIG_MPEG_VDPAU_DECODER
int block_last_index[12]
last non zero coefficient in block
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
int mpeg_enc_ctx_allocated
int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function for encode/decode called after coding/decoding the header and before a frame is code...
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
preferred ID for MPEG-1/2 video decoding
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
int xvmc_acceleration
XVideo Motion Acceleration.
static const float pred[4]
int first_field
is 1 for the first field of a field picture 0 otherwise
static int mpeg1_decode_sequence(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
#define MV_TYPE_16X16
1 vector for the whole mb
const uint8_t *const ff_mpeg2_dc_scale_table[4]
const uint8_t * avpriv_mpv_find_start_code(const uint8_t *restrict p, const uint8_t *end, uint32_t *restrict state)
uint16_t inter_matrix[64]
#define CODEC_CAP_HWACCEL
int concealment_motion_vectors
struct MpegEncContext * thread_context[MAX_THREADS]
AVRational frame_rate_ext
MPEG-2 specific framerate modificator.
#define FF_PROFILE_MPEG2_422
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
#define FF_QSCALE_TYPE_MPEG2
main external API structure.
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
#define OPEN_READER(name, gb)
int16_t(*[2] motion_val)[2]
motion vector table
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
uint32_t state
contains the last few bytes in MSB order
static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
int slice_flags
slice flags
static int mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
static void skip_bits(GetBitContext *s, int n)
enum AVPixelFormat(* get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
callback to negotiate the pixelFormat
void ff_draw_horiz_band(MpegEncContext *s, int y, int h)
#define SLICE_FLAG_ALLOW_FIELD
enum AVColorSpace colorspace
YUV colorspace type.
rational number numerator/denominator
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
static int vcr2_init_sequence(AVCodecContext *avctx)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define GET_CACHE(name, gb)
int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s)
Find the end of the current frame in the bitstream.
void ff_er_frame_start(MpegEncContext *s)
AVHWAccel * ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt)
Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.
discard useless packets like 0 size packets in avi
int8_t * ref_index[2]
motion reference frame index the order in which these are stored can depend on the codec...
DSPContext dsp
pointers for accelerated dsp functions
static void init_2d_vlc_rl(RLTable *rl)
int closed_gop
GOP is closed.
static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
#define CODEC_CAP_SLICE_THREADS
int bit_rate
wanted bit rate
DCTELEM(* block)[64]
points to one of the following blocks
struct Mpeg1Context Mpeg1Context
static av_const int sign_extend(int val, unsigned bits)
int skip_bottom
Number of macroblock rows at the bottom which are skipped.
static const uint32_t btype2mb_type[11]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
void(* clear_blocks)(DCTELEM *blocks)
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
#define SHOW_SBITS(name, gb, num)
discard all non reference
const AVRational ff_mpeg2_aspect[16]
AVCodec ff_mpeg1video_decoder
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
static int mpeg_decode_slice(MpegEncContext *s, int mb_y, const uint8_t **buf, int buf_size)
Decode a slice.
uint8_t ff_mpeg12_static_rl_table_store[2][2][2 *MAX_RUN+MAX_LEVEL+3]
const uint8_t * buffer_end
#define AVERROR_INVALIDDATA
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count)
Picture * last_picture_ptr
pointer to the previous picture.
static int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n)
static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
static int mpeg_decode_postinit(AVCodecContext *avctx)
const uint8_t ff_mpeg12_mbPatTable[64][2]
int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
int16_t position[3][2]
position of the top left corner in 1/16 pel for up to 3 fields/frames
static int mpeg2_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
void ff_mpeg12_common_init(MpegEncContext *s)
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
void ff_MPV_common_end(MpegEncContext *s)
void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
Print debugging info for the given picture.
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
#define MB_PTYPE_VLC_BITS
int resync_mb_y
y position of last resync marker
static int mpeg2_fast_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n)
ParseContext parse_context
const uint8_t ff_mpeg12_mbAddrIncrTable[36][2]
VLC_TYPE(* table)[2]
code, bits
static const uint8_t table_mb_btype[11][2]
int key_frame
1 -> keyframe, 0-> not
MpegEncContext mpeg_enc_ctx
int flags
AVCodecContext.flags (HQ, MV4, ...)
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
static void exchange_uv(MpegEncContext *s)
#define FF_DEBUG_STARTCODE
static const uint32_t ptype2mb_type[7]
ScanTable inter_scantable
if inter == intra then intra should be used to reduce tha cache usage
const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]
#define PICTURE_START_CODE
static const uint8_t table_mb_ptype[7][2]
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
#define CONFIG_MPEG_XVMC_DECODER
static void mpeg_decode_user_data(AVCodecContext *avctx, const uint8_t *p, int buf_size)
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
static int mpeg1_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n)
AVPixelFormat
Pixel format.
This structure stores compressed data.
const AVRational ff_mpeg12_frame_rate_tab[16]
#define CODEC_CAP_DRAW_HORIZ_BAND
static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, const uint8_t *new_perm)
void ff_MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
#define FF_PROFILE_UNKNOWN
AVPanScan pan_scan
some temporary storage for the panscan
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)
static enum AVPixelFormat pixfmt_xvmc_mpg2_420[]