148 if(pos+10>buf_size) pos=buf_size;
156 const int mb_size = 16;
173 const int qscale= s->
qscale;
287 }
else if(bits_left != 1){
289 v|= 0x7F >> (7-(bits_count&7));
291 if(v==0x7F && bits_left<=8)
320 max_extra+= 256*256*256*64;
343 void *
data,
int *got_frame,
347 int buf_size = avpkt->
size;
352 #ifdef PRINT_FRAME_TIME
353 uint64_t time= rdtsc();
497 #define SET_QPEL_FUNC(postfix1, postfix2) \
498 s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
499 s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
500 s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
643 if(ret<0)
return ret;
644 if(ret==1)
goto intrax8_decoded;
680 int startcode_found=0;
682 if(buf_size - current_pos > 5){
684 for(i=current_pos; i<buf_size-3; i++){
685 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
731 #ifdef PRINT_FRAME_TIME
int bitstream_buffer_size
enum AVPixelFormat ff_hwaccel_pixfmt_list_420[]
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.
This structure describes decoded (raw) audio or video data.
struct MpegEncContext MpegEncContext
MpegEncContext.
int vol_control_parameters
does the stream contain the low_delay flag, used to workaround buggy encoders
int coded_width
Bitstream width / height, may be different from width/height.
av_cold int ff_dct_common_init(MpegEncContext *s)
av_cold int ff_MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
#define SLICE_NOEND
no end marker or error found but mb count exceeded
void ff_MPV_report_decode_progress(MpegEncContext *s)
static void skip_bits_long(GetBitContext *s, int n)
#define FF_BUG_QPEL_CHROMA
static int decode_slice(MpegEncContext *s)
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
uint8_t * bitstream_buffer
#define CODEC_CAP_HWACCEL_VDPAU
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size)
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)
void ff_h263_decode_init_vlc(MpegEncContext *s)
int padding_bug_score
used to detect the VERY common padding bug in MPEG4
int mb_num
number of MBs of a picture
#define CODEC_FLAG_TRUNCATED
int ff_mpeg4_decode_partitions(MpegEncContext *s)
Decode the first and second partition.
enum AVDiscard skip_frame
void ff_mpeg4_clean_buffers(MpegEncContext *s)
struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define CONFIG_WMV2_DECODER
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
int ff_MPV_common_frame_size_change(MpegEncContext *s)
#define CONFIG_FLV_DECODER
enum OutputFormat out_format
output format
qpel_mc_func(* qpel_put)[16]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int no_rounding
apply no rounding to motion compensation (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
int resync_marker
could this stream contain resync markers
int ff_intel_h263_decode_picture_header(MpegEncContext *s)
Picture current_picture
copy of the current picture structure.
GetBitContext last_resync_gb
used to search for the next resync marker
static int get_bits_count(const GetBitContext *s)
int flags2
AVCodecContext.flags2.
int mb_height
number of MBs horizontally & vertically
void ff_MPV_frame_end(MpegEncContext *s)
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
int ff_wmv2_decode_picture_header(MpegEncContext *s)
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
static void ff_update_block_index(MpegEncContext *s)
static int init(AVCodecParserContext *s)
qpel_mc_func put_qpel_pixels_tab[2][16]
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
uint8_t * error_status_table
table of the error status of each MB
const uint8_t * ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end)
static int get_bits_left(GetBitContext *gb)
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...
#define FF_BUG_NO_PADDING
int has_b_frames
Size of the frame reordering buffer in the decoder.
int stream_codec_tag
internal stream_codec_tag upper case converted from avctx stream_codec_tag
int last_dc[3]
last DC values for MPEG1
Multithreading support functions.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
int partitioned_frame
is current frame partitioned
qpel_mc_func avg_qpel_pixels_tab[2][16]
int unrestricted_mv
mv can point outside of the coded picture
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int capabilities
Codec capabilities.
#define CODEC_CAP_TRUNCATED
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
int low_delay
no reordering needed / has no b-frames
int ff_flv_decode_picture_header(MpegEncContext *s)
void ff_mpeg_flush(AVCodecContext *avctx)
int resync_mb_x
x position of last resync marker
int(* decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64])
void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
void ff_h263_loop_filter(MpegEncContext *s)
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
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.
int ff_h263_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
int ff_h263_get_gob_height(MpegEncContext *s)
Get the GOB height based on picture height.
static int get_consumed_bytes(MpegEncContext *s, int buf_size)
Return the number of bytes consumed for building the current frame.
int next_p_frame_damaged
set if the next p frame is damaged, to avoid showing trashed b frames
#define FF_BUG_DIRECT_BLOCKSIZE
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
Picture * current_picture_ptr
pointer to the current picture
#define CONFIG_MPEG4_VDPAU_DECODER
qpel_mc_func avg_2tap_qpel_pixels_tab[4][16]
unsigned int allocated_bitstream_buffer_size
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
void ff_er_frame_end(MpegEncContext *s)
int ff_msmpeg4_decode_ext_header(MpegEncContext *s, int buf_size)
#define SET_QPEL_FUNC(postfix1, postfix2)
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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...
av_cold int ff_h263_decode_end(AVCodecContext *avctx)
#define MV_TYPE_16X16
1 vector for the whole mb
int first_slice_line
used in mpeg4 too to handle resync markers
void ff_h263_update_motion_val(MpegEncContext *s)
int h263_flv
use flv h263 header
#define FF_BUG_XVID_ILACE
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static void close(AVCodecParserContext *s)
int height
picture size. must be a multiple of 16
qpel_mc_func put_2tap_qpel_pixels_tab[4][16]
#define SLICE_END
end marker found
Picture * picture
main picture buffer
int data_partitioning
data partitioning flag from header
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 CONFIG_MPEG4_DECODER
#define CONFIG_H263I_DECODER
#define FF_INPUT_BUFFER_PADDING_SIZE
int slice_height
in macroblocks
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.
#define FF_BUG_AUTODETECT
DSPContext dsp
pointers for accelerated dsp functions
int ff_h263_decode_picture_header(MpegEncContext *s)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
DCTELEM(* block)[64]
points to one of the following blocks
int h263_pred
use mpeg4/h263 ac/dc predictions
av_cold int ff_h263_decode_init(AVCodecContext *avctx)
int ff_h263_resync(MpegEncContext *s)
Decode the group of blocks / video packet header.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
qpel_mc_func(* qpel_avg)[16]
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
discard all non reference
#define FF_BUG_QPEL_CHROMA2
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
#define CONFIG_H263_DECODER
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
const uint8_t * buffer_end
#define AVERROR_INVALIDDATA
Picture * last_picture_ptr
pointer to the previous picture.
int workaround_bugs
Work around bugs in encoders which sometimes cannot be detected automatically.
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.
int resync_mb_y
y position of last resync marker
ParseContext parse_context
int key_frame
1 -> keyframe, 0-> not
int flags
AVCodecContext.flags (HQ, MV4, ...)
#define FF_BUG_HPEL_CHROMA
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
#define FRAME_SKIPPED
return value for header parsers if frame is not coded
qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16]
int ff_mpeg4_decode_picture_header(MpegEncContext *s, GetBitContext *gb)
Decode mpeg4 headers.
int ff_msmpeg4_decode_picture_header(MpegEncContext *s)
int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
#define CONFIG_MSMPEG4_DECODER
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
int ff_find_unused_picture(MpegEncContext *s, int shared)
int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
int(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.
This structure stores compressed data.
#define CODEC_CAP_DRAW_HORIZ_BAND
void ff_MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.