hvirtual/quicktime/ffmpeg/libavcodec/mpeg12.c File Reference

#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include "mpeg12data.h"
#include "mdec.c"

Include dependency graph for mpeg12.c:

Go to the source code of this file.

Data Structures

struct  Mpeg1Context

Defines

#define SEQ_END_CODE   0x000001b7
#define SEQ_START_CODE   0x000001b3
#define GOP_START_CODE   0x000001b8
#define PICTURE_START_CODE   0x00000100
#define SLICE_MIN_START_CODE   0x00000101
#define SLICE_MAX_START_CODE   0x000001af
#define EXT_START_CODE   0x000001b5
#define USER_START_CODE   0x000001b2
#define DC_VLC_BITS   9
#define MV_VLC_BITS   9
#define MBINCR_VLC_BITS   9
#define MB_PAT_VLC_BITS   9
#define MB_PTYPE_VLC_BITS   6
#define MB_BTYPE_VLC_BITS   6
#define TEX_VLC_BITS   9
#define MT_FIELD   1
#define MT_FRAME   2
#define MT_16X8   2
#define MT_DMV   3
#define DECODE_SLICE_ERROR   -1
#define DECODE_SLICE_OK   0

Functions

static int mpeg1_decode_block_inter (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg1_decode_block_intra (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg1_fast_decode_block_inter (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg2_decode_block_non_intra (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg2_decode_block_intra (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg2_fast_decode_block_non_intra (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg2_fast_decode_block_intra (MpegEncContext *s, DCTELEM *block, int n)
static int mpeg_decode_motion (MpegEncContext *s, int fcode, int pred)
static void exchange_uv (MpegEncContext *s)
static void init_2d_vlc_rl (RLTable *rl, int use_static)
static void common_init (MpegEncContext *s)
void ff_mpeg1_clean_buffers (MpegEncContext *s)
static void init_vlcs (void)
static int get_dmv (MpegEncContext *s)
static int get_qscale (MpegEncContext *s)
static int mpeg_decode_mb (MpegEncContext *s, DCTELEM block[12][64])
static int decode_dc (GetBitContext *gb, int component)
static int mpeg_decode_init (AVCodecContext *avctx)
static void quant_matrix_rebuild (uint16_t *matrix, const uint8_t *old_perm, const uint8_t *new_perm)
static int mpeg_decode_postinit (AVCodecContext *avctx)
static int find_start_code (const uint8_t **pbuf_ptr, const uint8_t *buf_end)
static int mpeg1_decode_picture (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static void mpeg_decode_sequence_extension (Mpeg1Context *s1)
static void mpeg_decode_sequence_display_extension (Mpeg1Context *s1)
static void mpeg_decode_picture_display_extension (Mpeg1Context *s1)
static void mpeg_decode_quant_matrix_extension (MpegEncContext *s)
static void mpeg_decode_picture_coding_extension (MpegEncContext *s)
static void mpeg_decode_extension (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static int mpeg_field_start (MpegEncContext *s)
static int mpeg_decode_slice (Mpeg1Context *s1, int mb_y, const uint8_t **buf, int buf_size)
static int slice_decode_thread (AVCodecContext *c, void *arg)
static int slice_end (AVCodecContext *avctx, AVFrame *pict)
static int mpeg1_decode_sequence (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static int vcr2_init_sequence (AVCodecContext *avctx)
static void mpeg_decode_user_data (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static void mpeg_decode_gop (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
int ff_mpeg1_find_frame_end (ParseContext *pc, const uint8_t *buf, int buf_size)
static int mpeg_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
static int mpeg_decode_end (AVCodecContext *avctx)

Variables

enum PixelFormat pixfmt_yuv_420 [] = {PIX_FMT_YUV420P,-1}
enum PixelFormat pixfmt_yuv_422 [] = {PIX_FMT_YUV422P,-1}
enum PixelFormat pixfmt_yuv_444 [] = {PIX_FMT_YUV444P,-1}
enum PixelFormat pixfmt_xvmc_mpg2_420 []
static VLC dc_lum_vlc
static VLC dc_chroma_vlc
static VLC mv_vlc
static VLC mbincr_vlc
static VLC mb_ptype_vlc
static VLC mb_btype_vlc
static VLC mb_pat_vlc
AVCodec mpeg1video_decoder
AVCodec mpeg2video_decoder
AVCodec mpegvideo_decoder


Detailed Description

MPEG1/2 codec

Definition in file mpeg12.c.


Define Documentation

#define DC_VLC_BITS   9

Definition at line 47 of file mpeg12.c.

#define DECODE_SLICE_ERROR   -1

Definition at line 2511 of file mpeg12.c.

#define DECODE_SLICE_OK   0

Definition at line 2512 of file mpeg12.c.

#define EXT_START_CODE   0x000001b5

Definition at line 44 of file mpeg12.c.

#define GOP_START_CODE   0x000001b8

Definition at line 40 of file mpeg12.c.

#define MB_BTYPE_VLC_BITS   6

Definition at line 52 of file mpeg12.c.

Referenced by init_vlcs(), and mpeg_decode_mb().

#define MB_PAT_VLC_BITS   9

Definition at line 50 of file mpeg12.c.

Referenced by init_vlcs(), and mpeg_decode_mb().

#define MB_PTYPE_VLC_BITS   6

Definition at line 51 of file mpeg12.c.

Referenced by init_vlcs(), and mpeg_decode_mb().

#define MBINCR_VLC_BITS   9

Definition at line 49 of file mpeg12.c.

Referenced by init_vlcs(), and mpeg_decode_slice().

#define MT_16X8   2

Definition at line 1047 of file mpeg12.c.

#define MT_DMV   3

Definition at line 1048 of file mpeg12.c.

Referenced by mpeg_decode_mb().

#define MT_FIELD   1

Definition at line 1045 of file mpeg12.c.

Referenced by mpeg_decode_mb().

#define MT_FRAME   2

Definition at line 1046 of file mpeg12.c.

Referenced by mpeg_decode_mb().

#define MV_VLC_BITS   9

Definition at line 48 of file mpeg12.c.

#define PICTURE_START_CODE   0x00000100

Definition at line 41 of file mpeg12.c.

#define SEQ_END_CODE   0x000001b7

Definition at line 38 of file mpeg12.c.

#define SEQ_START_CODE   0x000001b3

Definition at line 39 of file mpeg12.c.

#define SLICE_MAX_START_CODE   0x000001af

Definition at line 43 of file mpeg12.c.

Referenced by ff_mpeg1_find_frame_end(), mpeg_decode_frame(), and mpegvideo_extract_headers().

#define SLICE_MIN_START_CODE   0x00000101

#define TEX_VLC_BITS   9

Definition at line 53 of file mpeg12.c.

#define USER_START_CODE   0x000001b2

Definition at line 45 of file mpeg12.c.


Function Documentation

static void common_init ( MpegEncContext s  )  [static]

static int decode_dc ( GetBitContext gb,
int  component 
) [inline, static]

Definition at line 1480 of file mpeg12.c.

References av_log(), AV_LOG_ERROR, DC_VLC_BITS, get_vlc2(), get_xbits(), NULL, and VLC::table.

Referenced by mdec_decode_block_intra(), mpeg1_decode_block_intra(), mpeg2_decode_block_intra(), and mpeg2_fast_decode_block_intra().

Here is the call graph for this function:

static void exchange_uv ( MpegEncContext s  )  [static]

Definition at line 2455 of file mpeg12.c.

References MpegEncContext::pblocks.

Referenced by mpeg_decode_mb(), and vcr2_init_sequence().

void ff_mpeg1_clean_buffers ( MpegEncContext s  ) 

int ff_mpeg1_find_frame_end ( ParseContext pc,
const uint8_t *  buf,
int  buf_size 
)

finds the end of the current frame in the bitstream.

Returns:
the position of the first byte of the next frame, or -1

Definition at line 2996 of file mpeg12.c.

References END_NOT_FOUND, ParseContext::frame_start_found, SLICE_MAX_START_CODE, SLICE_MIN_START_CODE, and ParseContext::state.

Referenced by mpeg_decode_frame(), and mpegvideo_parse().

static int find_start_code ( const uint8_t **  pbuf_ptr,
const uint8_t *  buf_end 
) [static]

Definition at line 2177 of file mpeg12.c.

Referenced by mpeg_decode_frame(), mpegvideo_extract_headers(), and slice_decode_thread().

static int get_dmv ( MpegEncContext s  )  [inline, static]

Definition at line 1026 of file mpeg12.c.

References MpegEncContext::gb, and get_bits1().

Referenced by mpeg_decode_mb().

Here is the call graph for this function:

static int get_qscale ( MpegEncContext s  )  [inline, static]

Definition at line 1034 of file mpeg12.c.

References MpegEncContext::gb, get_bits(), non_linear_qscale, and MpegEncContext::q_scale_type.

Referenced by ff_rate_control_init(), ff_rate_estimate_qscale(), init_pass2(), mpeg_decode_mb(), and mpeg_decode_slice().

Here is the call graph for this function:

static void init_2d_vlc_rl ( RLTable rl,
int  use_static 
) [static]

static void init_vlcs ( void   )  [static]

static int mpeg1_decode_block_inter ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg1_decode_block_intra ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg1_decode_picture ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

static int mpeg1_decode_sequence ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

static int mpeg1_fast_decode_block_inter ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg2_decode_block_intra ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg2_decode_block_non_intra ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg2_fast_decode_block_intra ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg2_fast_decode_block_non_intra ( MpegEncContext s,
DCTELEM block,
int  n 
) [inline, static]

static int mpeg_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 3201 of file mpeg12.c.

References Mpeg1Context::mpeg_enc_ctx, Mpeg1Context::mpeg_enc_ctx_allocated, MPV_common_end(), and AVCodecContext::priv_data.

Here is the call graph for this function:

static void mpeg_decode_extension ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

static int mpeg_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
uint8_t *  buf,
int  buf_size 
) [static]

Definition at line 3035 of file mpeg12.c.

References AC_END, AC_ERROR, av_log(), AV_LOG_DEBUG, AVDISCARD_ALL, AVDISCARD_DEFAULT, AVDISCARD_NONKEY, AVDISCARD_NONREF, B_TYPE, CODEC_FLAG_TRUNCATED, MpegEncContext::codec_id, CODEC_ID_MPEG2VIDEO, AVCodecContext::codec_tag, DC_END, DC_ERROR, AVCodecContext::debug, emms_c, MpegEncContext::end_mb_y, MpegEncContext::error_count, AVCodecContext::execute, EXT_START_CODE, ff_combine_frame(), FF_DEBUG_STARTCODE, ff_er_add_slice(), ff_mpeg1_find_frame_end(), ff_update_duplicate_context(), find_start_code(), MpegEncContext::first_field, MpegEncContext::first_slice, AVCodecContext::flags, MpegEncContext::flags, MpegEncContext::gb, GOP_START_CODE, AVCodecContext::hurry_up, I_TYPE, init_get_bits(), ParseContext::last_index, MpegEncContext::last_picture_ptr, MpegEncContext::low_delay, MpegEncContext::mb_height, MpegEncContext::mb_x, MpegEncContext::mb_y, mpeg1_decode_picture(), mpeg1_decode_sequence(), mpeg_decode_extension(), mpeg_decode_gop(), mpeg_decode_slice(), mpeg_decode_user_data(), Mpeg1Context::mpeg_enc_ctx, Mpeg1Context::mpeg_enc_ctx_allocated, mpeg_field_start(), MV_END, MV_ERROR, MpegEncContext::next_picture_ptr, NULL, P_TYPE, MpegEncContext::parse_context, MpegEncContext::pict_type, picture, PICTURE_START_CODE, AVCodecContext::priv_data, Mpeg1Context::repeat_field, MpegEncContext::resync_mb_x, MpegEncContext::resync_mb_y, s2, SEQ_START_CODE, AVCodecContext::skip_bottom, AVCodecContext::skip_frame, Mpeg1Context::slice_count, slice_decode_thread(), slice_end(), SLICE_MAX_START_CODE, SLICE_MIN_START_CODE, MpegEncContext::start_mb_y, MpegEncContext::thread_context, AVCodecContext::thread_count, USER_START_CODE, and vcr2_init_sequence().

Here is the call graph for this function:

static void mpeg_decode_gop ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

static int mpeg_decode_init ( AVCodecContext avctx  )  [static]

static int mpeg_decode_mb ( MpegEncContext s,
DCTELEM  block[12][64] 
) [static]

Definition at line 1050 of file mpeg12.c.

References av_log(), AV_LOG_ERROR, MpegEncContext::avctx, B_TYPE, MpegEncContext::block, MpegEncContext::block_last_index, btype2mb_type, MpegEncContext::chroma_format, MpegEncContext::chroma_y_shift, DSPContext::clear_blocks, CODEC_FLAG2_FAST, MpegEncContext::codec_id, CODEC_ID_MPEG2VIDEO, MpegEncContext::concealment_motion_vectors, MpegEncContext::current_picture, MpegEncContext::dsp, exchange_uv(), MpegEncContext::field_select, MpegEncContext::flags2, MpegEncContext::frame_pred_frame_dct, MpegEncContext::full_pel, MpegEncContext::gb, get_bits(), get_bits1(), get_dmv(), get_qscale(), get_vlc2(), HAS_CBP, I_TYPE, MpegEncContext::interlaced_dct, IS_INTRA, IS_QUANT, MpegEncContext::last_mv, MB_BTYPE_VLC_BITS, MpegEncContext::mb_intra, MB_PAT_VLC_BITS, MB_PTYPE_VLC_BITS, MpegEncContext::mb_skip_run, MpegEncContext::mb_skipped, MpegEncContext::mb_stride, MB_TYPE_16x16, MB_TYPE_16x8, MB_TYPE_CBP, MB_TYPE_INTERLACED, MB_TYPE_INTRA, MB_TYPE_L0, MB_TYPE_L0L1, MB_TYPE_QUANT, MB_TYPE_SKIP, MB_TYPE_ZERO_MV, MpegEncContext::mb_width, MpegEncContext::mb_x, MpegEncContext::mb_y, mpeg1_decode_block_inter(), mpeg1_decode_block_intra(), mpeg1_fast_decode_block_inter(), mpeg2_decode_block_intra(), mpeg2_decode_block_non_intra(), mpeg2_fast_decode_block_intra(), mpeg2_fast_decode_block_non_intra(), mpeg_decode_motion(), MpegEncContext::mpeg_f_code, MT_DMV, MT_FIELD, MT_FRAME, MpegEncContext::mv, MpegEncContext::mv_dir, MV_DIR_FORWARD, MpegEncContext::mv_type, MV_TYPE_16X16, MV_TYPE_16X8, MV_TYPE_DMV, MV_TYPE_FIELD, P_TYPE, MpegEncContext::pblocks, PICT_FRAME, PICT_TOP_FIELD, MpegEncContext::pict_type, MpegEncContext::picture_structure, ptype2mb_type, MpegEncContext::qscale, skip_bits1(), MpegEncContext::swap_uv, VLC::table, MpegEncContext::top_field_first, USES_LIST, and AVCodecContext::xvmc_acceleration.

Referenced by mpeg_decode_slice().

Here is the call graph for this function:

static int mpeg_decode_motion ( MpegEncContext s,
int  fcode,
int  pred 
) [static]

Definition at line 1450 of file mpeg12.c.

References MpegEncContext::gb, get_bits(), get_bits1(), get_vlc2(), INT_BIT, MV_VLC_BITS, shift(), and VLC::table.

Referenced by mpeg_decode_mb().

Here is the call graph for this function:

static void mpeg_decode_picture_coding_extension ( MpegEncContext s  )  [static]

static void mpeg_decode_picture_display_extension ( Mpeg1Context s1  )  [static]

static int mpeg_decode_postinit ( AVCodecContext avctx  )  [static]

static void mpeg_decode_quant_matrix_extension ( MpegEncContext s  )  [static]

static void mpeg_decode_sequence_display_extension ( Mpeg1Context s1  )  [static]

static void mpeg_decode_sequence_extension ( Mpeg1Context s1  )  [static]

static int mpeg_decode_slice ( Mpeg1Context s1,
int  mb_y,
const uint8_t **  buf,
int  buf_size 
) [static]

decodes a slice. MpegEncContext.mb_y must be set to the MB row from the startcode

Returns:
DECODE_SLICE_ERROR if the slice is damaged
DECODE_SLICE_OK if this slice is ok

Definition at line 2519 of file mpeg12.c.

References MpegEncContext::alternate_scan, av_log(), AV_LOG_DEBUG, AV_LOG_ERROR, MpegEncContext::avctx, MpegEncContext::b8_stride, B_TYPE, MpegEncContext::block, MpegEncContext::chroma_420_type, MpegEncContext::chroma_qscale, MpegEncContext::chroma_x_shift, MpegEncContext::concealment_motion_vectors, MpegEncContext::current_picture, AVCodecContext::debug, MpegEncContext::dest, MpegEncContext::encoding, AVCodecContext::error_resilience, FF_DEBUG_PICT_INFO, ff_draw_horiz_band(), FF_ER_AGGRESSIVE, ff_init_block_index(), ff_mpeg1_clean_buffers(), MpegEncContext::field_select, MpegEncContext::first_field, MpegEncContext::frame_pred_frame_dct, MpegEncContext::gb, get_bits1(), get_bits_count(), get_qscale(), get_vlc2(), I_TYPE, init_get_bits(), MpegEncContext::interlaced_dct, MpegEncContext::intra_dc_precision, MpegEncContext::intra_vlc_format, AVCodecContext::lowres, lowres, MpegEncContext::mb_height, MpegEncContext::mb_intra, MpegEncContext::mb_skip_run, MpegEncContext::mb_width, MpegEncContext::mb_x, MpegEncContext::mb_y, MBINCR_VLC_BITS, mpeg_decode_mb(), Mpeg1Context::mpeg_enc_ctx, MpegEncContext::mpeg_f_code, MPV_decode_mb(), MpegEncContext::mv, MpegEncContext::mv_type, MV_TYPE_16X16, MV_TYPE_FIELD, P_TYPE, PICT_FRAME, MpegEncContext::pict_type, MpegEncContext::picture_structure, MpegEncContext::progressive_frame, MpegEncContext::progressive_sequence, MpegEncContext::q_scale_type, MpegEncContext::qscale, MpegEncContext::repeat_first_field, MpegEncContext::resync_mb_x, MpegEncContext::resync_mb_y, show_bits(), GetBitContext::size_in_bits, skip_bits(), VLC::table, MpegEncContext::top_field_first, and AVCodecContext::xvmc_acceleration.

Referenced by mpeg_decode_frame(), and slice_decode_thread().

Here is the call graph for this function:

static void mpeg_decode_user_data ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
) [static]

Definition at line 2933 of file mpeg12.c.

References AVCodecContext::dtg_active_format.

Referenced by mpeg_decode_frame().

static int mpeg_field_start ( MpegEncContext s  )  [static]

static void quant_matrix_rebuild ( uint16_t *  matrix,
const uint8_t *  old_perm,
const uint8_t *  new_perm 
) [static]

Definition at line 2058 of file mpeg12.c.

References memcpy.

static int slice_decode_thread ( AVCodecContext c,
void *  arg 
) [static]

static int slice_end ( AVCodecContext avctx,
AVFrame pict 
) [static]

static int vcr2_init_sequence ( AVCodecContext avctx  )  [static]


Variable Documentation

VLC dc_chroma_vlc [static]

Definition at line 982 of file mpeg12.c.

VLC dc_lum_vlc [static]

Definition at line 981 of file mpeg12.c.

VLC mb_btype_vlc [static]

Definition at line 986 of file mpeg12.c.

VLC mb_pat_vlc [static]

Definition at line 987 of file mpeg12.c.

VLC mb_ptype_vlc [static]

Definition at line 985 of file mpeg12.c.

VLC mbincr_vlc [static]

Definition at line 984 of file mpeg12.c.

VLC mv_vlc [static]

Definition at line 983 of file mpeg12.c.

Initial value:

Definition at line 89 of file mpeg12.c.

Referenced by vcr2_init_sequence().

enum PixelFormat pixfmt_yuv_420[] = {PIX_FMT_YUV420P,-1}

Definition at line 86 of file mpeg12.c.

Referenced by vcr2_init_sequence().

enum PixelFormat pixfmt_yuv_422[] = {PIX_FMT_YUV422P,-1}

Definition at line 87 of file mpeg12.c.

enum PixelFormat pixfmt_yuv_444[] = {PIX_FMT_YUV444P,-1}

Definition at line 88 of file mpeg12.c.


Generated on Mon Apr 28 14:05:15 2008 for Cinelerra by  doxygen 1.5.5