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;
90 const int qscale = s->
qscale;
93 component = (n <= 3 ? 0 : n - 4 + 1);
100 block[0] = dc * quant_matrix[0];
112 }
else if (level != 0) {
115 level = (level * qscale * quant_matrix[j]) >> 4;
116 level = (level - 1) | 1;
126 }
else if (level == 0) {
133 level = (level * qscale * quant_matrix[j]) >> 4;
134 level = (level - 1) | 1;
137 level = (level * qscale * quant_matrix[j]) >> 4;
138 level = (level - 1) | 1;
165 const int qscale = s->
qscale;
173 level = (3 * qscale * quant_matrix[0]) >> 5;
174 level = (level - 1) | 1;
190 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
191 level = (level - 1) | 1;
201 }
else if (level == 0) {
208 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
209 level = (level - 1) | 1;
212 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
213 level = (level - 1) | 1;
239 const int qscale = s->
qscale;
247 level = (3 * qscale) >> 1;
248 level = (level - 1) | 1;
265 level = ((level * 2 + 1) * qscale) >> 1;
266 level = (level - 1) | 1;
276 }
else if (level == 0) {
283 level = ((level * 2 + 1) * qscale) >> 1;
284 level = (level - 1) | 1;
287 level = ((level * 2 + 1) * qscale) >> 1;
288 level = (level - 1) | 1;
311 const uint16_t *quant_matrix;
312 const int qscale = s->
qscale;
328 level= (3 * qscale * quant_matrix[0]) >> 5;
346 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
358 level = ((-level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
361 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
379 block[63] ^= (mismatch & 1);
391 const int qscale = s->
qscale;
398 level = (3 * qscale) >> 1;
415 level = ((level * 2 + 1) * qscale) >> 1;
427 level = ((-level * 2 + 1) * qscale) >> 1;
430 level = ((level * 2 + 1) * qscale) >> 1;
453 const uint16_t *quant_matrix;
454 const int qscale = s->
qscale;
463 component = (n & 1) + 1;
473 mismatch = block[0] ^ 1;
489 }
else if (level != 0) {
492 level = (level * qscale * quant_matrix[j]) >> 4;
503 level = (-level * qscale * quant_matrix[j]) >> 4;
506 level = (level * qscale * quant_matrix[j]) >> 4;
519 block[63] ^= mismatch & 1;
531 const uint16_t *quant_matrix;
532 const int qscale = s->
qscale;
540 component = (n & 1) + 1;
563 }
else if (level != 0) {
566 level = (level * qscale * quant_matrix[j]) >> 4;
577 level = (-level * qscale * quant_matrix[j]) >> 4;
580 level = (level * qscale * quant_matrix[j]) >> 4;
595 #define INIT_2D_VLC_RL(rl, static_size)\
597 static RL_VLC_ELEM rl_vlc_table[static_size];\
598 INIT_VLC_STATIC(&rl.vlc, TEX_VLC_BITS, rl.n + 2,\
599 &rl.table_vlc[0][1], 4, 2,\
600 &rl.table_vlc[0][0], 4, 2, static_size);\
602 rl.rl_vlc[0] = rl_vlc_table;\
603 init_2d_vlc_rl(&rl);\
625 }
else if (code == rl->
n+1) {
739 int i, j, k, cbp, val, mb_type, motion_type;
763 if ((s->
mv[0][0][0] | s->
mv[0][0][1] | s->
mv[1][0][0] | s->
mv[1][0][1]) == 0)
842 for (i = 0; i < 6; i++) {
846 for (i = 0; i < mb_block_count; i++) {
852 for (i = 0; i < 6; i++) {
897 s->
mv_dir = (mb_type >> 13) & 3;
899 switch (motion_type) {
904 for (i = 0; i < 2; i++) {
913 s->
mv[i][0][0] <<= 1;
914 s->
mv[i][0][1] <<= 1;
921 for (i = 0; i < 2; i++) {
924 for (j = 0; j < 2; j++) {
926 for (k = 0; k < 2; k++) {
930 s->
mv[i][j][k] = val;
941 for (i = 0; i < 2; i++) {
943 for (j = 0; j < 2; j++) {
948 s->
mv[i][j][0] = val;
952 s->
last_mv[i][j][1] = val << 1;
953 s->
mv[i][j][1] = val;
960 for (i = 0; i < 2; i++) {
963 for (k = 0; k < 2; k++) {
968 s->
mv[i][0][k] = val;
976 for (i = 0; i < 2; i++) {
978 int dmx, dmy, mx, my, m;
987 s->
last_mv[i][0][1] >> my_shift);
991 s->
last_mv[i][0][1] = my << my_shift;
992 s->
last_mv[i][1][1] = my << my_shift;
1006 s->
mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
1007 s->
mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1;
1009 s->
mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
1010 s->
mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
1014 s->
mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
1015 s->
mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy;
1035 if (mb_block_count > 6) {
1036 cbp <<= mb_block_count - 6;
1055 for (i = 0; i < 6; i++) {
1064 cbp <<= 12-mb_block_count;
1066 for (i = 0; i < mb_block_count; i++) {
1067 if (cbp & (1 << 11)) {
1078 for (i = 0; i < 6; i++) {
1087 for (i = 0; i < 6; i++) {
1099 for (i = 0; i < 12; i++)
1117 for (i = 0; i < 64; i++)
1146 if (avctx == avctx_from || !ctx_from->mpeg_enc_ctx_allocated || !
s1->context_initialized)
1150 if (err)
return err;
1164 uint16_t temp_matrix[64];
1167 memcpy(temp_matrix, matrix, 64 *
sizeof(uint16_t));
1169 for (i = 0; i < 64; i++) {
1170 matrix[new_perm[i]] = temp_matrix[old_perm[i]];
1284 s->avctx->sample_aspect_ratio =
1300 memcpy(old_permutation, s->dsp.idct_permutation, 64 *
sizeof(
uint8_t));
1310 s1->mpeg_enc_ctx_allocated = 1;
1316 const uint8_t *buf,
int buf_size)
1320 int ref, f_code, vbv_delay;
1360 int horiz_size_ext, vert_size_ext;
1370 s->
width |= (horiz_size_ext << 12);
1371 s->
height |= (vert_size_ext << 12);
1373 s->
bit_rate += (bit_rate_ext << 18) * 400;
1396 int color_description, w, h;
1400 if (color_description) {
1436 for (i = 0; i < nofco; i++) {
1454 for (i = 0; i < 64; i++) {
1461 if (intra && i == 0 && v != 8) {
1601 for (i = 0; i < 4; i++) {
1623 #define DECODE_SLICE_ERROR -1
1624 #define DECODE_SLICE_OK 0
1633 const uint8_t **buf,
int buf_size)
1641 assert(mb_y < s->mb_height);
1689 const uint8_t *buf_end, *buf_start = *buf - 4;
1690 int start_code = -1;
1692 if (buf_end < *buf + buf_size)
1708 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",
1729 int motion_x, motion_y, dir, i;
1731 for (i = 0; i < 2; i++) {
1732 for (dir = 0; dir < 2; dir++) {
1734 motion_x = motion_y = 0;
1736 motion_x = s->
mv[dir][0][0];
1737 motion_y = s->
mv[dir][0][1];
1739 motion_x = s->
mv[dir][i][0];
1740 motion_y = s->
mv[dir][i][1];
1763 const int mb_size = 16;
1769 s->
mb_y += 1 << field_pic;
1801 }
else if (code == 35) {
1823 for (i = 0; i < 12; i++)
1832 s->
mv[0][0][0] = s->
mv[0][0][1] = 0;
1862 uint32_t start_code;
1867 av_dlog(c,
"ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
1887 if (mb_y < 0 || mb_y >= s->
end_mb_y)
1943 const uint8_t *buf,
int buf_size)
1954 if (width <= 0 || height <= 0)
1978 for (i = 0; i < 64; i++) {
1988 for (i = 0; i < 64; i++) {
2050 for (i = 0; i < 64; i++) {
2075 const uint8_t *p,
int buf_size)
2077 const uint8_t *buf_end = p + buf_size;
2080 if (buf_end - p >= 5 &&
2081 p[0] ==
'D' && p[1] ==
'T' && p[2] ==
'G' && p[3] ==
'1') {
2089 if (buf_end - p < 1)
2097 const uint8_t *buf,
int buf_size)
2102 int time_code_hours, time_code_minutes;
2103 int time_code_seconds, time_code_pictures;
2124 time_code_hours, time_code_minutes, time_code_seconds,
2125 time_code_pictures, s1->
closed_gop, broken_link);
2148 for (i = 0; i < buf_size; i++) {
2154 if ((buf[i] & 3) == 3)
2193 const uint8_t *buf,
int buf_size)
2198 const uint8_t *buf_end = buf + buf_size;
2199 int ret, input_size;
2204 uint32_t start_code = -1;
2206 if (start_code > 0x1ff) {
2228 input_size = buf_end - buf_ptr;
2231 av_log(avctx,
AV_LOG_DEBUG,
"%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
2235 switch (start_code) {
2237 if (last_code == 0) {
2281 if (last_code == 0) {
2313 if (last_code == 0) {
2390 if (threshold <= mb_y) {
2426 void *
data,
int *got_output,
2430 int buf_size = avpkt->
size;
2434 av_dlog(avctx,
"fill_buffer\n");
2466 return decode_chunks(avctx, picture, got_output, buf, buf_size);
2503 .
name =
"mpeg1video",
2519 .
name =
"mpeg2video",
2534 #if CONFIG_MPEG_XVMC_DECODER
2542 av_dlog(avctx,
"mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
2552 AVCodec ff_mpeg_xvmc_decoder = {
2553 .
name =
"mpegvideo_xvmc",
2557 .
init = mpeg_mc_decode_init,
2568 #if CONFIG_MPEG_VDPAU_DECODER
2569 AVCodec ff_mpeg_vdpau_decoder = {
2570 .
name =
"mpegvideo_vdpau",
2584 #if CONFIG_MPEG1_VDPAU_DECODER
2585 AVCodec ff_mpeg1_vdpau_decoder = {
2586 .
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.
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.
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.
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[]